aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest/ktest.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-xtools/testing/ktest/ktest.pl190
1 files changed, 172 insertions, 18 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 35fc584a4ffe..4e67d52eb3a2 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -126,6 +126,7 @@ my $start_minconfig_defined;
126my $output_minconfig; 126my $output_minconfig;
127my $minconfig_type; 127my $minconfig_type;
128my $use_output_minconfig; 128my $use_output_minconfig;
129my $warnings_file;
129my $ignore_config; 130my $ignore_config;
130my $ignore_errors; 131my $ignore_errors;
131my $addconfig; 132my $addconfig;
@@ -193,6 +194,9 @@ my $patchcheck_end;
193# which would require more options. 194# which would require more options.
194my $buildonly = 1; 195my $buildonly = 1;
195 196
197# tell build not to worry about warnings, even when WARNINGS_FILE is set
198my $warnings_ok = 0;
199
196# set when creating a new config 200# set when creating a new config
197my $newconfig = 0; 201my $newconfig = 0;
198 202
@@ -235,6 +239,7 @@ my %option_map = (
235 "START_MIN_CONFIG" => \$start_minconfig, 239 "START_MIN_CONFIG" => \$start_minconfig,
236 "MIN_CONFIG_TYPE" => \$minconfig_type, 240 "MIN_CONFIG_TYPE" => \$minconfig_type,
237 "USE_OUTPUT_MIN_CONFIG" => \$use_output_minconfig, 241 "USE_OUTPUT_MIN_CONFIG" => \$use_output_minconfig,
242 "WARNINGS_FILE" => \$warnings_file,
238 "IGNORE_CONFIG" => \$ignore_config, 243 "IGNORE_CONFIG" => \$ignore_config,
239 "TEST" => \$run_test, 244 "TEST" => \$run_test,
240 "ADD_CONFIG" => \$addconfig, 245 "ADD_CONFIG" => \$addconfig,
@@ -619,6 +624,18 @@ sub set_value {
619 # Note if a test is something other than build, then we 624 # Note if a test is something other than build, then we
620 # will need other manditory options. 625 # will need other manditory options.
621 if ($prvalue ne "install") { 626 if ($prvalue ne "install") {
627 # for bisect, we need to check BISECT_TYPE
628 if ($prvalue ne "bisect") {
629 $buildonly = 0;
630 }
631 } else {
632 # install still limits some manditory options.
633 $buildonly = 2;
634 }
635 }
636
637 if ($buildonly && $lvalue =~ /^BISECT_TYPE(\[.*\])?$/ && $prvalue ne "build") {
638 if ($prvalue ne "install") {
622 $buildonly = 0; 639 $buildonly = 0;
623 } else { 640 } else {
624 # install still limits some manditory options. 641 # install still limits some manditory options.
@@ -1062,7 +1079,7 @@ sub read_config {
1062} 1079}
1063 1080
1064sub __eval_option { 1081sub __eval_option {
1065 my ($option, $i) = @_; 1082 my ($name, $option, $i) = @_;
1066 1083
1067 # Add space to evaluate the character before $ 1084 # Add space to evaluate the character before $
1068 $option = " $option"; 1085 $option = " $option";
@@ -1094,7 +1111,11 @@ sub __eval_option {
1094 my $o = "$var\[$i\]"; 1111 my $o = "$var\[$i\]";
1095 my $parento = "$var\[$parent\]"; 1112 my $parento = "$var\[$parent\]";
1096 1113
1097 if (defined($opt{$o})) { 1114 # If a variable contains itself, use the default var
1115 if (($var eq $name) && defined($opt{$var})) {
1116 $o = $opt{$var};
1117 $retval = "$retval$o";
1118 } elsif (defined($opt{$o})) {
1098 $o = $opt{$o}; 1119 $o = $opt{$o};
1099 $retval = "$retval$o"; 1120 $retval = "$retval$o";
1100 } elsif ($repeated && defined($opt{$parento})) { 1121 } elsif ($repeated && defined($opt{$parento})) {
@@ -1118,7 +1139,7 @@ sub __eval_option {
1118} 1139}
1119 1140
1120sub eval_option { 1141sub eval_option {
1121 my ($option, $i) = @_; 1142 my ($name, $option, $i) = @_;
1122 1143
1123 my $prev = ""; 1144 my $prev = "";
1124 1145
@@ -1134,7 +1155,7 @@ sub eval_option {
1134 "Check for recursive variables\n"; 1155 "Check for recursive variables\n";
1135 } 1156 }
1136 $prev = $option; 1157 $prev = $option;
1137 $option = __eval_option($option, $i); 1158 $option = __eval_option($name, $option, $i);
1138 } 1159 }
1139 1160
1140 return $option; 1161 return $option;
@@ -1191,11 +1212,24 @@ sub reboot {
1191 } 1212 }
1192 1213
1193 if (defined($time)) { 1214 if (defined($time)) {
1194 if (wait_for_monitor($time, $reboot_success_line)) { 1215
1216 # We only want to get to the new kernel, don't fail
1217 # if we stumble over a call trace.
1218 my $save_ignore_errors = $ignore_errors;
1219 $ignore_errors = 1;
1220
1221 # Look for the good kernel to boot
1222 if (wait_for_monitor($time, "Linux version")) {
1195 # reboot got stuck? 1223 # reboot got stuck?
1196 doprint "Reboot did not finish. Forcing power cycle\n"; 1224 doprint "Reboot did not finish. Forcing power cycle\n";
1197 run_command "$power_cycle"; 1225 run_command "$power_cycle";
1198 } 1226 }
1227
1228 $ignore_errors = $save_ignore_errors;
1229
1230 # Still need to wait for the reboot to finish
1231 wait_for_monitor($time, $reboot_success_line);
1232
1199 end_monitor; 1233 end_monitor;
1200 } 1234 }
1201} 1235}
@@ -1279,6 +1313,7 @@ sub start_monitor {
1279} 1313}
1280 1314
1281sub end_monitor { 1315sub end_monitor {
1316 return if (!defined $console);
1282 if (--$monitor_cnt) { 1317 if (--$monitor_cnt) {
1283 return; 1318 return;
1284 } 1319 }
@@ -1585,7 +1620,7 @@ sub wait_for_input
1585 1620
1586 $rin = ''; 1621 $rin = '';
1587 vec($rin, fileno($fp), 1) = 1; 1622 vec($rin, fileno($fp), 1) = 1;
1588 $ready = select($rin, undef, undef, $time); 1623 ($ready, $time) = select($rin, undef, undef, $time);
1589 1624
1590 $line = ""; 1625 $line = "";
1591 1626
@@ -1891,23 +1926,102 @@ sub get_version {
1891 1926
1892sub start_monitor_and_boot { 1927sub start_monitor_and_boot {
1893 # Make sure the stable kernel has finished booting 1928 # Make sure the stable kernel has finished booting
1894 start_monitor; 1929
1895 wait_for_monitor 5; 1930 # Install bisects, don't need console
1896 end_monitor; 1931 if (defined $console) {
1932 start_monitor;
1933 wait_for_monitor 5;
1934 end_monitor;
1935 }
1897 1936
1898 get_grub_index; 1937 get_grub_index;
1899 get_version; 1938 get_version;
1900 install; 1939 install;
1901 1940
1902 start_monitor; 1941 start_monitor if (defined $console);
1903 return monitor; 1942 return monitor;
1904} 1943}
1905 1944
1945my $check_build_re = ".*:.*(warning|error|Error):.*";
1946my $utf8_quote = "\\x{e2}\\x{80}(\\x{98}|\\x{99})";
1947
1948sub process_warning_line {
1949 my ($line) = @_;
1950
1951 chomp $line;
1952
1953 # for distcc heterogeneous systems, some compilers
1954 # do things differently causing warning lines
1955 # to be slightly different. This makes an attempt
1956 # to fixe those issues.
1957
1958 # chop off the index into the line
1959 # using distcc, some compilers give different indexes
1960 # depending on white space