|
Packit |
709fb3 |
#!/bin/sh
|
|
Packit |
709fb3 |
# grep-2.17 would take nearly 200x longer to run the command below.
|
|
Packit |
709fb3 |
# The 200x is on an Intel i7-based system.
|
|
Packit |
709fb3 |
# On an AMD FX-4100, it would take up to 2500x longer.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Copyright 2014-2017 Free Software Foundation, Inc.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
709fb3 |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
709fb3 |
# the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
709fb3 |
# (at your option) any later version.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
709fb3 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
709fb3 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
709fb3 |
# GNU General Public License for more details.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
709fb3 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
fail=0
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# This test is susceptible to failure due to differences in
|
|
Packit |
709fb3 |
# system load during the two test runs, so we'll mark it as
|
|
Packit |
709fb3 |
# "expensive", making it less likely to be run by regular users.
|
|
Packit |
709fb3 |
expensive_
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Make the input large enough so that even on high-end systems
|
|
Packit |
709fb3 |
# the unibyte test takes at least 10ms of user time.
|
|
Packit |
709fb3 |
n_lines=100000
|
|
Packit |
709fb3 |
while :; do
|
|
Packit |
709fb3 |
yes $(printf '%078d' 0) | sed ${n_lines}q > in || framework_failure_
|
|
Packit |
709fb3 |
ubyte_ms=$(LC_ALL=C user_time_ 1 grep -i foobar in) || fail=1
|
|
Packit |
709fb3 |
test $ubyte_ms -ge 10 && break
|
|
Packit |
709fb3 |
n_lines=$(expr $n_lines + 200000)
|
|
Packit |
709fb3 |
done
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
require_JP_EUC_locale_
|
|
Packit |
709fb3 |
mbyte_ms=$(user_time_ 1 grep -i foobar in) || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# The duration of the multi-byte run must be no more than 30 times
|
|
Packit |
709fb3 |
# that of the single-byte one.
|
|
Packit |
709fb3 |
# A multiple of 3 seems to be enough for i5,i7, but AMD needs >25.
|
|
Packit |
709fb3 |
returns_ 1 expr $ubyte_ms '<' $mbyte_ms / 30 || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Exit $fail
|