Last change
on this file since 3646 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:
1.0 KB
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | # Check that grep doesn't mishandle long matching lines.
|
---|
3 |
|
---|
4 | . "${srcdir=.}/init.sh"; path_prepend_ ../src
|
---|
5 | expensive_
|
---|
6 |
|
---|
7 | # Create a one-line file containing slightly more than 2 GiB.
|
---|
8 | echo x | dd bs=1024k seek=2048 >2G-plus-2 || framework_failure_
|
---|
9 |
|
---|
10 | skip_diagnostic=
|
---|
11 |
|
---|
12 | # These two patterns catch different kinds of
|
---|
13 | # failures due to internal integer overflows.
|
---|
14 | # However, the second one, '^.*x\(\)\1', provokes
|
---|
15 | # so much memory consumption via regexec.c that it renders
|
---|
16 | # some systems unusable.
|
---|
17 | for pattern in '^.*'; do
|
---|
18 | diagnostic=$(LC_ALL=C grep -a "$pattern" 2G-plus-2 2>&1 >/dev/null)
|
---|
19 | status=$?
|
---|
20 |
|
---|
21 | case $status,$diagnostic in
|
---|
22 | 0,*) ;;
|
---|
23 | 2,*': line too long for re_search')
|
---|
24 | skip_diagnostic='regular expression library cannot handle the test' ;;
|
---|
25 | 137,''|2,*': memory exhausted')
|
---|
26 | # The 137/no-diagnostic arises when the kernel OOM-kills grep.
|
---|
27 | skip_diagnostic='not enough main memory to run the test' ;;
|
---|
28 | *) fail=1 ;;
|
---|
29 | esac
|
---|
30 | done
|
---|
31 |
|
---|
32 | case $fail,$skip_diagnostic in
|
---|
33 | 0,?*) skip_ "$skip_diagnostic" ;;
|
---|
34 | esac
|
---|
35 |
|
---|
36 | Exit $fail
|
---|
Note:
See
TracBrowser
for help on using the repository browser.