From aad5428ee639eb9c462097022a0954e8a2bcfb90 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sun, 23 Nov 2008 17:24:13 +0100 Subject: [PATCH] Fedora Grep regression test suite --- tests/Makefile.am | 2 +- tests/fedora.sh | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletions(-) create mode 100644 tests/fedora.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 6ac60e6..02f30ac 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,7 +4,7 @@ AWK=@AWK@ TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh pcre.sh \ status.sh empty.sh options.sh backref.sh file.sh foad1.sh \ - fmbtest.sh yesno.sh + fmbtest.sh yesno.sh fedora.sh EXTRA_DIST = $(TESTS) \ khadafy.lines khadafy.regexp \ spencer1.awk spencer1.tests \ diff --git a/tests/fedora.sh b/tests/fedora.sh new file mode 100644 index 0000000..9a140b7 --- /dev/null +++ b/tests/fedora.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +# GREP Regression test suite for Fedora bugs and fixes +# (c) 2008 Lubomir Rintel +# Licensed under the same terms as GNU Grep itself + +if [ -t 1 ] +then + # Colored output on terimal + G='\033[32m' + R='\033[31m' + D='\033[0m' +fi + +ok () { echo -e "${G}OK${D}"; } +fail () { echo -e "${R}FAIL${D} (See ${U})"; failures=1; } + +U=https://bugzilla.redhat.com/show_bug.cgi?id=116909 +echo -n "fgrep false negatives: " +diff <(${GREP} -F -w -f \ +<(cat <' | LANG=it_IT ${GREP} -iE '\Wform\W') \ +<(cat < +EOF +) && ok || fail + +U=https://bugzilla.redhat.com/show_bug.cgi?id=189580 +echo -n "grep -D skip opening a special file: " +${GREP} -D skip foo /dev/zero & +sleep 1 +kill $! 2>/dev/null && fail || ok + +U=https://bugzilla.redhat.com/show_bug.cgi?id=169524 +echo -n "grep -Fw looping infinitely: " +echo foobar | ${GREP} -Fw "" & +sleep 1 +kill $! 2>/dev/null && fail || ok + +U=https://bugzilla.redhat.com/show_bug.cgi?id=140781 +echo -n "fgrep hangs on binary files: " +${GREP} -F grep $(which ${GREP}) >/dev/null & +sleep 1 +kill $! 2>/dev/null && fail || ok + +U=https://bugzilla.redhat.com/show_bug.cgi?id=161700 +echo -n "grep -Fw fails to match anything: " +diff <(${GREP} -Fw test <(cat </dev/null || exit $failures + +U=https://bugzilla.redhat.com/show_bug.cgi?id=171379 +echo -n "grep -P crashes on whitespace lines: " +diff <(${GREP} -P '^\s+$' <(echo " ")) \ +<(echo " ") && ok || fail + +U=https://bugzilla.redhat.com/show_bug.cgi?id=204255 +echo -n "-e '' does not work if not a first parameter: " +diff <(echo test | grep -e 'HighlightThis' -e '') \ + <(echo test | grep -e '' -e 'HighlightThis') && ok || fail + +U=https://bugzilla.redhat.com/show_bug.cgi?id=324781 +echo -n "bad handling of line breaks with grep -P #1: " +echo -ne "a\na" | ${GREP} -P '[^a]' >/dev/null && fail || ok + +# This is mostly a check that fix for above doesn't break -P further +echo -n "bad handling of line breaks with grep -P #2: " +echo -ne "a\na" | ${GREP} -P '[^b].[^b]' >/dev/null && fail || ok + +exit $failures -- 1.5.5.1