Subject: [PATCH] tests: avoid false-positive failure on some AMD CPUs

From: Jim Meyering <[email-masked]>
Date: Sun, 16 Mar 2014 13:47:20 -0700

The variation is striking:
From 87acde8879f8edbaf95aa1a91147dc1cebffd4a5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Sun, 16 Mar 2014 13:45:57 -0700
Subject: [PATCH] tests: avoid false-positive failure on some AMD CPUs

* tests/mb-non-UTF8-performance: Avoid false-positive failure
when run on certain AMD processors.
---
 tests/mb-non-UTF8-performance | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/mb-non-UTF8-performance b/tests/mb-non-UTF8-performance
index 640d5db..4ce3271 100755
--- a/tests/mb-non-UTF8-performance
+++ b/tests/mb-non-UTF8-performance
@@ -1,5 +1,7 @@
 #!/bin/sh
 # grep-2.17 would take nearly 200x longer to run the command below.
+# The 200x is on an Intel i7-based system.
+# On an AMD FX-4100, it would take up to 2500x longer.

 # Copyright 2014 Free Software Foundation, Inc.

@@ -29,8 +31,8 @@ LC_ALL=C grep -i foobar in; st=$?
 stop=$(hi_res_time_)

 # Use a multiple of the LC_ALL=C duration as the timeout for the JP/EUC test.
-# Typically, a multiple of 3 seems to be enough.
-timeout=$($AWK 'BEGIN { print 8 * ('$stop' - '$start')}' < /dev/null)
+# A multiple of 3 seems to be enough for i5,i7, but AMD needs >25.
+timeout=$($AWK 'BEGIN { print 30 * ('$stop' - '$start')}' < /dev/null)

 test $st = 1 || fail=1

-- 
1.9.0.167.g384364b