[patch] make new parts of testsuite work via make check

Bernhard Fischer rep.nop at aon.at
Tue Sep 20 17:48:09 UTC 2005


On Tue, Sep 20, 2005 at 09:10:29AM -0500, Rob Landley wrote:
>On Tuesday 20 September 2005 02:36, Bernhard Fischer wrote:

>> >Looking at the patch...
>> >
>> >Okay, I'd really rather _not_ introduce unnecessary environmental
>> > dependencies on running these tests.  When it's run outside of make,
>> > $srcdir is not set.
>>
>> Hm? My copy of trunks runtest reads:
>> $ grep srcdir= runtest
>> [ -n "$srcdir" ] || srcdir=$(pwd)
>
>Yeah, but if you run the test directly then srcdir has not been set.

If srcdir isn't set then just fall back to ./
so in *.test:
. ${srcdir:-.}/testing.sh
(instead of the . ${srcdir}/testing.sh i had in the propsed patch).

Would that do it?

With your recent change, i now get:
$ make check 2>&1 >&1 | egrep -v "(FAIL|PASS|UNTESTED)"
bindir=obj.ia32/busybox.oorig
srcdir=obj.ia32/busybox.oorig/testsuite \
obj.ia32/busybox.oorig/testsuite/runtest
obj.ia32/busybox.oorig/testsuite/runtest: line 106:
./busybox.tests: No such file or directory
obj.ia32/busybox.oorig/testsuite/runtest: line 106:
./sort.tests: No such file or directory
obj.ia32/busybox.oorig/testsuite/runtest: line 106:
./uniq.tests: No such file or directory
make: *** [check] Error 1

Which is slightly better but still does not look ok to me..

Attached patch fixes it for me (also corrects a typo in the uniq test
and fixes a test between two integers which was written as != instead
of -ne. Check if the links dir exists and remove the current applet link
if it does, else create it).

>> >We should not depend on srcdir being set.  I'd prefer making the
>> > dependency on the current directory containing testing.sh more explicit,
>> > and having make do a cd before trying to run it.
>> >
>> >It's _nice_ to be able to just run "COMMAND=../busybox ./busybox.tests".
>>
>> I thought one is supposed to make check rather than executing every
>> single one of *.tests by hand, no?
>
>The thing is you can run ./busybox.tests directly, and right now it works.  

With attached patch, it works as before.


The following tests fail if you're running on a terminal or console with
COLUMNS not equal to 80:
busybox --help busybox
busybox (about the same as the one above)
busybox --help (ditto)
busybox-suffix
busybox-suffix --help


-------------- next part --------------
diff -rup busybox.oorig/testsuite/busybox.tests busybox/testsuite/busybox.tests
--- busybox.oorig/testsuite/busybox.tests	2005-09-05 21:44:17.000000000 +0200
+++ busybox/testsuite/busybox.tests	2005-09-20 19:20:51.000000000 +0200
@@ -5,7 +5,7 @@
 # Licensed under GPL v2, see file LICENSE for details.
 
 if [ ${#COMMAND} -eq 0 ]; then COMMAND=busybox; fi
-. testing.sh
+. ${srcdir:-.}/testing.sh
 
 # We'll assume "cat" is built in, because we need some other command to test.
 
diff -rup busybox.oorig/testsuite/runtest busybox/testsuite/runtest
--- busybox.oorig/testsuite/runtest	2005-09-20 19:10:08.000000000 +0200
+++ busybox/testsuite/runtest	2005-09-20 19:28:41.000000000 +0200
@@ -97,13 +97,12 @@ for applet in $applets; do
 			status=1
 		fi
 	fi
-	applet=`echo "$applet" | sed -n 's/\.tests$//p'`
-	if [ ${#applet} != 0 ]
+	applet=$(echo "$applet" | sed -n 's/\.tests$//p')
+	if [ ${#applet} -ne 0 ]
 	then
-		mkdir links 2>/dev/null
-		rm -f links/"$applet"
-		ln -s ../../busybox links/"$applet"
-		PATH=links:$PATH ./"$applet".tests
+		[ -d links ] && rm -f links/"$applet" || mkdir links 2>/dev/null
+		ln -s ${bindir}/busybox links/"$applet"
+		PATH=links:$PATH ${srcdir}/"$applet".tests
 		if [ $? -ne 0 ]; then status=1; fi
 	fi
 
diff -rup busybox.oorig/testsuite/sort.tests busybox/testsuite/sort.tests
--- busybox.oorig/testsuite/sort.tests	2005-09-02 09:45:29.000000000 +0200
+++ busybox/testsuite/sort.tests	2005-09-20 19:20:51.000000000 +0200
@@ -5,7 +5,7 @@
 # Licensed under GPL v2, see file LICENSE for details.
 
 if [ ${#COMMAND} -eq 0 ]; then COMMAND=sort; fi
-. testing.sh
+. ${srcdir:-.}/testing.sh
 
 # The basic tests.  These should work even with the small busybox.
 
diff -rup busybox.oorig/testsuite/uniq.tests busybox/testsuite/uniq.tests
--- busybox.oorig/testsuite/uniq.tests	2005-09-15 22:00:44.000000000 +0200
+++ busybox/testsuite/uniq.tests	2005-09-20 19:20:51.000000000 +0200
@@ -7,7 +7,7 @@
 # AUDIT: Full SUSv3 coverage (except internationalization).
 
 if [ ${#COMMAND} -eq 0 ]; then COMMAND=uniq; fi
-. testing.sh
+. ${srcdir:-.}/testing.sh
 
 # testing "test name" "options" "expected result" "file input" "stdin"
 #   file input will be file called "input"
@@ -62,7 +62,7 @@ bb	cc	dd8
 aa	bb	cc9
 "
 
-# -d is "Suppress the writing fo lines that are not repeated in the input."
+# -d is "Suppress the writing of lines that are not repeated in the input."
 # -u is "Suppress the writing of lines that are repeated in the input."
 # Therefore, together this means they should produce no output.
 testing "uniq -u and -d produce no output" "-d -u" "" "" \


More information about the busybox mailing list