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