Debian Codegraph @

tests/fedora

raw
1 #!/bin/sh
2
3 . "${srcdir=.}/init.sh"; path_prepend_ ../src
4
5 # GREP Regression test suite for Fedora bugs and fixes
6 # (c) 2008 Lubomir Rintel
7 # Licensed under the same terms as GNU Grep itself
8
9 if [ -t 1 ]
10 then
11 # Colored output on terminal
12 G='\033[32m'
13 R='\033[31m'
14 D='\033[0m'
15 fi
16
17 ok () { printf "${G}OK${D}"; }
18 fail () { printf "${R}FAIL${D} (See ${U})"; failures=1; }
19
20 U=https://bugzilla.redhat.com/show_bug.cgi?id=116909
21 printf "grep -F false negatives: "
22 cat > 116909.list <<EOF
23 a
24 b
25 c
26 EOF
27 cat > 116909.in <<EOF
28 a
29 barn
30 c
31 EOF
32 cat > 116909.out <<EOF
33 a
34 c
35 EOF
36 grep -F -w -f 116909.list 116909.in > actual || fail
37 compare 116909.out actual && ok || fail
38
39 U=https://bugzilla.redhat.com/show_bug.cgi?id=123362
40 printf 'bad handling of brackets in UTF-8: '
41 echo Y > 123362.out
42 echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' > actual || fail
43 compare 123362.out actual && ok || fail
44
45 U=https://bugzilla.redhat.com/show_bug.cgi?id=112869
46 printf 'crash with \\W: '
47 echo '<form>' > 112869.out
48 LANG=it_IT grep -iE '\Wform\W' 112869.out > actual || fail
49 compare 112869.out actual && ok || fail
50
51 if ( timeout --version ) > /dev/null 2>&1; then
52
53 U=https://bugzilla.redhat.com/show_bug.cgi?id=189580
54 printf 'grep -D skip opening a special file: '
55 returns_ 124 timeout 10 grep -D skip foo /dev/zero && fail || ok
56
57 U=https://bugzilla.redhat.com/show_bug.cgi?id=169524
58 printf 'grep -Fw looping infinitely: '
59 echo foobar | returns_ 124 timeout 10 grep -Fw "" && fail || ok
60
61 U=https://bugzilla.redhat.com/show_bug.cgi?id=140781
62 printf 'grep -F hangs on binary files: '
63 returns_ 124 timeout 10 grep -F grep "$abs_top_builddir/src/grep" \
64 > /dev/null && fail || ok
65
66 fi
67
68 U=https://bugzilla.redhat.com/show_bug.cgi?id=161700
69 printf 'grep -Fw fails to match anything: '
70 echo test > 161700.out
71 grep -Fw test 161700.out > actual || fail
72 compare 161700.out actual && ok || fail
73
74 U=https://bugzilla.redhat.com/show_bug.cgi?id=179698
75 printf 'grep -w broken in non-utf8 multibyte locales: '
76 echo za a > 179698.out
77 LANG=ja_JP.eucjp grep -w a 179698.out > actual || fail
78 compare 179698.out actual && ok || fail
79
80 # Skip the rest of tests in compiled without PCRE
81 echo a |grep -P a >/dev/null || Exit $failures
82
83 U=https://bugzilla.redhat.com/show_bug.cgi?id=171379
84 printf 'grep -P crashes on whitespace lines: '
85 echo ' ' > 171379.out
86 grep -P '^\s+$' 171379.out > actual || fail
87 compare 171379.out actual && ok || fail
88
89 U=https://bugzilla.redhat.com/show_bug.cgi?id=204255
90 printf '%s' "-e '' does not work if not a first parameter: "
91 echo test | grep -e 'HighlightThis' -e '' > 204255.first
92 echo test | grep -e '' -e 'HighlightThis' > 204255.second
93 diff 204255.first 204255.second && ok || fail
94
95 U=https://bugzilla.redhat.com/show_bug.cgi?id=324781
96 printf 'bad handling of line breaks with grep -P #1: '
97 printf 'a\na' | grep -P '[^a]' >/dev/null && fail || ok
98
99 # This is mostly a check that fix for above doesn't break -P further
100 printf '%s' "bad handling of line breaks with grep -P #2: "
101 printf 'a\na' | grep -P '[^b].[^b]' >/dev/null && fail || ok
102
103 Exit $failures