Here's some basic updates to ktest.pl. They include:
o Add config to modify the signal to terminate console o Update to documentation (missing some config options) o Add KERNEL_VERSION variable to use for other configs o Add '=~' to let configs eval other configs o Add BISECT_TRIES to run multiple tests per git bisect good -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQEcBAABAgAGBQJS3UMjAAoJEKQekfcNnQGuU/YH/RdTp8o6GgHfBans6vG588mZ CoTOhfYH9loGTAcs8JqKt0sIBaPDmdF1Qur+nthBJ/vqyFSpRtaoCLTTvNTb8Snh Wia5DEpi4BnfH3TMyMqNVCyXJjO8wkxq7bv5wB1+pqVnIDADlX5xejOVCDms2scm EUXQeZx38KrFHH2ZvrjzjrGjIboKB/vTriqF8Q/Vmu0lRYo+Lt6HkDUEJEehxeLz oU+oQOuep5ABo1APMYIml9YZqBeJJuCeqKd75T3QfgWyyCaYLv1ggHXG/bymBROX uTd/RK3lKC/ODkVi9u57a4djptYYUW6mTDkUcLO3lZhqhVKqSiOQt0B9Bw/JTdQ= =+mEf -----END PGP SIGNATURE----- Merge tag 'ktest-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest Pull ktest updates from Steven Rostedt: "Here's some basic updates to ktest.pl. They include: - add config to modify the signal to terminate console - update to documentation (missing some config options) - add KERNEL_VERSION variable to use for other configs - add '=~' to let configs eval other configs - add BISECT_TRIES to run multiple tests per git bisect good" * tag 'ktest-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest: ktest: Add BISECT_TRIES to bisect test ktest: Add eval '=~' command to modify variables in config file ktest: Add special variable ${KERNEL_VERSION} ktest: Add documentation of CLOSE_CONSOLE_SIGNAL ktest: Make the signal to terminate the console configurable
This commit is contained in:
Коммит
9451ee2d17
|
@ -18,6 +18,7 @@ $| = 1;
|
||||||
my %opt;
|
my %opt;
|
||||||
my %repeat_tests;
|
my %repeat_tests;
|
||||||
my %repeats;
|
my %repeats;
|
||||||
|
my %evals;
|
||||||
|
|
||||||
#default opts
|
#default opts
|
||||||
my %default = (
|
my %default = (
|
||||||
|
@ -25,6 +26,7 @@ my %default = (
|
||||||
"TEST_TYPE" => "build",
|
"TEST_TYPE" => "build",
|
||||||
"BUILD_TYPE" => "randconfig",
|
"BUILD_TYPE" => "randconfig",
|
||||||
"MAKE_CMD" => "make",
|
"MAKE_CMD" => "make",
|
||||||
|
"CLOSE_CONSOLE_SIGNAL" => "INT",
|
||||||
"TIMEOUT" => 120,
|
"TIMEOUT" => 120,
|
||||||
"TMP_DIR" => "/tmp/ktest/\${MACHINE}",
|
"TMP_DIR" => "/tmp/ktest/\${MACHINE}",
|
||||||
"SLEEP_TIME" => 60, # sleep time between tests
|
"SLEEP_TIME" => 60, # sleep time between tests
|
||||||
|
@ -39,6 +41,7 @@ my %default = (
|
||||||
"CLEAR_LOG" => 0,
|
"CLEAR_LOG" => 0,
|
||||||
"BISECT_MANUAL" => 0,
|
"BISECT_MANUAL" => 0,
|
||||||
"BISECT_SKIP" => 1,
|
"BISECT_SKIP" => 1,
|
||||||
|
"BISECT_TRIES" => 1,
|
||||||
"MIN_CONFIG_TYPE" => "boot",
|
"MIN_CONFIG_TYPE" => "boot",
|
||||||
"SUCCESS_LINE" => "login:",
|
"SUCCESS_LINE" => "login:",
|
||||||
"DETECT_TRIPLE_FAULT" => 1,
|
"DETECT_TRIPLE_FAULT" => 1,
|
||||||
|
@ -137,6 +140,7 @@ my $bisect_bad_commit = "";
|
||||||
my $reverse_bisect;
|
my $reverse_bisect;
|
||||||
my $bisect_manual;
|
my $bisect_manual;
|
||||||
my $bisect_skip;
|
my $bisect_skip;
|
||||||
|
my $bisect_tries;
|
||||||
my $config_bisect_good;
|
my $config_bisect_good;
|
||||||
my $bisect_ret_good;
|
my $bisect_ret_good;
|
||||||
my $bisect_ret_bad;
|
my $bisect_ret_bad;
|
||||||
|
@ -163,6 +167,7 @@ my $timeout;
|
||||||
my $booted_timeout;
|
my $booted_timeout;
|
||||||
my $detect_triplefault;
|
my $detect_triplefault;
|
||||||
my $console;
|
my $console;
|
||||||
|
my $close_console_signal;
|
||||||
my $reboot_success_line;
|
my $reboot_success_line;
|
||||||
my $success_line;
|
my $success_line;
|
||||||
my $stop_after_success;
|
my $stop_after_success;
|
||||||
|
@ -273,6 +278,7 @@ my %option_map = (
|
||||||
"IGNORE_ERRORS" => \$ignore_errors,
|
"IGNORE_ERRORS" => \$ignore_errors,
|
||||||
"BISECT_MANUAL" => \$bisect_manual,
|
"BISECT_MANUAL" => \$bisect_manual,
|
||||||
"BISECT_SKIP" => \$bisect_skip,
|
"BISECT_SKIP" => \$bisect_skip,
|
||||||
|
"BISECT_TRIES" => \$bisect_tries,
|
||||||
"CONFIG_BISECT_GOOD" => \$config_bisect_good,
|
"CONFIG_BISECT_GOOD" => \$config_bisect_good,
|
||||||
"BISECT_RET_GOOD" => \$bisect_ret_good,
|
"BISECT_RET_GOOD" => \$bisect_ret_good,
|
||||||
"BISECT_RET_BAD" => \$bisect_ret_bad,
|
"BISECT_RET_BAD" => \$bisect_ret_bad,
|
||||||
|
@ -285,6 +291,7 @@ my %option_map = (
|
||||||
"TIMEOUT" => \$timeout,
|
"TIMEOUT" => \$timeout,
|
||||||
"BOOTED_TIMEOUT" => \$booted_timeout,
|
"BOOTED_TIMEOUT" => \$booted_timeout,
|
||||||
"CONSOLE" => \$console,
|
"CONSOLE" => \$console,
|
||||||
|
"CLOSE_CONSOLE_SIGNAL" => \$close_console_signal,
|
||||||
"DETECT_TRIPLE_FAULT" => \$detect_triplefault,
|
"DETECT_TRIPLE_FAULT" => \$detect_triplefault,
|
||||||
"SUCCESS_LINE" => \$success_line,
|
"SUCCESS_LINE" => \$success_line,
|
||||||
"REBOOT_SUCCESS_LINE" => \$reboot_success_line,
|
"REBOOT_SUCCESS_LINE" => \$reboot_success_line,
|
||||||
|
@ -445,6 +452,27 @@ $config_help{"REBOOT_SCRIPT"} = << "EOF"
|
||||||
EOF
|
EOF
|
||||||
;
|
;
|
||||||
|
|
||||||
|
sub _logit {
|
||||||
|
if (defined($opt{"LOG_FILE"})) {
|
||||||
|
open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
|
||||||
|
print OUT @_;
|
||||||
|
close(OUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub logit {
|
||||||
|
if (defined($opt{"LOG_FILE"})) {
|
||||||
|
_logit @_;
|
||||||
|
} else {
|
||||||
|
print @_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub doprint {
|
||||||
|
print @_;
|
||||||
|
_logit @_;
|
||||||
|
}
|
||||||
|
|
||||||
sub read_prompt {
|
sub read_prompt {
|
||||||
my ($cancel, $prompt) = @_;
|
my ($cancel, $prompt) = @_;
|
||||||
|
|
||||||
|
@ -662,6 +690,22 @@ sub set_value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_eval {
|
||||||
|
my ($lvalue, $rvalue, $name) = @_;
|
||||||
|
|
||||||
|
my $prvalue = process_variables($rvalue);
|
||||||
|
my $arr;
|
||||||
|
|
||||||
|
if (defined($evals{$lvalue})) {
|
||||||
|
$arr = $evals{$lvalue};
|
||||||
|
} else {
|
||||||
|
$arr = [];
|
||||||
|
$evals{$lvalue} = $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
push @{$arr}, $rvalue;
|
||||||
|
}
|
||||||
|
|
||||||
sub set_variable {
|
sub set_variable {
|
||||||
my ($lvalue, $rvalue) = @_;
|
my ($lvalue, $rvalue) = @_;
|
||||||
|
|
||||||
|
@ -947,6 +991,20 @@ sub __read_config {
|
||||||
$test_case = 1;
|
$test_case = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} elsif (/^\s*([A-Z_\[\]\d]+)\s*=~\s*(.*?)\s*$/) {
|
||||||
|
|
||||||
|
next if ($skip);
|
||||||
|
|
||||||
|
my $lvalue = $1;
|
||||||
|
my $rvalue = $2;
|
||||||
|
|
||||||
|
if ($default || $lvalue =~ /\[\d+\]$/) {
|
||||||
|
set_eval($lvalue, $rvalue, $name);
|
||||||
|
} else {
|
||||||
|
my $val = "$lvalue\[$test_num\]";
|
||||||
|
set_eval($val, $rvalue, $name);
|
||||||
|
}
|
||||||
|
|
||||||
} elsif (/^\s*([A-Z_\[\]\d]+)\s*=\s*(.*?)\s*$/) {
|
} elsif (/^\s*([A-Z_\[\]\d]+)\s*=\s*(.*?)\s*$/) {
|
||||||
|
|
||||||
next if ($skip);
|
next if ($skip);
|
||||||
|
@ -1126,6 +1184,10 @@ sub __eval_option {
|
||||||
} elsif (defined($opt{$var})) {
|
} elsif (defined($opt{$var})) {
|
||||||
$o = $opt{$var};
|
$o = $opt{$var};
|
||||||
$retval = "$retval$o";
|
$retval = "$retval$o";
|
||||||
|
} elsif ($var eq "KERNEL_VERSION" && defined($make)) {
|
||||||
|
# special option KERNEL_VERSION uses kernel version
|
||||||
|
get_version();
|
||||||
|
$retval = "$retval$version";
|
||||||
} else {
|
} else {
|
||||||
$retval = "$retval\$\{$var\}";
|
$retval = "$retval\$\{$var\}";
|
||||||
}
|
}
|
||||||
|
@ -1140,6 +1202,33 @@ sub __eval_option {
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub process_evals {
|
||||||
|
my ($name, $option, $i) = @_;
|
||||||
|
|
||||||
|
my $option_name = "$name\[$i\]";
|
||||||
|
my $ev;
|
||||||
|
|
||||||
|
my $old_option = $option;
|
||||||
|
|
||||||
|
if (defined($evals{$option_name})) {
|
||||||
|
$ev = $evals{$option_name};
|
||||||
|
} elsif (defined($evals{$name})) {
|
||||||
|
$ev = $evals{$name};
|
||||||
|
} else {
|
||||||
|
return $option;
|
||||||
|
}
|
||||||
|
|
||||||
|
for my $e (@{$ev}) {
|
||||||
|
eval "\$option =~ $e";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($option ne $old_option) {
|
||||||
|
doprint("$name changed from '$old_option' to '$option'\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $option;
|
||||||
|
}
|
||||||
|
|
||||||
sub eval_option {
|
sub eval_option {
|
||||||
my ($name, $option, $i) = @_;
|
my ($name, $option, $i) = @_;
|
||||||
|
|
||||||
|
@ -1160,30 +1249,11 @@ sub eval_option {
|
||||||
$option = __eval_option($name, $option, $i);
|
$option = __eval_option($name, $option, $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$option = process_evals($name, $option, $i);
|
||||||
|
|
||||||
return $option;
|
return $option;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _logit {
|
|
||||||
if (defined($opt{"LOG_FILE"})) {
|
|
||||||
open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
|
|
||||||
print OUT @_;
|
|
||||||
close(OUT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub logit {
|
|
||||||
if (defined($opt{"LOG_FILE"})) {
|
|
||||||
_logit @_;
|
|
||||||
} else {
|
|
||||||
print @_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub doprint {
|
|
||||||
print @_;
|
|
||||||
_logit @_;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub run_command;
|
sub run_command;
|
||||||
sub start_monitor;
|
sub start_monitor;
|
||||||
sub end_monitor;
|
sub end_monitor;
|
||||||
|
@ -1296,7 +1366,7 @@ sub close_console {
|
||||||
my ($fp, $pid) = @_;
|
my ($fp, $pid) = @_;
|
||||||
|
|
||||||
doprint "kill child process $pid\n";
|
doprint "kill child process $pid\n";
|
||||||
kill 2, $pid;
|
kill $close_console_signal, $pid;
|
||||||
|
|
||||||
print "closing!\n";
|
print "closing!\n";
|
||||||
close($fp);
|
close($fp);
|
||||||
|
@ -2517,12 +2587,29 @@ sub run_bisect {
|
||||||
$buildtype = "useconfig:$minconfig";
|
$buildtype = "useconfig:$minconfig";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $ret = run_bisect_test $type, $buildtype;
|
# If the user sets bisect_tries to less than 1, then no tries
|
||||||
|
# is a success.
|
||||||
|
my $ret = 1;
|
||||||
|
|
||||||
if ($bisect_manual) {
|
# Still let the user manually decide that though.
|
||||||
|
if ($bisect_tries < 1 && $bisect_manual) {
|
||||||
$ret = answer_bisect;
|
$ret = answer_bisect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (my $i = 0; $i < $bisect_tries; $i++) {
|
||||||
|
if ($bisect_tries > 1) {
|
||||||
|
my $t = $i + 1;
|
||||||
|
doprint("Running bisect trial $t of $bisect_tries:\n");
|
||||||
|
}
|
||||||
|
$ret = run_bisect_test $type, $buildtype;
|
||||||
|
|
||||||
|
if ($bisect_manual) {
|
||||||
|
$ret = answer_bisect;
|
||||||
|
}
|
||||||
|
|
||||||
|
last if (!$ret);
|
||||||
|
}
|
||||||
|
|
||||||
# Are we looking for where it worked, not failed?
|
# Are we looking for where it worked, not failed?
|
||||||
if ($reverse_bisect && $ret >= 0) {
|
if ($reverse_bisect && $ret >= 0) {
|
||||||
$ret = !$ret;
|
$ret = !$ret;
|
||||||
|
@ -3916,6 +4003,18 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
|
||||||
|
|
||||||
my $makecmd = set_test_option("MAKE_CMD", $i);
|
my $makecmd = set_test_option("MAKE_CMD", $i);
|
||||||
|
|
||||||
|
$outputdir = set_test_option("OUTPUT_DIR", $i);
|
||||||
|
$builddir = set_test_option("BUILD_DIR", $i);
|
||||||
|
|
||||||
|
chdir $builddir || die "can't change directory to $builddir";
|
||||||
|
|
||||||
|
if (!-d $outputdir) {
|
||||||
|
mkpath($outputdir) or
|
||||||
|
die "can't create $outputdir";
|
||||||
|
}
|
||||||
|
|
||||||
|
$make = "$makecmd O=$outputdir";
|
||||||
|
|
||||||
# Load all the options into their mapped variable names
|
# Load all the options into their mapped variable names
|
||||||
foreach my $opt (keys %option_map) {
|
foreach my $opt (keys %option_map) {
|
||||||
${$option_map{$opt}} = set_test_option($opt, $i);
|
${$option_map{$opt}} = set_test_option($opt, $i);
|
||||||
|
@ -3940,13 +4039,9 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
|
||||||
$start_minconfig = $minconfig;
|
$start_minconfig = $minconfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
chdir $builddir || die "can't change directory to $builddir";
|
if (!-d $tmpdir) {
|
||||||
|
mkpath($tmpdir) or
|
||||||
foreach my $dir ($tmpdir, $outputdir) {
|
die "can't create $tmpdir";
|
||||||
if (!-d $dir) {
|
|
||||||
mkpath($dir) or
|
|
||||||
die "can't create $dir";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ENV{"SSH_USER"} = $ssh_user;
|
$ENV{"SSH_USER"} = $ssh_user;
|
||||||
|
@ -3955,7 +4050,6 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
|
||||||
$buildlog = "$tmpdir/buildlog-$machine";
|
$buildlog = "$tmpdir/buildlog-$machine";
|
||||||
$testlog = "$tmpdir/testlog-$machine";
|
$testlog = "$tmpdir/testlog-$machine";
|
||||||
$dmesg = "$tmpdir/dmesg-$machine";
|
$dmesg = "$tmpdir/dmesg-$machine";
|
||||||
$make = "$makecmd O=$outputdir";
|
|
||||||
$output_config = "$outputdir/.config";
|
$output_config = "$outputdir/.config";
|
||||||
|
|
||||||
if (!$buildonly) {
|
if (!$buildonly) {
|
||||||
|
|
|
@ -328,6 +328,13 @@
|
||||||
# For a virtual machine with guest name "Guest".
|
# For a virtual machine with guest name "Guest".
|
||||||
#CONSOLE = virsh console Guest
|
#CONSOLE = virsh console Guest
|
||||||
|
|
||||||
|
# Signal to send to kill console.
|
||||||
|
# ktest.pl will create a child process to monitor the console.
|
||||||
|
# When the console is finished, ktest will kill the child process
|
||||||
|
# with this signal.
|
||||||
|
# (default INT)
|
||||||
|
#CLOSE_CONSOLE_SIGNAL = HUP
|
||||||
|
|
||||||
# Required version ending to differentiate the test
|
# Required version ending to differentiate the test
|
||||||
# from other linux builds on the system.
|
# from other linux builds on the system.
|
||||||
#LOCALVERSION = -test
|
#LOCALVERSION = -test
|
||||||
|
@ -1021,6 +1028,20 @@
|
||||||
# BISECT_BAD with BISECT_CHECK = good or
|
# BISECT_BAD with BISECT_CHECK = good or
|
||||||
# BISECT_CHECK = bad, respectively.
|
# BISECT_CHECK = bad, respectively.
|
||||||
#
|
#
|
||||||
|
# BISECT_TRIES = 5 (optional, default 1)
|
||||||
|
#
|
||||||
|
# For those cases that it takes several tries to hit a bug,
|
||||||
|
# the BISECT_TRIES is useful. It is the number of times the
|
||||||
|
# test is ran before it says the kernel is good. The first failure
|
||||||
|
# will stop trying and mark the current SHA1 as bad.
|
||||||
|
#
|
||||||
|
# Note, as with all race bugs, there's no guarantee that if
|
||||||
|
# it succeeds, it is really a good bisect. But it helps in case
|
||||||
|
# the bug is some what reliable.
|
||||||
|
#
|
||||||
|
# You can set BISECT_TRIES to zero, and all tests will be considered
|
||||||
|
# good, unless you also set BISECT_MANUAL.
|
||||||
|
#
|
||||||
# BISECT_RET_GOOD = 0 (optional, default undefined)
|
# BISECT_RET_GOOD = 0 (optional, default undefined)
|
||||||
#
|
#
|
||||||
# In case the specificed test returns something other than just
|
# In case the specificed test returns something other than just
|
||||||
|
|
Загрузка…
Ссылка в новой задаче