Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285885
b: refs/heads/master
c: de5b6e3
h: refs/heads/master
i:
  285883: a5c7b7b
v: v3
  • Loading branch information
Rabin Vincent authored and Steven Rostedt committed Nov 18, 2011
1 parent 35e7add commit 99c0bce
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a9dd5d631729eea8686703fbb25a7a9d4c75a724
refs/heads/master: de5b6e3bf5e71532057fb4f1eb8ee29c5c7f11db
80 changes: 46 additions & 34 deletions trunk/tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
my $patchcheck_sleep_time;
my $ignore_warnings;
my $store_failures;
my $store_successes;
my $test_name;
my $timeout;
my $booted_timeout;
Expand Down Expand Up @@ -976,6 +977,43 @@ sub wait_for_monitor {
print "** Monitor flushed **\n";
}

sub save_logs {
my ($result, $basedir) = @_;
my @t = localtime;
my $date = sprintf "%04d%02d%02d%02d%02d%02d",
1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0];

my $type = $build_type;
if ($type =~ /useconfig/) {
$type = "useconfig";
}

my $dir = "$machine-$test_type-$type-$result-$date";

$dir = "$basedir/$dir";

if (!-d $dir) {
mkpath($dir) or
die "can't create $dir";
}

my %files = (
"config" => $output_config,
"buildlog" => $buildlog,
"dmesg" => $dmesg,
"testlog" => $testlog,
);

while (my ($name, $source) = each(%files)) {
if (-f "$source") {
cp "$source", "$dir/$name" or
die "failed to copy $source";
}
}

doprint "*** Saved info to $dir ***\n";
}

sub fail {

if ($die_on_failure) {
Expand Down Expand Up @@ -1004,40 +1042,9 @@ sub fail {
doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
doprint "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";

return 1 if (!defined($store_failures));

my @t = localtime;
my $date = sprintf "%04d%02d%02d%02d%02d%02d",
1900+$t[5],$t[4],$t[3],$t[2],$t[1],$t[0];

my $type = $build_type;
if ($type =~ /useconfig/) {
$type = "useconfig";
}

my $dir = "$machine-$test_type-$type-fail-$date";
my $faildir = "$store_failures/$dir";

if (!-d $faildir) {
mkpath($faildir) or
die "can't create $faildir";
}

my %files = (
"config" => $output_config,
"buildlog" => $buildlog,
"dmesg" => $dmesg,
"testlog" => $testlog,
);

while (my ($name, $source) = each(%files)) {
if (-f "$source") {
cp "$source", "$faildir/$name" or
die "failed to copy $source";
}
}

doprint "*** Saved info to $faildir ***\n";
if (defined($store_failures)) {
save_logs "fail", $store_failures;
}

return 1;
}
Expand Down Expand Up @@ -1643,6 +1650,10 @@ sub success {
doprint "*******************************************\n";
doprint "*******************************************\n";

if (defined($store_successes)) {
save_logs "success", $store_successes;
}

if ($i != $opt{"NUM_TESTS"} && !do_not_reboot) {
doprint "Reboot and wait $sleep_time seconds\n";
reboot $sleep_time;
Expand Down Expand Up @@ -3137,6 +3148,7 @@ sub set_test_option {
$bisect_skip = set_test_option("BISECT_SKIP", $i);
$config_bisect_good = set_test_option("CONFIG_BISECT_GOOD", $i);
$store_failures = set_test_option("STORE_FAILURES", $i);
$store_successes = set_test_option("STORE_SUCCESSES", $i);
$test_name = set_test_option("TEST_NAME", $i);
$timeout = set_test_option("TIMEOUT", $i);
$booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
Expand Down
6 changes: 6 additions & 0 deletions trunk/tools/testing/ktest/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,12 @@
# (default undefined)
#STORE_FAILURES = /home/test/failures

# Directory to store success directories on success. If this is not
# set, the .config, dmesg and bootlog will not be saved if a
# test succeeds.
# (default undefined)
#STORE_SUCCESSES = /home/test/successes

# Build without doing a make mrproper, or removing .config
# (default 0)
#BUILD_NOCLEAN = 0
Expand Down

0 comments on commit 99c0bce

Please sign in to comment.