2017-01-01 00:14:16 +00:00
|
|
|
|
# Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
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
|
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
# 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
|
2015-12-08 18:45:14 +00:00
|
|
|
|
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \
|
2016-12-19 13:00:45 +00:00
|
|
|
|
modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \
|
|
|
|
|
fmaxf
|
2014-04-15 09:03:06 +00:00
|
|
|
|
|
|
|
|
|
bench-pthread := pthread_once
|
|
|
|
|
|
2015-12-08 18:45:14 +00:00
|
|
|
|
bench-string := ffs ffsll
|
|
|
|
|
|
|
|
|
|
bench := $(bench-math) $(bench-pthread) $(bench-string)
|
2013-05-22 05:35:04 +00:00
|
|
|
|
|
2013-04-16 12:07:24 +00:00
|
|
|
|
# String function benchmarks.
|
2015-12-08 18:45:14 +00:00
|
|
|
|
string-benchset := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
|
|
|
|
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-03-23 19:00:02 +00:00
|
|
|
|
strcoll memcpy-large memcpy-random memmove-large memset-large
|
2016-04-20 07:49:01 +00:00
|
|
|
|
|
|
|
|
|
# Build and run locale-dependent benchmarks only if we're building natively.
|
|
|
|
|
ifeq (no,$(cross-compiling))
|
2015-12-08 18:45:14 +00: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 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
|
|
|
|
|
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 07:27:11 +00:00
|
|
|
|
he_IL.UTF-8 is_IS.UTF-8 es_ES.UTF-8 hi_IN.UTF-8 sv_SE.UTF-8 \
|
2015-05-12 17:22:14 +00:00
|
|
|
|
hu_HU.UTF-8 it_IT.UTF-8 sr_RS.UTF-8 zh_CN.UTF-8
|
|
|
|
|
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
|
|
|
|
|
|
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)
|
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
|
2014-03-31 14:58:19 +00:00
|
|
|
|
|
2013-09-11 14:47:12 +00:00
|
|
|
|
bench-malloc := malloc-thread
|
|
|
|
|
|
Use existing makefile variables for dependencies on glibc libraries.
glibc's Makeconfig defines some variables such as $(libm) and $(libdl)
for linking with libraries built by glibc, and nptl/Makeconfig
(included by the toplevel Makeconfig) defines others such as
$(shared-thread-library).
In some places glibc's Makefiles use those variables when linking
against the relevant libraries, but in other places they hardcode the
location of the libraries in the build tree. This patch cleans up
various places to use the variables that already exist (in the case of
libm, replacing several duplicate definitions of a $(link-libm)
variable in subdirectory Makefiles). (It's not necessarily exactly
equivalent to what the existing code does - in particular,
$(shared-thread-library) includes libpthread_nonshared, but is
replacing places that just referred to libpthread.so. But I think
that change is desirable on the general principle of linking things as
close as possible to the way in which they would be linked with an
installed library, unless there is a clear reason not to do so.)
To support running tests with an installed copy of glibc without
needing the full build tree from when that copy was built, I think it
will be useful to use such variables more generally and systematically
- every time the rules for building a test refer to some file from the
build tree that's also installed by glibc, use a makefile variable so
that the installed-testing case can point those variables to installed
copies of the files. This patch just deals with straightforward cases
where such variables already exist.
It's quite possible some uses of $(shared-thread-library) should
actually be a new $(thread-library) variable that's set appropriately
in the --disable-shared case, if those uses would in fact work without
shared libraries. I didn't change the status quo that those cases
hardcode use of a shared library whether or not it's actually needed
(but other uses such as $(libm) and $(libdl) would now get the static
library if the shared library isn't built, when some previously
hardcoded use of the shared library - if they actually need shared
libraries, the test itself needs an enable-shared conditional anyway).
Tested x86_64.
* benchtests/Makefile
($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
not $(common-objpfx)math/libm.so.
($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
$(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
* elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
($(objpfx)tst-audit8): Depend on $(libm), not
$(common-objpfx)math/libm.so.
* malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
not $(common-objpfx)dlfcn/libdl.so.
* math/Makefile
($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
Depend on $(libm), not $(objpfx)libm.so. Do not condition on
[$(build-shared) = yes].
($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
$(common-objpfx)nptl/libpthread.so.
* misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
$(common-objpfx)math/libm.so$(libm.so-version) or
$(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
* nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
* setjmp/Makefile (link-libm): Remove variable.
($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
* stdio-common/Makefile (link-libm): Remove variable.
($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
* stdlib/Makefile (link-libm): Remove variable.
($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
($(objpfx)tst-strtod-round): Likewise.
($(objpfx)tst-tininess): Likewise.
($(objpfx)tst-strtod-underflow): Likewise.
($(objpfx)tst-strtod6): Likewise.
($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
$(libdl), not $(common-objpfx)nptl/libpthread.so and
$(common-objpfx)dlfcn/libdl.so.
2014-05-16 21:38:08 +00:00
|
|
|
|
$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
|
2015-09-18 15:02:38 +00:00
|
|
|
|
$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
|
Use existing makefile variables for dependencies on glibc libraries.
glibc's Makeconfig defines some variables such as $(libm) and $(libdl)
for linking with libraries built by glibc, and nptl/Makeconfig
(included by the toplevel Makeconfig) defines others such as
$(shared-thread-library).
In some places glibc's Makefiles use those variables when linking
against the relevant libraries, but in other places they hardcode the
location of the libraries in the build tree. This patch cleans up
various places to use the variables that already exist (in the case of
libm, replacing several duplicate definitions of a $(link-libm)
variable in subdirectory Makefiles). (It's not necessarily exactly
equivalent to what the existing code does - in particular,
$(shared-thread-library) includes libpthread_nonshared, but is
replacing places that just referred to libpthread.so. But I think
that change is desirable on the general principle of linking things as
close as possible to the way in which they would be linked with an
installed library, unless there is a clear reason not to do so.)
To support running tests with an installed copy of glibc without
needing the full build tree from when that copy was built, I think it
will be useful to use such variables more generally and systematically
- every time the rules for building a test refer to some file from the
build tree that's also installed by glibc, use a makefile variable so
that the installed-testing case can point those variables to installed
copies of the files. This patch just deals with straightforward cases
where such variables already exist.
It's quite possible some uses of $(shared-thread-library) should
actually be a new $(thread-library) variable that's set appropriately
in the --disable-shared case, if those uses would in fact work without
shared libraries. I didn't change the status quo that those cases
hardcode use of a shared library whether or not it's actually needed
(but other uses such as $(libm) and $(libdl) would now get the static
library if the shared library isn't built, when some previously
hardcoded use of the shared library - if they actually need shared
libraries, the test itself needs an enable-shared conditional anyway).
Tested x86_64.
* benchtests/Makefile
($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
not $(common-objpfx)math/libm.so.
($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
$(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
* elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
($(objpfx)tst-audit8): Depend on $(libm), not
$(common-objpfx)math/libm.so.
* malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
not $(common-objpfx)dlfcn/libdl.so.
* math/Makefile
($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
Depend on $(libm), not $(objpfx)libm.so. Do not condition on
[$(build-shared) = yes].
($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
$(common-objpfx)nptl/libpthread.so.
* misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
$(common-objpfx)math/libm.so$(libm.so-version) or
$(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
* nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
* setjmp/Makefile (link-libm): Remove variable.
($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
* stdio-common/Makefile (link-libm): Remove variable.
($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
* stdlib/Makefile (link-libm): Remove variable.
($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
($(objpfx)tst-strtod-round): Likewise.
($(objpfx)tst-tininess): Likewise.
($(objpfx)tst-strtod-underflow): Likewise.
($(objpfx)tst-strtod6): Likewise.
($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
$(libdl), not $(common-objpfx)nptl/libpthread.so and
$(common-objpfx)dlfcn/libdl.so.
2014-05-16 21:38:08 +00:00
|
|
|
|
$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
|
2013-09-11 14:47:12 +00:00
|
|
|
|
$(objpfx)bench-malloc-thread: $(shared-thread-library)
|
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:
|
|
|
|
|
|
2013-03-15 07:00:03 +00:00
|
|
|
|
include ../Rules
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
|
|
|
|
binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
|
2013-04-16 12:07:24 +00:00
|
|
|
|
binaries-benchset := $(addprefix $(objpfx)bench-,$(benchset))
|
2013-09-11 14:47:12 +00:00
|
|
|
|
binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
2013-04-30 08:40:20 +00:00
|
|
|
|
# The default duration: 10 seconds.
|
|
|
|
|
ifndef BENCH_DURATION
|
|
|
|
|
BENCH_DURATION := 10
|
|
|
|
|
endif
|
|
|
|
|
|
2013-06-10 04:38:46 +00:00
|
|
|
|
CPPFLAGS-nonlib += -DDURATION=$(BENCH_DURATION)
|
2013-04-30 08:40:20 +00:00
|
|
|
|
|
2013-05-13 08:14:32 +00:00
|
|
|
|
# Use clock_gettime to measure performance of functions. The default is to use
|
|
|
|
|
# HP_TIMING if it is available.
|
|
|
|
|
ifdef USE_CLOCK_GETTIME
|
|
|
|
|
CPPFLAGS-nonlib += -DUSE_CLOCK_GETTIME
|
|
|
|
|
endif
|
|
|
|
|
|
2014-03-29 04:10:19 +00:00
|
|
|
|
DETAILED_OPT :=
|
|
|
|
|
|
|
|
|
|
ifdef DETAILED
|
|
|
|
|
DETAILED_OPT := -d
|
|
|
|
|
endif
|
|
|
|
|
|
2013-04-16 13:04:03 +00:00
|
|
|
|
# This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed
|
|
|
|
|
# for all these modules.
|
2013-09-11 14:47:12 +00:00
|
|
|
|
cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c) \
|
|
|
|
|
$(binaries-bench-malloc:=.c)
|
2013-04-16 13:04:03 +00:00
|
|
|
|
lib := nonlib
|
|
|
|
|
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
|
|
|
|
|
2016-04-20 05:49:49 +00:00
|
|
|
|
bench-extra-objs = json-lib.o
|
|
|
|
|
|
|
|
|
|
extra-objs += $(bench-extra-objs)
|
2014-04-08 09:18:16 +00:00
|
|
|
|
|
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
|
|
|
|
|
|
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
|
|
|
|
|
2016-12-22 17:37:52 +00:00
|
|
|
|
# Define the bench target only if the target has a usable python installation.
|
|
|
|
|
ifdef PYTHON
|
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
|
|
|
|
else
|
|
|
|
|
bench:
|
|
|
|
|
@echo "The bench target needs python to run."
|
|
|
|
|
@exit 1
|
|
|
|
|
endif
|
|
|
|
|
|
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)
|
|
|
|
|
run=$(objpfx)bench-malloc-thread; \
|
|
|
|
|
for thr in 1 8 16 32; do \
|
|
|
|
|
echo "Running $${run} $${thr}"; \
|
|
|
|
|
$(run-bench) $${thr} > $${run}-$${thr}.out; \
|
|
|
|
|
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)
|
2014-04-08 09:18:16 +00:00
|
|
|
|
{ timing_type=$$($(timing-type)); \
|
|
|
|
|
echo "{\"timing_type\": \"$${timing_type}\","; \
|
|
|
|
|
echo " \"functions\": {"; \
|
2014-03-29 04:07:44 +00:00
|
|
|
|
for run in $^; do \
|
|
|
|
|
if ! [ "x$${run}" = "x$<" ]; then \
|
|
|
|
|
echo ","; \
|
|
|
|
|
fi; \
|
2013-04-15 08:22:26 +00:00
|
|
|
|
echo "Running $${run}" >&2; \
|
2014-03-29 04:10:19 +00:00
|
|
|
|
$(run-bench) $(DETAILED_OPT); \
|
2014-03-29 04:07:44 +00:00
|
|
|
|
done; \
|
2014-04-08 09:18:16 +00:00
|
|
|
|
echo; \
|
|
|
|
|
echo " }"; \
|
2014-03-29 04:07:44 +00:00
|
|
|
|
echo "}"; } > $(objpfx)bench.out-tmp; \
|
2013-04-12 09:31:44 +00:00
|
|
|
|
if [ -f $(objpfx)bench.out ]; then \
|
|
|
|
|
mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
|
|
|
|
|
fi; \
|
|
|
|
|
mv -f $(objpfx)bench.out-tmp $(objpfx)bench.out
|
2016-01-13 16:00:57 +00:00
|
|
|
|
$(PYTHON) scripts/validate_benchout.py $(objpfx)bench.out \
|
2014-06-11 08:46:29 +00:00
|
|
|
|
scripts/benchout.schema.json
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
2013-09-11 14:47:12 +00:00
|
|
|
|
$(timing-type) $(binaries-bench) $(binaries-benchset) \
|
|
|
|
|
$(binaries-bench-malloc): %: %.o $(objpfx)json-lib.o \
|
2016-12-17 19:52:29 +00:00
|
|
|
|
$(link-extra-libs-tests) \
|
2013-04-12 09:31:44 +00:00
|
|
|
|
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
|
|
|
|
|
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
2016-03-08 12:53:24 +00:00
|
|
|
|
$(+link-tests)
|
2013-04-12 09:31:44 +00:00
|
|
|
|
|
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 $@
|