Re: [PATCH 1/3] Align FAILED to test name to be parsable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 22 Oct 2012 10:31:23 +0200 (CEST) g.esp@xxxxxxx wrote:

> 
> 
> ----- Mail original -----
> > De: "NeilBrown" <neilb@xxxxxxx>
> > À: "Gilles Espinasse" <g.esp@xxxxxxx>
> > Cc: linux-raid@xxxxxxxxxxxxxxx
> > Envoyé: Lundi 22 Octobre 2012 00:08:55
> > Objet: Re: [PATCH 1/3] Align FAILED to test name to be parsable
> > 
> > On Sat, 20 Oct 2012 18:03:22 +0200 Gilles Espinasse <g.esp@xxxxxxx>
> > wrote:
> > 
> > > Signed-off-by: Gilles Espinasse <g.esp@xxxxxxx>
> > > 
> > > So 'grep FAILED log' is now meaningfull.
> > > Let both stdout and sderr be displayed after a failed test
> > > ---
> > >  test |    5 +++--
> > >  1 files changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/test b/test
> > > index 9340afe..2bb482c 100755
> > > --- a/test
> > > +++ b/test
> > > @@ -222,12 +222,13 @@ do_test() {
> > >      # source script in a subshell, so it has access to our
> > >      # namespace, but cannot change it.
> > >      echo -ne "$_script... "
> > > -    if ( set -ex ; . $_script )  2> $targetdir/log
> > > +    if ( set -ex ; . $_script ) &> $targetdir/log
> > >      then
> > >        echo "succeeded"
> > >        _fail=0
> > >      else
> > > -      echo "FAILED - see $targetdir/log for details"
> > > +      echo "FAILED"
> > > +      cat $targetdir/log
> > >        _fail=1
> > >      fi
> > >      if [ "$savelogs" == "1" ]; then
> > 
> > Hi,
> >  the patch makes some sense, but it doesn't seem to match the
> >  description,
> >  though maybe I'm just being dense.
> > 
> >  How does the patch "Align FAILED to test name" ?
> > 
> > Thanks,
> > NeilBrown
> > 
> I have a test that failed with
> tests/06r5swap... --- /var/tmp/d1	2012-10-20 08:36:12.000000000 +0200

Ahh, I see what you mean.

I've change the patch description and removed the change to the failed
message, because I don't want the log to appear in-line:

From 45e34015b6f3c9deb4f489095eeedc9343a34b5e Mon Sep 17 00:00:00 2001
From: Gilles Espinasse <g.esp@xxxxxxx>
Date: Tue, 23 Oct 2012 09:12:15 +1100
Subject: [PATCH] test: redirect all output to log file to keep output clean

If a test sent anything to stdout, it would not get logged, and would
mess up the listing of test status.

Signed-off-by: Gilles Espinasse <g.esp@xxxxxxx>
Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/test b/test
index 48b47d9..e313385 100755
--- a/test
+++ b/test
@@ -227,7 +227,7 @@ do_test() {
     # source script in a subshell, so it has access to our
     # namespace, but cannot change it.
     echo -ne "$_script... "
-    if ( set -ex ; . $_script )  2> $targetdir/log
+    if ( set -ex ; . $_script ) &> $targetdir/log
     then
       echo "succeeded"
       _fail=0


and I have added another patch which will make sure we don't lose the logs
when using --keep-going

From 1dc837e4edc805819a1ff40add3d0beecfeecdbb Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@xxxxxxx>
Date: Tue, 23 Oct 2012 09:21:32 +1100
Subject: [PATCH] test: keep separate log file for each failed test.

If a test failed when --keep-going is selected, give the
log file a name based on the test name, so that all the logs
can be examined afterwards.

Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/test b/test
index e313385..3f8515f 100755
--- a/test
+++ b/test
@@ -232,7 +232,12 @@ do_test() {
       echo "succeeded"
       _fail=0
     else
-      echo "FAILED - see $targetdir/log for details"
+      log=log
+      if [ $exitonerror == 0 ]; then
+	  log=log-`basename $_script`
+	  mv $targetdir/log $targetdir/$log
+      fi
+      echo "FAILED - see $targetdir/$log for details"
       _fail=1
     fi
     if [ "$savelogs" == "1" ]; then


Thanks,
NeilBrown

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux