Blame tests/fedora

Packit 709fb3
#!/bin/sh
Packit 709fb3
Packit 709fb3
. "${srcdir=.}/init.sh"; path_prepend_ ../src
Packit 709fb3
Packit 709fb3
# GREP Regression test suite for Fedora bugs and fixes
Packit 709fb3
# (c) 2008 Lubomir Rintel
Packit 709fb3
# Licensed under the same terms as GNU Grep itself
Packit 709fb3
Packit 709fb3
if [ -t 1 ]
Packit 709fb3
then
Packit 709fb3
        # Colored output on terminal
Packit 709fb3
        G='\033[32m'
Packit 709fb3
        R='\033[31m'
Packit 709fb3
        D='\033[0m'
Packit 709fb3
fi
Packit 709fb3
Packit 709fb3
ok ()	{ printf "${G}OK${D}"; }
Packit 709fb3
fail () { printf "${R}FAIL${D} (See ${U})"; failures=1; }
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=116909
Packit 709fb3
printf "fgrep false negatives: "
Packit 709fb3
cat > 116909.list <
Packit 709fb3
a
Packit 709fb3
b
Packit 709fb3
c
Packit 709fb3
EOF
Packit 709fb3
cat > 116909.in <
Packit 709fb3
a
Packit 709fb3
barn
Packit 709fb3
c
Packit 709fb3
EOF
Packit 709fb3
cat > 116909.out <
Packit 709fb3
a
Packit 709fb3
c
Packit 709fb3
EOF
Packit 709fb3
grep -F -w -f 116909.list 116909.in > actual || fail
Packit 709fb3
compare 116909.out actual && ok || fail
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=123362
Packit 709fb3
printf 'bad handling of brackets in UTF-8: '
Packit 709fb3
echo Y > 123362.out
Packit 709fb3
echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' > actual || fail
Packit 709fb3
compare 123362.out actual && ok || fail
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=112869
Packit 709fb3
printf 'crash with \\W: '
Packit 709fb3
echo '<form>' > 112869.out
Packit 709fb3
LANG=it_IT grep -iE '\Wform\W' 112869.out > actual || fail
Packit 709fb3
compare 112869.out actual && ok || fail
Packit 709fb3
Packit 709fb3
if ( timeout --version ) > /dev/null 2>&1; then
Packit 709fb3
Packit 709fb3
  U=https://bugzilla.redhat.com/show_bug.cgi?id=189580
Packit 709fb3
  printf 'grep -D skip opening a special file: '
Packit 709fb3
  returns_ 124 timeout 10 grep -D skip foo /dev/zero && fail || ok
Packit 709fb3
Packit 709fb3
  U=https://bugzilla.redhat.com/show_bug.cgi?id=169524
Packit 709fb3
  printf 'grep -Fw looping infinitely: '
Packit 709fb3
  echo foobar | returns_ 124 timeout 10 grep -Fw "" && fail || ok
Packit 709fb3
Packit 709fb3
  U=https://bugzilla.redhat.com/show_bug.cgi?id=140781
Packit 709fb3
  printf 'fgrep hangs on binary files: '
Packit 709fb3
  returns_ 124 timeout 10 grep -F grep "$abs_top_builddir/src/grep" \
Packit 709fb3
    > /dev/null && fail || ok
Packit 709fb3
Packit 709fb3
fi
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=161700
Packit 709fb3
printf 'grep -Fw fails to match anything: '
Packit 709fb3
echo test > 161700.out
Packit 709fb3
grep -Fw test 161700.out > actual || fail
Packit 709fb3
compare 161700.out actual && ok || fail
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=179698
Packit 709fb3
printf 'grep -w broken in non-utf8 multibyte locales: '
Packit 709fb3
echo za a > 179698.out
Packit 709fb3
LANG=ja_JP.eucjp grep -w a 179698.out > actual || fail
Packit 709fb3
compare 179698.out actual && ok || fail
Packit 709fb3
Packit 709fb3
# Skip the rest of tests in compiled without PCRE
Packit 709fb3
echo a |grep -P a >/dev/null || Exit $failures
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=171379
Packit 709fb3
printf 'grep -P crashes on whitespace lines: '
Packit 709fb3
echo '   ' > 171379.out
Packit 709fb3
grep -P '^\s+$' 171379.out > actual || fail
Packit 709fb3
compare 171379.out actual && ok || fail
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=204255
Packit 709fb3
printf '%s' "-e '' does not work if not a first parameter: "
Packit 709fb3
echo test | grep -e 'HighlightThis' -e '' > 204255.first
Packit 709fb3
echo test | grep -e '' -e 'HighlightThis' > 204255.second
Packit 709fb3
diff 204255.first 204255.second && ok || fail
Packit 709fb3
Packit 709fb3
U=https://bugzilla.redhat.com/show_bug.cgi?id=324781
Packit 709fb3
printf 'bad handling of line breaks with grep -P #1: '
Packit 709fb3
printf 'a\na' | grep -P '[^a]' >/dev/null && fail || ok
Packit 709fb3
Packit 709fb3
# This is mostly a check that fix for above doesn't break -P further
Packit 709fb3
printf '%s' "bad handling of line breaks with grep -P #2: "
Packit 709fb3
printf 'a\na' | grep -P '[^b].[^b]' >/dev/null && fail || ok
Packit 709fb3
Packit 709fb3
Exit $failures