2022-01-01 18:54:23 +00:00
|
|
|
|
# Copyright (C) 2013-2022 Free Software Foundation, Inc.
|
2022-04-29 05:36:00 +00:00
|
|
|
|
# Copyright The GNU Toolchain Authors.
|
2013-03-15 07:00:03 +00: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 05:40:42 +00:00
|
|
|
|
# <https://www.gnu.org/licenses/>.
|
2013-03-15 07:00:03 +00:00
|
|
|
|
|
|
|
|
|
# Makefile for benchmark tests. The only useful target here is `bench`.
|
2013-05-22 05:35:04 +00:00
|
|
|
|
# Add benchmark functions in alphabetical order.
|
2013-03-15 07:00:03 +00:00
|
|
|
|
|
|
|
|
|
subdir := benchtests
|
2014-02-26 23:12:03 +00:00
|
|
|
|
|
|
|
|
|
include ../Makeconfig
|
2021-10-22 23:13:11 +00: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-05 17:08:42 +00:00
|
|
|
|
hypotf \
|
2021-10-22 23:13:11 +00: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 14:11:57 +00:00
|
|
|
|
|
2021-05-03 09:30:25 +00:00
|
|
|
|
ifneq (,$(filter yes,$(float96-fcts)))
|
2022-02-07 14:37:39 +00:00
|
|
|
|
bench-math += \
|
|
|
|
|
cbrtl \
|
|
|
|
|
# bench-math
|
2021-05-03 09:30:25 +00:00
|
|
|
|
endif
|
|
|
|
|
|
2020-09-23 14:11:57 +00:00
|
|
|
|
ifneq (,$(filter yes,$(float128-fcts) $(float128-alias-fcts)))
|
2022-02-07 14:37:39 +00:00
|
|
|
|
bench-math += \
|
|
|
|
|
expf128 \
|
|
|
|
|
ilogbf128 \
|
|
|
|
|
powf128 \
|
|
|
|
|
sinf128 \
|
|
|
|
|
# bench-math
|
2020-09-23 14:11:57 +00:00
|
|
|
|
endif
|
2014-04-15 09:03:06 +00:00
|
|
|
|
|
2022-02-07 14:37:39 +00:00
|
|
|
|
bench-pthread := \
|
|
|
|
|
pthread-locks \
|
2022-04-21 03:28:41 +00:00
|
|
|
|
pthread-mutex-locks \
|
2022-02-07 14:37:39 +00:00
|
|
|
|
pthread_once \
|
|
|
|
|
thread_create \
|
|
|
|
|
# bench-pthread
|
2014-04-15 09:03:06 +00:00
|
|
|
|
|
2022-02-07 14:37:39 +00:00
|
|
|
|
bench-string := \
|
|
|
|
|
ffs \
|
|
|
|
|
ffsll \
|
|
|
|
|
# bench-string
|
2015-12-08 18:45:14 +00:00
|
|
|
|
|
2013-04-16 12:07:24 +00:00
|
|
|
|
# String function benchmarks.
|
2022-02-07 14:37:39 +00:00
|
|
|
|
string-benchset := \
|
2022-02-07 15:10:05 +00:00
|
|
|
|
bzero \
|
|
|
|
|
bzero-large \
|
|
|
|
|
bzero-walk \
|
2022-02-07 14:37:39 +00:00
|
|
|
|
memccpy \
|
|
|
|
|
memchr \
|
|
|
|
|
memcmp \
|
|
|
|
|
memcmpeq \
|
|
|
|
|
memcpy \
|
|
|
|
|
memcpy-large \
|
|
|
|
|
memcpy-random \
|
|
|
|
|
memcpy-walk \
|
|
|
|
|
memmem \
|
|
|
|
|
memmove \
|
|
|
|
|
memmove-large \
|
|
|
|
|
memmove-walk \
|
|
|
|
|
mempcpy \
|
|
|
|
|
memrchr \
|
|
|
|
|
memset \
|
|
|
|
|
memset-large \
|
|
|
|
|
memset-walk \
|
2022-02-09 15:31:41 +00:00
|
|
|
|
memset-zero \
|
|
|
|
|
memset-zero-large \
|
|
|
|
|
memset-zero-walk \
|
2022-02-07 14:37:39 +00:00
|
|
|
|
rawmemchr \
|
|
|
|
|
stpcpy \
|
|
|
|
|
stpcpy_chk \
|
|
|
|
|
stpncpy \
|
|
|
|
|
strcasecmp \
|
|
|
|
|
strcasestr \
|
|
|
|
|
strcat \
|
|
|
|
|
strchr \
|
|
|
|
|
strchrnul \
|
|
|
|
|
strcmp \
|
|
|
|
|
strcoll \
|
|
|
|
|
strcpy \
|
|
|
|
|
strcpy_chk \
|
|
|
|
|
strcspn \
|
|
|
|
|
strlen \
|
|
|
|
|
strncasecmp \
|
|
|
|
|
strncat \
|
|
|
|
|
strncmp \
|
|
|
|
|
strncpy \
|
|
|
|
|
strnlen \
|
|
|
|
|
strpbrk \
|
|
|
|
|
strrchr \
|
|
|
|
|
strsep \
|
|
|
|
|
strspn \
|
|
|
|
|
strstr \
|
|
|
|
|
strtok \
|
|
|
|
|
# string-benchset
|
2016-04-20 07:49:01 +00:00
|
|
|
|
|
|
|
|
|
# Build and run locale-dependent benchmarks only if we're building natively.
|
|
|
|
|
ifeq (no,$(cross-compiling))
|
2022-02-07 14:37:39 +00:00
|
|
|
|
wcsmbs-benchset := \
|
|
|
|
|
wcpcpy \
|
|
|
|
|
wcpncpy \
|
2022-05-06 12:46:43 +00:00
|
|
|
|
wcrtomb \
|
2022-02-07 14:37:39 +00:00
|
|
|
|
wcscat \
|
|
|
|
|
wcschr \
|
|
|
|
|
wcschrnul \
|
|
|
|
|
wcscmp \
|
|
|
|
|
wcscpy \
|
|
|
|
|
wcscspn \
|
|
|
|
|
wcslen \
|
|
|
|
|
wcsncat \
|
|
|
|
|
wcsncmp \
|
|
|
|
|
wcsncpy \
|
|
|
|
|
wcsnlen \
|
|
|
|
|
wcspbrk \
|
|
|
|
|
wcsrchr \
|
|
|
|
|
wcsspn \
|
|
|
|
|
wmemchr \
|
|
|
|
|
wmemcmp \
|
|
|
|
|
wmemset \
|
|
|
|
|
# wcsmbs-benchset
|
2016-04-20 07:49:01 +00:00
|
|
|
|
else
|
|
|
|
|
wcsmbs-benchset :=
|
|
|
|
|
endif
|
|
|
|
|
|
2015-12-08 18:45:14 +00:00
|
|
|
|
string-benchset-all := $(string-benchset) ${wcsmbs-benchset}
|
2013-04-16 12:07:24 +00:00
|
|
|
|
|
2016-04-20 07:49:01 +00:00
|
|
|
|
ifeq (no,$(cross-compiling))
|
2015-05-12 17:22:14 +00:00
|
|
|
|
# We have to generate locales
|
2022-02-07 14:37:39 +00:00
|
|
|
|
LOCALES := \
|
|
|
|
|
ar_SA.UTF-8 \
|
|
|
|
|
cs_CZ.UTF-8 \
|
|
|
|
|
da_DK.UTF-8 \
|
|
|
|
|
el_GR.UTF-8 \
|
|
|
|
|
en_GB.UTF-8 \
|
|
|
|
|
en_US.UTF-8 \
|
|
|
|
|
es_ES.UTF-8 \
|
|
|
|
|
fa_IR.UTF-8 \
|
|
|
|
|
fr_FR.UTF-8 \
|
|
|
|
|
he_IL.UTF-8 \
|
|
|
|
|
hi_IN.UTF-8 \
|
|
|
|
|
hu_HU.UTF-8 \
|
|
|
|
|
is_IS.UTF-8 \
|
|
|
|
|
it_IT.UTF-8 \
|
|
|
|
|
ja_JP.UTF-8 \
|
|
|
|
|
pl_PL.UTF-8 \
|
|
|
|
|
pt_PT.UTF-8 \
|
|
|
|
|
ru_RU.UTF-8 \
|
|
|
|
|
si_LK.UTF-8 \
|
|
|
|
|
sr_RS.UTF-8 \
|
|
|
|
|
sv_SE.UTF-8 \
|
|
|
|
|
tr_TR.UTF-8 \
|
|
|
|
|
vi_VN.UTF-8 \
|
|
|
|
|
zh_CN.UTF-8 \
|
|
|
|
|
# LOCALES
|
2015-05-12 17:22:14 +00:00
|
|
|
|
include ../gen-locales.mk
|
2016-04-20 07:49:01 +00:00
|
|
|
|
endif
|
2015-05-12 17:22:14 +00:00
|
|
|
|
|
2015-12-08 18:45:14 +00:00
|
|
|
|
stdlib-benchset := strtod
|
2013-11-11 13:23:02 +00:00
|
|
|
|
|
2015-12-08 18:45:14 +00:00
|
|
|
|
stdio-common-benchset := sprintf
|
2015-05-21 14:01:34 +00:00
|
|
|
|
|
2015-09-18 15:02:38 +00:00
|
|
|
|
math-benchset := math-inlines
|
|
|
|
|
|
2017-11-28 14:27:46 +00:00
|
|
|
|
ifeq (${BENCHSET},)
|
2015-12-08 18:45:14 +00:00
|
|
|
|
benchset := $(string-benchset-all) $(stdlib-benchset) $(stdio-common-benchset) \
|
2015-09-18 15:02:38 +00:00
|
|
|
|
$(math-benchset)
|
2017-11-28 14:27:46 +00:00
|
|
|
|
else
|
|
|
|
|
benchset := $(foreach B,$(filter %-benchset,${BENCHSET}), ${${B}})
|
|
|
|
|
endif
|
2013-04-16 12:07:24 +00:00
|
|
|
|
|
2014-03-31 14:58:19 +00:00
|
|
|
|
CFLAGS-bench-ffs.c += -fno-builtin
|
|
|
|
|
CFLAGS-bench-ffsll.c += -fno-builtin
|
2016-10-21 21:18:03 +00:00
|
|
|
|
CFLAGS-bench-sqrt.c += -fno-builtin
|
2016-12-16 19:10:58 +00:00
|
|
|
|
CFLAGS-bench-fmin.c += -fno-builtin
|
2016-12-19 13:00:45 +00:00
|
|
|
|
CFLAGS-bench-fminf.c += -fno-builtin
|
2016-12-16 19:10:58 +00:00
|
|
|
|
CFLAGS-bench-fmax.c += -fno-builtin
|
2016-12-19 13:00:45 +00:00
|
|
|
|
CFLAGS-bench-fmaxf.c += -fno-builtin
|
2017-09-19 12:59:01 +00:00
|
|
|
|
CFLAGS-bench-trunc.c += -fno-builtin
|
|
|
|
|
CFLAGS-bench-truncf.c += -fno-builtin
|
2020-03-27 23:24:02 +00:00
|
|
|
|
CFLAGS-bench-roundeven.c += -fno-builtin
|
|
|
|
|
CFLAGS-bench-roundevenf.c += -fno-builtin
|
2019-03-27 14:10:13 +00:00
|
|
|
|
CFLAGS-bench-isnan.c += -fsignaling-nans
|
|
|
|
|
CFLAGS-bench-isinf.c += -fsignaling-nans
|
|
|
|
|
CFLAGS-bench-isfinite.c += -fsignaling-nans
|
2014-03-31 14:58:19 +00:00
|
|
|
|
|
2017-11-28 14:27:46 +00:00
|
|
|
|
ifeq (${BENCHSET},)
|
2019-02-14 16:37:11 +00:00
|
|
|
|
bench-malloc := malloc-thread malloc-simple
|
2017-11-28 14:27:46 +00:00
|
|
|
|
else
|
|
|
|
|
bench-malloc := $(filter malloc-%,${BENCHSET})
|
|
|
|
|
endif
|
2013-09-11 14:47:12 +00:00
|
|
|
|
|
2021-07-30 19:15:27 +00: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)
|
2022-04-21 03:28:41 +00:00
|
|
|
|
$(addprefix $(objpfx)bench-,pthread-mutex-locks): $(libm-benchtests)
|
2013-09-19 11:25:27 +00:00
|
|
|
|
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Rules to build and execute the benchmarks. Do not put any benchmark
|
|
|
|
|
# parameters beyond this point.
|
|
|
|
|
|
2013-04-16 12:07:24 +00:00
|
|
|
|
# We don't want the benchmark programs to run in parallel since that could
|
|
|
|
|
# affect their performance.
|
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
|
2017-08-21 17:28:54 +00:00
|
|
|
|
bench-extra-objs = json-lib.o
|
|
|
|
|
|
|
|
|
|
extra-objs += $(bench-extra-objs)
|
|
|
|
|
others-extras = $(bench-extra-objs)
|
|
|
|
|
|
2019-04-24 14:38:49 +00:00
|
|
|
|
# The default duration: 1 seconds.
|
2013-04-30 08:40:20 +00:00
|
|
|
|
ifndef BENCH_DURATION
|
2019-04-24 14:38:49 +00:00
|
|
|
|
BENCH_DURATION := 1
|
2013-04-30 08:40:20 +00:00
|
|
|
|
endif
|
|
|
|
|
|
2018-03-15 15:44:58 +00:00
|
|
|
|
CPPFLAGS-nonlib += -DDURATION=$(BENCH_DURATION) -D_ISOMAC
|
2013-04-30 08:40:20 +00:00
|
|
|
|
|
2020-06-05 16:48:04 +00: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 09:19:15 +00: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-05 16:48:04 +00:00
|
|
|
|
endif
|
2013-05-13 08:14:32 +00:00
|
|
|
|
|
2014-03-29 04:10:19 +00:00
|
|
|
|
DETAILED_OPT :=
|
|
|
|
|
|
|
|
|
|
ifdef DETAILED
|
|
|
|
|
DETAILED_OPT := -d
|
|
|
|
|
endif
|
|
|
|
|
|
2013-05-13 08:14:32 +00:00
|
|
|
|
bench-deps := bench-skeleton.c bench-timing.h Makefile
|
2013-04-15 05:47:01 +00:00
|
|
|
|
|
2013-04-12 09:31:44 +00: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-06 22:19:27 +00:00
|
|
|
|
$(run-program-env) \
|
2016-03-08 12:53:24 +00:00
|
|
|
|
$($*-ENV) $(test-via-rtld-prefix) $${run}
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
2014-03-29 04:07:44 +00:00
|
|
|
|
timing-type := $(objpfx)bench-timing-type
|
2022-02-24 22:10:35 +00:00
|
|
|
|
extra-objs += bench-timing-type.o
|
|
|
|
|
|
|
|
|
|
include ../Rules
|
2014-03-29 04:07:44 +00:00
|
|
|
|
|
2022-04-29 06:15:56 +00:00
|
|
|
|
bench-math += $(bench-libmvec)
|
|
|
|
|
|
|
|
|
|
ifeq (${BENCHSET},)
|
|
|
|
|
bench := $(bench-math) $(bench-pthread) $(bench-string)
|
|
|
|
|
else
|
|
|
|
|
bench := $(foreach B,$(filter bench-%,${BENCHSET}), ${${B}})
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# NB: Use "=" instead of ":=" since sysdeps Makefiles may add more
|
|
|
|
|
# benches.
|
|
|
|
|
binaries-bench = $(addprefix $(objpfx)bench-,$(bench))
|
|
|
|
|
extra-objs += $(addsuffix .o,$(addprefix bench-,$(bench)))
|
|
|
|
|
binaries-benchset = $(addprefix $(objpfx)bench-,$(benchset))
|
|
|
|
|
extra-objs += $(addsuffix .o,$(addprefix bench-,$(benchset)))
|
|
|
|
|
binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
|
|
|
|
|
extra-objs += $(addsuffix .o,$(addprefix bench-,$(bench-malloc)))
|
|
|
|
|
|
2021-01-26 17:14:19 +00: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 08:37:21 +00:00
|
|
|
|
bench-clean:
|
|
|
|
|
rm -f $(binaries-bench) $(addsuffix .o,$(binaries-bench))
|
2013-04-16 12:07:24 +00:00
|
|
|
|
rm -f $(binaries-benchset) $(addsuffix .o,$(binaries-benchset))
|
2013-09-11 14:47:12 +00:00
|
|
|
|
rm -f $(binaries-bench-malloc) $(addsuffix .o,$(binaries-bench-malloc))
|
2014-03-29 04:07:44 +00:00
|
|
|
|
rm -f $(timing-type) $(addsuffix .o,$(timing-type))
|
2016-04-20 05:49:49 +00:00
|
|
|
|
rm -f $(addprefix $(objpfx),$(bench-extra-objs))
|
2013-04-16 12:07:24 +00:00
|
|
|
|
|
2017-11-28 14:27:46 +00: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-14 16:37:11 +00:00
|
|
|
|
malloc-thread malloc-simple
|
2017-11-28 14:27:46 +00: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 07:49:01 +00:00
|
|
|
|
bench: bench-build bench-set bench-func bench-malloc
|
2016-12-22 17:37:52 +00:00
|
|
|
|
|
2016-04-20 07:49:01 +00: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 12:07:24 +00:00
|
|
|
|
|
|
|
|
|
bench-set: $(binaries-benchset)
|
|
|
|
|
for run in $^; do \
|
|
|
|
|
echo "Running $${run}"; \
|
|
|
|
|
$(run-bench) > $${run}.out; \
|
|
|
|
|
done
|
2013-04-16 08:37:21 +00:00
|
|
|
|
|
2013-09-11 14:47:12 +00:00
|
|
|
|
bench-malloc: $(binaries-bench-malloc)
|
2017-11-28 14:27:46 +00:00
|
|
|
|
for run in $^; do \
|
2019-02-14 16:37:11 +00:00
|
|
|
|
echo "$${run}"; \
|
|
|
|
|
if [ `basename $${run}` = "bench-malloc-thread" ]; then \
|
2017-11-28 14:27:46 +00:00
|
|
|
|
for thr in 1 8 16 32; do \
|
|
|
|
|
echo "Running $${run} $${thr}"; \
|
2019-02-14 16:37:11 +00: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 14:47:12 +00:00
|
|
|
|
done
|
|
|
|
|
|
2014-03-29 04:07:44 +00: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 12:07:24 +00:00
|
|
|
|
bench-func: $(binaries-bench)
|
2017-11-28 14:27:46 +00:00
|
|
|
|
if [ -n '$^' ] ; then \
|
2020-01-20 11:29:41 +00:00
|
|
|
|
{ timing_type=$$($(test-wrapper-env) \
|
|
|
|
|
$(run-program-env) \
|
|
|
|
|
$(test-via-rtld-prefix) \
|
|
|
|
|
$(timing-type)); \
|
2017-11-28 14:27:46 +00:00
|
|
|
|
echo "{\"timing_type\": \"$${timing_type}\","; \
|
|
|
|
|
echo " \"functions\": {"; \
|
|
|
|
|
for run in $^; do \
|
2022-04-29 05:36:00 +00:00
|
|
|
|
op=$$($(run-bench) $(DETAILED_OPT)); \
|
|
|
|
|
ret=$$?; \
|
|
|
|
|
case "$${ret}" in \
|
|
|
|
|
77) \
|
|
|
|
|
echo "UNSUPPORTED $${run}: $${op}" >&2; \
|
|
|
|
|
;; \
|
|
|
|
|
0) \
|
|
|
|
|
echo "Running $${run}" >&2; \
|
|
|
|
|
if [ "$${run}" != "$<" ]; then \
|
|
|
|
|
echo ","; \
|
|
|
|
|
fi; \
|
|
|
|
|
echo "$${op}"; \
|
|
|
|
|
;; \
|
|
|
|
|
*) \
|
|
|
|
|
echo "FAILED $${run}" >&2; \
|
|
|
|
|
;; \
|
|
|
|
|
esac; \
|
2017-11-28 14:27:46 +00:00
|
|
|
|
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 04:07:44 +00:00
|
|
|
|
fi; \
|
2017-11-28 14:27:46 +00: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 09:31:44 +00:00
|
|
|
|
|
2019-04-25 08:41:52 +00: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-17 19:52:29 +00:00
|
|
|
|
$(link-extra-libs-tests) \
|
2021-07-30 19:15:27 +00:00
|
|
|
|
$(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
|
2013-04-12 09:31:44 +00:00
|
|
|
|
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
2021-07-30 19:15:27 +00:00
|
|
|
|
$(+link-benchtests)
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
2019-04-25 08:41:52 +00:00
|
|
|
|
$(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
|
|
|
|
|
|
2013-04-15 05:47:01 +00:00
|
|
|
|
$(objpfx)bench-%.c: %-inputs $(bench-deps)
|
2013-04-12 09:31:44 +00:00
|
|
|
|
{ if [ -n "$($*-INCLUDE)" ]; then \
|
|
|
|
|
cat $($*-INCLUDE); \
|
|
|
|
|
fi; \
|
2016-01-13 16:00:57 +00:00
|
|
|
|
$(PYTHON) scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp
|
2013-04-12 09:31:44 +00:00
|
|
|
|
mv -f $@-tmp $@
|