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
This commit is contained in:
Andreas Stieger 2014-03-26 18:41:35 +00:00 committed by Git OBS Bridge
parent e6941a8946
commit af2cc815a7
3 changed files with 77 additions and 0 deletions

View File

@ -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 Sat Feb 22 19:19:46 UTC 2014 - andreas.stieger@gmx.de

View File

@ -26,6 +26,8 @@ Url: http://www.gnu.org/software/grep/
Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source2: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig 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 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: makeinfo
BuildRequires: pcre-devel BuildRequires: pcre-devel
@ -45,6 +47,7 @@ the matching lines.
%prep %prep
%setup -q %setup -q
%patch0 -p1
%if 0%{?suse_version} < 1120 %if 0%{?suse_version} < 1120
echo "ac_cv_search_pcre_compile=\${ac_cv_search_pcre_compile=%{_libdir}/libpcre.a}" >config.cache echo "ac_cv_search_pcre_compile=\${ac_cv_search_pcre_compile=%{_libdir}/libpcre.a}" >config.cache
%endif %endif

View File

@ -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