Please find attached a patch that makes the following changes to the
test suite:
- The output for a failing test generated by tests/spencer1.awk is
more informative.
- tests/spencer1.awk doesn't run grep in backticks, so the shell
doesn't subject the pattern to any form of quote removal. This
fixes three spurious test failures in tests/spencer2.sh (#91, #92,
#93).
- tests/foad1.sh uses the $GREP environment variable as $GREP (not the
space-protected version "$GREP"), to match the rest of the test
suite.
- Add additional generated files to .cvsignore.
--
Aaron Crane
Index: .cvsignore
===================================================================
RCS file: /sources/grep/grep/tests/.cvsignore,v
retrieving revision 1.2
diff -u -p -r1.2 .cvsignore
--- .cvsignore 20 Nov 2004 14:46:19 -0000 1.2
+++ .cvsignore 15 Oct 2006 16:45:03 -0000
@@ -5,3 +5,5 @@ ere.script
khadafy.out
patfile
spencer1.script
+spencer2.script
+yesno.txt
Index: foad1.sh
===================================================================
RCS file: /sources/grep/grep/tests/foad1.sh,v
retrieving revision 1.15
diff -u -p -r1.15 foad1.sh
--- foad1.sh 18 Nov 2005 20:02:22 -0000 1.15
+++ foad1.sh 15 Oct 2006 16:45:04 -0000
@@ -16,7 +16,7 @@ grep_test ()
INPUT="$1"
EXPECT="$2"
shift 2
- OUTPUT=`echo -n "$INPUT" | tr "/" "\n" | "$GREP" "$@" | tr "\n" "/"`
+ OUTPUT=`echo -n "$INPUT" | tr "/" "\n" | $GREP "$@" | tr "\n" "/"`
if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "1"; then
echo "Testing: $GREP $@"
test "$LC_ALL" != C && test "$LC_ALL" != "" && echo " LC_ALL: \"$LC_ALL\""
@@ -128,7 +128,7 @@ grep_test "$x3" "$y3" -F -w --color=alwa
# The rest of this file is meant to be executed under this locale.
LC_ALL=cs_CZ.UTF-8; export LC_ALL
# If the UTF-8 locale doesn't work, skip these tests silently.
-locale -k LC_CTYPE 2>/dev/null | "${GREP}" -q "charmap.*UTF-8" || exit
$failures
+locale -k LC_CTYPE 2>/dev/null | ${GREP} -q "charmap.*UTF-8" || exit $failures
# Test character class erroneously matching a '[' character.
grep_test "[/" "" "[[:alpha:]]" -E
Index: spencer1.awk
===================================================================
RCS file: /sources/grep/grep/tests/spencer1.awk,v
retrieving revision 1.8
diff -u -p -r1.8 spencer1.awk
--- spencer1.awk 19 Nov 2004 14:00:18 -0000 1.8
+++ spencer1.awk 15 Oct 2006 16:45:04 -0000
@@ -4,10 +4,10 @@ BEGIN {
}
$0 !~ /^#/ && NF == 3 {
-# printf ("status=`echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo
$?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ; echo
$?; }`\n",$3, $2);
+ printf ("echo '%s' | $GREP -E -e '%s' > /dev/null 2>&1\n", $3, $2);
+ printf ("status=$?\n");
printf ("if test $status -ne %s ; then\n", $1);
- printf ("\techo Spencer test \\#%d failed\n", ++n);
+ printf ("\techo \"Spencer test #%d failed (expected=%s
status=$status)\"\n", ++n, $1);
printf ("\tfailures=1\n");
printf ("fi\n");
}