aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-02-07 14:50:03 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-02-07 14:50:03 -0500
commit5739438b725c09938bb6af9e4477c4283b8326cf (patch)
treef424249eafcd1c8dd85f42add9628da9c9fb7e28 /tools
parent6474ace999edd714151c04c0b0534b89c2e9b6d8 (diff)
ktest: Add variable run_command_status to save status of commands executed
Create a variable called run_command_status that saves the status of the executed commands and can be used by other functions later to test for status. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 6a1484cc4436..29470b554711 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -179,6 +179,7 @@ my $localversion;
179my $iteration = 0; 179my $iteration = 0;
180my $successes = 0; 180my $successes = 0;
181my $stty_orig; 181my $stty_orig;
182my $run_command_status = 0;
182 183
183my $bisect_good; 184my $bisect_good;
184my $bisect_bad; 185my $bisect_bad;
@@ -1736,11 +1737,8 @@ sub run_command {
1736 } 1737 }
1737 1738
1738 waitpid($pid, 0); 1739 waitpid($pid, 0);
1739 my $failed = $?; 1740 # shift 8 for real exit status
1740 1741 $run_command_status = $? >> 8;
1741 if ($hit_timeout) {
1742 $failed = 1;
1743 }
1744 1742
1745 close(CMD); 1743 close(CMD);
1746 close(LOG) if ($dolog); 1744 close(LOG) if ($dolog);
@@ -1755,13 +1753,17 @@ sub run_command {
1755 doprint "[$delta seconds] "; 1753 doprint "[$delta seconds] ";
1756 } 1754 }
1757 1755
1758 if ($failed) { 1756 if ($hit_timeout) {
1757 $run_command_status = 1;
1758 }
1759
1760 if ($run_command_status) {
1759 doprint "FAILED!\n"; 1761 doprint "FAILED!\n";
1760 } else { 1762 } else {
1761 doprint "SUCCESS\n"; 1763 doprint "SUCCESS\n";
1762 } 1764 }
1763 1765
1764 return !$failed; 1766 return !$run_command_status;
1765} 1767}
1766 1768
1767sub run_ssh { 1769sub run_ssh {
@@ -2578,16 +2580,15 @@ sub answer_bisect {
2578} 2580}
2579 2581
2580sub child_run_test { 2582sub child_run_test {
2581 my $failed = 0;
2582 2583
2583 # child should have no power 2584 # child should have no power
2584 $reboot_on_error = 0; 2585 $reboot_on_error = 0;
2585 $poweroff_on_error = 0; 2586 $poweroff_on_error = 0;
2586 $die_on_failure = 1; 2587 $die_on_failure = 1;
2587 2588
2588 run_command $run_test, $testlog or $failed = 1; 2589 run_command $run_test, $testlog;
2589 2590
2590 exit $failed; 2591 exit $run_command_status;
2591} 2592}
2592 2593
2593my $child_done; 2594my $child_done;
@@ -3371,7 +3372,6 @@ sub config_bisect {
3371 save_config \%good_configs, $good_config; 3372 save_config \%good_configs, $good_config;
3372 save_config \%bad_configs, $bad_config; 3373 save_config \%bad_configs, $bad_config;
3373 3374
3374
3375 if (defined($config_bisect_check) && $config_bisect_check ne "0") { 3375 if (defined($config_bisect_check) && $config_bisect_check ne "0") {
3376 if ($config_bisect_check ne "good") { 3376 if ($config_bisect_check ne "good") {
3377 doprint "Testing bad config\n"; 3377 doprint "Testing bad config\n";