Debian Codegraph @

tests/fgrep-infloop

raw
1 #!/bin/sh
2 # This would infloop for grep-2.6.1
3 . "${srcdir=.}/init.sh"; path_prepend_ ../src
4
5 require_en_utf8_locale_
6 require_timeout_
7 require_compiled_in_MB_support
8
9 encode() { echo "$1" | tr ABC '\357\274\241'; }
10
11 encode ABC > in || framework_failure_
12 fail=0
13
14 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
15 out=out1-$LOC
16 LC_ALL=$LOC timeout 10s grep -F "$(encode BC)" in > $out
17 status=$?
18 if test $status -eq 0; then
19 compare in $out
20 elif test $status -eq 1; then
21 compare_dev_null_ /dev/null $out
22 else
23 test $status -eq 2
24 fi || fail=1
25 done
26
27 Exit $fail