summaryrefslogtreecommitdiff
path: root/tests/fgrep-infloop
diff options
context:
space:
mode:
authorNorihiro Tanaka <noritnk@kcn.ne.jp>2010-03-28 17:56:22 +0200
committerJim Meyering <meyering@redhat.com>2010-03-28 20:59:44 +0200
commit46c97344bac16916352b198ac5fbe14c5cd2bf2c (patch)
treedd583d137e2eddaa4b1034d521d8956b1d8ffb64 /tests/fgrep-infloop
parentdb9d6340b42a7774fae526f6a90eea3ce834e2d0 (diff)
downloadgrep-46c97344bac16916352b198ac5fbe14c5cd2bf2c.tar.gz
tests: add tests for the fgrep-infloop bug
* tests/init.cfg (require_timeout_): New function. * tests/fgrep-infloop: New file. Test for the above fix. * tests/Makefile.am (TESTS): Add it.
Diffstat (limited to 'tests/fgrep-infloop')
-rw-r--r--tests/fgrep-infloop20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/fgrep-infloop b/tests/fgrep-infloop
new file mode 100644
index 00000000..159baca5
--- /dev/null
+++ b/tests/fgrep-infloop
@@ -0,0 +1,20 @@
+#!/bin/sh
+# This would infloop for grep-2.6.1
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+require_timeout_
+
+encode() { echo "$1" | tr ABC '\357\274\241'; }
+
+fail=0
+
+for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
+ out=out1-$LOC
+ encode ABC \
+ | LC_ALL=$LOC timeout 10s grep -F "$(encode BC)" > $out 2>&1
+ test $? = 1 || fail=1
+ compare $out /dev/null || fail=1
+done
+
+Exit $fail