bkabrda / rpms / grep

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