[patch] testsuite/cpio.tests: removes the SKIP line

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Tue May 6 12:08:11 PDT 2008


On Tue, 6 May 2008, Denys Vlasenko wrote:

> On Tuesday 06 May 2008 15:45, Cristian Ionescu-Idbohrn wrote:
> >  #!/bin/sh
> > +
> > +set -e
> >
> > > Why?
> >
> > Why not?
> >
> > Unhandled errors will abort the rest of the script:
> ...
> > but I believe you already know that.  Scripts, and especially test
> > scripts, should handle all possible errors.
>
> Did you actually tried the result?

Yes I did, but I must have missed something.  I think I found it now (see
below).

> Original:
>
> # ./runtest cpio
> PASS: cpio extracts zero-sized hardlinks
> FAIL: cpio lists hardlinks
> Failures detected, running with -v (verbose) will give more info
>
> After set -e added to cpio.tests:
>
> # ./runtest cpio
> PASS: cpio extracts zero-sized hardlinks
> Failures detected, running with -v (verbose) will give more info

With this patch:

---8<---
Index: testsuite/testing.sh
===================================================================
--- testsuite/testing.sh	(revision 21938)
+++ testsuite/testing.sh	(working copy)
@@ -90,14 +90,13 @@
   $ECHO -ne "$5" | eval "$2" > actual
   RETVAL=$?

-  cmp expected actual >/dev/null 2>/dev/null
-  if [ $? -ne 0 ]
+  if cmp expected actual >/dev/null 2>/dev/null
   then
+    echo "PASS: $NAME"
+  else
     FAILCOUNT=$(($FAILCOUNT + 1))
     echo "FAIL: $NAME"
     [ -n "$VERBOSE" ] && diff -u expected actual
-  else
-    echo "PASS: $NAME"
   fi
   rm -f input expected actual

Index: testsuite/cpio.tests
===================================================================
--- testsuite/cpio.tests	(revision 21938)
+++ testsuite/cpio.tests	(working copy)
@@ -2,6 +2,8 @@
 # Copyright 2008 by Denys Vlasenko
 # Licensed under GPL v2, see file LICENSE for details.

+set -e
+
 . testing.sh

 # check if hexdump supports the '-R' option
---8<---

things seem to change to the expected behaviour:

# ./runtest cpio
PASS: cpio extracts zero-sized hardlinks
FAIL: cpio lists hardlinks
Failures detected, running with -v (verbose) will give more info

> After I intentionally broke "cpio extracts zero-sized hardlinks"
> test:
>
> # ./runtest cpio
> Failures detected, running with -v (verbose) will give more info

The patch above should take care of that too, but if it dosn't, I'm sure
I'll be told ;-)

> Do you think that not showing failed test's name is better?

No, I don't.  But, as you may very well deduct from the patch above,
testing.sh is, IMHO, broken.

> # ./runtest cpio cut
> PASS: cut-cuts-a-character
> PASS: cut-cuts-a-closed-range
> PASS: cut-cuts-a-field
> PASS: cut-cuts-an-open-range
> PASS: cut-cuts-an-unclosed-range
> PASS: cut '-' (stdin) and multi file handling
> Failures detected, running with -v (verbose) will give more info

Is this better?

 ./runtest cpio cut
PASS: cpio extracts zero-sized hardlinks
FAIL: cpio lists hardlinks
PASS: cut-cuts-a-character
PASS: cut-cuts-a-closed-range
PASS: cut-cuts-a-field
PASS: cut-cuts-an-open-range
PASS: cut-cuts-an-unclosed-range
PASS: cut '-' (stdin) and multi file handling
Failures detected, running with -v (verbose) will give more info

> That's what happens when you are fixing the problems which do not exist.

But those problems _do_ exist.

> You run the risk of creating more problems than you fix.

Merrily letting them show up, IMO.  At least in this case ;-)


Cheers,

-- 
Cristian


More information about the busybox mailing list