VirtualBox

source: kBuild/vendor/grep/2.12/tests/backref-multibyte-slow@ 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: 949 bytes
Line 
1#!/bin/sh
2# This was approximately quadratic up to grep-2.6.3
3. "${srcdir=.}/init.sh"; path_prepend_ ../src
4
5require_en_utf8_locale_
6require_timeout_
7
8fail=0
9
10# Create a 13000-line input
11$AWK 'BEGIN {for (i=0; i<13000; i++) print "aba"}' /dev/null > in || fail=1
12
13# Use 10 times the duration of running grep in the C locale as the timeout
14# when running in en_US.UTF-8. Round up to whole seconds, since timeout
15# can't deal with fractional seconds.
16max_seconds=$(LC_ALL=C perl -le 'use Time::HiRes qw(time); my $s = time();
17 system q,grep -E '\''^([a-z]).\1$'\'' in > /dev/null,;
18 my $elapsed = time() - $s; print int (1 + 10 * $elapsed)') \
19 || { max_seconds=5;
20 warn_ "$ME_: warning: no perl? using default of 5s timeout"; }
21
22for LOC in en_US.UTF-8; do
23 out=out-$LOC
24 LC_ALL=$LOC timeout ${max_seconds}s grep -E '^([a-z]).\1$' in > $out 2>&1
25 test $? = 0 || fail=1
26 compare $out in || fail=1
27done
28
29Exit $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