diff options
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 167 | ||||
| -rw-r--r-- | tools/testing/ktest/sample.conf | 52 |
2 files changed, 215 insertions, 4 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 292b13ad03f5..52b7959cd513 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -52,6 +52,7 @@ my %default = ( | |||
| 52 | "STOP_AFTER_SUCCESS" => 10, | 52 | "STOP_AFTER_SUCCESS" => 10, |
| 53 | "STOP_AFTER_FAILURE" => 60, | 53 | "STOP_AFTER_FAILURE" => 60, |
| 54 | "STOP_TEST_AFTER" => 600, | 54 | "STOP_TEST_AFTER" => 600, |
| 55 | "MAX_MONITOR_WAIT" => 1800, | ||
| 55 | 56 | ||
| 56 | # required, and we will ask users if they don't have them but we keep the default | 57 | # required, and we will ask users if they don't have them but we keep the default |
| 57 | # value something that is common. | 58 | # value something that is common. |
| @@ -77,6 +78,11 @@ my $output_config; | |||
| 77 | my $test_type; | 78 | my $test_type; |
| 78 | my $build_type; | 79 | my $build_type; |
| 79 | my $build_options; | 80 | my $build_options; |
| 81 | my $final_post_ktest; | ||
| 82 | my $pre_ktest; | ||
| 83 | my $post_ktest; | ||
| 84 | my $pre_test; | ||
| 85 | my $post_test; | ||
| 80 | my $pre_build; | 86 | my $pre_build; |
| 81 | my $post_build; | 87 | my $post_build; |
| 82 | my $pre_build_die; | 88 | my $pre_build_die; |
| @@ -93,6 +99,7 @@ my $reboot_on_success; | |||
| 93 | my $die_on_failure; | 99 | my $die_on_failure; |
| 94 | my $powercycle_after_reboot; | 100 | my $powercycle_after_reboot; |
| 95 | my $poweroff_after_halt; | 101 | my $poweroff_after_halt; |
| 102 | my $max_monitor_wait; | ||
| 96 | my $ssh_exec; | 103 | my $ssh_exec; |
| 97 | my $scp_to_target; | 104 | my $scp_to_target; |
| 98 | my $scp_to_target_install; | 105 | my $scp_to_target_install; |
| @@ -101,6 +108,7 @@ my $grub_menu; | |||
| 101 | my $grub_number; | 108 | my $grub_number; |
| 102 | my $target; | 109 | my $target; |
| 103 | my $make; | 110 | my $make; |
| 111 | my $pre_install; | ||
| 104 | my $post_install; | 112 | my $post_install; |
| 105 | my $no_install; | 113 | my $no_install; |
| 106 | my $noclean; | 114 | my $noclean; |
| @@ -167,6 +175,7 @@ my $bisect_check; | |||
| 167 | 175 | ||
| 168 | my $config_bisect; | 176 | my $config_bisect; |
| 169 | my $config_bisect_type; | 177 | my $config_bisect_type; |
| 178 | my $config_bisect_check; | ||
| 170 | 179 | ||
| 171 | my $patchcheck_type; | 180 | my $patchcheck_type; |
| 172 | my $patchcheck_start; | 181 | my $patchcheck_start; |
| @@ -182,6 +191,9 @@ my $newconfig = 0; | |||
| 182 | my %entered_configs; | 191 | my %entered_configs; |
| 183 | my %config_help; | 192 | my %config_help; |
| 184 | my %variable; | 193 | my %variable; |
| 194 | |||
| 195 | # force_config is the list of configs that we force enabled (or disabled) | ||
| 196 | # in a .config file. The MIN_CONFIG and ADD_CONFIG configs. | ||
| 185 | my %force_config; | 197 | my %force_config; |
| 186 | 198 | ||
| 187 | # do not force reboots on config problems | 199 | # do not force reboots on config problems |
| @@ -197,6 +209,10 @@ my %option_map = ( | |||
| 197 | "OUTPUT_DIR" => \$outputdir, | 209 | "OUTPUT_DIR" => \$outputdir, |
| 198 | "BUILD_DIR" => \$builddir, | 210 | "BUILD_DIR" => \$builddir, |
| 199 | "TEST_TYPE" => \$test_type, | 211 | "TEST_TYPE" => \$test_type, |
| 212 | "PRE_KTEST" => \$pre_ktest, | ||
| 213 | "POST_KTEST" => \$post_ktest, | ||
| 214 | "PRE_TEST" => \$pre_test, | ||
| 215 | "POST_TEST" => \$post_test, | ||
| 200 | "BUILD_TYPE" => \$build_type, | 216 | "BUILD_TYPE" => \$build_type, |
| 201 | "BUILD_OPTIONS" => \$build_options, | 217 | "BUILD_OPTIONS" => \$build_options, |
| 202 | "PRE_BUILD" => \$pre_build, | 218 | "PRE_BUILD" => \$pre_build, |
| @@ -216,6 +232,7 @@ my %option_map = ( | |||
| 216 | "ADD_CONFIG" => \$addconfig, | 232 | "ADD_CONFIG" => \$addconfig, |
| 217 | "REBOOT_TYPE" => \$reboot_type, | 233 | "REBOOT_TYPE" => \$reboot_type, |
| 218 | "GRUB_MENU" => \$grub_menu, | 234 | "GRUB_MENU" => \$grub_menu, |
| 235 | "PRE_INSTALL" => \$pre_install, | ||
| 219 | "POST_INSTALL" => \$post_install, | 236 | "POST_INSTALL" => \$post_install, |
| 220 | "NO_INSTALL" => \$no_install, | 237 | "NO_INSTALL" => \$no_install, |
| 221 | "REBOOT_SCRIPT" => \$reboot_script, | 238 | "REBOOT_SCRIPT" => \$reboot_script, |
| @@ -228,6 +245,7 @@ my %option_map = ( | |||
| 228 | "POWER_OFF" => \$power_off, | 245 | "POWER_OFF" => \$power_off, |
| 229 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, | 246 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, |
| 230 | "POWEROFF_AFTER_HALT" => \$poweroff_after_halt, | 247 | "POWEROFF_AFTER_HALT" => \$poweroff_after_halt, |
| 248 | "MAX_MONITOR_WAIT" => \$max_monitor_wait, | ||
| 231 | "SLEEP_TIME" => \$sleep_time, | 249 | "SLEEP_TIME" => \$sleep_time, |
| 232 | "BISECT_SLEEP_TIME" => \$bisect_sleep_time, | 250 | "BISECT_SLEEP_TIME" => \$bisect_sleep_time, |
| 233 | "PATCHCHECK_SLEEP_TIME" => \$patchcheck_sleep_time, | 251 | "PATCHCHECK_SLEEP_TIME" => \$patchcheck_sleep_time, |
| @@ -272,6 +290,7 @@ my %option_map = ( | |||
| 272 | 290 | ||
| 273 | "CONFIG_BISECT" => \$config_bisect, | 291 | "CONFIG_BISECT" => \$config_bisect, |
| 274 | "CONFIG_BISECT_TYPE" => \$config_bisect_type, | 292 | "CONFIG_BISECT_TYPE" => \$config_bisect_type, |
| 293 | "CONFIG_BISECT_CHECK" => \$config_bisect_check, | ||
| 275 | 294 | ||
| 276 | "PATCHCHECK_TYPE" => \$patchcheck_type, | 295 | "PATCHCHECK_TYPE" => \$patchcheck_type, |
| 277 | "PATCHCHECK_START" => \$patchcheck_start, | 296 | "PATCHCHECK_START" => \$patchcheck_start, |
| @@ -604,6 +623,10 @@ sub process_compare { | |||
| 604 | return $lval eq $rval; | 623 | return $lval eq $rval; |
| 605 | } elsif ($cmp eq "!=") { | 624 | } elsif ($cmp eq "!=") { |
| 606 | return $lval ne $rval; | 625 | return $lval ne $rval; |
| 626 | } elsif ($cmp eq "=~") { | ||
| 627 | return $lval =~ m/$rval/; | ||
| 628 | } elsif ($cmp eq "!~") { | ||
| 629 | return $lval !~ m/$rval/; | ||
| 607 | } | 630 | } |
| 608 | 631 | ||
| 609 | my $statement = "$lval $cmp $rval"; | 632 | my $statement = "$lval $cmp $rval"; |
| @@ -659,7 +682,7 @@ sub process_expression { | |||
| 659 | } | 682 | } |
| 660 | } | 683 | } |
| 661 | 684 | ||
| 662 | if ($val =~ /(.*)(==|\!=|>=|<=|>|<)(.*)/) { | 685 | if ($val =~ /(.*)(==|\!=|>=|<=|>|<|=~|\!~)(.*)/) { |
| 663 | my $ret = process_compare($1, $2, $3); | 686 | my $ret = process_compare($1, $2, $3); |
| 664 | if ($ret < 0) { | 687 | if ($ret < 0) { |
| 665 | die "$name: $.: Unable to process comparison\n"; | 688 | die "$name: $.: Unable to process comparison\n"; |
| @@ -1117,7 +1140,11 @@ sub reboot { | |||
| 1117 | } | 1140 | } |
| 1118 | 1141 | ||
| 1119 | if (defined($time)) { | 1142 | if (defined($time)) { |
| 1120 | wait_for_monitor($time, $reboot_success_line); | 1143 | if (wait_for_monitor($time, $reboot_success_line)) { |
| 1144 | # reboot got stuck? | ||
| 1145 | doprint "Reboot did not finish. Forcing power cycle\n"; | ||
| 1146 | run_command "$power_cycle"; | ||
| 1147 | } | ||
| 1121 | end_monitor; | 1148 | end_monitor; |
| 1122 | } | 1149 | } |
| 1123 | } | 1150 | } |
| @@ -1212,6 +1239,11 @@ sub wait_for_monitor { | |||
| 1212 | my $full_line = ""; | 1239 | my $full_line = ""; |
| 1213 | my $line; | 1240 | my $line; |
| 1214 | my $booted = 0; | 1241 | my $booted = 0; |
| 1242 | my $start_time = time; | ||
| 1243 | my $skip_call_trace = 0; | ||
| 1244 | my $bug = 0; | ||
| 1245 | my $bug_ignored = 0; | ||
| 1246 | my $now; | ||
| 1215 | 1247 | ||
| 1216 | doprint "** Wait for monitor to settle down **\n"; | 1248 | doprint "** Wait for monitor to settle down **\n"; |
| 1217 | 1249 | ||
| @@ -1227,11 +1259,39 @@ sub wait_for_monitor { | |||
| 1227 | $booted = 1; | 1259 | $booted = 1; |
| 1228 | } | 1260 | } |
| 1229 | 1261 | ||
| 1262 | if ($full_line =~ /\[ backtrace testing \]/) { | ||
| 1263 | $skip_call_trace = 1; | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | if ($full_line =~ /call trace:/i) { | ||
| 1267 | if (!$bug && !$skip_call_trace) { | ||
| 1268 | if ($ignore_errors) { | ||
| 1269 | $bug_ignored = 1; | ||
| 1270 | } else { | ||
| 1271 | $bug = 1; | ||
| 1272 | } | ||
| 1273 | } | ||
| 1274 | } | ||
| 1275 | |||
| 1276 | if ($full_line =~ /\[ end of backtrace testing \]/) { | ||
| 1277 | $skip_call_trace = 0; | ||
| 1278 | } | ||
| 1279 | |||
| 1280 | if ($full_line =~ /Kernel panic -/) { | ||
| 1281 | $bug = 1; | ||
| 1282 | } | ||
| 1283 | |||
| 1230 | if ($line =~ /\n/) { | 1284 | if ($line =~ /\n/) { |
| 1231 | $full_line = ""; | 1285 | $full_line = ""; |
| 1232 | } | 1286 | } |
| 1287 | $now = time; | ||
| 1288 | if ($now - $start_time >= $max_monitor_wait) { | ||
| 1289 | doprint "Exiting monitor flush due to hitting MAX_MONITOR_WAIT\n"; | ||
| 1290 | return 1; | ||
| 1291 | } | ||
| 1233 | } | 1292 | } |
| 1234 | print "** Monitor flushed **\n"; | 1293 | print "** Monitor flushed **\n"; |
| 1294 | return $bug; | ||
| 1235 | } | 1295 | } |
| 1236 | 1296 | ||
| 1237 | sub save_logs { | 1297 | sub save_logs { |
| @@ -1273,6 +1333,10 @@ sub save_logs { | |||
| 1273 | 1333 | ||
| 1274 | sub fail { | 1334 | sub fail { |
| 1275 | 1335 | ||
| 1336 | if (defined($post_test)) { | ||
| 1337 | run_command $post_test; | ||
| 1338 | } | ||
| 1339 | |||
| 1276 | if ($die_on_failure) { | 1340 | if ($die_on_failure) { |
| 1277 | dodie @_; | 1341 | dodie @_; |
| 1278 | } | 1342 | } |
| @@ -1656,6 +1720,12 @@ sub install { | |||
| 1656 | 1720 | ||
| 1657 | return if ($no_install); | 1721 | return if ($no_install); |
| 1658 | 1722 | ||
| 1723 | if (defined($pre_install)) { | ||
| 1724 | my $cp_pre_install = eval_kernel_version $pre_install; | ||
| 1725 | run_command "$cp_pre_install" or | ||
| 1726 | dodie "Failed to run pre install"; | ||
| 1727 | } | ||
| 1728 | |||
| 1659 | my $cp_target = eval_kernel_version $target_image; | 1729 | my $cp_target = eval_kernel_version $target_image; |
| 1660 | 1730 | ||
| 1661 | run_scp_install "$outputdir/$build_target", "$cp_target" or | 1731 | run_scp_install "$outputdir/$build_target", "$cp_target" or |
| @@ -1814,6 +1884,7 @@ sub make_oldconfig { | |||
| 1814 | sub load_force_config { | 1884 | sub load_force_config { |
| 1815 | my ($config) = @_; | 1885 | my ($config) = @_; |
| 1816 | 1886 | ||
| 1887 | doprint "Loading force configs from $config\n"; | ||
| 1817 | open(IN, $config) or | 1888 | open(IN, $config) or |
| 1818 | dodie "failed to read $config"; | 1889 | dodie "failed to read $config"; |
| 1819 | while (<IN>) { | 1890 | while (<IN>) { |
| @@ -1937,6 +2008,10 @@ sub halt { | |||
| 1937 | sub success { | 2008 | sub success { |
| 1938 | my ($i) = @_; | 2009 | my ($i) = @_; |
| 1939 | 2010 | ||
| 2011 | if (defined($post_test)) { | ||
| 2012 | run_command $post_test; | ||
| 2013 | } | ||
| 2014 | |||
| 1940 | $successes++; | 2015 | $successes++; |
| 1941 | 2016 | ||
| 1942 | my $name = ""; | 2017 | my $name = ""; |
| @@ -2003,6 +2078,7 @@ sub do_run_test { | |||
| 2003 | my $line; | 2078 | my $line; |
| 2004 | my $full_line; | 2079 | my $full_line; |
| 2005 | my $bug = 0; | 2080 | my $bug = 0; |
| 2081 | my $bug_ignored = 0; | ||
| 2006 | 2082 | ||
| 2007 | wait_for_monitor 1; | 2083 | wait_for_monitor 1; |
| 2008 | 2084 | ||
| @@ -2027,7 +2103,11 @@ sub do_run_test { | |||
| 2027 | doprint $line; | 2103 | doprint $line; |
| 2028 | 2104 | ||
| 2029 | if ($full_line =~ /call trace:/i) { | 2105 | if ($full_line =~ /call trace:/i) { |
| 2030 | $bug = 1; | 2106 | if ($ignore_errors) { |
| 2107 | $bug_ignored = 1; | ||
| 2108 | } else { | ||
| 2109 | $bug = 1; | ||
| 2110 | } | ||
| 2031 | } | 2111 | } |
| 2032 | 2112 | ||
| 2033 | if ($full_line =~ /Kernel panic -/) { | 2113 | if ($full_line =~ /Kernel panic -/) { |
| @@ -2040,6 +2120,10 @@ sub do_run_test { | |||
| 2040 | } | 2120 | } |
| 2041 | } while (!$child_done && !$bug); | 2121 | } while (!$child_done && !$bug); |
| 2042 | 2122 | ||
| 2123 | if (!$bug && $bug_ignored) { | ||
| 2124 | doprint "WARNING: Call Trace detected but ignored due to IGNORE_ERRORS=1\n"; | ||
| 2125 | } | ||
| 2126 | |||
| 2043 | if ($bug) { | 2127 | if ($bug) { |
| 2044 | my $failure_start = time; | 2128 | my $failure_start = time; |
| 2045 | my $now; | 2129 | my $now; |
| @@ -2362,9 +2446,24 @@ sub bisect { | |||
| 2362 | success $i; | 2446 | success $i; |
| 2363 | } | 2447 | } |
| 2364 | 2448 | ||
| 2449 | # config_ignore holds the configs that were set (or unset) for | ||
| 2450 | # a good config and we will ignore these configs for the rest | ||
| 2451 | # of a config bisect. These configs stay as they were. | ||
| 2365 | my %config_ignore; | 2452 | my %config_ignore; |
| 2453 | |||
| 2454 | # config_set holds what all configs were set as. | ||
| 2366 | my %config_set; | 2455 | my %config_set; |
| 2367 | 2456 | ||
| 2457 | # config_off holds the set of configs that the bad config had disabled. | ||
| 2458 | # We need to record them and set them in the .config when running | ||
| 2459 | # oldnoconfig, because oldnoconfig does not turn off new symbols, but | ||
| 2460 | # instead just keeps the defaults. | ||
| 2461 | my %config_off; | ||
| 2462 | |||
| 2463 | # config_off_tmp holds a set of configs to turn off for now | ||
| 2464 | my @config_off_tmp; | ||
| 2465 | |||
| 2466 | # config_list is the set of configs that are being tested | ||
| 2368 | my %config_list; | 2467 | my %config_list; |
| 2369 | my %null_config; | 2468 | my %null_config; |
| 2370 | 2469 | ||
| @@ -2443,12 +2542,21 @@ sub create_config { | |||
| 2443 | } | 2542 | } |
| 2444 | } | 2543 | } |
| 2445 | 2544 | ||
| 2545 | # turn off configs to keep off | ||
| 2546 | foreach my $config (keys %config_off) { | ||
| 2547 | print OUT "# $config is not set\n"; | ||
| 2548 | } | ||
| 2549 | |||
| 2550 | # turn off configs that should be off for now | ||
| 2551 | foreach my $config (@config_off_tmp) { | ||
| 2552 | print OUT "# $config is not set\n"; | ||
| 2553 | } | ||
| 2554 | |||
| 2446 | foreach my $config (keys %config_ignore) { | 2555 | foreach my $config (keys %config_ignore) { |
| 2447 | print OUT "$config_ignore{$config}\n"; | 2556 | print OUT "$config_ignore{$config}\n"; |
| 2448 | } | 2557 | } |
| 2449 | close(OUT); | 2558 | close(OUT); |
| 2450 | 2559 | ||
| 2451 | # exit; | ||
| 2452 | make_oldconfig; | 2560 | make_oldconfig; |
| 2453 | } | 2561 | } |
| 2454 | 2562 | ||
| @@ -2525,6 +2633,13 @@ sub run_config_bisect { | |||
| 2525 | do { | 2633 | do { |
| 2526 | my @tophalf = @start_list[0 .. $half]; | 2634 | my @tophalf = @start_list[0 .. $half]; |
| 2527 | 2635 | ||
| 2636 | # keep the bottom half off | ||
| 2637 | if ($half < $#start_list) { | ||
| 2638 | @config_off_tmp = @start_list[$half + 1 .. $#start_list]; | ||
| 2639 | } else { | ||
| 2640 | @config_off_tmp = (); | ||
| 2641 | } | ||
| 2642 | |||
| 2528 | create_config @tophalf; | 2643 | create_config @tophalf; |
| 2529 | read_current_config \%current_config; | 2644 | read_current_config \%current_config; |
| 2530 | 2645 | ||
| @@ -2541,7 +2656,11 @@ sub run_config_bisect { | |||
| 2541 | if (!$found) { | 2656 | if (!$found) { |
| 2542 | # try the other half | 2657 | # try the other half |
| 2543 | doprint "Top half produced no set configs, trying bottom half\n"; | 2658 | doprint "Top half produced no set configs, trying bottom half\n"; |
| 2659 | |||
| 2660 | # keep the top half off | ||
| 2661 | @config_off_tmp = @tophalf; | ||
| 2544 | @tophalf = @start_list[$half + 1 .. $#start_list]; | 2662 | @tophalf = @start_list[$half + 1 .. $#start_list]; |
| 2663 | |||
| 2545 | create_config @tophalf; | 2664 | create_config @tophalf; |
| 2546 | read_current_config \%current_config; | 2665 | read_current_config \%current_config; |
| 2547 | foreach my $config (@tophalf) { | 2666 | foreach my $config (@tophalf) { |
| @@ -2679,6 +2798,10 @@ sub config_bisect { | |||
| 2679 | $added_configs{$2} = $1; | 2798 | $added_configs{$2} = $1; |
| 2680 | $config_list{$2} = $1; | 2799 | $config_list{$2} = $1; |
| 2681 | } | 2800 | } |
| 2801 | } elsif (/^# ((CONFIG\S*).*)/) { | ||
| 2802 | # Keep these configs disabled | ||
| 2803 | $config_set{$2} = $1; | ||
| 2804 | $config_off{$2} = $1; | ||
| 2682 | } | 2805 | } |
| 2683 | } | 2806 | } |
| 2684 | close(IN); | 2807 | close(IN); |
| @@ -2701,6 +2824,8 @@ sub config_bisect { | |||
| 2701 | my %config_test; | 2824 | my %config_test; |
| 2702 | my $once = 0; | 2825 | my $once = 0; |
| 2703 | 2826 | ||
| 2827 | @config_off_tmp = (); | ||
| 2828 | |||
| 2704 | # Sometimes kconfig does weird things. We must make sure | 2829 | # Sometimes kconfig does weird things. We must make sure |
| 2705 | # that the config we autocreate has everything we need | 2830 | # that the config we autocreate has everything we need |
| 2706 | # to test, otherwise we may miss testing configs, or | 2831 | # to test, otherwise we may miss testing configs, or |
| @@ -2719,6 +2844,18 @@ sub config_bisect { | |||
| 2719 | } | 2844 | } |
| 2720 | } | 2845 | } |
| 2721 | my $ret; | 2846 | my $ret; |
| 2847 | |||
| 2848 | if (defined($config_bisect_check) && $config_bisect_check) { | ||
| 2849 | doprint " Checking to make sure bad config with min config fails\n"; | ||
| 2850 | create_config keys %config_list; | ||
| 2851 | $ret = run_config_bisect_test $config_bisect_type; | ||
| 2852 | if ($ret) { | ||
| 2853 | doprint " FAILED! Bad config with min config boots fine\n"; | ||
| 2854 | return -1; | ||
| 2855 | } | ||
| 2856 | doprint " Bad config with min config fails as expected\n"; | ||
| 2857 | } | ||
| 2858 | |||
| 2722 | do { | 2859 | do { |
| 2723 | $ret = run_config_bisect; | 2860 | $ret = run_config_bisect; |
| 2724 | } while (!$ret); | 2861 | } while (!$ret); |
| @@ -3510,6 +3647,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3510 | 3647 | ||
| 3511 | $iteration = $i; | 3648 | $iteration = $i; |
| 3512 | 3649 | ||
| 3650 | undef %force_config; | ||
| 3651 | |||
| 3513 | my $makecmd = set_test_option("MAKE_CMD", $i); | 3652 | my $makecmd = set_test_option("MAKE_CMD", $i); |
| 3514 | 3653 | ||
| 3515 | # Load all the options into their mapped variable names | 3654 | # Load all the options into their mapped variable names |
| @@ -3519,6 +3658,18 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3519 | 3658 | ||
| 3520 | $start_minconfig_defined = 1; | 3659 | $start_minconfig_defined = 1; |
| 3521 | 3660 | ||
| 3661 | # The first test may override the PRE_KTEST option | ||
| 3662 | if (defined($pre_ktest) && $i == 1) { | ||
| 3663 | doprint "\n"; | ||
| 3664 | run_command $pre_ktest; | ||
| 3665 | } | ||
| 3666 | |||
| 3667 | # Any test can override the POST_KTEST option | ||
| 3668 | # The last test takes precedence. | ||
| 3669 | if (defined($post_ktest)) { | ||
| 3670 | $final_post_ktest = $post_ktest; | ||
| 3671 | } | ||
| 3672 | |||
| 3522 | if (!defined($start_minconfig)) { | 3673 | if (!defined($start_minconfig)) { |
| 3523 | $start_minconfig_defined = 0; | 3674 | $start_minconfig_defined = 0; |
| 3524 | $start_minconfig = $minconfig; | 3675 | $start_minconfig = $minconfig; |
| @@ -3573,6 +3724,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3573 | doprint "\n\n"; | 3724 | doprint "\n\n"; |
| 3574 | doprint "RUNNING TEST $i of $opt{NUM_TESTS} with option $test_type $run_type$installme\n\n"; | 3725 | doprint "RUNNING TEST $i of $opt{NUM_TESTS} with option $test_type $run_type$installme\n\n"; |
| 3575 | 3726 | ||
| 3727 | if (defined($pre_test)) { | ||
| 3728 | run_command $pre_test; | ||
| 3729 | } | ||
| 3730 | |||
| 3576 | unlink $dmesg; | 3731 | unlink $dmesg; |
| 3577 | unlink $buildlog; | 3732 | unlink $buildlog; |
| 3578 | unlink $testlog; | 3733 | unlink $testlog; |
| @@ -3638,6 +3793,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3638 | success $i; | 3793 | success $i; |
| 3639 | } | 3794 | } |
| 3640 | 3795 | ||
| 3796 | if (defined($final_post_ktest)) { | ||
| 3797 | run_command $final_post_ktest; | ||
| 3798 | } | ||
| 3799 | |||
| 3641 | if ($opt{"POWEROFF_ON_SUCCESS"}) { | 3800 | if ($opt{"POWEROFF_ON_SUCCESS"}) { |
| 3642 | halt; | 3801 | halt; |
| 3643 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) { | 3802 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) { |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index cf362b3d1ec9..de28a0a3b8fc 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
| @@ -376,6 +376,24 @@ | |||
| 376 | # DEFAULTS | 376 | # DEFAULTS |
| 377 | # DEFAULTS SKIP | 377 | # DEFAULTS SKIP |
| 378 | 378 | ||
| 379 | # If you want to execute some command before the first test runs | ||
| 380 | # you can set this option. Note, it can be set as a default option | ||
| 381 | # or an option in the first test case. All other test cases will | ||
| 382 | # ignore it. If both the default and first test have this option | ||
| 383 | # set, then the first test will take precedence. | ||
| 384 | # | ||
| 385 | # default (undefined) | ||
| 386 | #PRE_KTEST = ${SSH} ~/set_up_test | ||
| 387 | |||
| 388 | # If you want to execute some command after all the tests have | ||
| 389 | # completed, you can set this option. Note, it can be set as a | ||
| 390 | # default or any test case can override it. If multiple test cases | ||
| 391 | # set this option, then the last test case that set it will take | ||
| 392 | # precedence | ||
| 393 | # | ||
| 394 | # default (undefined) | ||
| 395 | #POST_KTEST = ${SSH} ~/dismantle_test | ||
| 396 | |||
| 379 | # The default test type (default test) | 397 | # The default test type (default test) |
| 380 | # The test types may be: | 398 | # The test types may be: |
| 381 | # build - only build the kernel, do nothing else | 399 | # build - only build the kernel, do nothing else |
| @@ -408,6 +426,14 @@ | |||
| 408 | # (default "") | 426 | # (default "") |
| 409 | #BUILD_OPTIONS = -j20 | 427 | #BUILD_OPTIONS = -j20 |
| 410 | 428 | ||
| 429 | # If you need to do some special handling before installing | ||
| 430 | # you can add a script with this option. | ||
| 431 | # The environment variable KERNEL_VERSION will be set to the | ||
| 432 | # kernel version that is used. | ||
| 433 | # | ||
| 434 | # default (undefined) | ||
| 435 | #PRE_INSTALL = ssh user@target rm -rf '/lib/modules/*-test*' | ||
| 436 | |||
| 411 | # If you need an initrd, you can add a script or code here to install | 437 | # If you need an initrd, you can add a script or code here to install |
| 412 | # it. The environment variable KERNEL_VERSION will be set to the | 438 | # it. The environment variable KERNEL_VERSION will be set to the |
| 413 | # kernel version that is used. Remember to add the initrd line | 439 | # kernel version that is used. Remember to add the initrd line |
| @@ -426,6 +452,18 @@ | |||
| 426 | # (default 0) | 452 | # (default 0) |
| 427 | #NO_INSTALL = 1 | 453 | #NO_INSTALL = 1 |
| 428 | 454 | ||
| 455 | # If there is a command that you want to run before the individual test | ||
| 456 | # case executes, then you can set this option | ||
| 457 | # | ||
| 458 | # default (undefined) | ||
| 459 | #PRE_TEST = ${SSH} reboot_to_special_kernel | ||
| 460 | |||
| 461 | # If there is a command you want to run after the individual test case | ||
| 462 | # completes, then you can set this option. | ||
| 463 | # | ||
| 464 | # default (undefined) | ||
| 465 | #POST_TEST = cd ${BUILD_DIR}; git reset --hard | ||
| 466 | |||
| 429 | # If there is a script that you require to run before the build is done | 467 | # If there is a script that you require to run before the build is done |
| 430 | # you can specify it with PRE_BUILD. | 468 | # you can specify it with PRE_BUILD. |
| 431 | # | 469 | # |
| @@ -657,6 +695,14 @@ | |||
| 657 | # (default 60) | 695 | # (default 60) |
| 658 | #BISECT_SLEEP_TIME = 60 | 696 | #BISECT_SLEEP_TIME = 60 |
| 659 | 697 | ||
| 698 | # The max wait time (in seconds) for waiting for the console to finish. | ||
| 699 | # If for some reason, the console is outputting content without | ||
| 700 | # ever finishing, this will cause ktest to get stuck. This | ||
| 701 | # option is the max time ktest will wait for the monitor (console) | ||
| 702 | # to settle down before continuing. | ||
| 703 | # (default 1800) | ||
| 704 | #MAX_MONITOR_WAIT | ||
| 705 | |||
| 660 | # The time in between patch checks to sleep (in seconds) | 706 | # The time in between patch checks to sleep (in seconds) |
| 661 | # (default 60) | 707 | # (default 60) |
| 662 | #PATCHCHECK_SLEEP_TIME = 60 | 708 | #PATCHCHECK_SLEEP_TIME = 60 |
| @@ -1039,6 +1085,12 @@ | |||
| 1039 | # can specify it with CONFIG_BISECT_GOOD. Otherwise | 1085 | # can specify it with CONFIG_BISECT_GOOD. Otherwise |
| 1040 | # the MIN_CONFIG is the base. | 1086 | # the MIN_CONFIG is the base. |
| 1041 | # | 1087 | # |
| 1088 | # CONFIG_BISECT_CHECK (optional) | ||
| 1089 | # Set this to 1 if you want to confirm that the config ktest | ||
| 1090 | # generates (the bad config with the min config) is still bad. | ||
| 1091 | # It may be that the min config fixes what broke the bad config | ||
| 1092 | # and the test will not return a result. | ||
| 1093 | # | ||
| 1042 | # Example: | 1094 | # Example: |
| 1043 | # TEST_START | 1095 | # TEST_START |
| 1044 | # TEST_TYPE = config_bisect | 1096 | # TEST_TYPE = config_bisect |
