From af2cc815a7e66ef425779ab41ab77324b97f1b09d78b55a837fa4d1179e20317 Mon Sep 17 00:00:00 2001 From: Andreas Stieger Date: Wed, 26 Mar 2014 18:41:35 +0000 Subject: [PATCH] Accepting request 227607 from home:Andreas_Schwab:Factory - mb-non-UTF8-performance.patch: make performance-measuring less system-sensitive OBS-URL: https://build.opensuse.org/request/show/227607 OBS-URL: https://build.opensuse.org/package/show/Base:System/grep?expand=0&rev=46 --- grep.changes | 6 ++++ grep.spec | 3 ++ mb-non-UTF8-performance.patch | 68 +++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 mb-non-UTF8-performance.patch diff --git a/grep.changes b/grep.changes index a064d0e..d1cc09c 100644 --- a/grep.changes +++ b/grep.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Mar 25 15:10:02 UTC 2014 - schwab@suse.de + +- mb-non-UTF8-performance.patch: make performance-measuring less + system-sensitive + ------------------------------------------------------------------- Sat Feb 22 19:19:46 UTC 2014 - andreas.stieger@gmx.de diff --git a/grep.spec b/grep.spec index 40e9695..a6a2f03 100644 --- a/grep.spec +++ b/grep.spec @@ -26,6 +26,8 @@ Url: http://www.gnu.org/software/grep/ Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz Source2: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source3: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=grep&download=1#/%{name}.keyring +# PATCH-FIX-UPSTREAM http://git.savannah.gnu.org/cgit/grep.git/commit/?id=6e3ea0dd74426fd394225d3f9dc132e40cd92fd2 +Patch0: mb-non-UTF8-performance.patch BuildRequires: makeinfo BuildRequires: pcre-devel @@ -45,6 +47,7 @@ the matching lines. %prep %setup -q +%patch0 -p1 %if 0%{?suse_version} < 1120 echo "ac_cv_search_pcre_compile=\${ac_cv_search_pcre_compile=%{_libdir}/libpcre.a}" >config.cache %endif diff --git a/mb-non-UTF8-performance.patch b/mb-non-UTF8-performance.patch new file mode 100644 index 0000000..f5fd141 --- /dev/null +++ b/mb-non-UTF8-performance.patch @@ -0,0 +1,68 @@ +Index: grep-2.18/tests/init.cfg +=================================================================== +--- grep-2.18.orig/tests/init.cfg ++++ grep-2.18/tests/init.cfg +@@ -103,6 +103,21 @@ require_unibyte_locale() + skip_ 'no unibyte locale found' + } + ++# Define hi_res_time_ to a function that prints the current time ++# as a floating point number with greater than 1-second resolution. ++# Otherwise, skip the requiring test. ++require_hi_res_time_() ++{ ++ local cmd ++ for cmd in 'date +%s.%N' \ ++ 'perl -le "use Time::HiRes qw(time); print scalar time()"'; do ++ case $($cmd) in ++ *.[0-9]*) eval 'hi_res_time_() { '"$cmd"'; }'; break;; ++ esac ++ done ++ type hi_res_time_ || skip_ no high-resolution timer support ++} ++ + require_JP_EUC_locale_() + { + local locale=ja_JP.eucJP +Index: grep-2.18/tests/mb-non-UTF8-performance +=================================================================== +--- grep-2.18.orig/tests/mb-non-UTF8-performance ++++ grep-2.18/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. + +@@ -18,15 +20,26 @@ + + . "${srcdir=.}/init.sh"; path_prepend_ ../src + require_timeout_ ++require_hi_res_time_ + + fail=0 + +-require_JP_EUC_locale_ +- + yes $(printf '%078d' 0) | head -50000 > in || framework_failure_ + ++start=$(hi_res_time_) ++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. ++# A multiple of 3 seems to be enough for i5,i7, but AMD needs >25. ++timeout=$($AWK 'BEGIN { print 50 * ('$stop' - '$start')}' < /dev/null) ++ ++test $st = 1 || fail=1 ++ ++require_JP_EUC_locale_ ++ + # Expect no match, i.e., exit status of 1. Anything else is an error. +-timeout 4 grep -i foobar in; st=$? ++timeout $timeout grep -i foobar in; st=$? + test $st = 1 || fail=1 + + Exit $fail