VirtualBox

source: kBuild/trunk/src/grep/tests/fedora@ 3532

Last change on this file since 3532 was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 3.0 KB
Line 
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
9if [ -t 1 ]
10then
11 # Colored output on terminal
12 G='\033[32m'
13 R='\033[31m'
14 D='\033[0m'
15fi
16
17ok () { printf "${G}OK${D}"; }
18fail () { printf "${R}FAIL${D} (See ${U})"; failures=1; }
19
20U=https://bugzilla.redhat.com/show_bug.cgi?id=116909
21printf "fgrep false negatives: "
22cat > 116909.list <<EOF
23a
24b
25c
26EOF
27cat > 116909.in <<EOF
28a
29barn
30c
31EOF
32cat > 116909.out <<EOF
33a
34c
35EOF
36grep -F -w -f 116909.list 116909.in > actual || fail
37compare 116909.out actual && ok || fail
38
39U=https://bugzilla.redhat.com/show_bug.cgi?id=123362
40printf 'bad handling of brackets in UTF-8: '
41echo Y > 123362.out
42echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' > actual || fail
43compare 123362.out actual && ok || fail
44
45U=https://bugzilla.redhat.com/show_bug.cgi?id=112869
46printf 'crash with \\W: '
47echo '<form>' > 112869.out
48LANG=it_IT grep -iE '\Wform\W' 112869.out > actual || fail
49compare 112869.out actual && ok || fail
50
51if ( 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 'fgrep hangs on binary files: '
63 returns_ 124 timeout 10 grep -F grep "$abs_top_builddir/src/grep" \
64 > /dev/null && fail || ok
65
66fi
67
68U=https://bugzilla.redhat.com/show_bug.cgi?id=161700
69printf 'grep -Fw fails to match anything: '
70echo test > 161700.out
71grep -Fw test 161700.out > actual || fail
72compare 161700.out actual && ok || fail
73
74U=https://bugzilla.redhat.com/show_bug.cgi?id=179698
75printf 'grep -w broken in non-utf8 multibyte locales: '
76echo za a > 179698.out
77LANG=ja_JP.eucjp grep -w a 179698.out > actual || fail
78compare 179698.out actual && ok || fail
79
80# Skip the rest of tests in compiled without PCRE
81echo a |grep -P a >/dev/null || Exit $failures
82
83U=https://bugzilla.redhat.com/show_bug.cgi?id=171379
84printf 'grep -P crashes on whitespace lines: '
85echo ' ' > 171379.out
86grep -P '^\s+$' 171379.out > actual || fail
87compare 171379.out actual && ok || fail
88
89U=https://bugzilla.redhat.com/show_bug.cgi?id=204255
90printf '%s' "-e '' does not work if not a first parameter: "
91echo test | grep -e 'HighlightThis' -e '' > 204255.first
92echo test | grep -e '' -e 'HighlightThis' > 204255.second
93diff 204255.first 204255.second && ok || fail
94
95U=https://bugzilla.redhat.com/show_bug.cgi?id=324781
96printf 'bad handling of line breaks with grep -P #1: '
97printf '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
100printf '%s' "bad handling of line breaks with grep -P #2: "
101printf 'a\na' | grep -P '[^b].[^b]' >/dev/null && fail || ok
102
103Exit $failures
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette