VirtualBox

source: kBuild/vendor/grep/2.12/tests/fedora

Last change on this file was 2595, checked in by bird, 12 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 2.9 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 | diff - 116909.out && ok || fail
37
38U=https://bugzilla.redhat.com/show_bug.cgi?id=123362
39printf 'bad handling of brackets in UTF-8: '
40echo Y > 123362.out
41echo Y | LC_ALL=de_DE.UTF-8 grep -i '[y,Y]' | diff - 123362.out && ok || fail
42
43U=https://bugzilla.redhat.com/show_bug.cgi?id=112869
44printf 'crash with \\W: '
45echo '<form>' > 112869.out
46LANG=it_IT grep -iE '\Wform\W' 112869.out | diff - 112869.out && ok || fail
47
48if ( timeout --version ) > /dev/null 2>&1; then
49
50 U=https://bugzilla.redhat.com/show_bug.cgi?id=189580
51 printf 'grep -D skip opening a special file: '
52 timeout 10 grep -D skip foo /dev/zero
53 test $? = 124 && fail || ok
54
55 U=https://bugzilla.redhat.com/show_bug.cgi?id=169524
56 printf 'grep -Fw looping infinitely: '
57 echo foobar | timeout 10 grep -Fw ""
58 test $? = 124 && fail || ok
59
60 U=https://bugzilla.redhat.com/show_bug.cgi?id=140781
61 printf 'fgrep hangs on binary files: '
62 timeout 10 grep -F grep "$abs_top_builddir/src/grep" >/dev/null
63 test $? = 124 && fail || ok
64
65fi
66
67U=https://bugzilla.redhat.com/show_bug.cgi?id=161700
68printf 'grep -Fw fails to match anything: '
69echo test > 161700.out
70grep -Fw test 161700.out | diff - 161700.out && ok || fail
71
72U=https://bugzilla.redhat.com/show_bug.cgi?id=179698
73printf 'grep -w broken in non-utf8 multibyte locales: '
74echo za a > 179698.out
75LANG=ja_JP.eucjp grep -w a 179698.out | diff - 179698.out && ok || fail
76
77# Skip the rest of tests in compiled without PCRE
78echo a |grep -P a >/dev/null || Exit $failures
79
80U=https://bugzilla.redhat.com/show_bug.cgi?id=171379
81printf 'grep -P crashes on whitespace lines: '
82echo ' ' > 171379.out
83grep -P '^\s+$' 171379.out | diff - 171379.out && ok || fail
84
85U=https://bugzilla.redhat.com/show_bug.cgi?id=204255
86printf '%s' "-e '' does not work if not a first parameter: "
87echo test | grep -e 'HighlightThis' -e '' > 204255.first
88echo test | grep -e '' -e 'HighlightThis' > 204255.second
89diff 204255.first 204255.second && ok || fail
90
91U=https://bugzilla.redhat.com/show_bug.cgi?id=324781
92printf 'bad handling of line breaks with grep -P #1: '
93printf 'a\na' | grep -P '[^a]' >/dev/null && fail || ok
94
95# This is mostly a check that fix for above doesn't break -P further
96printf '%s' "bad handling of line breaks with grep -P #2: "
97printf 'a\na' | grep -P '[^b].[^b]' >/dev/null && fail || ok
98
99Exit $failures
Note: See TracBrowser for help on using the repository browser.

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