All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Rabin Vincent <rabin@rab.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] ktest: allow success logs to be stored
Date: Fri, 18 Nov 2011 10:40:35 -0500	[thread overview]
Message-ID: <1321630835.3533.50.camel@frodo> (raw)
In-Reply-To: <1321616131-21352-3-git-send-email-rabin@rab.in>

On Fri, 2011-11-18 at 17:05 +0530, Rabin Vincent wrote:
> Add a STORE_SUCCESSES option, to allow success logs to be stored, for
> example to double-check or otherwise post-process the test logs.

Looks good. I'll give it a test run and put it into the 3.3 queue.

Thanks!

-- Steve

> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>
> ---
>  tools/testing/ktest/ktest.pl    |   80 ++++++++++++++++++++++----------------
>  tools/testing/ktest/sample.conf |    6 +++
>  2 files changed, 52 insertions(+), 34 deletions(-)
> 
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index e93c21c..6ef104e 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -113,6 +113,7 @@ my $bisect_sleep_time;
>  my $patchcheck_sleep_time;
>  my $ignore_warnings;
>  my $store_failures;
> +my $store_successes;
>  my $test_name;
>  my $timeout;
>  my $booted_timeout;
> @@ -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) {
> @@ -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;
>  }
> @@ -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;
> @@ -3137,6 +3148,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
>      $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);
> diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
> index dbedfa1..42e0eb9 100644
> --- a/tools/testing/ktest/sample.conf
> +++ b/tools/testing/ktest/sample.conf
> @@ -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



  reply	other threads:[~2011-11-18 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 11:35 [PATCH 1/3] ktest: save test output Rabin Vincent
2011-11-18 11:35 ` [PATCH 2/3] ktest: check parent options for a repeated test Rabin Vincent
2011-11-18 15:38   ` Steven Rostedt
2011-11-18 11:35 ` [PATCH 3/3] ktest: allow success logs to be stored Rabin Vincent
2011-11-18 15:40   ` Steven Rostedt [this message]
2011-11-18 17:06   ` Steven Rostedt
2011-11-18 15:36 ` [PATCH 1/3] ktest: save test output Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321630835.3533.50.camel@frodo \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rabin@rab.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.