diff options
author | Jim Meyering <meyering@fb.com> | 2016-01-07 21:30:08 -0800 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2016-01-07 21:37:24 -0800 |
commit | 6c7f8166c7928cf48a8288c0333941f3bf3466c1 (patch) | |
tree | 67cae1a975c8dc524bfe793dac7874e4b38046bb | |
parent | ca68df394ba1d9359c0e4d825394ab875c7fe1c2 (diff) | |
download | grep-6c7f8166c7928cf48a8288c0333941f3bf3466c1.tar.gz |
mb-non-UTF8-performance: avoid FP test failure on fast hardware
* tests/mb-non-UTF8-performance: Don't use a fixed size.
Otherwise, on a fast system, the fixed-size unibyte test
would complete in a nominal 0 ms, which might well be
smaller than 1/30 of the multibyte duration, provoking
a false positive test failure. Instead, increase the
size of the input until we obtain a unibyte duration of
at least 10ms.
-rwxr-xr-x | tests/mb-non-UTF8-performance | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/mb-non-UTF8-performance b/tests/mb-non-UTF8-performance index e8433d8e..fc371bd6 100755 --- a/tests/mb-non-UTF8-performance +++ b/tests/mb-non-UTF8-performance @@ -27,11 +27,16 @@ fail=0 # "expensive", making it less likely to be run by regular users. expensive_ -# Make this large enough so that even on high-end systems -# it incurs at least 5-10ms of user time. -yes $(printf '%078d' 0) | head -400000 > in || framework_failure_ +# Make the input large enough so that even on high-end systems +# the unibyte test takes at least 10ms of user time. +n_lines=100000 +while :; do + yes $(printf '%078d' 0) | head -$n_lines > in || framework_failure_ + ubyte_ms=$(LC_ALL=C user_time_ 1 grep -i foobar in) || fail=1 + test $ubyte_ms -ge 10 && break + n_lines=$(expr $n_lines + 200000) +done -ubyte_ms=$(LC_ALL=C user_time_ 1 grep -i foobar in) || fail=1 require_JP_EUC_locale_ mbyte_ms=$(user_time_ 1 grep -i foobar in) || fail=1 |