svn commit: trunk/busybox/testsuite

vda at busybox.net vda at busybox.net
Mon Nov 26 05:38:21 UTC 2007


Author: vda
Date: 2007-11-25 21:38:20 -0800 (Sun, 25 Nov 2007)
New Revision: 20536

Log:
testsuite: add tests for cut and grep;
slight improvements to infrastructure



Added:
   trunk/busybox/testsuite/cut.tests

Modified:
   trunk/busybox/testsuite/grep.tests
   trunk/busybox/testsuite/runtest
   trunk/busybox/testsuite/testing.sh


Changeset:
Added: trunk/busybox/testsuite/cut.tests
===================================================================
--- trunk/busybox/testsuite/cut.tests	                        (rev 0)
+++ trunk/busybox/testsuite/cut.tests	2007-11-26 05:38:20 UTC (rev 20536)
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# grep tests.
+# Copyright 2007 by Denys Vlasenko <vda.linux at googlemail.com>
+# Licensed under GPL v2, see file LICENSE for details.
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+#   file input will be file called "input"
+#   test can create a file "actual" instead of writing to stdout
+
+testing "cut '-' (stdin) and multi file handling" \
+	"cut -d' ' -f2 - input" \
+	"over\n""quick\n" \
+	"the quick brown fox\n" \
+	"jumps over the lazy dog\n" \
+
+exit $FAILCOUNT

Modified: trunk/busybox/testsuite/grep.tests
===================================================================
--- trunk/busybox/testsuite/grep.tests	2007-11-26 05:37:07 UTC (rev 20535)
+++ trunk/busybox/testsuite/grep.tests	2007-11-26 05:38:20 UTC (rev 20536)
@@ -29,9 +29,10 @@
 
 testing "grep (no newline at EOL)" "grep bug" "bug" "bug" ""
 
-# Note that this assumes actual is empty.
-testing "grep input actual (two files)" "grep two input actual 2> /dev/null" \
+>empty
+testing "grep two files" "grep two input empty 2>/dev/null" \
 	"input:two\n" "one\ntwo\nthree\nthree\nthree\n" ""
+rm empty
 
 testing "grep - infile (specify stdin and file)" "grep two - input" \
 	"(standard input):two\ninput:two\n" "one\ntwo\nthree\n" \
@@ -73,6 +74,8 @@
 # -e regex
 testing "grep handles multiple regexps" "grep -e one -e two input ; echo \$?" \
 	"one\ntwo\n0\n" "one\ntwo\n" ""
+testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \
+	"one\ntwo\n0\n" "one\ntwo\n" ""
 
 optional FEATURE_GREP_EGREP_ALIAS
 testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \

Modified: trunk/busybox/testsuite/runtest
===================================================================
--- trunk/busybox/testsuite/runtest	2007-11-26 05:37:07 UTC (rev 20535)
+++ trunk/busybox/testsuite/runtest	2007-11-26 05:38:20 UTC (rev 20536)
@@ -127,7 +127,7 @@
 			echo "SKIPPED: $applet (not built)"
 			continue
 		fi
-		if PATH="$LINKSDIR":$tsdir:$bindir:$PATH \
+		if PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \
 				"${tsdir:-.}/$applet".tests
 		then
 			:
@@ -137,5 +137,11 @@
 	fi
 
 done
-rm -rf "$LINKSDIR"
+
+# Leaving the dir makes it somewhat easier to run failed test by hand
+#rm -rf "$LINKSDIR"
+
+if [ $status != 0 -a x"$VERBOSE" = x ]; then
+	echo "Failures detected, running with VERBOSE=1 will give more info"
+fi
 exit $status

Modified: trunk/busybox/testsuite/testing.sh
===================================================================
--- trunk/busybox/testsuite/testing.sh	2007-11-26 05:37:07 UTC (rev 20535)
+++ trunk/busybox/testsuite/testing.sh	2007-11-26 05:38:20 UTC (rev 20536)
@@ -58,7 +58,7 @@
 
   if [ $# -ne 5 ]
   then
-    echo "Test $NAME has the wrong number of arguments ($# $*)" >&2
+    echo "Test $NAME has wrong number of arguments (must be 5) ($# $*)" >&2
     exit
   fi
 




More information about the busybox-cvs mailing list