From a2a3df953a91f898bd94f05a26088ccdc351fb3a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 5 Aug 2016 21:38:30 -0700 Subject: [PATCH] tests/backref-multibyte-slow:: avoid false positive * tests/backref-multibyte-slow: When redirecting the "fast" LC_ALL=C run's output to /dev/null, we got an artificially low timing (of 0), due to grep's own stdout-vs-/dev/null optimization. With an initial timing of 0 on that first run, the derived timeout for the UTF-8 run (which redirects to a file) would be a mere 1 second. The fix: also redirect that first run's output to a file, not to /dev/null. --- tests/backref-multibyte-slow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/backref-multibyte-slow b/tests/backref-multibyte-slow index d447a4a..05bb62e 100755 --- a/tests/backref-multibyte-slow +++ b/tests/backref-multibyte-slow @@ -14,7 +14,7 @@ $AWK 'BEGIN {for (i=0; i<13000; i++) print "aba"}' /dev/null > in || fail=1 # 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 perl -le 'use Time::HiRes qw(time); my $s = time(); - system q,grep -E '\''^([a-z]).\1$'\'' in > /dev/null,; + system q,grep -E '\''^([a-z]).\1$'\'' in > junk,; my $elapsed = time() - $s; print int (1 + 10 * $elapsed)') \ || { max_seconds=5; warn_ "$ME_: warning: no perl? using default of 5s timeout"; } -- 2.8.0-rc2