| 
            Last change
 on this file was             3529, checked in by bird, 4 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.1 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | #!/bin/sh
 | 
|---|
| 2 | # This was approximately quadratic up to grep-2.6.3
 | 
|---|
| 3 | . "${srcdir=.}/init.sh"; path_prepend_ ../src
 | 
|---|
| 4 | 
 | 
|---|
| 5 | require_en_utf8_locale_
 | 
|---|
| 6 | require_timeout_
 | 
|---|
| 7 | 
 | 
|---|
| 8 | fail=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.
 | 
|---|
| 16 | max_seconds=$(LC_ALL=C perl -le 'use Time::HiRes qw(time); my $s = time();
 | 
|---|
| 17 |               system q,grep -E '\''^([a-z]).\1$'\'' in > junk,;
 | 
|---|
| 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 | 
 | 
|---|
| 22 | # If the above finished so quickly that we'd have a 1-second timeout,
 | 
|---|
| 23 | # increase it to a duration less likely to arise in a parallel test run.
 | 
|---|
| 24 | test $max_seconds = 1 && max_seconds=5
 | 
|---|
| 25 | 
 | 
|---|
| 26 | for LOC in en_US.UTF-8; do
 | 
|---|
| 27 |   out=out-$LOC
 | 
|---|
| 28 |   LC_ALL=$LOC timeout ${max_seconds}s grep -aE '^([a-z]).\1$' in > $out 2>&1 \
 | 
|---|
| 29 |     || fail=1
 | 
|---|
| 30 |   compare $out in || fail=1
 | 
|---|
| 31 | done
 | 
|---|
| 32 | 
 | 
|---|
| 33 | Exit $fail
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.