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:
1011 bytes
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | # Check that grep --binary-file=without-match quickly skips files with holes.
|
---|
3 |
|
---|
4 | . "${srcdir=.}/init.sh"; path_prepend_ ../src
|
---|
5 |
|
---|
6 | expensive_
|
---|
7 |
|
---|
8 | # Skip this test if there is no usable SEEK_HOLE support,
|
---|
9 | # as is the case with linux-3.5.0 on ext4 and tmpfs file systems.
|
---|
10 | $PERL -e '$f=*STDERR; sysseek($f,2**22,0); syswrite($f,"a");' \
|
---|
11 | -e 'exit ("0 but true" ne sysseek($f,0,4))' 2> seek-hole-test \
|
---|
12 | || skip_ "this system/FS lacks SEEK_HOLE support"
|
---|
13 |
|
---|
14 | # Try to make this test not THAT expensive, on typical hosts.
|
---|
15 | virtual_memory_KiB=10240
|
---|
16 | if echo x | (ulimit -v $virtual_memory_KiB && grep x) >/dev/null 2>&1; then
|
---|
17 | ulimit -v $virtual_memory_KiB
|
---|
18 | fi
|
---|
19 |
|
---|
20 | # Create a file that starts with at least a buffer's worth of text,
|
---|
21 | # but has a big hole later.
|
---|
22 | (${AWK-awk} 'BEGIN{ for (i=0;i<1000;i++) printf "%080d\n", 0 }' < /dev/null
|
---|
23 | echo x | dd bs=1024k seek=8000000
|
---|
24 | ) >8T-or-so || skip_ 'cannot create big sparse file'
|
---|
25 |
|
---|
26 | grep --binary-file=without-match x 8T-or-so >/dev/null
|
---|
27 | test $? -eq 1 || fail=1
|
---|
28 |
|
---|
29 | Exit $fail
|
---|
Note:
See
TracBrowser
for help on using the repository browser.