3 # Copywrite 2010 - Steven Rostedt <srostedt@redhat.com>, Red Hat Inc.
4 # Licensed under the terms of the GNU GPL License version 2
9 use Fcntl
qw(F_GETFL F_SETFL O_NONBLOCK);
10 use File
::Path
qw(mkpath);
11 use File
::Copy
qw(cp);
14 $#ARGV >= 0 || die "usage: ktest.pl config-file\n";
24 $default{"NUM_TESTS"} = 1;
25 $default{"REBOOT_TYPE"} = "grub";
26 $default{"TEST_TYPE"} = "test";
27 $default{"BUILD_TYPE"} = "randconfig";
28 $default{"MAKE_CMD"} = "make";
29 $default{"TIMEOUT"} = 120;
30 $default{"TMP_DIR"} = "/tmp/ktest";
31 $default{"SLEEP_TIME"} = 60; # sleep time between tests
32 $default{"BUILD_NOCLEAN"} = 0;
33 $default{"REBOOT_ON_ERROR"} = 0;
34 $default{"POWEROFF_ON_ERROR"} = 0;
35 $default{"REBOOT_ON_SUCCESS"} = 1;
36 $default{"POWEROFF_ON_SUCCESS"} = 0;
37 $default{"BUILD_OPTIONS"} = "";
38 $default{"BISECT_SLEEP_TIME"} = 60; # sleep time between bisects
39 $default{"CLEAR_LOG"} = 0;
40 $default{"SUCCESS_LINE"} = "login:";
41 $default{"BOOTED_TIMEOUT"} = 1;
42 $default{"DIE_ON_FAILURE"} = 1;
56 my $poweroff_on_error;
58 my $powercycle_after_reboot;
59 my $poweroff_after_halt;
72 my $in_patchcheck = 0;
81 my $bisect_sleep_time;
93 my ($lvalue, $rvalue) = @_;
95 if (defined($opt{$lvalue})) {
96 die "Error: Option $lvalue defined more than once!\n";
98 $opt{$lvalue} = $rvalue;
104 open(IN
, $config) || die "can't read file $config";
107 $name =~ s
,.*/(.*),$1,;
112 my $num_tests_set = 0;
118 # ignore blank lines and comments
119 next if (/^\s*$/ || /\s*\#/);
121 if (/^\s*TEST_START(.*)/) {
125 if ($num_tests_set) {
126 die "$name: $.: Can not specify both NUM_TESTS and TEST_START\n";
129 my $old_test_num = $test_num;
131 $test_num += $repeat;
135 if ($rest =~ /\s+SKIP(.*)/) {
142 if ($rest =~ /\s+ITERATE\s+(\d+)(.*)$/) {
145 $repeat_tests{"$test_num"} = $repeat;
148 if ($rest =~ /\s+SKIP(.*)/) {
153 if ($rest !~ /^\s*$/) {
154 die "$name: $.: Gargbage found after TEST_START\n$_";
158 $test_num = $old_test_num;
162 } elsif (/^\s*DEFAULTS(.*)$/) {
167 if ($rest =~ /\s+SKIP(.*)/) {
174 if ($rest !~ /^\s*$/) {
175 die "$name: $.: Gargbage found after DEFAULTS\n$_";
178 } elsif (/^\s*([A-Z_\[\]\d]+)\s*=\s*(.*?)\s*$/) {
186 ($lvalue eq "NUM_TESTS" ||
187 $lvalue eq "LOG_FILE" ||
188 $lvalue eq "CLEAR_LOG")) {
189 die "$name: $.: $lvalue must be set in DEFAULTS section\n";
192 if ($lvalue eq "NUM_TESTS") {
194 die "$name: $.: Can not specify both NUM_TESTS and TEST_START\n";
197 die "$name: $.: NUM_TESTS must be set in default section\n";
202 if ($default || $lvalue =~ /\[\d+\]$/) {
203 set_value
($lvalue, $rvalue);
205 my $val = "$lvalue\[$test_num\]";
206 set_value
($val, $rvalue);
209 $repeats{$val} = $repeat;
213 die "$name: $.: Garbage found in config\n$_";
220 $test_num += $repeat - 1;
221 $opt{"NUM_TESTS"} = $test_num;
226 foreach my $default (keys %default) {
227 if (!defined($opt{$default})) {
228 $opt{$default} = $default{$default};
234 if (defined($opt{"LOG_FILE"})) {
235 open(OUT
, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
249 # try to reboot normally
250 if (run_command
"ssh $target reboot") {
251 if (defined($powercycle_after_reboot)) {
252 sleep $powercycle_after_reboot;
253 run_command
"$power_cycle";
256 # nope? power cycle it.
257 run_command
"$power_cycle";
264 return $test_type eq "build" ||
265 ($test_type eq "patchcheck" && $opt{"PATCHCHECK_TYPE[$i]"} eq "build") ||
266 ($test_type eq "bisect" && $opt{"BISECT_TYPE[$i]"} eq "build");
270 doprint
"CRITICAL FAILURE... ", @_, "\n";
274 if ($reboot_on_error && !do_not_reboot
) {
276 doprint
"REBOOTING\n";
279 } elsif ($poweroff_on_error && defined($power_off)) {
280 doprint
"POWERING OFF\n";
292 my $pid = open($fp, "$console|") or
293 dodie
"Can't open console $console";
295 $flags = fcntl($fp, F_GETFL
, 0) or
296 dodie
"Can't get flags for the socket: $!";
297 $flags = fcntl($fp, F_SETFL
, $flags | O_NONBLOCK
) or
298 dodie
"Can't set flags for the socket: $!";
306 doprint
"kill child process $pid\n";
314 if ($monitor_cnt++) {
317 $monitor_fp = \
*MONFD
;
318 $monitor_pid = open_console
$monitor_fp;
322 open(MONFD
, "Stop perl from warning about single use of MONFD");
326 if (--$monitor_cnt) {
329 close_console
($monitor_fp, $monitor_pid);
332 sub wait_for_monitor
{
336 doprint
"** Wait for monitor to settle down **\n";
338 # read the monitor and wait for the system to calm down
340 $line = wait_for_input
($monitor_fp, $time);
341 print "$line" if (defined($line));
342 } while (defined($line));
343 print "** Monitor flushed **\n";
348 if ($die_on_failure) {
356 # no need to reboot for just building.
357 if (!do_not_reboot
) {
358 doprint
"REBOOTING\n";
361 wait_for_monitor
$sleep_time;
365 doprint
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
366 doprint
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
367 doprint
"**** Failed: ", @_, " ****\n";
368 doprint
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
369 doprint
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
371 return 1 if (!defined($store_failures));
374 my $date = sprintf "%04d%02d%02d%02d%02d%02d",
375 1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0];
377 my $dir = "$machine-$test_type-$build_type-fail-$date";
378 my $faildir = "$store_failures/$dir";
382 die "can't create $faildir";
384 if (-f
"$outputdir/.config") {
385 cp
"$outputdir/.config", "$faildir/config" or
386 die "failed to copy .config";
389 cp
$buildlog, "$faildir/buildlog" or
390 die "failed to move $buildlog";
393 cp
$dmesg, "$faildir/dmesg" or
394 die "failed to move $dmesg";
397 doprint
"*** Saved info to $faildir ***\n";
408 doprint
("$command ... ");
410 $pid = open(CMD
, "$command 2>&1 |") or
411 (fail
"unable to exec $command" and return 0);
413 if (defined($opt{"LOG_FILE"})) {
414 open(LOG
, ">>$opt{LOG_FILE}") or
415 dodie
"failed to write to log";
419 if (defined($redirect)) {
420 open (RD
, ">$redirect") or
421 dodie
"failed to write to redirect $redirect";
426 print LOG
if ($dolog);
434 close(LOG
) if ($dolog);
435 close(RD
) if ($dord);
448 if ($reboot_type ne "grub") {
451 return if (defined($grub_number));
453 doprint
"Find grub menu ... ";
455 open(IN
, "ssh $target cat /boot/grub/menu.lst |")
456 or die "unable to get menu.lst";
458 if (/^\s*title\s+$grub_menu\s*$/) {
461 } elsif (/^\s*title\s/) {
467 die "Could not find '$grub_menu' in /boot/grub/menu on $machine"
468 if ($grub_number < 0);
469 doprint
"$grub_number\n";
474 my ($fp, $time) = @_;
480 if (!defined($time)) {
485 vec($rin, fileno($fp), 1) = 1;
486 $ready = select($rin, undef, undef, $time);
490 # try to read one char at a time
491 while (sysread $fp, $ch, 1) {
493 last if ($ch eq "\n");
496 if (!length($line)) {
504 if ($reboot_type eq "grub") {
505 run_command
"ssh $target '(echo \"savedefault --default=$grub_number --once\" | grub --batch; reboot)'";
509 run_command
"$reboot_script";
515 doprint
"git rev-list --max-count=1 $commit ... ";
516 my $sha1 = `git rev-list --max-count=1 $commit`;
523 dodie
"Failed to get git $commit";
536 my $skip_call_trace = 0;
544 open(DMESG
, "> $dmesg") or
545 die "unable to write to $dmesg";
552 $line = wait_for_input
($monitor_fp, $booted_timeout);
554 $line = wait_for_input
($monitor_fp);
557 last if (!defined($line));
562 # we are not guaranteed to get a full line
565 if ($full_line =~ /$success_line/) {
569 if ($full_line =~ /\[ backtrace testing \]/) {
570 $skip_call_trace = 1;
573 if ($full_line =~ /call trace:/i) {
574 $bug = 1 if (!$skip_call_trace);
577 if ($full_line =~ /\[ end of backtrace testing \]/) {
578 $skip_call_trace = 0;
581 if ($full_line =~ /Kernel panic -/) {
593 return 0 if ($in_bisect);
594 fail
"failed - got a bug report" and return 0;
598 return 0 if ($in_bisect);
599 fail
"failed - never got a boot prompt." and return 0;
607 run_command
"scp $outputdir/$build_target $target:$target_image" or
608 dodie
"failed to copy image";
610 my $install_mods = 0;
612 # should we process modules?
614 open(IN
, "$outputdir/.config") or dodie
("Can't read config file");
616 if (/CONFIG_MODULES(=y)?/) {
617 $install_mods = 1 if (defined($1));
623 if (!$install_mods) {
624 doprint
"No modules needed\n";
628 run_command
"$make INSTALL_MOD_PATH=$tmpdir modules_install" or
629 dodie
"Failed to install modules";
631 my $modlib = "/lib/modules/$version";
632 my $modtar = "ktest-mods.tar.bz2";
634 run_command
"ssh $target rm -rf $modlib" or
635 dodie
"failed to remove old mods: $modlib";
637 # would be nice if scp -r did not follow symbolic links
638 run_command
"cd $tmpdir && tar -cjf $modtar lib/modules/$version" or
639 dodie
"making tarball";
641 run_command
"scp $tmpdir/$modtar $target:/tmp" or
642 dodie
"failed to copy modules";
644 unlink "$tmpdir/$modtar";
646 run_command
"ssh $target '(cd / && tar xf /tmp/$modtar)'" or
647 dodie
"failed to tar modules";
649 run_command
"ssh $target rm -f /tmp/$modtar";
651 return if (!defined($post_install));
653 my $save_env = $ENV{KERNEL_VERSION
};
655 $ENV{KERNEL_VERSION
} = $version;
656 run_command
"$post_install" or
657 dodie
"Failed to run post install";
659 $ENV{KERNEL_VERSION
} = $save_env;
665 my @files = `git show $patch | diffstat -l`;
667 open(IN
, "git show $patch |") or
668 dodie
"failed to show $patch";
670 if (m
,^--- a
/(.*),) {
672 $files[$#files] = $1;
677 open(IN
, $buildlog) or dodie
"Can't open $buildlog";
679 if (/^\s*(.*?):.*(warning|error)/) {
681 foreach my $file (@files) {
682 my $fullpath = "$builddir/$file";
683 if ($file eq $err || $fullpath eq $err) {
684 fail
"$file built with warnings" and return 0;
701 if ($type =~ /^useconfig:(.*)/) {
702 run_command
"cp $1 $outputdir/.config" or
703 dodie
"could not copy $1 to .config";
708 # old config can ask questions
709 if ($type eq "oldconfig") {
712 # allow for empty configs
713 run_command
"touch $outputdir/.config";
715 run_command
"mv $outputdir/.config $outputdir/config_temp" or
716 dodie
"moving .config";
718 if (!$noclean && !run_command
"$make mrproper") {
719 dodie
"make mrproper";
722 run_command
"mv $outputdir/config_temp $outputdir/.config" or
723 dodie
"moving config_temp";
725 } elsif (!$noclean) {
726 unlink "$outputdir/.config";
727 run_command
"$make mrproper" or
728 dodie
"make mrproper";
731 # add something to distinguish this build
732 open(OUT
, "> $outputdir/localversion") or dodie
("Can't make localversion file");
733 print OUT
"$localversion\n";
736 if (defined($minconfig)) {
737 $defconfig = "KCONFIG_ALLCONFIG=$minconfig";
740 run_command
"$append $defconfig $make $type" or
741 dodie
"failed make config";
743 $redirect = "$buildlog";
744 if (!run_command
"$make $build_options") {
746 # bisect may need this to pass
747 return 0 if ($in_bisect);
748 fail
"failed build" and return 0;
756 if (!run_command
"ssh $target halt" or defined($power_off)) {
757 if (defined($poweroff_after_halt)) {
758 sleep $poweroff_after_halt;
759 run_command
"$power_off";
763 run_command
"$power_off";
770 doprint
"\n\n*******************************************\n";
771 doprint
"*******************************************\n";
772 doprint
"** TEST $i SUCCESS!!!! **\n";
773 doprint
"*******************************************\n";
774 doprint
"*******************************************\n";
776 if ($i != $opt{"NUM_TESTS"} && !do_not_reboot
) {
777 doprint
"Reboot and wait $sleep_time seconds\n";
780 wait_for_monitor
$sleep_time;
786 # get the release name
787 doprint
"$make kernelrelease ... ";
788 $version = `$make kernelrelease | tail -1`;
790 doprint
"$version\n";
796 # child should have no power
797 $reboot_on_error = 0;
798 $poweroff_on_error = 0;
801 run_command
$run_test or $failed = 1;
820 doprint
"run test $run_test\n";
824 $SIG{CHLD
} = qw(child_finished);
828 child_run_test
if (!$child_pid);
833 $line = wait_for_input
($monitor_fp, 1);
834 if (defined($line)) {
836 # we are not guaranteed to get a full line
839 if ($full_line =~ /call trace:/i) {
843 if ($full_line =~ /Kernel panic -/) {
851 } while (!$child_done && !$bug);
854 doprint
"Detected kernel crash!\n";
855 # kill the child with extreme prejudice
859 waitpid $child_pid, 0;
862 if ($bug || $child_exit) {
863 return 0 if $in_bisect;
864 fail
"test failed" and return 0;
872 doprint
"$command ... ";
874 my $output = `$command 2>&1`;
881 dodie
"Failed to git bisect";
885 if ($output =~ m/^(Bisecting: .*\(roughly \d+ steps?\))\s+\[([[:xdigit:]]+)\]/) {
887 } elsif ($output =~ m/^([[:xdigit:]]+) is the first bad commit/) {
889 doprint
"Found bad commit... $1\n";
892 # we already logged it, just print it now.
907 if (defined($minconfig)) {
908 build
"useconfig:$minconfig" or $failed = 1;
910 # ?? no config to use?
911 build
"oldconfig" or $failed = 1;
914 if ($type ne "build") {
915 dodie
"Failed on build" if $failed;
923 monitor
or $failed = 1;
925 if ($type ne "boot") {
926 dodie
"Failed on boot" if $failed;
928 do_run_test
or $failed = 1;
936 # reboot the box to a good kernel
937 if ($type ne "build") {
938 doprint
"Reboot and sleep $bisect_sleep_time seconds\n";
941 wait_for_monitor
$bisect_sleep_time;
948 # Are we looking for where it worked, not failed?
949 if ($reverse_bisect) {
965 die "BISECT_GOOD[$i] not defined\n" if (!defined($opt{"BISECT_GOOD[$i]"}));
966 die "BISECT_BAD[$i] not defined\n" if (!defined($opt{"BISECT_BAD[$i]"}));
967 die "BISECT_TYPE[$i] not defined\n" if (!defined($opt{"BISECT_TYPE[$i]"}));
969 my $good = $opt{"BISECT_GOOD[$i]"};
970 my $bad = $opt{"BISECT_BAD[$i]"};
971 my $type = $opt{"BISECT_TYPE[$i]"};
972 my $start = $opt{"BISECT_START[$i]"};
973 my $replay = $opt{"BISECT_REPLAY[$i]"};
975 # convert to true sha1's
976 $good = get_sha1
($good);
977 $bad = get_sha1
($bad);
979 if (defined($opt{"BISECT_REVERSE[$i]"}) &&
980 $opt{"BISECT_REVERSE[$i]"} == 1) {
981 doprint
"Performing a reverse bisect (bad is good, good is bad!)\n";
989 # Can't have a test without having a test to run
990 if ($type eq "test" && !defined($run_test)) {
994 my $check = $opt{"BISECT_CHECK[$i]"};
995 if (defined($check) && $check ne "0") {
998 my $head = get_sha1
("HEAD");
1000 if ($check ne "good") {
1001 doprint
"TESTING BISECT BAD [$bad]\n";
1002 run_command
"git checkout $bad" or
1003 die "Failed to checkout $bad";
1005 $result = run_bisect
$type;
1007 if ($result ne "bad") {
1008 fail
"Tested BISECT_BAD [$bad] and it succeeded" and return 0;
1012 if ($check ne "bad") {
1013 doprint
"TESTING BISECT GOOD [$good]\n";
1014 run_command
"git checkout $good" or
1015 die "Failed to checkout $good";
1017 $result = run_bisect
$type;
1019 if ($result ne "good") {
1020 fail
"Tested BISECT_GOOD [$good] and it failed" and return 0;
1024 # checkout where we started
1025 run_command
"git checkout $head" or
1026 die "Failed to checkout $head";
1029 run_command
"git bisect start" or
1030 dodie
"could not start bisect";
1032 run_command
"git bisect good $good" or
1033 dodie
"could not set bisect good to $good";
1035 run_git_bisect
"git bisect bad $bad" or
1036 dodie
"could not set bisect bad to $bad";
1038 if (defined($replay)) {
1039 run_command
"git bisect replay $replay" or
1040 dodie
"failed to run replay";
1043 if (defined($start)) {
1044 run_command
"git checkout $start" or
1045 dodie
"failed to checkout $start";
1050 $result = run_bisect
$type;
1051 $test = run_git_bisect
"git bisect $result";
1054 run_command
"git bisect log" or
1055 dodie
"could not capture git bisect log";
1057 run_command
"git bisect reset" or
1058 dodie
"could not reset git bisect";
1060 doprint
"Bad commit was [$bisect_bad]\n";
1070 die "PATCHCHECK_START[$i] not defined\n"
1071 if (!defined($opt{"PATCHCHECK_START[$i]"}));
1072 die "PATCHCHECK_TYPE[$i] not defined\n"
1073 if (!defined($opt{"PATCHCHECK_TYPE[$i]"}));
1075 my $start = $opt{"PATCHCHECK_START[$i]"};
1078 if (defined($opt{"PATCHCHECK_END[$i]"})) {
1079 $end = $opt{"PATCHCHECK_END[$i]"};
1082 # Get the true sha1's since we can use things like HEAD~3
1083 $start = get_sha1
($start);
1084 $end = get_sha1
($end);
1086 my $type = $opt{"PATCHCHECK_TYPE[$i]"};
1088 # Can't have a test without having a test to run
1089 if ($type eq "test" && !defined($run_test)) {
1093 open (IN
, "git log --pretty=oneline $end|") or
1094 dodie
"could not get git list";
1100 $list[$#list+1] = $_;
1101 last if (/^$start/);
1105 if ($list[$#list] !~ /^$start/) {
1106 fail
"SHA1 $start not found";
1109 # go backwards in the list
1110 @list = reverse @list;
1112 my $save_clean = $noclean;
1115 foreach my $item (@list) {
1117 $sha1 =~ s/^([[:xdigit:]]+).*/$1/;
1119 doprint
"\nProcessing commit $item\n\n";
1121 run_command
"git checkout $sha1" or
1122 die "Failed to checkout $sha1";
1124 # only clean on the first and last patch
1125 if ($item eq $list[0] ||
1126 $item eq $list[$#list]) {
1127 $noclean = $save_clean;
1132 if (defined($minconfig)) {
1133 build
"useconfig:$minconfig" or return 0;
1135 # ?? no config to use?
1136 build
"oldconfig" or return 0;
1139 check_buildlog
$sha1 or return 0;
1141 next if ($type eq "build");
1150 monitor
or $failed = 1;
1152 if (!$failed && $type ne "boot"){
1153 do_run_test
or $failed = 1;
1156 return 0 if ($failed);
1165 read_config
$ARGV[0];
1168 die "MACHINE not defined\n" if (!defined($opt{"MACHINE"}));
1169 die "SSH_USER not defined\n" if (!defined($opt{"SSH_USER"}));
1170 die "BUILD_DIR not defined\n" if (!defined($opt{"BUILD_DIR"}));
1171 die "OUTPUT_DIR not defined\n" if (!defined($opt{"OUTPUT_DIR"}));
1172 die "BUILD_TARGET not defined\n" if (!defined($opt{"BUILD_TARGET"}));
1173 die "TARGET_IMAGE not defined\n" if (!defined($opt{"TARGET_IMAGE"}));
1174 die "POWER_CYCLE not defined\n" if (!defined($opt{"POWER_CYCLE"}));
1175 die "CONSOLE not defined\n" if (!defined($opt{"CONSOLE"}));
1176 die "LOCALVERSION not defined\n" if (!defined($opt{"LOCALVERSION"}));
1178 if ($opt{"CLEAR_LOG"} && defined($opt{"LOG_FILE"})) {
1179 unlink $opt{"LOG_FILE"};
1182 doprint
"\n\nSTARTING AUTOMATED TESTS\n\n";
1184 for (my $i = 0, my $repeat = 1; $i <= $opt{"NUM_TESTS"}; $i += $repeat) {
1187 doprint
"DEFAULT OPTIONS:\n";
1189 doprint
"\nTEST $i OPTIONS";
1190 if (defined($repeat_tests{$i})) {
1191 $repeat = $repeat_tests{$i};
1192 doprint
" ITERATE $repeat";
1197 foreach my $option (sort keys %opt) {
1199 if ($option =~ /\[(\d+)\]$/) {
1205 doprint
"$option = $opt{$option}\n";
1209 sub set_test_option
{
1210 my ($name, $i) = @_;
1212 my $option = "$name\[$i\]";
1214 if (defined($opt{$option})) {
1215 return $opt{$option};
1218 foreach my $test (keys %repeat_tests) {
1220 $i < $test + $repeat_tests{$test}) {
1221 $option = "$name\[$test\]";
1222 if (defined($opt{$option})) {
1223 return $opt{$option};
1228 if (defined($opt{$name})) {
1235 # First we need to do is the builds
1236 for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
1240 my $ssh_user = set_test_option
("SSH_USER", $i);
1241 my $makecmd = set_test_option
("MAKE_CMD", $i);
1243 $machine = set_test_option
("MACHINE", $i);
1244 $tmpdir = set_test_option
("TMP_DIR", $i);
1245 $outputdir = set_test_option
("OUTPUT_DIR", $i);
1246 $builddir = set_test_option
("BUILD_DIR", $i);
1247 $test_type = set_test_option
("TEST_TYPE", $i);
1248 $build_type = set_test_option
("BUILD_TYPE", $i);
1249 $build_options = set_test_option
("BUILD_OPTIONS", $i);
1250 $power_cycle = set_test_option
("POWER_CYCLE", $i);
1251 $noclean = set_test_option
("BUILD_NOCLEAN", $i);
1252 $minconfig = set_test_option
("MIN_CONFIG", $i);
1253 $run_test = set_test_option
("TEST", $i);
1254 $addconfig = set_test_option
("ADD_CONFIG", $i);
1255 $reboot_type = set_test_option
("REBOOT_TYPE", $i);
1256 $grub_menu = set_test_option
("GRUB_MENU", $i);
1257 $post_install = set_test_option
("POST_INSTALL", $i);
1258 $reboot_script = set_test_option
("REBOOT_SCRIPT", $i);
1259 $reboot_on_error = set_test_option
("REBOOT_ON_ERROR", $i);
1260 $poweroff_on_error = set_test_option
("POWEROFF_ON_ERROR", $i);
1261 $die_on_failure = set_test_option
("DIE_ON_FAILURE", $i);
1262 $power_off = set_test_option
("POWER_OFF", $i);
1263 $powercycle_after_reboot = set_test_option
("POWERCYCLE_AFTER_REBOOT", $i);
1264 $poweroff_after_halt = set_test_option
("POWEROFF_AFTER_HALT", $i);
1265 $sleep_time = set_test_option
("SLEEP_TIME", $i);
1266 $bisect_sleep_time = set_test_option
("BISECT_SLEEP_TIME", $i);
1267 $store_failures = set_test_option
("STORE_FAILURES", $i);
1268 $timeout = set_test_option
("TIMEOUT", $i);
1269 $booted_timeout = set_test_option
("BOOTED_TIMEOUT", $i);
1270 $console = set_test_option
("CONSOLE", $i);
1271 $success_line = set_test_option
("SUCCESS_LINE", $i);
1272 $build_target = set_test_option
("BUILD_TARGET", $i);
1273 $target_image = set_test_option
("TARGET_IMAGE", $i);
1274 $localversion = set_test_option
("LOCALVERSION", $i);
1276 chdir $builddir || die "can't change directory to $builddir";
1280 die "can't create $tmpdir";
1283 $target = "$ssh_user\@$machine";
1285 $buildlog = "$tmpdir/buildlog-$machine";
1286 $dmesg = "$tmpdir/dmesg-$machine";
1287 $make = "$makecmd O=$outputdir";
1289 if ($reboot_type eq "grub") {
1290 dodie
"GRUB_MENU not defined" if (!defined($grub_menu));
1291 } elsif (!defined($reboot_script)) {
1292 dodie
"REBOOT_SCRIPT not defined"
1295 my $run_type = $build_type;
1296 if ($test_type eq "patchcheck") {
1297 $run_type = $opt{"PATCHCHECK_TYPE[$i]"};
1298 } elsif ($test_type eq "bisect") {
1299 $run_type = $opt{"BISECT_TYPE[$i]"};
1302 # mistake in config file?
1303 if (!defined($run_type)) {
1304 $run_type = "ERROR";
1308 doprint
"RUNNING TEST $i of $opt{NUM_TESTS} with option $test_type $run_type\n\n";
1313 if (!defined($minconfig)) {
1314 $minconfig = $addconfig;
1316 } elsif (defined($addconfig)) {
1317 run_command
"cat $addconfig $minconfig > $tmpdir/use_config" or
1318 dodie
"Failed to create temp config";
1319 $minconfig = "$tmpdir/use_config";
1322 my $checkout = $opt{"CHECKOUT[$i]"};
1323 if (defined($checkout)) {
1324 run_command
"git checkout $checkout" or
1325 die "failed to checkout $checkout";
1328 if ($test_type eq "bisect") {
1331 } elsif ($test_type eq "patchcheck") {
1336 if ($build_type ne "nobuild") {
1337 build
$build_type or next;
1340 if ($test_type ne "build") {
1347 monitor
or $failed = 1;;
1349 if (!$failed && $test_type ne "boot" && defined($run_test)) {
1350 do_run_test
or $failed = 1;
1359 if ($opt{"POWEROFF_ON_SUCCESS"}) {
1361 } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot
) {
This page took 0.093492 seconds and 5 git commands to generate.