----- Original Message ----- From: "Jim Meyering" <[email protected]> To: "Gilles Espinasse" <[email protected]> Cc: "PÃf¡draig Brady" <[email protected]>; <[email protected]>; <[email protected]> Sent: Thursday, November 04, 2010 1:08 PM Subject: Re: tests/backref-multibyte-slow timeout 5s is too short for my imac 400
> Gilles Espinasse wrote: > > Selon Jim Meyering <[email protected]>: ... > Actually, giving a warning and using the old default of 5 seconds > should be good enough if perl doesn't work: > > From 93015c3bebeca0cf2ed17ac0b561b7c3453864d8 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <[email protected]> > Date: Thu, 4 Nov 2010 13:04:52 +0100 > Subject: [PATCH] tests: don't hard-code a 5-second timeout; that's not always enough > > Instead, time the command in the C locale and use 10 times that > duration -- rounded up to whole seconds -- as the timeout when running > it in the UTF-8 locale. > * tests/backref-multibyte-slow: Compute a performance-relative timeout. > Reported by Gilles Espinasse, regarding an imac 400. For more details, > see http://thread.gmane.org/gmane.comp.gnu.grep.bugs/3360 > --- > tests/backref-multibyte-slow | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/tests/backref-multibyte-slow b/tests/backref-multibyte-slow > index eb32b43..80ac197 100644 > --- a/tests/backref-multibyte-slow > +++ b/tests/backref-multibyte-slow > @@ -10,9 +10,18 @@ fail=0 > # Create a 13000-line input > $AWK 'BEGIN {for (i=0; i<13000; i++) print "aba"}' /dev/null > in || fail=1 > > +# Use 10 times the duration of running grep in the C locale as the timeout > +# when running in en_US.UTF-8. Round up to whole seconds, since timeout > +# can't deal with fractional seconds. > +max_seconds=$(LC_ALL=C zerl -le 'use Time::HiRes qw(time); my $s = time(); > + system q,grep -E '\''^([a-z]).\1$'\'' in > /dev/null,; > + my $elapsed = time() - $s; print int (1 + 10 * $elapsed)') \ > + || { max_seconds=5; > + warn_ "$ME_: warning: no perl? using default of 5s timeout"; } > + > for LOC in en_US.UTF-8; do > out=out-$LOC > - LC_ALL=$LOC timeout 5s grep -E '^([a-z]).\1$' in > $out 2>&1 > + LC_ALL=$LOC timeout ${max_seconds}s grep -E '^([a-z]).\1$' in > $out 2>&1 > test $? = 0 || fail=1 > compare $out in || fail=1 > done > -- Patch work with the zerl/perl typo fixed PASS: backref-multibyte-slow Gilles.
