diff options
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 970 | ||||
| -rw-r--r-- | tools/testing/ktest/sample.conf | 142 |
2 files changed, 963 insertions, 149 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index cef28e6632b9..8d02ccb10c59 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -27,7 +27,7 @@ $default{"TEST_TYPE"} = "test"; | |||
| 27 | $default{"BUILD_TYPE"} = "randconfig"; | 27 | $default{"BUILD_TYPE"} = "randconfig"; |
| 28 | $default{"MAKE_CMD"} = "make"; | 28 | $default{"MAKE_CMD"} = "make"; |
| 29 | $default{"TIMEOUT"} = 120; | 29 | $default{"TIMEOUT"} = 120; |
| 30 | $default{"TMP_DIR"} = "/tmp/ktest"; | 30 | $default{"TMP_DIR"} = "/tmp/ktest/\${MACHINE}"; |
| 31 | $default{"SLEEP_TIME"} = 60; # sleep time between tests | 31 | $default{"SLEEP_TIME"} = 60; # sleep time between tests |
| 32 | $default{"BUILD_NOCLEAN"} = 0; | 32 | $default{"BUILD_NOCLEAN"} = 0; |
| 33 | $default{"REBOOT_ON_ERROR"} = 0; | 33 | $default{"REBOOT_ON_ERROR"} = 0; |
| @@ -41,6 +41,7 @@ $default{"CLEAR_LOG"} = 0; | |||
| 41 | $default{"BISECT_MANUAL"} = 0; | 41 | $default{"BISECT_MANUAL"} = 0; |
| 42 | $default{"BISECT_SKIP"} = 1; | 42 | $default{"BISECT_SKIP"} = 1; |
| 43 | $default{"SUCCESS_LINE"} = "login:"; | 43 | $default{"SUCCESS_LINE"} = "login:"; |
| 44 | $default{"DETECT_TRIPLE_FAULT"} = 1; | ||
| 44 | $default{"BOOTED_TIMEOUT"} = 1; | 45 | $default{"BOOTED_TIMEOUT"} = 1; |
| 45 | $default{"DIE_ON_FAILURE"} = 1; | 46 | $default{"DIE_ON_FAILURE"} = 1; |
| 46 | $default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; | 47 | $default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; |
| @@ -62,6 +63,10 @@ my $output_config; | |||
| 62 | my $test_type; | 63 | my $test_type; |
| 63 | my $build_type; | 64 | my $build_type; |
| 64 | my $build_options; | 65 | my $build_options; |
| 66 | my $pre_build; | ||
| 67 | my $post_build; | ||
| 68 | my $pre_build_die; | ||
| 69 | my $post_build_die; | ||
| 65 | my $reboot_type; | 70 | my $reboot_type; |
| 66 | my $reboot_script; | 71 | my $reboot_script; |
| 67 | my $power_cycle; | 72 | my $power_cycle; |
| @@ -81,12 +86,17 @@ my $make; | |||
| 81 | my $post_install; | 86 | my $post_install; |
| 82 | my $noclean; | 87 | my $noclean; |
| 83 | my $minconfig; | 88 | my $minconfig; |
| 89 | my $start_minconfig; | ||
| 90 | my $start_minconfig_defined; | ||
| 91 | my $output_minconfig; | ||
| 92 | my $ignore_config; | ||
| 84 | my $addconfig; | 93 | my $addconfig; |
| 85 | my $in_bisect = 0; | 94 | my $in_bisect = 0; |
| 86 | my $bisect_bad = ""; | 95 | my $bisect_bad = ""; |
| 87 | my $reverse_bisect; | 96 | my $reverse_bisect; |
| 88 | my $bisect_manual; | 97 | my $bisect_manual; |
| 89 | my $bisect_skip; | 98 | my $bisect_skip; |
| 99 | my $config_bisect_good; | ||
| 90 | my $in_patchcheck = 0; | 100 | my $in_patchcheck = 0; |
| 91 | my $run_test; | 101 | my $run_test; |
| 92 | my $redirect; | 102 | my $redirect; |
| @@ -98,9 +108,12 @@ my $monitor_cnt = 0; | |||
| 98 | my $sleep_time; | 108 | my $sleep_time; |
| 99 | my $bisect_sleep_time; | 109 | my $bisect_sleep_time; |
| 100 | my $patchcheck_sleep_time; | 110 | my $patchcheck_sleep_time; |
| 111 | my $ignore_warnings; | ||
| 101 | my $store_failures; | 112 | my $store_failures; |
| 113 | my $test_name; | ||
| 102 | my $timeout; | 114 | my $timeout; |
| 103 | my $booted_timeout; | 115 | my $booted_timeout; |
| 116 | my $detect_triplefault; | ||
| 104 | my $console; | 117 | my $console; |
| 105 | my $success_line; | 118 | my $success_line; |
| 106 | my $stop_after_success; | 119 | my $stop_after_success; |
| @@ -115,6 +128,7 @@ my $successes = 0; | |||
| 115 | my %entered_configs; | 128 | my %entered_configs; |
| 116 | my %config_help; | 129 | my %config_help; |
| 117 | my %variable; | 130 | my %variable; |
| 131 | my %force_config; | ||
| 118 | 132 | ||
| 119 | $config_help{"MACHINE"} = << "EOF" | 133 | $config_help{"MACHINE"} = << "EOF" |
| 120 | The machine hostname that you will test. | 134 | The machine hostname that you will test. |
| @@ -204,6 +218,26 @@ $config_help{"REBOOT_SCRIPT"} = << "EOF" | |||
| 204 | EOF | 218 | EOF |
| 205 | ; | 219 | ; |
| 206 | 220 | ||
| 221 | sub read_yn { | ||
| 222 | my ($prompt) = @_; | ||
| 223 | |||
| 224 | my $ans; | ||
| 225 | |||
| 226 | for (;;) { | ||
| 227 | print "$prompt [Y/n] "; | ||
| 228 | $ans = <STDIN>; | ||
| 229 | chomp $ans; | ||
| 230 | if ($ans =~ /^\s*$/) { | ||
| 231 | $ans = "y"; | ||
| 232 | } | ||
| 233 | last if ($ans =~ /^y$/i || $ans =~ /^n$/i); | ||
| 234 | print "Please answer either 'y' or 'n'.\n"; | ||
| 235 | } | ||
| 236 | if ($ans !~ /^y$/i) { | ||
| 237 | return 0; | ||
| 238 | } | ||
| 239 | return 1; | ||
| 240 | } | ||
| 207 | 241 | ||
| 208 | sub get_ktest_config { | 242 | sub get_ktest_config { |
| 209 | my ($config) = @_; | 243 | my ($config) = @_; |
| @@ -335,6 +369,7 @@ sub read_config { | |||
| 335 | my $num_tests_set = 0; | 369 | my $num_tests_set = 0; |
| 336 | my $skip = 0; | 370 | my $skip = 0; |
| 337 | my $rest; | 371 | my $rest; |
| 372 | my $test_case = 0; | ||
| 338 | 373 | ||
| 339 | while (<IN>) { | 374 | while (<IN>) { |
| 340 | 375 | ||
| @@ -360,6 +395,7 @@ sub read_config { | |||
| 360 | $rest = $1; | 395 | $rest = $1; |
| 361 | $skip = 1; | 396 | $skip = 1; |
| 362 | } else { | 397 | } else { |
| 398 | $test_case = 1; | ||
| 363 | $skip = 0; | 399 | $skip = 0; |
| 364 | } | 400 | } |
| 365 | 401 | ||
| @@ -464,6 +500,15 @@ sub read_config { | |||
| 464 | # make sure we have all mandatory configs | 500 | # make sure we have all mandatory configs |
| 465 | get_ktest_configs; | 501 | get_ktest_configs; |
| 466 | 502 | ||
| 503 | # was a test specified? | ||
| 504 | if (!$test_case) { | ||
| 505 | print "No test case specified.\n"; | ||
| 506 | print "What test case would you like to run?\n"; | ||
| 507 | my $ans = <STDIN>; | ||
| 508 | chomp $ans; | ||
| 509 | $default{"TEST_TYPE"} = $ans; | ||
| 510 | } | ||
| 511 | |||
| 467 | # set any defaults | 512 | # set any defaults |
| 468 | 513 | ||
| 469 | foreach my $default (keys %default) { | 514 | foreach my $default (keys %default) { |
| @@ -473,6 +518,69 @@ sub read_config { | |||
| 473 | } | 518 | } |
| 474 | } | 519 | } |
| 475 | 520 | ||
| 521 | sub __eval_option { | ||
| 522 | my ($option, $i) = @_; | ||
| 523 | |||
| 524 | # Add space to evaluate the character before $ | ||
| 525 | $option = " $option"; | ||
| 526 | my $retval = ""; | ||
| 527 | |||
| 528 | while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) { | ||
| 529 | my $start = $1; | ||
| 530 | my $var = $2; | ||
| 531 | my $end = $3; | ||
| 532 | |||
| 533 | # Append beginning of line | ||
| 534 | $retval = "$retval$start"; | ||
| 535 | |||
| 536 | # If the iteration option OPT[$i] exists, then use that. | ||
| 537 | # otherwise see if the default OPT (without [$i]) exists. | ||
| 538 | |||
| 539 | my $o = "$var\[$i\]"; | ||
| 540 | |||
| 541 | if (defined($opt{$o})) { | ||
| 542 | $o = $opt{$o}; | ||
| 543 | $retval = "$retval$o"; | ||
| 544 | } elsif (defined($opt{$var})) { | ||
| 545 | $o = $opt{$var}; | ||
| 546 | $retval = "$retval$o"; | ||
| 547 | } else { | ||
| 548 | $retval = "$retval\$\{$var\}"; | ||
| 549 | } | ||
| 550 | |||
| 551 | $option = $end; | ||
| 552 | } | ||
| 553 | |||
| 554 | $retval = "$retval$option"; | ||
| 555 | |||
| 556 | $retval =~ s/^ //; | ||
| 557 | |||
| 558 | return $retval; | ||
| 559 | } | ||
| 560 | |||
| 561 | sub eval_option { | ||
| 562 | my ($option, $i) = @_; | ||
| 563 | |||
| 564 | my $prev = ""; | ||
| 565 | |||
| 566 | # Since an option can evaluate to another option, | ||
| 567 | # keep iterating until we do not evaluate any more | ||
| 568 | # options. | ||
| 569 | my $r = 0; | ||
| 570 | while ($prev ne $option) { | ||
| 571 | # Check for recursive evaluations. | ||
| 572 | # 100 deep should be more than enough. | ||
| 573 | if ($r++ > 100) { | ||
| 574 | die "Over 100 evaluations accurred with $option\n" . | ||
| 575 | "Check for recursive variables\n"; | ||
| 576 | } | ||
| 577 | $prev = $option; | ||
| 578 | $option = __eval_option($option, $i); | ||
| 579 | } | ||
| 580 | |||
| 581 | return $option; | ||
| 582 | } | ||
| 583 | |||
| 476 | sub _logit { | 584 | sub _logit { |
| 477 | if (defined($opt{"LOG_FILE"})) { | 585 | if (defined($opt{"LOG_FILE"})) { |
| 478 | open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; | 586 | open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; |
| @@ -617,9 +725,15 @@ sub fail { | |||
| 617 | end_monitor; | 725 | end_monitor; |
| 618 | } | 726 | } |
| 619 | 727 | ||
| 728 | my $name = ""; | ||
| 729 | |||
| 730 | if (defined($test_name)) { | ||
| 731 | $name = " ($test_name)"; | ||
| 732 | } | ||
| 733 | |||
| 620 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; | 734 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; |
| 621 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; | 735 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; |
| 622 | doprint "KTEST RESULT: TEST $i Failed: ", @_, "\n"; | 736 | doprint "KTEST RESULT: TEST $i$name Failed: ", @_, "\n"; |
| 623 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; | 737 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; |
| 624 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; | 738 | doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; |
| 625 | 739 | ||
| @@ -836,17 +950,35 @@ sub monitor { | |||
| 836 | my $failure_start; | 950 | my $failure_start; |
| 837 | my $monitor_start = time; | 951 | my $monitor_start = time; |
| 838 | my $done = 0; | 952 | my $done = 0; |
| 953 | my $version_found = 0; | ||
| 839 | 954 | ||
| 840 | while (!$done) { | 955 | while (!$done) { |
| 841 | 956 | ||
| 842 | if ($booted) { | 957 | if ($bug && defined($stop_after_failure) && |
| 958 | $stop_after_failure >= 0) { | ||
| 959 | my $time = $stop_after_failure - (time - $failure_start); | ||
| 960 | $line = wait_for_input($monitor_fp, $time); | ||
| 961 | if (!defined($line)) { | ||
| 962 | doprint "bug timed out after $booted_timeout seconds\n"; | ||
| 963 | doprint "Test forced to stop after $stop_after_failure seconds after failure\n"; | ||
| 964 | last; | ||
| 965 | } | ||
| 966 | } elsif ($booted) { | ||
| 843 | $line = wait_for_input($monitor_fp, $booted_timeout); | 967 | $line = wait_for_input($monitor_fp, $booted_timeout); |
| 968 | if (!defined($line)) { | ||
| 969 | my $s = $booted_timeout == 1 ? "" : "s"; | ||
| 970 | doprint "Successful boot found: break after $booted_timeout second$s\n"; | ||
| 971 | last; | ||
| 972 | } | ||
| 844 | } else { | 973 | } else { |
| 845 | $line = wait_for_input($monitor_fp); | 974 | $line = wait_for_input($monitor_fp); |
| 975 | if (!defined($line)) { | ||
| 976 | my $s = $timeout == 1 ? "" : "s"; | ||
| 977 | doprint "Timed out after $timeout second$s\n"; | ||
| 978 | last; | ||
| 979 | } | ||
| 846 | } | 980 | } |
| 847 | 981 | ||
| 848 | last if (!defined($line)); | ||
| 849 | |||
| 850 | doprint $line; | 982 | doprint $line; |
| 851 | print DMESG $line; | 983 | print DMESG $line; |
| 852 | 984 | ||
| @@ -896,6 +1028,22 @@ sub monitor { | |||
| 896 | $bug = 1; | 1028 | $bug = 1; |
| 897 | } | 1029 | } |
| 898 | 1030 | ||
| 1031 | # Detect triple faults by testing the banner | ||
| 1032 | if ($full_line =~ /\bLinux version (\S+).*\n/) { | ||
| 1033 | if ($1 eq $version) { | ||
| 1034 | $version_found = 1; | ||
| 1035 | } elsif ($version_found && $detect_triplefault) { | ||
| 1036 | # We already booted into the kernel we are testing, | ||
| 1037 | # but now we booted into another kernel? | ||
| 1038 | # Consider this a triple fault. | ||
| 1039 | doprint "Aleady booted in Linux kernel $version, but now\n"; | ||
| 1040 | doprint "we booted into Linux kernel $1.\n"; | ||
| 1041 | doprint "Assuming that this is a triple fault.\n"; | ||
| 1042 | doprint "To disable this: set DETECT_TRIPLE_FAULT to 0\n"; | ||
| 1043 | last; | ||
| 1044 | } | ||
| 1045 | } | ||
| 1046 | |||
| 899 | if ($line =~ /\n/) { | 1047 | if ($line =~ /\n/) { |
| 900 | $full_line = ""; | 1048 | $full_line = ""; |
| 901 | } | 1049 | } |
| @@ -923,6 +1071,16 @@ sub monitor { | |||
| 923 | return 1; | 1071 | return 1; |
| 924 | } | 1072 | } |
| 925 | 1073 | ||
| 1074 | sub do_post_install { | ||
| 1075 | |||
| 1076 | return if (!defined($post_install)); | ||
| 1077 | |||
| 1078 | my $cp_post_install = $post_install; | ||
| 1079 | $cp_post_install =~ s/\$KERNEL_VERSION/$version/g; | ||
| 1080 | run_command "$cp_post_install" or | ||
| 1081 | dodie "Failed to run post install"; | ||
| 1082 | } | ||
| 1083 | |||
| 926 | sub install { | 1084 | sub install { |
| 927 | 1085 | ||
| 928 | run_scp "$outputdir/$build_target", "$target_image" or | 1086 | run_scp "$outputdir/$build_target", "$target_image" or |
| @@ -942,6 +1100,7 @@ sub install { | |||
| 942 | close(IN); | 1100 | close(IN); |
| 943 | 1101 | ||
| 944 | if (!$install_mods) { | 1102 | if (!$install_mods) { |
| 1103 | do_post_install; | ||
| 945 | doprint "No modules needed\n"; | 1104 | doprint "No modules needed\n"; |
| 946 | return; | 1105 | return; |
| 947 | } | 1106 | } |
| @@ -964,17 +1123,29 @@ sub install { | |||
| 964 | 1123 | ||
| 965 | unlink "$tmpdir/$modtar"; | 1124 | unlink "$tmpdir/$modtar"; |
| 966 | 1125 | ||
| 967 | run_ssh "'(cd / && tar xf /tmp/$modtar)'" or | 1126 | run_ssh "'(cd / && tar xjf /tmp/$modtar)'" or |
| 968 | dodie "failed to tar modules"; | 1127 | dodie "failed to tar modules"; |
| 969 | 1128 | ||
| 970 | run_ssh "rm -f /tmp/$modtar"; | 1129 | run_ssh "rm -f /tmp/$modtar"; |
| 971 | 1130 | ||
| 972 | return if (!defined($post_install)); | 1131 | do_post_install; |
| 1132 | } | ||
| 973 | 1133 | ||
| 974 | my $cp_post_install = $post_install; | 1134 | sub get_version { |
| 975 | $cp_post_install =~ s/\$KERNEL_VERSION/$version/g; | 1135 | # get the release name |
| 976 | run_command "$cp_post_install" or | 1136 | doprint "$make kernelrelease ... "; |
| 977 | dodie "Failed to run post install"; | 1137 | $version = `$make kernelrelease | tail -1`; |
| 1138 | chomp($version); | ||
| 1139 | doprint "$version\n"; | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | sub start_monitor_and_boot { | ||
| 1143 | get_grub_index; | ||
| 1144 | get_version; | ||
| 1145 | install; | ||
| 1146 | |||
| 1147 | start_monitor; | ||
| 1148 | return monitor; | ||
| 978 | } | 1149 | } |
| 979 | 1150 | ||
| 980 | sub check_buildlog { | 1151 | sub check_buildlog { |
| @@ -1009,24 +1180,84 @@ sub check_buildlog { | |||
| 1009 | return 1; | 1180 | return 1; |
| 1010 | } | 1181 | } |
| 1011 | 1182 | ||
| 1183 | sub apply_min_config { | ||
| 1184 | my $outconfig = "$output_config.new"; | ||
| 1185 | |||
| 1186 | # Read the config file and remove anything that | ||
| 1187 | # is in the force_config hash (from minconfig and others) | ||
| 1188 | # then add the force config back. | ||
| 1189 | |||
| 1190 | doprint "Applying minimum configurations into $output_config.new\n"; | ||
| 1191 | |||
| 1192 | open (OUT, ">$outconfig") or | ||
| 1193 | dodie "Can't create $outconfig"; | ||
| 1194 | |||
| 1195 | if (-f $output_config) { | ||
| 1196 | open (IN, $output_config) or | ||
| 1197 | dodie "Failed to open $output_config"; | ||
| 1198 | while (<IN>) { | ||
| 1199 | if (/^(# )?(CONFIG_[^\s=]*)/) { | ||
| 1200 | next if (defined($force_config{$2})); | ||
| 1201 | } | ||
| 1202 | print OUT; | ||
| 1203 | } | ||
| 1204 | close IN; | ||
| 1205 | } | ||
| 1206 | foreach my $config (keys %force_config) { | ||
| 1207 | print OUT "$force_config{$config}\n"; | ||
| 1208 | } | ||
| 1209 | close OUT; | ||
| 1210 | |||
| 1211 | run_command "mv $outconfig $output_config"; | ||
| 1212 | } | ||
| 1213 | |||
| 1012 | sub make_oldconfig { | 1214 | sub make_oldconfig { |
| 1013 | my ($defconfig) = @_; | ||
| 1014 | 1215 | ||
| 1015 | if (!run_command "$defconfig $make oldnoconfig") { | 1216 | my @force_list = keys %force_config; |
| 1217 | |||
| 1218 | if ($#force_list >= 0) { | ||
| 1219 | apply_min_config; | ||
| 1220 | } | ||
| 1221 | |||
| 1222 | if (!run_command "$make oldnoconfig") { | ||
| 1016 | # Perhaps oldnoconfig doesn't exist in this version of the kernel | 1223 | # Perhaps oldnoconfig doesn't exist in this version of the kernel |
| 1017 | # try a yes '' | oldconfig | 1224 | # try a yes '' | oldconfig |
| 1018 | doprint "oldnoconfig failed, trying yes '' | make oldconfig\n"; | 1225 | doprint "oldnoconfig failed, trying yes '' | make oldconfig\n"; |
| 1019 | run_command "yes '' | $defconfig $make oldconfig" or | 1226 | run_command "yes '' | $make oldconfig" or |
| 1020 | dodie "failed make config oldconfig"; | 1227 | dodie "failed make config oldconfig"; |
| 1021 | } | 1228 | } |
| 1022 | } | 1229 | } |
| 1023 | 1230 | ||
| 1231 | # read a config file and use this to force new configs. | ||
| 1232 | sub load_force_config { | ||
| 1233 | my ($config) = @_; | ||
| 1234 | |||
| 1235 | open(IN, $config) or | ||
| 1236 | dodie "failed to read $config"; | ||
| 1237 | while (<IN>) { | ||
| 1238 | chomp; | ||
| 1239 | if (/^(CONFIG[^\s=]*)(\s*=.*)/) { | ||
| 1240 | $force_config{$1} = $_; | ||
| 1241 | } elsif (/^# (CONFIG_\S*) is not set/) { | ||
| 1242 | $force_config{$1} = $_; | ||
| 1243 | } | ||
| 1244 | } | ||
| 1245 | close IN; | ||
| 1246 | } | ||
| 1247 | |||
| 1024 | sub build { | 1248 | sub build { |
| 1025 | my ($type) = @_; | 1249 | my ($type) = @_; |
| 1026 | my $defconfig = ""; | ||
| 1027 | 1250 | ||
| 1028 | unlink $buildlog; | 1251 | unlink $buildlog; |
| 1029 | 1252 | ||
| 1253 | if (defined($pre_build)) { | ||
| 1254 | my $ret = run_command $pre_build; | ||
| 1255 | if (!$ret && defined($pre_build_die) && | ||
| 1256 | $pre_build_die) { | ||
| 1257 | dodie "failed to pre_build\n"; | ||
| 1258 | } | ||
| 1259 | } | ||
| 1260 | |||
| 1030 | if ($type =~ /^useconfig:(.*)/) { | 1261 | if ($type =~ /^useconfig:(.*)/) { |
| 1031 | run_command "cp $1 $output_config" or | 1262 | run_command "cp $1 $output_config" or |
| 1032 | dodie "could not copy $1 to .config"; | 1263 | dodie "could not copy $1 to .config"; |
| @@ -1063,24 +1294,33 @@ sub build { | |||
| 1063 | close(OUT); | 1294 | close(OUT); |
| 1064 | 1295 | ||
| 1065 | if (defined($minconfig)) { | 1296 | if (defined($minconfig)) { |
| 1066 | $defconfig = "KCONFIG_ALLCONFIG=$minconfig"; | 1297 | load_force_config($minconfig); |
| 1067 | } | 1298 | } |
| 1068 | 1299 | ||
| 1069 | if ($type eq "oldnoconfig") { | 1300 | if ($type ne "oldnoconfig") { |
| 1070 | make_oldconfig $defconfig; | 1301 | run_command "$make $type" or |
| 1071 | } else { | ||
| 1072 | run_command "$defconfig $make $type" or | ||
| 1073 | dodie "failed make config"; | 1302 | dodie "failed make config"; |
| 1074 | } | 1303 | } |
| 1304 | # Run old config regardless, to enforce min configurations | ||
| 1305 | make_oldconfig; | ||
| 1075 | 1306 | ||
| 1076 | $redirect = "$buildlog"; | 1307 | $redirect = "$buildlog"; |
| 1077 | if (!run_command "$make $build_options") { | 1308 | my $build_ret = run_command "$make $build_options"; |
| 1078 | undef $redirect; | 1309 | undef $redirect; |
| 1310 | |||
| 1311 | if (defined($post_build)) { | ||
| 1312 | my $ret = run_command $post_build; | ||
| 1313 | if (!$ret && defined($post_build_die) && | ||
| 1314 | $post_build_die) { | ||
| 1315 | dodie "failed to post_build\n"; | ||
| 1316 | } | ||
| 1317 | } | ||
| 1318 | |||
| 1319 | if (!$build_ret) { | ||
| 1079 | # bisect may need this to pass | 1320 | # bisect may need this to pass |
| 1080 | return 0 if ($in_bisect); | 1321 | return 0 if ($in_bisect); |
| 1081 | fail "failed build" and return 0; | 1322 | fail "failed build" and return 0; |
| 1082 | } | 1323 | } |
| 1083 | undef $redirect; | ||
| 1084 | 1324 | ||
| 1085 | return 1; | 1325 | return 1; |
| 1086 | } | 1326 | } |
| @@ -1102,9 +1342,15 @@ sub success { | |||
| 1102 | 1342 | ||
| 1103 | $successes++; | 1343 | $successes++; |
| 1104 | 1344 | ||
| 1345 | my $name = ""; | ||
| 1346 | |||
| 1347 | if (defined($test_name)) { | ||
| 1348 | $name = " ($test_name)"; | ||
| 1349 | } | ||
| 1350 | |||
| 1105 | doprint "\n\n*******************************************\n"; | 1351 | doprint "\n\n*******************************************\n"; |
| 1106 | doprint "*******************************************\n"; | 1352 | doprint "*******************************************\n"; |
| 1107 | doprint "KTEST RESULT: TEST $i SUCCESS!!!! **\n"; | 1353 | doprint "KTEST RESULT: TEST $i$name SUCCESS!!!! **\n"; |
| 1108 | doprint "*******************************************\n"; | 1354 | doprint "*******************************************\n"; |
| 1109 | doprint "*******************************************\n"; | 1355 | doprint "*******************************************\n"; |
| 1110 | 1356 | ||
| @@ -1117,14 +1363,6 @@ sub success { | |||
| 1117 | } | 1363 | } |
| 1118 | } | 1364 | } |
| 1119 | 1365 | ||
| 1120 | sub get_version { | ||
| 1121 | # get the release name | ||
| 1122 | doprint "$make kernelrelease ... "; | ||
| 1123 | $version = `$make kernelrelease | tail -1`; | ||
| 1124 | chomp($version); | ||
| 1125 | doprint "$version\n"; | ||
| 1126 | } | ||
| 1127 | |||
| 1128 | sub answer_bisect { | 1366 | sub answer_bisect { |
| 1129 | for (;;) { | 1367 | for (;;) { |
| 1130 | doprint "Pass or fail? [p/f]"; | 1368 | doprint "Pass or fail? [p/f]"; |
| @@ -1289,12 +1527,7 @@ sub run_bisect_test { | |||
| 1289 | dodie "Failed on build" if $failed; | 1527 | dodie "Failed on build" if $failed; |
| 1290 | 1528 | ||
| 1291 | # Now boot the box | 1529 | # Now boot the box |
| 1292 | get_grub_index; | 1530 | start_monitor_and_boot or $failed = 1; |
| 1293 | get_version; | ||
| 1294 | install; | ||
| 1295 | |||
| 1296 | start_monitor; | ||
| 1297 | monitor or $failed = 1; | ||
| 1298 | 1531 | ||
| 1299 | if ($type ne "boot") { | 1532 | if ($type ne "boot") { |
| 1300 | if ($failed && $bisect_skip) { | 1533 | if ($failed && $bisect_skip) { |
| @@ -1473,21 +1706,27 @@ my %null_config; | |||
| 1473 | 1706 | ||
| 1474 | my %dependency; | 1707 | my %dependency; |
| 1475 | 1708 | ||
| 1476 | sub process_config_ignore { | 1709 | sub assign_configs { |
| 1477 | my ($config) = @_; | 1710 | my ($hash, $config) = @_; |
| 1478 | 1711 | ||
| 1479 | open (IN, $config) | 1712 | open (IN, $config) |
| 1480 | or dodie "Failed to read $config"; | 1713 | or dodie "Failed to read $config"; |
| 1481 | 1714 | ||
| 1482 | while (<IN>) { | 1715 | while (<IN>) { |
| 1483 | if (/^((CONFIG\S*)=.*)/) { | 1716 | if (/^((CONFIG\S*)=.*)/) { |
| 1484 | $config_ignore{$2} = $1; | 1717 | ${$hash}{$2} = $1; |
| 1485 | } | 1718 | } |
| 1486 | } | 1719 | } |
| 1487 | 1720 | ||
| 1488 | close(IN); | 1721 | close(IN); |
| 1489 | } | 1722 | } |
| 1490 | 1723 | ||
| 1724 | sub process_config_ignore { | ||
| 1725 | my ($config) = @_; | ||
| 1726 | |||
| 1727 | assign_configs \%config_ignore, $config; | ||
| 1728 | } | ||
| 1729 | |||
| 1491 | sub read_current_config { | 1730 | sub read_current_config { |
| 1492 | my ($config_ref) = @_; | 1731 | my ($config_ref) = @_; |
| 1493 | 1732 | ||
| @@ -1546,7 +1785,7 @@ sub create_config { | |||
| 1546 | close(OUT); | 1785 | close(OUT); |
| 1547 | 1786 | ||
| 1548 | # exit; | 1787 | # exit; |
| 1549 | make_oldconfig ""; | 1788 | make_oldconfig; |
| 1550 | } | 1789 | } |
| 1551 | 1790 | ||
| 1552 | sub compare_configs { | 1791 | sub compare_configs { |
| @@ -1718,6 +1957,10 @@ sub config_bisect { | |||
| 1718 | 1957 | ||
| 1719 | my $tmpconfig = "$tmpdir/use_config"; | 1958 | my $tmpconfig = "$tmpdir/use_config"; |
| 1720 | 1959 | ||
| 1960 | if (defined($config_bisect_good)) { | ||
| 1961 | process_config_ignore $config_bisect_good; | ||
| 1962 | } | ||
| 1963 | |||
| 1721 | # Make the file with the bad config and the min config | 1964 | # Make the file with the bad config and the min config |
| 1722 | if (defined($minconfig)) { | 1965 | if (defined($minconfig)) { |
| 1723 | # read the min config for things to ignore | 1966 | # read the min config for things to ignore |
| @@ -1727,15 +1970,8 @@ sub config_bisect { | |||
| 1727 | unlink $tmpconfig; | 1970 | unlink $tmpconfig; |
| 1728 | } | 1971 | } |
| 1729 | 1972 | ||
| 1730 | # Add other configs | ||
| 1731 | if (defined($addconfig)) { | ||
| 1732 | run_command "cat $addconfig >> $tmpconfig" or | ||
| 1733 | dodie "failed to append $addconfig"; | ||
| 1734 | } | ||
| 1735 | |||
| 1736 | my $defconfig = ""; | ||
| 1737 | if (-f $tmpconfig) { | 1973 | if (-f $tmpconfig) { |
| 1738 | $defconfig = "KCONFIG_ALLCONFIG=$tmpconfig"; | 1974 | load_force_config($tmpconfig); |
| 1739 | process_config_ignore $tmpconfig; | 1975 | process_config_ignore $tmpconfig; |
| 1740 | } | 1976 | } |
| 1741 | 1977 | ||
| @@ -1755,8 +1991,8 @@ sub config_bisect { | |||
| 1755 | } | 1991 | } |
| 1756 | close(IN); | 1992 | close(IN); |
| 1757 | 1993 | ||
| 1758 | # Now run oldconfig with the minconfig (and addconfigs) | 1994 | # Now run oldconfig with the minconfig |
| 1759 | make_oldconfig $defconfig; | 1995 | make_oldconfig; |
| 1760 | 1996 | ||
| 1761 | # check to see what we lost (or gained) | 1997 | # check to see what we lost (or gained) |
| 1762 | open (IN, $output_config) | 1998 | open (IN, $output_config) |
| @@ -1882,6 +2118,13 @@ sub patchcheck { | |||
| 1882 | @list = reverse @list; | 2118 | @list = reverse @list; |
| 1883 | 2119 | ||
| 1884 | my $save_clean = $noclean; | 2120 | my $save_clean = $noclean; |
| 2121 | my %ignored_warnings; | ||
| 2122 | |||
| 2123 | if (defined($ignore_warnings)) { | ||
| 2124 | foreach my $sha1 (split /\s+/, $ignore_warnings) { | ||
| 2125 | $ignored_warnings{$sha1} = 1; | ||
| 2126 | } | ||
| 2127 | } | ||
| 1885 | 2128 | ||
| 1886 | $in_patchcheck = 1; | 2129 | $in_patchcheck = 1; |
| 1887 | foreach my $item (@list) { | 2130 | foreach my $item (@list) { |
| @@ -1908,18 +2151,16 @@ sub patchcheck { | |||
| 1908 | build "oldconfig" or return 0; | 2151 | build "oldconfig" or return 0; |
| 1909 | } | 2152 | } |
| 1910 | 2153 | ||
| 1911 | check_buildlog $sha1 or return 0; | ||
| 1912 | 2154 | ||
| 1913 | next if ($type eq "build"); | 2155 | if (!defined($ignored_warnings{$sha1})) { |
| 2156 | check_buildlog $sha1 or return 0; | ||
| 2157 | } | ||
| 1914 | 2158 | ||
| 1915 | get_grub_index; | 2159 | next if ($type eq "build"); |
| 1916 | get_version; | ||
| 1917 | install; | ||
| 1918 | 2160 | ||
| 1919 | my $failed = 0; | 2161 | my $failed = 0; |
| 1920 | 2162 | ||
| 1921 | start_monitor; | 2163 | start_monitor_and_boot or $failed = 1; |
| 1922 | monitor or $failed = 1; | ||
| 1923 | 2164 | ||
| 1924 | if (!$failed && $type ne "boot"){ | 2165 | if (!$failed && $type ne "boot"){ |
| 1925 | do_run_test or $failed = 1; | 2166 | do_run_test or $failed = 1; |
| @@ -1936,24 +2177,505 @@ sub patchcheck { | |||
| 1936 | return 1; | 2177 | return 1; |
| 1937 | } | 2178 | } |
| 1938 | 2179 | ||
| 2180 | my %depends; | ||
| 2181 | my $iflevel = 0; | ||
| 2182 | my @ifdeps; | ||
| 2183 | |||
| 2184 | # prevent recursion | ||
| 2185 | my %read_kconfigs; | ||
| 2186 | |||
| 2187 | # taken from streamline_config.pl | ||
| 2188 | sub read_kconfig { | ||
| 2189 | my ($kconfig) = @_; | ||
| 2190 | |||
| 2191 | my $state = "NONE"; | ||
| 2192 | my $config; | ||
| 2193 | my @kconfigs; | ||
| 2194 | |||
| 2195 | my $cont = 0; | ||
| 2196 | my $line; | ||
| 2197 | |||
| 2198 | |||
| 2199 | if (! -f $kconfig) { | ||
| 2200 | doprint "file $kconfig does not exist, skipping\n"; | ||
| 2201 | return; | ||
| 2202 | } | ||
| 2203 | |||
| 2204 | open(KIN, "$kconfig") | ||
| 2205 | or die "Can't open $kconfig"; | ||
| 2206 | while (<KIN>) { | ||
| 2207 | chomp; | ||
| 2208 | |||
| 2209 | # Make sure that lines ending with \ continue | ||
| 2210 | if ($cont) { | ||
| 2211 | $_ = $line . " " . $_; | ||
| 2212 | } | ||
| 2213 | |||
| 2214 | if (s/\\$//) { | ||
| 2215 | $cont = 1; | ||
| 2216 | $line = $_; | ||
| 2217 | next; | ||
| 2218 | } | ||
| 2219 | |||
| 2220 | $cont = 0; | ||
| 2221 | |||
| 2222 | # collect any Kconfig sources | ||
| 2223 | if (/^source\s*"(.*)"/) { | ||
| 2224 | $kconfigs[$#kconfigs+1] = $1; | ||
| 2225 | } | ||
| 2226 | |||
| 2227 | # configs found | ||
| 2228 | if (/^\s*(menu)?config\s+(\S+)\s*$/) { | ||
| 2229 | $state = "NEW"; | ||
| 2230 | $config = $2; | ||
| 2231 | |||
| 2232 | for (my $i = 0; $i < $iflevel; $i++) { | ||
| 2233 | if ($i) { | ||
| 2234 | $depends{$config} .= " " . $ifdeps[$i]; | ||
| 2235 | } else { | ||
| 2236 | $depends{$config} = $ifdeps[$i]; | ||
| 2237 | } | ||
| 2238 | $state = "DEP"; | ||
| 2239 | } | ||
| 2240 | |||
| 2241 | # collect the depends for the config | ||
| 2242 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | ||
| 2243 | |||
| 2244 | if (defined($depends{$1})) { | ||
| 2245 | $depends{$config} .= " " . $1; | ||
| 2246 | } else { | ||
| 2247 | $depends{$config} = $1; | ||
| 2248 | } | ||
| 2249 | |||
| 2250 | # Get the configs that select this config | ||
| 2251 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { | ||
| 2252 | if (defined($depends{$1})) { | ||
| 2253 | $depends{$1} .= " " . $config; | ||
| 2254 | } else { | ||
| 2255 | $depends{$1} = $config; | ||
| 2256 | } | ||
| 2257 | |||
| 2258 | # Check for if statements | ||
| 2259 | } elsif (/^if\s+(.*\S)\s*$/) { | ||
| 2260 | my $deps = $1; | ||
| 2261 | # remove beginning and ending non text | ||
| 2262 | $deps =~ s/^[^a-zA-Z0-9_]*//; | ||
| 2263 | $deps =~ s/[^a-zA-Z0-9_]*$//; | ||
| 2264 | |||
| 2265 | my @deps = split /[^a-zA-Z0-9_]+/, $deps; | ||
| 2266 | |||
| 2267 | $ifdeps[$iflevel++] = join ':', @deps; | ||
| 2268 | |||
| 2269 | } elsif (/^endif/) { | ||
| 2270 | |||
| 2271 | $iflevel-- if ($iflevel); | ||
| 2272 | |||
| 2273 | # stop on "help" | ||
| 2274 | } elsif (/^\s*help\s*$/) { | ||
| 2275 | $state = "NONE"; | ||
| 2276 | } | ||
| 2277 | } | ||
| 2278 | close(KIN); | ||
| 2279 | |||
| 2280 | # read in any configs that were found. | ||
| 2281 | foreach $kconfig (@kconfigs) { | ||
| 2282 | if (!defined($read_kconfigs{$kconfig})) { | ||
| 2283 | $read_kconfigs{$kconfig} = 1; | ||
| 2284 | read_kconfig("$builddir/$kconfig"); | ||
| 2285 | } | ||
| 2286 | } | ||
| 2287 | } | ||
| 2288 | |||
| 2289 | sub read_depends { | ||
| 2290 | # find out which arch this is by the kconfig file | ||
| 2291 | open (IN, $output_config) | ||
| 2292 | or dodie "Failed to read $output_config"; | ||
| 2293 | my $arch; | ||
| 2294 | while (<IN>) { | ||
| 2295 | if (m,Linux/(\S+)\s+\S+\s+Kernel Configuration,) { | ||
| 2296 | $arch = $1; | ||
| 2297 | last; | ||
| 2298 | } | ||
| 2299 | } | ||
| 2300 | close IN; | ||
| 2301 | |||
| 2302 | if (!defined($arch)) { | ||
| 2303 | doprint "Could not find arch from config file\n"; | ||
| 2304 | doprint "no dependencies used\n"; | ||
| 2305 | return; | ||
| 2306 | } | ||
| 2307 | |||
| 2308 | # arch is really the subarch, we need to know | ||
| 2309 | # what directory to look at. | ||
| 2310 | if ($arch eq "i386" || $arch eq "x86_64") { | ||
| 2311 | $arch = "x86"; | ||
| 2312 | } elsif ($arch =~ /^tile/) { | ||
| 2313 | $arch = "tile"; | ||
| 2314 | } | ||
| 2315 | |||
| 2316 | my $kconfig = "$builddir/arch/$arch/Kconfig"; | ||
| 2317 | |||
| 2318 | if (! -f $kconfig && $arch =~ /\d$/) { | ||
| 2319 | my $orig = $arch; | ||
| 2320 | # some subarchs have numbers, truncate them | ||
| 2321 | $arch =~ s/\d*$//; | ||
| 2322 | $kconfig = "$builddir/arch/$arch/Kconfig"; | ||
| 2323 | if (! -f $kconfig) { | ||
| 2324 | doprint "No idea what arch dir $orig is for\n"; | ||
| 2325 | doprint "no dependencies used\n"; | ||
| 2326 | return; | ||
| 2327 | } | ||
| 2328 | } | ||
| 2329 | |||
| 2330 | read_kconfig($kconfig); | ||
| 2331 | } | ||
| 2332 | |||
| 2333 | sub read_config_list { | ||
| 2334 | my ($config) = @_; | ||
| 2335 | |||
| 2336 | open (IN, $config) | ||
| 2337 | or dodie "Failed to read $config"; | ||
| 2338 | |||
| 2339 | while (<IN>) { | ||
| 2340 | if (/^((CONFIG\S*)=.*)/) { | ||
| 2341 | if (!defined($config_ignore{$2})) { | ||
| 2342 | $config_list{$2} = $1; | ||
| 2343 | } | ||
| 2344 | } | ||
| 2345 | } | ||
| 2346 | |||
| 2347 | close(IN); | ||
| 2348 | } | ||
| 2349 | |||
| 2350 | sub read_output_config { | ||
| 2351 | my ($config) = @_; | ||
| 2352 | |||
| 2353 | assign_configs \%config_ignore, $config; | ||
| 2354 | } | ||
| 2355 | |||
| 2356 | sub make_new_config { | ||
| 2357 | my @configs = @_; | ||
| 2358 | |||
| 2359 | open (OUT, ">$output_config") | ||
| 2360 | or dodie "Failed to write $output_config"; | ||
| 2361 | |||
| 2362 | foreach my $config (@configs) { | ||
| 2363 | print OUT "$config\n"; | ||
| 2364 | } | ||
| 2365 | close OUT; | ||
| 2366 | } | ||
| 2367 | |||
| 2368 | sub get_depends { | ||
| 2369 | my ($dep) = @_; | ||
| 2370 | |||
| 2371 | my $kconfig = $dep; | ||
| 2372 | $kconfig =~ s/CONFIG_//; | ||
| 2373 | |||
| 2374 | $dep = $depends{"$kconfig"}; | ||
| 2375 | |||
| 2376 | # the dep string we have saves the dependencies as they | ||
| 2377 | # were found, including expressions like ! && ||. We | ||
| 2378 | # want to split this out into just an array of configs. | ||
| 2379 | |||
| 2380 | my $valid = "A-Za-z_0-9"; | ||
| 2381 | |||
| 2382 | my @configs; | ||
| 2383 | |||
| 2384 | while ($dep =~ /[$valid]/) { | ||
| 2385 | |||
| 2386 | if ($dep =~ /^[^$valid]*([$valid]+)/) { | ||
| 2387 | my $conf = "CONFIG_" . $1; | ||
| 2388 | |||
| 2389 | $configs[$#configs + 1] = $conf; | ||
| 2390 | |||
| 2391 | $dep =~ s/^[^$valid]*[$valid]+//; | ||
| 2392 | } else { | ||
| 2393 | die "this should never happen"; | ||
| 2394 | } | ||
| 2395 | } | ||
| 2396 | |||
| 2397 | return @configs; | ||
| 2398 | } | ||
| 2399 | |||
| 2400 | my %min_configs; | ||
| 2401 | my %keep_configs; | ||
| 2402 | my %save_configs; | ||
| 2403 | my %processed_configs; | ||
| 2404 | my %nochange_config; | ||
| 2405 | |||
| 2406 | sub test_this_config { | ||
| 2407 | my ($config) = @_; | ||
| 2408 | |||
| 2409 | my $found; | ||
| 2410 | |||
| 2411 | # if we already processed this config, skip it | ||
| 2412 | if (defined($processed_configs{$config})) { | ||
| 2413 | return undef; | ||
| 2414 | } | ||
| 2415 | $processed_configs{$config} = 1; | ||
| 2416 | |||
| 2417 | # if this config failed during this round, skip it | ||
| 2418 | if (defined($nochange_config{$config})) { | ||
| 2419 | return undef; | ||
| 2420 | } | ||
| 2421 | |||
| 2422 | my $kconfig = $config; | ||
| 2423 | $kconfig =~ s/CONFIG_//; | ||
| 2424 | |||
| 2425 | # Test dependencies first | ||
| 2426 | if (defined($depends{"$kconfig"})) { | ||
| 2427 | my @parents = get_depends $config; | ||
| 2428 | foreach my $parent (@parents) { | ||
| 2429 | # if the parent is in the min config, check it first | ||
| 2430 | next if (!defined($min_configs{$parent})); | ||
| 2431 | $found = test_this_config($parent); | ||
| 2432 | if (defined($found)) { | ||
| 2433 | return $found; | ||
| 2434 | } | ||
| 2435 | } | ||
| 2436 | } | ||
| 2437 | |||
| 2438 | # Remove this config from the list of configs | ||
| 2439 | # do a make oldnoconfig and then read the resulting | ||
| 2440 | # .config to make sure it is missing the config that | ||
| 2441 | # we had before | ||
| 2442 | my %configs = %min_configs; | ||
| 2443 | delete $configs{$config}; | ||
| 2444 | make_new_config ((values %configs), (values %keep_configs)); | ||
| 2445 | make_oldconfig; | ||
| 2446 | undef %configs; | ||
| 2447 | assign_configs \%configs, $output_config; | ||
| 2448 | |||
| 2449 | return $config if (!defined($configs{$config})); | ||
| 2450 | |||
| 2451 | doprint "disabling config $config did not change .config\n"; | ||
| 2452 | |||
| 2453 | $nochange_config{$config} = 1; | ||
| 2454 | |||
| 2455 | return undef; | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | sub make_min_config { | ||
| 2459 | my ($i) = @_; | ||
| 2460 | |||
| 2461 | if (!defined($output_minconfig)) { | ||
| 2462 | fail "OUTPUT_MIN_CONFIG not defined" and return; | ||
| 2463 | } | ||
| 2464 | |||
| 2465 | # If output_minconfig exists, and the start_minconfig | ||
| 2466 | # came from min_config, than ask if we should use | ||
| 2467 | # that instead. | ||
| 2468 | if (-f $output_minconfig && !$start_minconfig_defined) { | ||
| 2469 | print "$output_minconfig exists\n"; | ||
| 2470 | if (read_yn " Use it as minconfig?") { | ||
| 2471 | $start_minconfig = $output_minconfig; | ||
| 2472 | } | ||
| 2473 | } | ||
| 2474 | |||
| 2475 | if (!defined($start_minconfig)) { | ||
| 2476 | fail "START_MIN_CONFIG or MIN_CONFIG not defined" and return; | ||
| 2477 | } | ||
| 2478 | |||
| 2479 | my $temp_config = "$tmpdir/temp_config"; | ||
| 2480 | |||
| 2481 | # First things first. We build an allnoconfig to find | ||
| 2482 | # out what the defaults are that we can't touch. | ||
| 2483 | # Some are selections, but we really can't handle selections. | ||
| 2484 | |||
| 2485 | my $save_minconfig = $minconfig; | ||
| 2486 | undef $minconfig; | ||
| 2487 | |||
| 2488 | run_command "$make allnoconfig" or return 0; | ||
| 2489 | |||
| 2490 | read_depends; | ||
| 2491 | |||
| 2492 | process_config_ignore $output_config; | ||
| 2493 | |||
| 2494 | undef %save_configs; | ||
| 2495 | undef %min_configs; | ||
| 2496 | |||
| 2497 | if (defined($ignore_config)) { | ||
| 2498 | # make sure the file exists | ||
| 2499 | `touch $ignore_config`; | ||
| 2500 | assign_configs \%save_configs, $ignore_config; | ||
| 2501 | } | ||
| 2502 | |||
| 2503 | %keep_configs = %save_configs; | ||
| 2504 | |||
| 2505 | doprint "Load initial configs from $start_minconfig\n"; | ||
| 2506 | |||
| 2507 | # Look at the current min configs, and save off all the | ||
| 2508 | # ones that were set via the allnoconfig | ||
| 2509 | assign_configs \%min_configs, $start_minconfig; | ||
| 2510 | |||
| 2511 | my @config_keys = keys %min_configs; | ||
| 2512 | |||
| 2513 | # Remove anything that was set by the make allnoconfig | ||
| 2514 | # we shouldn't need them as they get set for us anyway. | ||
| 2515 | foreach my $config (@config_keys) { | ||
| 2516 | # Remove anything in the ignore_config | ||
| 2517 | if (defined($keep_configs{$config})) { | ||
| 2518 | my $file = $ignore_config; | ||
| 2519 | $file =~ s,.*/(.*?)$,$1,; | ||
| 2520 | doprint "$config set by $file ... ignored\n"; | ||
| 2521 | delete $min_configs{$config}; | ||
| 2522 | next; | ||
| 2523 | } | ||
| 2524 | # But make sure the settings are the same. If a min config | ||
| 2525 | # sets a selection, we do not want to get rid of it if | ||
| 2526 | # it is not the same as what we have. Just move it into | ||
| 2527 | # the keep configs. | ||
| 2528 | if (defined($config_ignore{$config})) { | ||
| 2529 | if ($config_ignore{$config} ne $min_configs{$config}) { | ||
| 2530 | doprint "$config is in allnoconfig as '$config_ignore{$config}'"; | ||
| 2531 | doprint " but it is '$min_configs{$config}' in minconfig .. keeping\n"; | ||
| 2532 | $keep_configs{$config} = $min_configs{$config}; | ||
| 2533 | } else { | ||
| 2534 | doprint "$config set by allnoconfig ... ignored\n"; | ||
| 2535 | } | ||
| 2536 | delete $min_configs{$config}; | ||
| 2537 | } | ||
| 2538 | } | ||
| 2539 | |||
| 2540 | my $done = 0; | ||
| 2541 | my $take_two = 0; | ||
| 2542 | |||
| 2543 | while (!$done) { | ||
| 2544 | |||
| 2545 | my $config; | ||
| 2546 | my $found; | ||
| 2547 | |||
| 2548 | # Now disable each config one by one and do a make oldconfig | ||
| 2549 | # till we find a config that changes our list. | ||
| 2550 | |||
| 2551 | # Put configs that did not modify the config at the end. | ||
| 2552 | my @test_configs = keys %min_configs; | ||
| 2553 | my $reset = 1; | ||
| 2554 | for (my $i = 0; $i < $#test_configs; $i++) { | ||
| 2555 | if (!defined($nochange_config{$test_configs[0]})) { | ||
| 2556 | $reset = 0; | ||
| 2557 | last; | ||
| 2558 | } | ||
| 2559 | # This config didn't change the .config last time. | ||
| 2560 | # Place it at the end | ||
| 2561 | my $config = shift @test_configs; | ||
| 2562 | push @test_configs, $config; | ||
| 2563 | } | ||
| 2564 | |||
| 2565 | # if every test config has failed to modify the .config file | ||
| 2566 | # in the past, then reset and start over. | ||
| 2567 | if ($reset) { | ||
| 2568 | undef %nochange_config; | ||
| 2569 | } | ||
| 2570 | |||
| 2571 | undef %processed_configs; | ||
| 2572 | |||
| 2573 | foreach my $config (@test_configs) { | ||
| 2574 | |||
| 2575 | $found = test_this_config $config; | ||
| 2576 | |||
| 2577 | last if (defined($found)); | ||
| 2578 | |||
| 2579 | # oh well, try another config | ||
| 2580 | } | ||
| 2581 | |||
| 2582 | if (!defined($found)) { | ||
| 2583 | # we could have failed due to the nochange_config hash | ||
| 2584 | # reset and try again | ||
| 2585 | if (!$take_two) { | ||
| 2586 | undef %nochange_config; | ||
| 2587 | $take_two = 1; | ||
| 2588 | next; | ||
| 2589 | } | ||
| 2590 | doprint "No more configs found that we can disable\n"; | ||
| 2591 | $done = 1; | ||
| 2592 | last; | ||
| 2593 | } | ||
| 2594 | $take_two = 0; | ||
| 2595 | |||
| 2596 | $config = $found; | ||
| 2597 | |||
| 2598 | doprint "Test with $config disabled\n"; | ||
| 2599 | |||
| 2600 | # set in_bisect to keep build and monitor from dieing | ||
| 2601 | $in_bisect = 1; | ||
| 2602 | |||
| 2603 | my $failed = 0; | ||
| 2604 | build "oldconfig"; | ||
| 2605 | start_monitor_and_boot or $failed = 1; | ||
| 2606 | end_monitor; | ||
| 2607 | |||
| 2608 | $in_bisect = 0; | ||
| 2609 | |||
| 2610 | if ($failed) { | ||
| 2611 | doprint "$min_configs{$config} is needed to boot the box... keeping\n"; | ||
| 2612 | # this config is needed, add it to the ignore list. | ||
| 2613 | $keep_configs{$config} = $min_configs{$config}; | ||
| 2614 | $save_configs{$config} = $min_configs{$config}; | ||
| 2615 | delete $min_configs{$config}; | ||
| 2616 | |||
| 2617 | # update new ignore configs | ||
| 2618 | if (defined($ignore_config)) { | ||
| 2619 | open (OUT, ">$temp_config") | ||
| 2620 | or die "Can't write to $temp_config"; | ||
| 2621 | foreach my $config (keys %save_configs) { | ||
| 2622 | print OUT "$save_configs{$config}\n"; | ||
| 2623 | } | ||
| 2624 | close OUT; | ||
| 2625 | run_command "mv $temp_config $ignore_config" or | ||
| 2626 | dodie "failed to copy update to $ignore_config"; | ||
| 2627 | } | ||
| 2628 | |||
| 2629 | } else { | ||
| 2630 | # We booted without this config, remove it from the minconfigs. | ||
| 2631 | doprint "$config is not needed, disabling\n"; | ||
| 2632 | |||
| 2633 | delete $min_configs{$config}; | ||
| 2634 | |||
| 2635 | # Also disable anything that is not enabled in this config | ||
| 2636 | my %configs; | ||
| 2637 | assign_configs \%configs, $output_config; | ||
| 2638 | my @config_keys = keys %min_configs; | ||
| 2639 | foreach my $config (@config_keys) { | ||
| 2640 | if (!defined($configs{$config})) { | ||
| 2641 | doprint "$config is not set, disabling\n"; | ||
| 2642 | delete $min_configs{$config}; | ||
| 2643 | } | ||
| 2644 | } | ||
| 2645 | |||
| 2646 | # Save off all the current mandidory configs | ||
| 2647 | open (OUT, ">$temp_config") | ||
| 2648 | or die "Can't write to $temp_config"; | ||
| 2649 | foreach my $config (keys %keep_configs) { | ||
| 2650 | print OUT "$keep_configs{$config}\n"; | ||
| 2651 | } | ||
| 2652 | foreach my $config (keys %min_configs) { | ||
| 2653 | print OUT "$min_configs{$config}\n"; | ||
| 2654 | } | ||
| 2655 | close OUT; | ||
| 2656 | |||
| 2657 | run_command "mv $temp_config $output_minconfig" or | ||
| 2658 | dodie "failed to copy update to $output_minconfig"; | ||
| 2659 | } | ||
| 2660 | |||
| 2661 | doprint "Reboot and wait $sleep_time seconds\n"; | ||
| 2662 | reboot; | ||
| 2663 | start_monitor; | ||
| 2664 | wait_for_monitor $sleep_time; | ||
| 2665 | end_monitor; | ||
| 2666 | } | ||
| 2667 | |||
| 2668 | success $i; | ||
| 2669 | return 1; | ||
| 2670 | } | ||
| 2671 | |||
| 1939 | $#ARGV < 1 or die "ktest.pl version: $VERSION\n usage: ktest.pl config-file\n"; | 2672 | $#ARGV < 1 or die "ktest.pl version: $VERSION\n usage: ktest.pl config-file\n"; |
| 1940 | 2673 | ||
| 1941 | if ($#ARGV == 0) { | 2674 | if ($#ARGV == 0) { |
| 1942 | $ktest_config = $ARGV[0]; | 2675 | $ktest_config = $ARGV[0]; |
| 1943 | if (! -f $ktest_config) { | 2676 | if (! -f $ktest_config) { |
| 1944 | print "$ktest_config does not exist.\n"; | 2677 | print "$ktest_config does not exist.\n"; |
| 1945 | my $ans; | 2678 | if (!read_yn "Create it?") { |
| 1946 | for (;;) { | ||
| 1947 | print "Create it? [Y/n] "; | ||
| 1948 | $ans = <STDIN>; | ||
| 1949 | chomp $ans; | ||
| 1950 | if ($ans =~ /^\s*$/) { | ||
| 1951 | $ans = "y"; | ||
| 1952 | } | ||
| 1953 | last if ($ans =~ /^y$/i || $ans =~ /^n$/i); | ||
| 1954 | print "Please answer either 'y' or 'n'.\n"; | ||
| 1955 | } | ||
| 1956 | if ($ans !~ /^y$/i) { | ||
| 1957 | exit 0; | 2679 | exit 0; |
| 1958 | } | 2680 | } |
| 1959 | } | 2681 | } |
| @@ -1977,6 +2699,10 @@ EOF | |||
| 1977 | } | 2699 | } |
| 1978 | read_config $ktest_config; | 2700 | read_config $ktest_config; |
| 1979 | 2701 | ||
| 2702 | if (defined($opt{"LOG_FILE"})) { | ||
| 2703 | $opt{"LOG_FILE"} = eval_option($opt{"LOG_FILE"}, -1); | ||
| 2704 | } | ||
| 2705 | |||
| 1980 | # Append any configs entered in manually to the config file. | 2706 | # Append any configs entered in manually to the config file. |
| 1981 | my @new_configs = keys %entered_configs; | 2707 | my @new_configs = keys %entered_configs; |
| 1982 | if ($#new_configs >= 0) { | 2708 | if ($#new_configs >= 0) { |
| @@ -2045,70 +2771,13 @@ sub __set_test_option { | |||
| 2045 | return undef; | 2771 | return undef; |
| 2046 | } | 2772 | } |
| 2047 | 2773 | ||
| 2048 | sub eval_option { | ||
| 2049 | my ($option, $i) = @_; | ||
| 2050 | |||
| 2051 | # Add space to evaluate the character before $ | ||
| 2052 | $option = " $option"; | ||
| 2053 | my $retval = ""; | ||
| 2054 | |||
| 2055 | while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) { | ||
| 2056 | my $start = $1; | ||
| 2057 | my $var = $2; | ||
| 2058 | my $end = $3; | ||
| 2059 | |||
| 2060 | # Append beginning of line | ||
| 2061 | $retval = "$retval$start"; | ||
| 2062 | |||
| 2063 | # If the iteration option OPT[$i] exists, then use that. | ||
| 2064 | # otherwise see if the default OPT (without [$i]) exists. | ||
| 2065 | |||
| 2066 | my $o = "$var\[$i\]"; | ||
| 2067 | |||
| 2068 | if (defined($opt{$o})) { | ||
| 2069 | $o = $opt{$o}; | ||
| 2070 | $retval = "$retval$o"; | ||
| 2071 | } elsif (defined($opt{$var})) { | ||
| 2072 | $o = $opt{$var}; | ||
| 2073 | $retval = "$retval$o"; | ||
| 2074 | } else { | ||
| 2075 | $retval = "$retval\$\{$var\}"; | ||
| 2076 | } | ||
| 2077 | |||
| 2078 | $option = $end; | ||
| 2079 | } | ||
| 2080 | |||
| 2081 | $retval = "$retval$option"; | ||
| 2082 | |||
| 2083 | $retval =~ s/^ //; | ||
| 2084 | |||
| 2085 | return $retval; | ||
| 2086 | } | ||
| 2087 | |||
| 2088 | sub set_test_option { | 2774 | sub set_test_option { |
| 2089 | my ($name, $i) = @_; | 2775 | my ($name, $i) = @_; |
| 2090 | 2776 | ||
| 2091 | my $option = __set_test_option($name, $i); | 2777 | my $option = __set_test_option($name, $i); |
| 2092 | return $option if (!defined($option)); | 2778 | return $option if (!defined($option)); |
| 2093 | 2779 | ||
| 2094 | my $prev = ""; | 2780 | return eval_option($option, $i); |
| 2095 | |||
| 2096 | # Since an option can evaluate to another option, | ||
| 2097 | # keep iterating until we do not evaluate any more | ||
| 2098 | # options. | ||
| 2099 | my $r = 0; | ||
| 2100 | while ($prev ne $option) { | ||
| 2101 | # Check for recursive evaluations. | ||
| 2102 | # 100 deep should be more than enough. | ||
| 2103 | if ($r++ > 100) { | ||
| 2104 | die "Over 100 evaluations accurred with $name\n" . | ||
| 2105 | "Check for recursive variables\n"; | ||
| 2106 | } | ||
| 2107 | $prev = $option; | ||
| 2108 | $option = eval_option($option, $i); | ||
| 2109 | } | ||
| 2110 | |||
| 2111 | return $option; | ||
| 2112 | } | 2781 | } |
| 2113 | 2782 | ||
| 2114 | # First we need to do is the builds | 2783 | # First we need to do is the builds |
| @@ -2126,10 +2795,17 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2126 | $test_type = set_test_option("TEST_TYPE", $i); | 2795 | $test_type = set_test_option("TEST_TYPE", $i); |
| 2127 | $build_type = set_test_option("BUILD_TYPE", $i); | 2796 | $build_type = set_test_option("BUILD_TYPE", $i); |
| 2128 | $build_options = set_test_option("BUILD_OPTIONS", $i); | 2797 | $build_options = set_test_option("BUILD_OPTIONS", $i); |
| 2798 | $pre_build = set_test_option("PRE_BUILD", $i); | ||
| 2799 | $post_build = set_test_option("POST_BUILD", $i); | ||
| 2800 | $pre_build_die = set_test_option("PRE_BUILD_DIE", $i); | ||
| 2801 | $post_build_die = set_test_option("POST_BUILD_DIE", $i); | ||
| 2129 | $power_cycle = set_test_option("POWER_CYCLE", $i); | 2802 | $power_cycle = set_test_option("POWER_CYCLE", $i); |
| 2130 | $reboot = set_test_option("REBOOT", $i); | 2803 | $reboot = set_test_option("REBOOT", $i); |
| 2131 | $noclean = set_test_option("BUILD_NOCLEAN", $i); | 2804 | $noclean = set_test_option("BUILD_NOCLEAN", $i); |
| 2132 | $minconfig = set_test_option("MIN_CONFIG", $i); | 2805 | $minconfig = set_test_option("MIN_CONFIG", $i); |
| 2806 | $output_minconfig = set_test_option("OUTPUT_MIN_CONFIG", $i); | ||
| 2807 | $start_minconfig = set_test_option("START_MIN_CONFIG", $i); | ||
| 2808 | $ignore_config = set_test_option("IGNORE_CONFIG", $i); | ||
| 2133 | $run_test = set_test_option("TEST", $i); | 2809 | $run_test = set_test_option("TEST", $i); |
| 2134 | $addconfig = set_test_option("ADD_CONFIG", $i); | 2810 | $addconfig = set_test_option("ADD_CONFIG", $i); |
| 2135 | $reboot_type = set_test_option("REBOOT_TYPE", $i); | 2811 | $reboot_type = set_test_option("REBOOT_TYPE", $i); |
| @@ -2145,12 +2821,16 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2145 | $sleep_time = set_test_option("SLEEP_TIME", $i); | 2821 | $sleep_time = set_test_option("SLEEP_TIME", $i); |
| 2146 | $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i); | 2822 | $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i); |
| 2147 | $patchcheck_sleep_time = set_test_option("PATCHCHECK_SLEEP_TIME", $i); | 2823 | $patchcheck_sleep_time = set_test_option("PATCHCHECK_SLEEP_TIME", $i); |
| 2824 | $ignore_warnings = set_test_option("IGNORE_WARNINGS", $i); | ||
| 2148 | $bisect_manual = set_test_option("BISECT_MANUAL", $i); | 2825 | $bisect_manual = set_test_option("BISECT_MANUAL", $i); |
| 2149 | $bisect_skip = set_test_option("BISECT_SKIP", $i); | 2826 | $bisect_skip = set_test_option("BISECT_SKIP", $i); |
| 2827 | $config_bisect_good = set_test_option("CONFIG_BISECT_GOOD", $i); | ||
| 2150 | $store_failures = set_test_option("STORE_FAILURES", $i); | 2828 | $store_failures = set_test_option("STORE_FAILURES", $i); |
| 2829 | $test_name = set_test_option("TEST_NAME", $i); | ||
| 2151 | $timeout = set_test_option("TIMEOUT", $i); | 2830 | $timeout = set_test_option("TIMEOUT", $i); |
| 2152 | $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i); | 2831 | $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i); |
| 2153 | $console = set_test_option("CONSOLE", $i); | 2832 | $console = set_test_option("CONSOLE", $i); |
| 2833 | $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i); | ||
| 2154 | $success_line = set_test_option("SUCCESS_LINE", $i); | 2834 | $success_line = set_test_option("SUCCESS_LINE", $i); |
| 2155 | $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); | 2835 | $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); |
| 2156 | $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); | 2836 | $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); |
| @@ -2161,6 +2841,13 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2161 | $target_image = set_test_option("TARGET_IMAGE", $i); | 2841 | $target_image = set_test_option("TARGET_IMAGE", $i); |
| 2162 | $localversion = set_test_option("LOCALVERSION", $i); | 2842 | $localversion = set_test_option("LOCALVERSION", $i); |
| 2163 | 2843 | ||
| 2844 | $start_minconfig_defined = 1; | ||
| 2845 | |||
| 2846 | if (!defined($start_minconfig)) { | ||
| 2847 | $start_minconfig_defined = 0; | ||
| 2848 | $start_minconfig = $minconfig; | ||
| 2849 | } | ||
| 2850 | |||
| 2164 | chdir $builddir || die "can't change directory to $builddir"; | 2851 | chdir $builddir || die "can't change directory to $builddir"; |
| 2165 | 2852 | ||
| 2166 | if (!-d $tmpdir) { | 2853 | if (!-d $tmpdir) { |
| @@ -2193,6 +2880,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2193 | $run_type = $opt{"CONFIG_BISECT_TYPE[$i]"}; | 2880 | $run_type = $opt{"CONFIG_BISECT_TYPE[$i]"}; |
| 2194 | } | 2881 | } |
| 2195 | 2882 | ||
| 2883 | if ($test_type eq "make_min_config") { | ||
| 2884 | $run_type = ""; | ||
| 2885 | } | ||
| 2886 | |||
| 2196 | # mistake in config file? | 2887 | # mistake in config file? |
| 2197 | if (!defined($run_type)) { | 2888 | if (!defined($run_type)) { |
| 2198 | $run_type = "ERROR"; | 2889 | $run_type = "ERROR"; |
| @@ -2204,11 +2895,12 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2204 | unlink $dmesg; | 2895 | unlink $dmesg; |
| 2205 | unlink $buildlog; | 2896 | unlink $buildlog; |
| 2206 | 2897 | ||
| 2207 | if (!defined($minconfig)) { | 2898 | if (defined($addconfig)) { |
| 2208 | $minconfig = $addconfig; | 2899 | my $min = $minconfig; |
| 2209 | 2900 | if (!defined($minconfig)) { | |
| 2210 | } elsif (defined($addconfig)) { | 2901 | $min = ""; |
| 2211 | run_command "cat $addconfig $minconfig > $tmpdir/add_config" or | 2902 | } |
| 2903 | run_command "cat $addconfig $min > $tmpdir/add_config" or | ||
| 2212 | dodie "Failed to create temp config"; | 2904 | dodie "Failed to create temp config"; |
| 2213 | $minconfig = "$tmpdir/add_config"; | 2905 | $minconfig = "$tmpdir/add_config"; |
| 2214 | } | 2906 | } |
| @@ -2228,6 +2920,9 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2228 | } elsif ($test_type eq "patchcheck") { | 2920 | } elsif ($test_type eq "patchcheck") { |
| 2229 | patchcheck $i; | 2921 | patchcheck $i; |
| 2230 | next; | 2922 | next; |
| 2923 | } elsif ($test_type eq "make_min_config") { | ||
| 2924 | make_min_config $i; | ||
| 2925 | next; | ||
| 2231 | } | 2926 | } |
| 2232 | 2927 | ||
| 2233 | if ($build_type ne "nobuild") { | 2928 | if ($build_type ne "nobuild") { |
| @@ -2235,13 +2930,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 2235 | } | 2930 | } |
| 2236 | 2931 | ||
| 2237 | if ($test_type ne "build") { | 2932 | if ($test_type ne "build") { |
| 2238 | get_grub_index; | ||
| 2239 | get_version; | ||
| 2240 | install; | ||
| 2241 | |||
| 2242 | my $failed = 0; | 2933 | my $failed = 0; |
| 2243 | start_monitor; | 2934 | start_monitor_and_boot or $failed = 1; |
| 2244 | monitor or $failed = 1;; | ||
| 2245 | 2935 | ||
| 2246 | if (!$failed && $test_type ne "boot" && defined($run_test)) { | 2936 | if (!$failed && $test_type ne "boot" && defined($run_test)) { |
| 2247 | do_run_test or $failed = 1; | 2937 | do_run_test or $failed = 1; |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 48cbcc80602a..b8bcd14b5a4d 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
| @@ -293,6 +293,38 @@ | |||
| 293 | # or on some systems: | 293 | # or on some systems: |
| 294 | #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION | 294 | #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION |
| 295 | 295 | ||
| 296 | # If there is a script that you require to run before the build is done | ||
| 297 | # you can specify it with PRE_BUILD. | ||
| 298 | # | ||
| 299 | # One example may be if you must add a temporary patch to the build to | ||
| 300 | # fix a unrelated bug to perform a patchcheck test. This will apply the | ||
| 301 | # patch before each build that is made. Use the POST_BUILD to do a git reset --hard | ||
| 302 | # to remove the patch. | ||
| 303 | # | ||
| 304 | # (default undef) | ||
| 305 | #PRE_BUILD = cd ${BUILD_DIR} && patch -p1 < /tmp/temp.patch | ||
| 306 | |||
| 307 | # To specify if the test should fail if the PRE_BUILD fails, | ||
| 308 | # PRE_BUILD_DIE needs to be set to 1. Otherwise the PRE_BUILD | ||
| 309 | # result is ignored. | ||
| 310 | # (default 0) | ||
| 311 | # PRE_BUILD_DIE = 1 | ||
| 312 | |||
| 313 | # If there is a script that should run after the build is done | ||
| 314 | # you can specify it with POST_BUILD. | ||
| 315 | # | ||
| 316 | # As the example in PRE_BUILD, POST_BUILD can be used to reset modifications | ||
| 317 | # made by the PRE_BUILD. | ||
| 318 | # | ||
| 319 | # (default undef) | ||
| 320 | #POST_BUILD = cd ${BUILD_DIR} && git reset --hard | ||
| 321 | |||
| 322 | # To specify if the test should fail if the POST_BUILD fails, | ||
| 323 | # POST_BUILD_DIE needs to be set to 1. Otherwise the POST_BUILD | ||
| 324 | # result is ignored. | ||
| 325 | # (default 0) | ||
| 326 | #POST_BUILD_DIE = 1 | ||
| 327 | |||
| 296 | # Way to reboot the box to the test kernel. | 328 | # Way to reboot the box to the test kernel. |
| 297 | # Only valid options so far are "grub" and "script" | 329 | # Only valid options so far are "grub" and "script" |
| 298 | # (default grub) | 330 | # (default grub) |
| @@ -360,8 +392,8 @@ | |||
| 360 | #ADD_CONFIG = /home/test/config-broken | 392 | #ADD_CONFIG = /home/test/config-broken |
| 361 | 393 | ||
| 362 | # The location on the host where to write temp files | 394 | # The location on the host where to write temp files |
| 363 | # (default /tmp/ktest) | 395 | # (default /tmp/ktest/${MACHINE}) |
| 364 | #TMP_DIR = /tmp/ktest | 396 | #TMP_DIR = /tmp/ktest/${MACHINE} |
| 365 | 397 | ||
| 366 | # Optional log file to write the status (recommended) | 398 | # Optional log file to write the status (recommended) |
| 367 | # Note, this is a DEFAULT section only option. | 399 | # Note, this is a DEFAULT section only option. |
| @@ -518,6 +550,16 @@ | |||
| 518 | # The variables SSH_USER and MACHINE are defined. | 550 | # The variables SSH_USER and MACHINE are defined. |
| 519 | #REBOOT = ssh $SSH_USER@$MACHINE reboot | 551 | #REBOOT = ssh $SSH_USER@$MACHINE reboot |
| 520 | 552 | ||
| 553 | # The way triple faults are detected is by testing the kernel | ||
| 554 | # banner. If the kernel banner for the kernel we are testing is | ||
| 555 | # found, and then later a kernel banner for another kernel version | ||
| 556 | # is found, it is considered that we encountered a triple fault, | ||
| 557 | # and there is no panic or callback, but simply a reboot. | ||
| 558 | # To disable this (because it did a false positive) set the following | ||
| 559 | # to 0. | ||
| 560 | # (default 1) | ||
| 561 | #DETECT_TRIPLE_FAULT = 0 | ||
| 562 | |||
| 521 | #### Per test run options #### | 563 | #### Per test run options #### |
| 522 | # The following options are only allowed in TEST_START sections. | 564 | # The following options are only allowed in TEST_START sections. |
| 523 | # They are ignored in the DEFAULTS sections. | 565 | # They are ignored in the DEFAULTS sections. |
| @@ -535,6 +577,12 @@ | |||
| 535 | # all preceding tests until a new CHECKOUT is set. | 577 | # all preceding tests until a new CHECKOUT is set. |
| 536 | # | 578 | # |
| 537 | # | 579 | # |
| 580 | # TEST_NAME = name | ||
| 581 | # | ||
| 582 | # If you want the test to have a name that is displayed in | ||
| 583 | # the test result banner at the end of the test, then use this | ||
| 584 | # option. This is useful to search for the RESULT keyword and | ||
| 585 | # not have to translate a test number to a test in the config. | ||
| 538 | # | 586 | # |
| 539 | # For TEST_TYPE = patchcheck | 587 | # For TEST_TYPE = patchcheck |
| 540 | # | 588 | # |
| @@ -556,7 +604,12 @@ | |||
| 556 | # build, boot, test. | 604 | # build, boot, test. |
| 557 | # | 605 | # |
| 558 | # Note, the build test will look for warnings, if a warning occurred | 606 | # Note, the build test will look for warnings, if a warning occurred |
| 559 | # in a file that a commit touches, the build will fail. | 607 | # in a file that a commit touches, the build will fail, unless |
| 608 | # IGNORE_WARNINGS is set for the given commit's sha1 | ||
| 609 | # | ||
| 610 | # IGNORE_WARNINGS can be used to disable the failure of patchcheck | ||
| 611 | # on a particuler commit (SHA1). You can add more than one commit | ||
| 612 | # by adding a list of SHA1s that are space delimited. | ||
| 560 | # | 613 | # |
| 561 | # If BUILD_NOCLEAN is set, then make mrproper will not be run on | 614 | # If BUILD_NOCLEAN is set, then make mrproper will not be run on |
| 562 | # any of the builds, just like all other TEST_TYPE tests. But | 615 | # any of the builds, just like all other TEST_TYPE tests. But |
| @@ -571,6 +624,7 @@ | |||
| 571 | # PATCHCHECK_TYPE = boot | 624 | # PATCHCHECK_TYPE = boot |
| 572 | # PATCHCHECK_START = 747e94ae3d1b4c9bf5380e569f614eb9040b79e7 | 625 | # PATCHCHECK_START = 747e94ae3d1b4c9bf5380e569f614eb9040b79e7 |
| 573 | # PATCHCHECK_END = HEAD~2 | 626 | # PATCHCHECK_END = HEAD~2 |
| 627 | # IGNORE_WARNINGS = 42f9c6b69b54946ffc0515f57d01dc7f5c0e4712 0c17ca2c7187f431d8ffc79e81addc730f33d128 | ||
| 574 | # | 628 | # |
| 575 | # | 629 | # |
| 576 | # | 630 | # |
| @@ -739,13 +793,18 @@ | |||
| 739 | # boot - bad builds but fails to boot | 793 | # boot - bad builds but fails to boot |
| 740 | # test - bad boots but fails a test | 794 | # test - bad boots but fails a test |
| 741 | # | 795 | # |
| 742 | # CONFIG_BISECT is the config that failed to boot | 796 | # CONFIG_BISECT is the config that failed to boot |
| 743 | # | 797 | # |
| 744 | # If BISECT_MANUAL is set, it will pause between iterations. | 798 | # If BISECT_MANUAL is set, it will pause between iterations. |
| 745 | # This is useful to use just ktest.pl just for the config bisect. | 799 | # This is useful to use just ktest.pl just for the config bisect. |
| 746 | # If you set it to build, it will run the bisect and you can | 800 | # If you set it to build, it will run the bisect and you can |
| 747 | # control what happens in between iterations. It will ask you if | 801 | # control what happens in between iterations. It will ask you if |
| 748 | # the test succeeded or not and continue the config bisect. | 802 | # the test succeeded or not and continue the config bisect. |
| 803 | # | ||
| 804 | # CONFIG_BISECT_GOOD (optional) | ||
| 805 | # If you have a good config to start with, then you | ||
| 806 | # can specify it with CONFIG_BISECT_GOOD. Otherwise | ||
| 807 | # the MIN_CONFIG is the base. | ||
| 749 | # | 808 | # |
| 750 | # Example: | 809 | # Example: |
| 751 | # TEST_START | 810 | # TEST_START |
| @@ -755,3 +814,68 @@ | |||
| 755 | # MIN_CONFIG = /home/test/config-min | 814 | # MIN_CONFIG = /home/test/config-min |
| 756 | # BISECT_MANUAL = 1 | 815 | # BISECT_MANUAL = 1 |
| 757 | # | 816 | # |
| 817 | # | ||
| 818 | # | ||
| 819 | # For TEST_TYPE = make_min_config | ||
| 820 | # | ||
| 821 | # After doing a make localyesconfig, your kernel configuration may | ||
| 822 | # not be the most useful minimum configuration. Having a true minimum | ||
| 823 | # config that you can use against other configs is very useful if | ||
| 824 | # someone else has a config that breaks on your code. By only forcing | ||
| 825 | # those configurations that are truly required to boot your machine | ||
| 826 | # will give you less of a chance that one of your set configurations | ||
| 827 | # will make the bug go away. This will give you a better chance to | ||
| 828 | # be able to reproduce the reported bug matching the broken config. | ||
| 829 | # | ||
| 830 | # Note, this does take some time, and may require you to run the | ||
| 831 | # test over night, or perhaps over the weekend. But it also allows | ||
| 832 | # you to interrupt it, and gives you the current minimum config | ||
| 833 | # that was found till that time. | ||
| 834 | # | ||
| 835 | # Note, this test automatically assumes a BUILD_TYPE of oldconfig | ||
| 836 | # and its test type acts like boot. | ||
| 837 | # TODO: add a test version that makes the config do more than just | ||
| 838 | # boot, like having network access. | ||
| 839 | # | ||
| 840 | # To save time, the test does not just grab any option and test | ||
| 841 | # it. The Kconfig files are examined to determine the dependencies | ||
| 842 | # of the configs. If a config is chosen that depends on another | ||
| 843 | # config, that config will be checked first. By checking the | ||
| 844 | # parents first, we can eliminate whole groups of configs that | ||
| 845 | # may have been enabled. | ||
| 846 | # | ||
| 847 | # For example, if a USB device config is chosen and depends on CONFIG_USB, | ||
| 848 | # the CONFIG_USB will be tested before the device. If CONFIG_USB is | ||
| 849 | # found not to be needed, it, as well as all configs that depend on | ||
| 850 | # it, will be disabled and removed from the current min_config. | ||
| 851 | # | ||
| 852 | # OUTPUT_MIN_CONFIG is the path and filename of the file that will | ||
| 853 | # be created from the MIN_CONFIG. If you interrupt the test, set | ||
| 854 | # this file as your new min config, and use it to continue the test. | ||
| 855 | # This file does not need to exist on start of test. | ||
| 856 | # This file is not created until a config is found that can be removed. | ||
| 857 | # If this file exists, you will be prompted if you want to use it | ||
| 858 | # as the min_config (overriding MIN_CONFIG) if START_MIN_CONFIG | ||
| 859 | # is not defined. | ||
| 860 | # (required field) | ||
| 861 | # | ||
| 862 | # START_MIN_CONFIG is the config to use to start the test with. | ||
| 863 | # you can set this as the same OUTPUT_MIN_CONFIG, but if you do | ||
| 864 | # the OUTPUT_MIN_CONFIG file must exist. | ||
| 865 | # (default MIN_CONFIG) | ||
| 866 | # | ||
| 867 | # IGNORE_CONFIG is used to specify a config file that has configs that | ||
| 868 | # you already know must be set. Configs are written here that have | ||
| 869 | # been tested and proved to be required. It is best to define this | ||
| 870 | # file if you intend on interrupting the test and running it where | ||
| 871 | # it left off. New configs that it finds will be written to this file | ||
| 872 | # and will not be tested again in later runs. | ||
| 873 | # (optional) | ||
| 874 | # | ||
| 875 | # Example: | ||
| 876 | # | ||
| 877 | # TEST_TYPE = make_min_config | ||
| 878 | # OUTPUT_MIN_CONFIG = /path/to/config-new-min | ||
| 879 | # START_MIN_CONFIG = /path/to/config-min | ||
| 880 | # IGNORE_CONFIG = /path/to/config-tested | ||
| 881 | # | ||
