VirtualBox

source: kBuild/vendor/grep/2.12/tests/big-match@ 3627

Last change on this file since 3627 was 2595, checked in by bird, 13 years ago

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

File size: 852 bytes
Line 
1#!/bin/sh
2# Check that grep doesn't mishandle long matching lines.
3
4. "${srcdir=.}/init.sh"; path_prepend_ ../src
5expensive_
6
7# Create a one-line file containing slightly more than 2 GiB.
8echo x | dd bs=1024k seek=2048 >2G-plus-2 || framework_failure_
9
10skip_diagnostic=
11
12# These two patterns catch different kinds of
13# failures due to internal integer overflows.
14for pattern in '^.*' '^.*x\(\)\1'; do
15 diagnostic=$(LC_ALL=C grep -a "$pattern" 2G-plus-2 2>&1 >/dev/null)
16 status=$?
17
18 case $status,$diagnostic in
19 0,*) ;;
20 2,*': line too long for re_search')
21 skip_diagnostic='regular expression library cannot handle the test' ;;
22 2,*': memory exhausted')
23 skip_diagnostic='not enough main memory to run the test' ;;
24 *) fail=1 ;;
25 esac
26done
27
28case $fail,$skip_diagnostic in
290,?*) skip_ "$skip_diagnostic" ;;
30esac
31
32Exit $fail
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