bug-grep
[Top][All Lists]
Advanced

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

[PATCH] tests: use different output files to simplify reading failed .lo


From: Paolo Bonzini
Subject: [PATCH] tests: use different output files to simplify reading failed .log files
Date: Wed, 17 Mar 2010 09:46:05 +0100

I noticed that from the .log files it is hard to understand which
grep invocation fails.  One way to work around it would be to use
set -x, but I think this other fix is better.

* tests/case-fold-backref, tests/case-fold-char-class,
tests/case-fold-char-range, tests/case-fold-char-type: Use a different
name for each output file from grep.
* tests/dfaexec-multibyte: Likewise, and merge some grep invocations.
---
 tests/case-fold-backref    |    4 ++--
 tests/case-fold-char-class |    8 ++++----
 tests/case-fold-char-range |    8 ++++----
 tests/case-fold-char-type  |    8 ++++----
 tests/dfaexec-multibyte    |   23 ++++++++---------------
 5 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/tests/case-fold-backref b/tests/case-fold-backref
index 01a2f1f..528d847 100644
--- a/tests/case-fold-backref
+++ b/tests/case-fold-backref
@@ -7,8 +7,8 @@ printf 'the the\nThe the\nTHE the\n'      > exp1 || 
framework_failure
 fail=0
 
 for LOC in en_US.UTF-8 en_US zh_CN $LOCALE_FR_UTF8 C; do
-  LC_ALL=$LOC grep -Ei '(the) \1' exp1 > out1 || fail=1
-  compare out1 exp1 || fail=1
+  LC_ALL=$LOC grep -Ei '(the) \1' exp1 > out1-$LOC || fail=1
+  compare out1-$LOC exp1 || fail=1
 done
 
 Exit $fail
diff --git a/tests/case-fold-char-class b/tests/case-fold-char-class
index 8b0ac92..46f0d4c 100644
--- a/tests/case-fold-char-class
+++ b/tests/case-fold-char-class
@@ -7,15 +7,15 @@ printf 'Y\n'      > exp1 || framework_failure
 fail=0
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  printf 'X\nY\nZ\n' | LC_ALL=$LOC grep -i '[y]' > out1 || fail=1
-  compare out1 exp1 || fail=1
+  printf 'X\nY\nZ\n' | LC_ALL=$LOC grep -i '[y]' > out1-$LOC || fail=1
+  compare out1-$LOC exp1 || fail=1
 done
 
 printf 'y\n'      > exp2 || framework_failure
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  printf 'x\ny\nz\n' | LC_ALL=$LOC grep -i '[Y]' > out2 || fail=1
-  compare out2 exp2 || fail=1
+  printf 'x\ny\nz\n' | LC_ALL=$LOC grep -i '[Y]' > out2-$LOC || fail=1
+  compare out2-$LOC exp2 || fail=1
 done
 
 Exit $fail
diff --git a/tests/case-fold-char-range b/tests/case-fold-char-range
index 9b3120f..6db5398 100644
--- a/tests/case-fold-char-range
+++ b/tests/case-fold-char-range
@@ -7,16 +7,16 @@ printf 'A\nZ\n'      > exp1 || framework_failure
 fail=0
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  printf 'A\n1\nZ\n.\n' | LC_ALL=$LOC grep -i '[a-z]' > out1 || fail=1
-  compare out1 exp1 || fail=1
+  printf 'A\n1\nZ\n.\n' | LC_ALL=$LOC grep -i '[a-z]' > out1-$LOC || fail=1
+  compare out1-$LOC exp1 || fail=1
 done
 
 # This actually passes also for grep-2.5.3
 printf 'a\nz\n'      > exp2 || framework_failure
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  printf 'a\n1\nz\n.\n' | LC_ALL=$LOC grep -i '[A-Z]' > out2 || fail=1
-  compare out2 exp2 || fail=1
+  printf 'a\n1\nz\n.\n' | LC_ALL=$LOC grep -i '[A-Z]' > out2-$LOC || fail=1
+  compare out2-$LOC exp2 || fail=1
 done
 
 Exit $fail
diff --git a/tests/case-fold-char-type b/tests/case-fold-char-type
index f3a19b4..e2d4835 100644
--- a/tests/case-fold-char-type
+++ b/tests/case-fold-char-type
@@ -7,15 +7,15 @@ printf 'Y\n'      > exp1 || framework_failure
 fail=0
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  printf '1\nY\n.\n' | LC_ALL=$LOC grep -i '[[:lower:]]' > out1 || fail=1
-  compare out1 exp1 || fail=1
+  printf '1\nY\n.\n' | LC_ALL=$LOC grep -i '[[:lower:]]' > out1-$LOC || fail=1
+  compare out1-$LOC exp1 || fail=1
 done
 
 printf 'y\n'      > exp2 || framework_failure
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  printf '1\ny\n.\n' | LC_ALL=$LOC grep -i '[[:upper:]]' > out2 || fail=1
-  compare out2 exp2 || fail=1
+  printf '1\ny\n.\n' | LC_ALL=$LOC grep -i '[[:upper:]]' > out2-$LOC || fail=1
+  compare out2-$LOC exp2 || fail=1
 done
 
 Exit $fail
diff --git a/tests/dfaexec-multibyte b/tests/dfaexec-multibyte
index 47db42b..ea5c428 100644
--- a/tests/dfaexec-multibyte
+++ b/tests/dfaexec-multibyte
@@ -3,27 +3,20 @@
 : ${srcdir=.}
 . "$srcdir/init.sh"; path_prepend_ ../src
 
-printf 'aa\n' > exp-aa || framework_failure
-printf 'ab\n' > exp-ab || framework_failure
-printf '1 2 3\n' > exp-123 || framework_failure
+printf 'aa\nab\nba\nbb\n' > exp1 || framework_failure
+printf '1 2 3\n' > exp2 || framework_failure
 
 fail=0
 
 for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
-  LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp-aa > out || fail=1
-  compare out exp-aa || fail=1
+  LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp1 > out1-ab-$LOC || fail=1
+  compare out1-ab-$LOC exp1 || fail=1
 
-  LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp-aa > out || fail=1
-  compare out exp-aa || fail=1
+  LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp1 > out1-ba-$LOC || fail=1
+  compare out1-ba-$LOC exp1 || fail=1
 
-  LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp-ab > out || fail=1
-  compare out exp-ab || fail=1
-
-  LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp-ab > out || fail=1
-  compare out exp-ab || fail=1
-
-  LC_ALL=$LOC grep -E '^([[:digit:]]+[[:space:]]+){2}' < exp-123 > out || 
fail=1
-  compare out exp-123 || fail=1
+  LC_ALL=$LOC grep -E '^([[:digit:]]+[[:space:]]+){2}' < exp2 > out2-$LOC || 
fail=1
+  compare out2-$LOC exp2 || fail=1
 
 done
 
-- 
1.6.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]