| 1 |
From aad5428ee639eb9c462097022a0954e8a2bcfb90 Mon Sep 17 00:00:00 2001
|
| 2 |
From: Lubomir Rintel <lkundrak@v3.sk>
|
| 3 |
Date: Sun, 23 Nov 2008 17:24:13 +0100
|
| 4 |
Subject: [PATCH] Fedora Grep regression test suite
|
| 5 |
|
| 6 |
---
|
| 7 |
tests/Makefile.am | 2 +-
|
| 8 |
tests/fedora.sh | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 9 |
2 files changed, 114 insertions(+), 1 deletions(-)
|
| 10 |
create mode 100644 tests/fedora.sh
|
| 11 |
|
| 12 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
| 13 |
index 6ac60e6..02f30ac 100644
|
| 14 |
--- a/tests/Makefile.am
|
| 15 |
+++ b/tests/Makefile.am
|
| 16 |
@@ -4,7 +4,7 @@ AWK=@AWK@
|
| 17 |
|
| 18 |
TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh pcre.sh \
|
| 19 |
status.sh empty.sh options.sh backref.sh file.sh foad1.sh \
|
| 20 |
- fmbtest.sh yesno.sh
|
| 21 |
+ fmbtest.sh yesno.sh fedora.sh
|
| 22 |
EXTRA_DIST = $(TESTS) \
|
| 23 |
khadafy.lines khadafy.regexp \
|
| 24 |
spencer1.awk spencer1.tests \
|
| 25 |
diff --git a/tests/fedora.sh b/tests/fedora.sh
|
| 26 |
new file mode 100644
|
| 27 |
index 0000000..9a140b7
|
| 28 |
--- /dev/null
|
| 29 |
+++ b/tests/fedora.sh
|
| 30 |
@@ -0,0 +1,113 @@
|
| 31 |
+#!/bin/bash
|
| 32 |
+
|
| 33 |
+# GREP Regression test suite for Fedora bugs and fixes
|
| 34 |
+# (c) 2008 Lubomir Rintel
|
| 35 |
+# Licensed under the same terms as GNU Grep itself
|
| 36 |
+
|
| 37 |
+if [ -t 1 ]
|
| 38 |
+then
|
| 39 |
+ # Colored output on terimal
|
| 40 |
+ G='\033[32m'
|
| 41 |
+ R='\033[31m'
|
| 42 |
+ D='\033[0m'
|
| 43 |
+fi
|
| 44 |
+
|
| 45 |
+ok () { echo -e "${G}OK${D}"; }
|
| 46 |
+fail () { echo -e "${R}FAIL${D} (See ${U})"; failures=1; }
|
| 47 |
+
|
| 48 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=116909
|
| 49 |
+echo -n "fgrep false negatives: "
|
| 50 |
+diff <(${GREP} -F -w -f \
|
| 51 |
+<(cat <<EOF
|
| 52 |
+a
|
| 53 |
+b
|
| 54 |
+c
|
| 55 |
+EOF
|
| 56 |
+) \
|
| 57 |
+<(cat <<EOF
|
| 58 |
+a
|
| 59 |
+barn
|
| 60 |
+c
|
| 61 |
+EOF
|
| 62 |
+)) \
|
| 63 |
+<(cat <<EOF
|
| 64 |
+a
|
| 65 |
+c
|
| 66 |
+EOF
|
| 67 |
+) && ok || fail
|
| 68 |
+
|
| 69 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=123362
|
| 70 |
+echo -n "bad handling of brackets in UTF-8: "
|
| 71 |
+diff <(echo Y | LC_ALL=de_DE.UTF-8 ${GREP} -i '[y,Y]') \
|
| 72 |
+<(cat <<EOF
|
| 73 |
+Y
|
| 74 |
+EOF
|
| 75 |
+) && ok || fail
|
| 76 |
+
|
| 77 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=112869
|
| 78 |
+echo -n "crash with \W: "
|
| 79 |
+diff <(echo '<form>' | LANG=it_IT ${GREP} -iE '\Wform\W') \
|
| 80 |
+<(cat <<EOF
|
| 81 |
+<form>
|
| 82 |
+EOF
|
| 83 |
+) && ok || fail
|
| 84 |
+
|
| 85 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=189580
|
| 86 |
+echo -n "grep -D skip opening a special file: "
|
| 87 |
+${GREP} -D skip foo /dev/zero &
|
| 88 |
+sleep 1
|
| 89 |
+kill $! 2>/dev/null && fail || ok
|
| 90 |
+
|
| 91 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=169524
|
| 92 |
+echo -n "grep -Fw looping infinitely: "
|
| 93 |
+echo foobar | ${GREP} -Fw "" &
|
| 94 |
+sleep 1
|
| 95 |
+kill $! 2>/dev/null && fail || ok
|
| 96 |
+
|
| 97 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=140781
|
| 98 |
+echo -n "fgrep hangs on binary files: "
|
| 99 |
+${GREP} -F grep $(which ${GREP}) >/dev/null &
|
| 100 |
+sleep 1
|
| 101 |
+kill $! 2>/dev/null && fail || ok
|
| 102 |
+
|
| 103 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=161700
|
| 104 |
+echo -n "grep -Fw fails to match anything: "
|
| 105 |
+diff <(${GREP} -Fw test <(cat <<EOF
|
| 106 |
+test
|
| 107 |
+EOF
|
| 108 |
+)) \
|
| 109 |
+<(cat <<EOF
|
| 110 |
+test
|
| 111 |
+EOF
|
| 112 |
+) && ok || fail
|
| 113 |
+
|
| 114 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=179698
|
| 115 |
+echo -n "grep -w broken in non-utf8 multibyte locales"
|
| 116 |
+diff <(echo za a | LANG=ja_JP.eucjp grep -w a) \
|
| 117 |
+<(cat <<EOF
|
| 118 |
+za a
|
| 119 |
+EOF
|
| 120 |
+) && ok || fail
|
| 121 |
+
|
| 122 |
+# Skip the rest of tests in compiled without PCRE
|
| 123 |
+echo a |grep -P a >/dev/null || exit $failures
|
| 124 |
+
|
| 125 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=171379
|
| 126 |
+echo -n "grep -P crashes on whitespace lines: "
|
| 127 |
+diff <(${GREP} -P '^\s+$' <(echo " ")) \
|
| 128 |
+<(echo " ") && ok || fail
|
| 129 |
+
|
| 130 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=204255
|
| 131 |
+echo -n "-e '' does not work if not a first parameter: "
|
| 132 |
+diff <(echo test | grep -e 'HighlightThis' -e '') \
|
| 133 |
+ <(echo test | grep -e '' -e 'HighlightThis') && ok || fail
|
| 134 |
+
|
| 135 |
+U=https://bugzilla.redhat.com/show_bug.cgi?id=324781
|
| 136 |
+echo -n "bad handling of line breaks with grep -P #1: "
|
| 137 |
+echo -ne "a\na" | ${GREP} -P '[^a]' >/dev/null && fail || ok
|
| 138 |
+
|
| 139 |
+# This is mostly a check that fix for above doesn't break -P further
|
| 140 |
+echo -n "bad handling of line breaks with grep -P #2: "
|
| 141 |
+echo -ne "a\na" | ${GREP} -P '[^b].[^b]' >/dev/null && fail || ok
|
| 142 |
+
|
| 143 |
+exit $failures
|
| 144 |
--
|
| 145 |
1.5.5.1
|
| 146 |
|