2022-01-02 02:54:23 +08:00
|
|
|
|
# Copyright (C) 2013-2022 Free Software Foundation, Inc.
|
2013-03-15 15:00:03 +08:00
|
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 13:40:42 +08:00
|
|
|
|
# <https://www.gnu.org/licenses/>.
|
2013-03-15 15:00:03 +08:00
|
|
|
|
|
|
|
|
|
# Makefile for benchmark tests. The only useful target here is `bench`.
|
2013-05-22 13:35:04 +08:00
|
|
|
|
# Add benchmark functions in alphabetical order.
|
2013-03-15 15:00:03 +08:00
|
|
|
|
|
|
|
|
|
subdir := benchtests
|
2014-02-27 07:12:03 +08:00
|
|
|
|
|
|
|
|
|
include ../Makeconfig
|
2021-10-23 07:13:11 +08:00
|
|
|
|
|
|
|
|
|
bench-math := \
|
|
|
|
|
acos \
|
|
|
|
|
acosh \
|
|
|
|
|
asin \
|
|
|
|
|
asinh \
|
|
|
|
|
atan \
|
|
|
|
|
atan2 \
|
|
|
|
|
atanh \
|
|
|
|
|
cbrt \
|
|
|
|
|
cos \
|
|
|
|
|
cosf \
|
|
|
|
|
cosh \
|
|
|
|
|
erf \
|
|
|
|
|
erfc \
|
|
|
|
|
exp \
|
|
|
|
|
exp10 \
|
|
|
|
|
exp10f \
|
|
|
|
|
exp2 \
|
|
|
|
|
exp2f \
|
|
|
|
|
expf \
|
|
|
|
|
expm1 \
|
|
|
|
|
fmax \
|
|
|
|
|
fmaxf \
|
|
|
|
|
fmin \
|
|
|
|
|
fminf \
|
|
|
|
|
hypot \
|
2021-04-06 01:08:42 +08:00
|
|
|
|
hypotf \
|
2021-10-23 07:13:11 +08:00
|
|
|
|
ilogb \
|
|
|
|
|
ilogbf \
|
|
|
|
|
isfinite \
|
|
|
|
|
isinf \
|
|
|
|
|
isnan \
|
|
|
|
|
j0 \
|
|
|
|
|
j1 \
|
|
|
|
|
lgamma \
|
|
|
|
|
log \
|
|
|
|
|
log10 \
|
|
|
|
|
log1p \
|
|
|
|
|
log2 \
|
|
|
|
|
log2f \
|
|
|
|
|
logb \
|
|
|
|
|
logbf \
|
|
|
|
|
logf \
|
|
|
|
|
modf \
|
|
|
|
|
pow \
|
|
|
|
|
powf \
|
|
|
|
|
rint \
|
|
|
|
|
roundeven \
|
|
|
|
|
roundevenf \
|
|
|
|
|
sin \
|
|
|
|
|
sincos \
|
|
|
|
|
sincosf \
|
|
|
|
|
sinf \
|
|
|
|
|
sinh \
|
|
|
|
|
sqrt \
|
|
|
|
|
tan \
|
|
|
|
|
tanh \
|
|
|
|
|
tgamma \
|
|
|
|
|
trunc \
|
|
|
|
|
truncf \
|
|
|
|
|
y0 \
|
|
|
|
|
y1 \
|
2020-09-23 22:11:57 +08:00
|
|
|
|
|
2021-05-03 17:30:25 +08:00
|
|
|
|
ifneq (,$(filter yes,$(float96-fcts)))
|
|
|
|
|
bench-math += cbrtl
|
|
|
|
|
endif
|
|
|
|
|
|
2020-09-23 22:11:57 +08:00
|
|
|
|
ifneq (,$(filter yes,$(float128-fcts) $(float128-alias-fcts)))
|
2020-12-03 21:41:02 +08:00
|
|
|
|
bench-math += expf128 powf128 sinf128 ilogbf128
|
2020-09-23 22:11:57 +08:00
|
|
|
|
endif
|
2014-04-15 17:03:06 +08:00
|
|
|
|
|
2020-10-08 05:04:12 +08:00
|
|
|
|
bench-pthread := pthread_once thread_create pthread-locks
|
2014-04-15 17:03:06 +08:00
|
|
|
|
|
2015-12-09 02:45:14 +08:00
|
|
|
|
bench-string := ffs ffsll
|
|
|
|
|
|
2017-11-28 22:27:46 +08:00
|
|
|
|
ifeq (${BENCHSET},)
|
2015-12-09 02:45:14 +08:00
|
|
|
|
bench := $(bench-math) $(bench-pthread) $(bench-string)
|
2017-11-28 22:27:46 +08:00
|
|
|
|
else
|
|
|
|
|
bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
|
|
|
|
|
endif
|
2013-05-22 13:35:04 +08:00
|
|
|
|
|
2013-04-16 20:07:24 +08:00
|
|
|
|
# String function benchmarks.
|
2021-10-23 13:36:30 +08:00
|
|
|
|
string-benchset := memccpy memchr memcmp memcmpeq memcpy memmem memmove \
|
2015-12-09 02:45:14 +08:00
|
|
|
|
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
|
|
|
|
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
|
|
|
|
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
|
|
|
|
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok \
|
2017-10-06 00:19:37 +08:00
|
|
|
|
strcoll memcpy-large memcpy-random memmove-large memset-large \
|
2017-10-06 00:23:13 +08:00
|
|
|
|
memcpy-walk memset-walk memmove-walk
|
2016-04-20 15:49:01 +08:00
|
|
|
|
|
|
|
|
|
# Build and run locale-dependent benchmarks only if we're building natively.
|
|
|
|
|
ifeq (no,$(cross-compiling))
|
2015-12-09 02:45:14 +08:00
|
|
|
|
wcsmbs-benchset := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat \
|
|
|
|
|
wcscmp wcsncmp wcschr wcschrnul wcsrchr wcsspn wcspbrk wcscspn \
|
|
|
|
|
wmemchr wmemset wmemcmp
|
2016-04-20 15:49:01 +08:00
|
|
|
|
else
|
|
|
|
|
wcsmbs-benchset :=
|
|
|
|
|
endif
|
|
|
|
|
|
2015-12-09 02:45:14 +08:00
|
|
|
|
string-benchset-all := $(string-benchset) ${wcsmbs-benchset}
|
2013-04-16 20:07:24 +08:00
|
|
|
|
|
2016-04-20 15:49:01 +08:00
|
|
|
|
ifeq (no,$(cross-compiling))
|
2015-05-13 01:22:14 +08:00
|
|
|
|
# We have to generate locales
|
|
|
|
|
LOCALES := en_US.UTF-8 tr_TR.UTF-8 cs_CZ.UTF-8 fa_IR.UTF-8 fr_FR.UTF-8 \
|
|
|
|
|
ja_JP.UTF-8 si_LK.UTF-8 en_GB.UTF-8 vi_VN.UTF-8 ar_SA.UTF-8 \
|
|
|
|
|
da_DK.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 el_GR.UTF-8 ru_RU.UTF-8 \
|
2016-02-19 15:27:11 +08:00
|
|
|
|
he_IL.UTF-8 is_IS.UTF-8 es_ES.UTF-8 hi_IN.UTF-8 sv_SE.UTF-8 \
|
2015-05-13 01:22:14 +08:00
|
|
|
|
hu_HU.UTF-8 it_IT.UTF-8 sr_RS.UTF-8 zh_CN.UTF-8
|
|
|
|
|
include ../gen-locales.mk
|
2016-04-20 15:49:01 +08:00
|
|
|
|
endif
|
2015-05-13 01:22:14 +08:00
|
|
|
|
|
2015-12-09 02:45:14 +08:00
|
|
|
|
stdlib-benchset := strtod
|
2013-11-11 21:23:02 +08:00
|
|
|
|
|
2015-12-09 02:45:14 +08:00
|
|
|
|
stdio-common-benchset := sprintf
|
2015-05-21 22:01:34 +08:00
|
|
|
|
|
2015-09-18 23:02:38 +08:00
|
|
|
|
math-benchset := math-inlines
|
|
|
|
|
|
2017-11-28 22:27:46 +08:00
|
|
|
|
ifeq (${BENCHSET},)
|
2015-12-09 02:45:14 +08:00
|
|
|
|
benchset := $(string-benchset-all) $(stdlib-benchset) $(stdio-common-benchset) \
|
2015-09-18 23:02:38 +08:00
|
|
|
|
$(math-benchset)
|
2017-11-28 22:27:46 +08:00
|
|
|
|
else
|
|
|
|
|
benchset := $(foreach B,$(filter %-benchset,${BENCHSET}), ${${B}})
|
|
|
|
|
endif
|
2013-04-16 20:07:24 +08:00
|
|
|
|
|
2014-03-31 22:58:19 +08:00
|
|
|
|
CFLAGS-bench-ffs.c += -fno-builtin
|
|
|
|
|
CFLAGS-bench-ffsll.c += -fno-builtin
|
2016-10-22 05:18:03 +08:00
|
|
|
|
CFLAGS-bench-sqrt.c += -fno-builtin
|
2016-12-17 03:10:58 +08:00
|
|
|
|
CFLAGS-bench-fmin.c += -fno-builtin
|
2016-12-19 21:00:45 +08:00
|
|
|
|
CFLAGS-bench-fminf.c += -fno-builtin
|
2016-12-17 03:10:58 +08:00
|
|
|
|
CFLAGS-bench-fmax.c += -fno-builtin
|
2016-12-19 21:00:45 +08:00
|
|
|
|
CFLAGS-bench-fmaxf.c += -fno-builtin
|
2017-09-19 20:59:01 +08:00
|
|
|
|
CFLAGS-bench-trunc.c += -fno-builtin
|
|
|
|
|
CFLAGS-bench-truncf.c += -fno-builtin
|
2020-03-28 07:24:02 +08:00
|
|
|
|
CFLAGS-bench-roundeven.c += -fno-builtin
|
|
|
|
|
CFLAGS-bench-roundevenf.c += -fno-builtin
|
2019-03-27 22:10:13 +08:00
|
|
|
|
CFLAGS-bench-isnan.c += -fsignaling-nans
|
|
|
|
|
CFLAGS-bench-isinf.c += -fsignaling-nans
|
|
|
|
|
CFLAGS-bench-isfinite.c += -fsignaling-nans
|
2014-03-31 22:58:19 +08:00
|
|
|
|
|
2017-11-28 22:27:46 +08:00
|
|
|
|
ifeq (${BENCHSET},)
|
2019-02-15 00:37:11 +08:00
|
|
|
|
bench-malloc := malloc-thread malloc-simple
|
2017-11-28 22:27:46 +08:00
|
|
|
|
else
|
|
|
|
|
bench-malloc := $(filter malloc-%,${BENCHSET})
|
|
|
|
|
endif
|
2013-09-11 22:47:12 +08:00
|
|
|
|
|
2021-07-31 03:15:27 +08:00
|
|
|
|
ifeq (${STATIC-BENCHTESTS},yes)
|
|
|
|
|
+link-benchtests = $(+link-static-tests)
|
|
|
|
|
link-libc-benchtests = $(link-libc-static)
|
|
|
|
|
libm-benchtests = $(common-objpfx)math/libm.a
|
|
|
|
|
thread-library-benchtests = $(static-thread-library)
|
|
|
|
|
else
|
|
|
|
|
link-libc-benchtests = $(link-libc)
|
|
|
|
|
+link-benchtests = $(+link-tests)
|
|
|
|
|
thread-library-benchtests = $(shared-thread-library)
|
|
|
|
|
libm-benchtests = $(libm)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
|
|
|
|
|
$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
|
|
|
|
|
$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
|
|
|
|
|
$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
|
|
|
|
|
$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
|
2013-09-19 19:25:27 +08:00
|
|
|
|
|
2013-04-12 17:31:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Rules to build and execute the benchmarks. Do not put any benchmark
|
|
|
|
|
# parameters beyond this point.
|
|
|
|
|
|
2013-04-16 20:07:24 +08:00
|
|
|
|
# We don't want the benchmark programs to run in parallel since that could
|
|
|
|
|
# affect their performance.
|
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
|
2017-08-22 01:28:54 +08:00
|
|
|
|
bench-extra-objs = json-lib.o
|
|
|
|
|
|
|
|
|
|
extra-objs += $(bench-extra-objs)
|
|
|
|
|
others-extras = $(bench-extra-objs)
|
|
|
|
|
|
2013-03-15 15:00:03 +08:00
|
|
|
|
include ../Rules
|
2013-04-12 17:31:44 +08:00
|
|
|
|
|
|
|
|
|
binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
|
2013-04-16 20:07:24 +08:00
|
|
|
|
binaries-benchset := $(addprefix $(objpfx)bench-,$(benchset))
|
2013-09-11 22:47:12 +08:00
|
|
|
|
binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
|
2013-04-12 17:31:44 +08:00
|
|
|
|
|
2019-04-24 22:38:49 +08:00
|
|
|
|
# The default duration: 1 seconds.
|
2013-04-30 16:40:20 +08:00
|
|
|
|
ifndef BENCH_DURATION
|
2019-04-24 22:38:49 +08:00
|
|
|
|
BENCH_DURATION := 1
|
2013-04-30 16:40:20 +08:00
|
|
|
|
endif
|
|
|
|
|
|
2018-03-15 23:44:58 +08:00
|
|
|
|
CPPFLAGS-nonlib += -DDURATION=$(BENCH_DURATION) -D_ISOMAC
|
2013-04-30 16:40:20 +08:00
|
|
|
|
|
2020-06-06 00:48:04 +08:00
|
|
|
|
# Use clock_gettime to measure performance of functions. The default is
|
|
|
|
|
# to use the architecture-specific high precision timing instructions.
|
|
|
|
|
ifdef USE_CLOCK_GETTIME
|
|
|
|
|
CPPFLAGS-nonlib += -DUSE_CLOCK_GETTIME
|
|
|
|
|
else
|
2018-10-24 17:19:15 +08:00
|
|
|
|
# On x86 processors, use RDTSCP, instead of RDTSC, to measure performance
|
|
|
|
|
# of functions. All x86 processors since 2010 support RDTSCP instruction.
|
|
|
|
|
ifdef USE_RDTSCP
|
|
|
|
|
CPPFLAGS-nonlib += -DUSE_RDTSCP
|
|
|
|
|
endif
|
2020-06-06 00:48:04 +08:00
|
|
|
|
endif
|
2013-05-13 16:14:32 +08:00
|
|
|
|
|
2014-03-29 12:10:19 +08:00
|
|
|
|
DETAILED_OPT :=
|
|
|
|
|
|
|
|
|
|
ifdef DETAILED
|
|
|
|
|
DETAILED_OPT := -d
|
|
|
|
|
endif
|
|
|
|
|
|
2013-05-13 16:14:32 +08:00
|
|
|
|
bench-deps := bench-skeleton.c bench-timing.h Makefile
|
2013-04-15 13:47:01 +08:00
|
|
|
|
|
2013-04-12 17:31:44 +08:00
|
|
|
|
run-bench = $(test-wrapper-env) \
|
Don't require test wrappers to preserve environment variables, use more consistent environment.
One wart in the original support for test wrappers for cross testing,
as noted in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00722.html>, is the
requirement for test wrappers to pass a poorly-defined set of
environment variables from the build system to the system running the
glibc under test. Although some variables are passed explicitly via
$(test-wrapper-env), including LD_* variables that simply can't be
passed implicitly because of the side effects they'd have on the build
system's dynamic linker, others are passed implicitly, including
variables such as GCONV_PATH and LOCPATH that could potentially affect
the build system's libc (so effectively relying on any such effects
not breaking the wrappers). In addition, the code in
cross-test-ssh.sh for preserving environment variables is fragile (it
depends on how bash formats a list of exported variables, and could
well break for multi-line variable definitions where the contents
contain things looking like other variable definitions).
This patch moves to explicitly passing environment variables via
$(test-wrapper-env). Makefile variables that previously used
$(test-wrapper) are split up into -before-env and -after-env parts
that can be passed separately to the various .sh files used in
testing, so those files can then insert environment settings between
the two parts.
The common default environment settings in make-test-out are made into
a separate makefile variable that can also be passed to scripts,
rather than many scripts duplicating those settings (for testing an
installed glibc, it is desirable to have the GCONV_PATH setting on
just one place, so just that one place needs to support it pointing to
an installed sysroot instead of the build tree). The default settings
are included in the variables such as $(test-program-prefix), so that
if tests do not need any non-default settings they can continue to use
single variables rather than the split-up variables.
Although this patch cleans up LC_ALL=C settings (that being part of
the common defaults), various LANG=C and LANGUAGE=C settings remain.
Those are generally unnecessary and I propose a subsequent cleanup to
remove them. LC_ALL takes precedence over LANG, and while LANGUAGE
takes precedence over LC_ALL, it only does so for settings other than
LC_ALL=C. So LC_ALL=C on its own is sufficient to ensure the C
locale, and anything that gets LC_ALL=C does not need the other
settings.
While preparing this patch I noticed some tests with .sh files that
appeared to do nothing beyond what the generic makefile support for
tests can do (localedata/tst-wctype.sh - the makefiles support -ENV
variables and .input files - and localedata/tst-mbswcs.sh - just runs
five tests that could be run individually from the makefile). So I
propose another subsequent cleanup to move those to using the generic
support instead of special .sh files.
Tested x86_64 (native) and powerpc32 (cross).
* Makeconfig (run-program-env): New variable.
(run-program-prefix-before-env): Likewise.
(run-program-prefix-after-env): Likewise.
(run-program-prefix): Define in terms of new variables.
(built-program-cmd-before-env): New variable.
(built-program-cmd-after-env): Likewise.
(built-program-cmd): Define in terms of new variables.
(test-program-prefix-before-env): New variable.
(test-program-prefix-after-env): Likewise.
(test-program-prefix): Define in terms of new variables.
(test-program-cmd-before-env): New variable.
(test-program-cmd-after-env): Likewise.
(test-program-cmd): Define in terms of new variables.
* Rules (make-test-out): Use $(run-program-env).
* scripts/cross-test-ssh.sh (env_blacklist): Remove variable.
(help): Do not mention environment variables. Mention
--timeoutfactor option.
(timeoutfactor): New variable.
(blacklist_exports): Remove function.
(exports): Remove variable.
(command): Do not include ${exports}.
* manual/install.texi (Configuring and compiling): Do not mention
test wrappers preserving environment variables. Mention that last
assignment to a variable must take precedence.
* INSTALL: Regenerated.
* benchtests/Makefile (run-bench): Use $(run-program-env).
* catgets/Makefile ($(objpfx)test1.cat): Use
$(built-program-cmd-before-env), $(run-program-env) and
$(built-program-cmd-after-env).
($(objpfx)test2.cat): Do not specify environment variables
explicitly.
($(objpfx)de/libc.cat): Use $(built-program-cmd-before-env),
$(run-program-env) and $(built-program-cmd-after-env).
($(objpfx)test-gencat.out): Use $(test-program-cmd-before-env),
$(run-program-env) and $(test-program-cmd-after-env).
($(objpfx)sample.SJIS.cat): Do not specify environment variables
explicitly.
* catgets/test-gencat.sh: Use test_program_cmd_before_env,
run_program_env and test_program_cmd_after_env arguments.
* elf/Makefile ($(objpfx)tst-pathopt.out): Use $(run-program-env).
* elf/tst-pathopt.sh: Use run_program_env argument.
* iconvdata/Makefile ($(objpfx)iconv-test.out): Use
$(test-wrapper-env) and $(run-program-env).
* iconvdata/run-iconv-test.sh: Use test_wrapper_env and
run_program_env arguments.
* iconvdata/tst-table.sh: Do not set GCONV_PATH explicitly.
* intl/Makefile ($(objpfx)tst-gettext.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
($(objpfx)tst-gettext2.out): Likewise.
* intl/tst-gettext.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* intl/tst-gettext2.sh: Likewise.
* intl/tst-gettext4.sh: Do not set environment variables
explicitly.
* intl/tst-gettext6.sh: Likewise.
* intl/tst-translit.sh: Likewise.
* malloc/Makefile ($(objpfx)tst-mtrace.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
* malloc/tst-mtrace.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* math/Makefile (run-regen-ulps): Use $(run-program-env).
* nptl/Makefile ($(objpfx)tst-tls6.out): Use $(run-program-env).
* nptl/tst-tls6.sh: Use run_program_env argument. Set LANG=C
explicitly with each use of ${test_wrapper_env}.
* posix/Makefile ($(objpfx)wordexp-tst.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
* posix/tst-getconf.sh: Do not set environment variables
explicitly.
* posix/wordexp-tst.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* stdio-common/tst-printf.sh: Do not set environment variables
explicitly.
* stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
* stdlib/tst-fmtmsg.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
Split $test calls into $test_pre and $test.
* timezone/Makefile (build-testdata): Use
$(built-program-cmd-before-env), $(run-program-env) and
$(built-program-cmd-after-env).
localedata/ChangeLog:
* Makefile ($(addprefix $(objpfx),$(CTYPE_FILES))): Use
$(built-program-cmd-before-env), $(run-program-env) and
$(built-program-cmd-after-env).
($(objpfx)sort-test.out): Use $(test-program-prefix-before-env),
$(run-program-env) and $(test-program-prefix-after-env).
($(objpfx)tst-fmon.out): Use $(run-program-prefix-before-env),
$(run-program-env) and $(run-program-prefix-after-env).
($(objpfx)tst-locale.out): Use $(built-program-cmd-before-env),
$(run-program-env) and $(built-program-cmd-after-env).
($(objpfx)tst-trans.out): Use $(run-program-prefix-before-env),
$(run-program-env), $(run-program-prefix-after-env),
$(test-program-prefix-before-env) and
$(test-program-prefix-after-env).
($(objpfx)tst-ctype.out): Use $(test-program-cmd-before-env),
$(run-program-env) and $(test-program-cmd-after-env).
($(objpfx)tst-wctype.out): Likewise.
($(objpfx)tst-langinfo.out): Likewise.
($(objpfx)tst-langinfo-static.out): Likewise.
* gen-locale.sh: Use localedef_before_env, run_program_env and
localedef_after_env arguments.
* sort-test.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* tst-ctype.sh: Use tst_ctype_before_env, run_program_env and
tst_ctype_after_env arguments.
* tst-fmon.sh: Use run_program_prefix_before_env, run_program_env
and run_program_prefix_after_env arguments.
* tst-langinfo.sh: Use tst_langinfo_before_env, run_program_env
and tst_langinfo_after_env arguments.
* tst-locale.sh: Use localedef_before_env, run_program_env and
localedef_after_env arguments.
* tst-mbswcs.sh: Do not set environment variables explicitly.
* tst-numeric.sh: Likewise.
* tst-rpmatch.sh: Likewise.
* tst-trans.sh: Use run_program_prefix_before_env,
run_program_env, run_program_prefix_after_env,
test_program_prefix_before_env and test_program_prefix_after_env
arguments.
* tst-wctype.sh: Use tst_wctype_before_env, run_program_env and
tst_wctype_after_env arguments.
2014-06-07 06:19:27 +08:00
|
|
|
|
$(run-program-env) \
|
2016-03-08 20:53:24 +08:00
|
|
|
|
$($*-ENV) $(test-via-rtld-prefix) $${run}
|
2013-04-12 17:31:44 +08:00
|
|
|
|
|
2014-03-29 12:07:44 +08:00
|
|
|
|
timing-type := $(objpfx)bench-timing-type
|
|
|
|
|
|
2021-01-27 01:14:19 +08:00
|
|
|
|
# This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed
|
|
|
|
|
# for all these modules.
|
|
|
|
|
cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c) \
|
|
|
|
|
$(binaries-bench-malloc:=.c) $(timing-type:=.c)
|
|
|
|
|
lib := nonlib
|
|
|
|
|
include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
|
|
|
|
|
|
2013-04-16 16:37:21 +08:00
|
|
|
|
bench-clean:
|
|
|
|
|
rm -f $(binaries-bench) $(addsuffix .o,$(binaries-bench))
|
2013-04-16 20:07:24 +08:00
|
|
|
|
rm -f $(binaries-benchset) $(addsuffix .o,$(binaries-benchset))
|
2013-09-11 22:47:12 +08:00
|
|
|
|
rm -f $(binaries-bench-malloc) $(addsuffix .o,$(binaries-bench-malloc))
|
2014-03-29 12:07:44 +08:00
|
|
|
|
rm -f $(timing-type) $(addsuffix .o,$(timing-type))
|
2016-04-20 13:49:49 +08:00
|
|
|
|
rm -f $(addprefix $(objpfx),$(bench-extra-objs))
|
2013-04-16 20:07:24 +08:00
|
|
|
|
|
2017-11-28 22:27:46 +08:00
|
|
|
|
# Validate the passed in BENCHSET
|
|
|
|
|
ifneq ($(strip ${BENCHSET}),)
|
|
|
|
|
VALIDBENCHSETNAMES := bench-pthread bench-math bench-string string-benchset \
|
|
|
|
|
wcsmbs-benchset stdlib-benchset stdio-common-benchset math-benchset \
|
2019-02-15 00:37:11 +08:00
|
|
|
|
malloc-thread malloc-simple
|
2017-11-28 22:27:46 +08:00
|
|
|
|
INVALIDBENCHSETNAMES := $(filter-out ${VALIDBENCHSETNAMES},${BENCHSET})
|
|
|
|
|
ifneq (${INVALIDBENCHSETNAMES},)
|
|
|
|
|
$(info The following values in BENCHSET are invalid: ${INVALIDBENCHSETNAMES})
|
|
|
|
|
$(info The valid ones are: ${VALIDBENCHSETNAMES})
|
|
|
|
|
$(error Invalid BENCHSET value)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
2016-04-20 15:49:01 +08:00
|
|
|
|
bench: bench-build bench-set bench-func bench-malloc
|
2016-12-23 01:37:52 +08:00
|
|
|
|
|
2016-04-20 15:49:01 +08:00
|
|
|
|
# Target to only build the benchmark without running it. We generate locales
|
|
|
|
|
# only if we're building natively.
|
|
|
|
|
ifeq (no,$(cross-compiling))
|
|
|
|
|
bench-build: $(gen-locales) $(timing-type) $(binaries-bench) \
|
|
|
|
|
$(binaries-benchset) $(binaries-bench-malloc)
|
|
|
|
|
else
|
|
|
|
|
bench-build: $(timing-type) $(binaries-bench) $(binaries-benchset) \
|
|
|
|
|
$(binaries-bench-malloc)
|
|
|
|
|
endif
|
2013-04-16 20:07:24 +08:00
|
|
|
|
|
|
|
|
|
bench-set: $(binaries-benchset)
|
|
|
|
|
for run in $^; do \
|
|
|
|
|
echo "Running $${run}"; \
|
|
|
|
|
$(run-bench) > $${run}.out; \
|
|
|
|
|
done
|
2013-04-16 16:37:21 +08:00
|
|
|
|
|
2013-09-11 22:47:12 +08:00
|
|
|
|
bench-malloc: $(binaries-bench-malloc)
|
2017-11-28 22:27:46 +08:00
|
|
|
|
for run in $^; do \
|
2019-02-15 00:37:11 +08:00
|
|
|
|
echo "$${run}"; \
|
|
|
|
|
if [ `basename $${run}` = "bench-malloc-thread" ]; then \
|
2017-11-28 22:27:46 +08:00
|
|
|
|
for thr in 1 8 16 32; do \
|
|
|
|
|
echo "Running $${run} $${thr}"; \
|
2019-02-15 00:37:11 +08:00
|
|
|
|
$(run-bench) $${thr} > $${run}-$${thr}.out; \
|
|
|
|
|
done;\
|
|
|
|
|
else \
|
|
|
|
|
for thr in 8 16 32 64 128 256 512 1024 2048 4096; do \
|
|
|
|
|
echo "Running $${run} $${thr}"; \
|
|
|
|
|
$(run-bench) $${thr} > $${run}-$${thr}.out; \
|
|
|
|
|
done;\
|
|
|
|
|
fi;\
|
2013-09-11 22:47:12 +08:00
|
|
|
|
done
|
|
|
|
|
|
2014-03-29 12:07:44 +08:00
|
|
|
|
# Build and execute the benchmark functions. This target generates JSON
|
|
|
|
|
# formatted bench.out. Each of the programs produce independent JSON output,
|
|
|
|
|
# so one could even execute them individually and process it using any JSON
|
|
|
|
|
# capable language or tool.
|
2013-04-16 20:07:24 +08:00
|
|
|
|
bench-func: $(binaries-bench)
|
2017-11-28 22:27:46 +08:00
|
|
|
|
if [ -n '$^' ] ; then \
|
2020-01-20 19:29:41 +08:00
|
|
|
|
{ timing_type=$$($(test-wrapper-env) \
|
|
|
|
|
$(run-program-env) \
|
|
|
|
|
$(test-via-rtld-prefix) \
|
|
|
|
|
$(timing-type)); \
|
2017-11-28 22:27:46 +08:00
|
|
|
|
echo "{\"timing_type\": \"$${timing_type}\","; \
|
|
|
|
|
echo " \"functions\": {"; \
|
|
|
|
|
for run in $^; do \
|
|
|
|
|
if ! [ "x$${run}" = "x$<" ]; then \
|
|
|
|
|
echo ","; \
|
|
|
|
|
fi; \
|
|
|
|
|
echo "Running $${run}" >&2; \
|
|
|
|
|
$(run-bench) $(DETAILED_OPT); \
|
|
|
|
|
done; \
|
|
|
|
|
echo; \
|
|
|
|
|
echo " }"; \
|
|
|
|
|
echo "}"; \
|
|
|
|
|
} > $(objpfx)bench.out-tmp; \
|
|
|
|
|
if [ -f $(objpfx)bench.out ]; then \
|
|
|
|
|
mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
|
2014-03-29 12:07:44 +08:00
|
|
|
|
fi; \
|
2017-11-28 22:27:46 +08:00
|
|
|
|
mv -f $(objpfx)bench.out-tmp $(objpfx)bench.out; \
|
|
|
|
|
$(PYTHON) scripts/validate_benchout.py $(objpfx)bench.out \
|
|
|
|
|
scripts/benchout.schema.json; \
|
|
|
|
|
fi
|
2013-04-12 17:31:44 +08:00
|
|
|
|
|
2019-04-25 16:41:52 +08:00
|
|
|
|
ifeq ($(bind-now),yes)
|
|
|
|
|
link-bench-bind-now = -Wl,-z,now
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
|
|
|
|
|
$(binaries-bench-malloc)
|
|
|
|
|
|
|
|
|
|
$(bench-link-targets): %: %.o $(objpfx)json-lib.o \
|
2016-12-18 03:52:29 +08:00
|
|
|
|
$(link-extra-libs-tests) \
|
2021-07-31 03:15:27 +08:00
|
|
|
|
$(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
|
2013-04-12 17:31:44 +08:00
|
|
|
|
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
2021-07-31 03:15:27 +08:00
|
|
|
|
$(+link-benchtests)
|
2013-04-12 17:31:44 +08:00
|
|
|
|
|
2019-04-25 16:41:52 +08:00
|
|
|
|
$(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
|
|
|
|
|
|
2013-04-15 13:47:01 +08:00
|
|
|
|
$(objpfx)bench-%.c: %-inputs $(bench-deps)
|
2013-04-12 17:31:44 +08:00
|
|
|
|
{ if [ -n "$($*-INCLUDE)" ]; then \
|
|
|
|
|
cat $($*-INCLUDE); \
|
|
|
|
|
fi; \
|
2016-01-14 00:00:57 +08:00
|
|
|
|
$(PYTHON) scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp
|
2013-04-12 17:31:44 +08:00
|
|
|
|
mv -f $@-tmp $@
|