public inbox for linux-kernel@vger.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 1/3] ktest: save test output
Date: Fri, 18 Nov 2011 10:36:41 -0500	[thread overview]
Message-ID: <1321630601.3533.47.camel@frodo> (raw)
In-Reply-To: <1321616131-21352-1-git-send-email-rabin@rab.in>

On Fri, 2011-11-18 at 17:05 +0530, Rabin Vincent wrote:
> The test output may contain useful information; save it along with the
> already-saved buildlog, dmesg, and .config.

Makes sense.

> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>
> ---
>  tools/testing/ktest/ktest.pl |   30 +++++++++++++++++++-----------
>  1 files changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index 30e2bef..3185e0a 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -103,6 +103,7 @@ my $in_patchcheck = 0;
>  my $run_test;
>  my $redirect;
>  my $buildlog;
> +my $testlog;
>  my $dmesg;
>  my $monitor_fp;
>  my $monitor_pid;
> @@ -1005,17 +1006,19 @@ sub fail {
>  	    mkpath($faildir) or
>  		die "can't create $faildir";
>  	}
> -	if (-f "$output_config") {
> -	    cp "$output_config", "$faildir/config" or
> -		die "failed to copy .config";
> -	}
> -	if (-f $buildlog) {
> -	    cp $buildlog, "$faildir/buildlog" or
> -		die "failed to move $buildlog";
> -	}
> -	if (-f $dmesg) {
> -	    cp $dmesg, "$faildir/dmesg" or
> -		die "failed to move $dmesg";
> +
> +	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";
> +		}

Nice little clean up. You can see that I think more C like than Perl. I
usually don't like "perlisms" but this is a clean perl fix that isn't
too complex to understand by non perl folks.

>  	}
>  
>  	doprint "*** Saved info to $faildir ***\n";
> @@ -1653,7 +1656,10 @@ sub child_run_test {
>      $poweroff_on_error = 0;
>      $die_on_failure = 1;
>  
> +    $redirect = "$testlog";
>      run_command $run_test or $failed = 1;
> +    undef $redirect;
> +
>      exit $failed;
>  }
>  
> @@ -3153,6 +3159,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
>      $target = "$ssh_user\@$machine";
>  
>      $buildlog = "$tmpdir/buildlog-$machine";
> +    $testlog = "$tmpdir/testlog-$machine";
>      $dmesg = "$tmpdir/dmesg-$machine";
>      $make = "$makecmd O=$outputdir";
>      $output_config = "$outputdir/.config";
> @@ -3189,6 +3196,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
>  
>      unlink $dmesg;
>      unlink $buildlog;
> +    unlink $testlog;
>  
>      if (defined($addconfig)) {
>  	my $min = $minconfig;

I'll pull it in, thanks!

-- Steve



      parent reply	other threads:[~2011-11-18 15:36 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
2011-11-18 17:06   ` Steven Rostedt
2011-11-18 15:36 ` Steven Rostedt [this message]

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=1321630601.3533.47.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox