mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
math: Add support for auto static math tests
It basically copy the already in place rules for dynamic tests for auto-generated math functions for all support types. To avoid the need to duplicate .inc files, a .SECONDEXPANSION rules is adeed for the gen-libm-test.py generation. New tests are added on the new rules 'libm-test-funcs-auto-static', 'libm-test-funcs-noauto-static', and 'libm-test-funcs-narrow-static'; similar to the non-static counterparts. To avoid add extra build and disk requirement, the new math static tests are only enable with a new define 'build-math-static-tests'. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
parent
85472c20a5
commit
ce6cdb94d0
@ -768,6 +768,11 @@ run-built-tests = yes
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Whether to build the static math tests
|
||||||
|
ifndef build-math-static-tests
|
||||||
|
build-math-static-tests = no
|
||||||
|
endif
|
||||||
|
|
||||||
# Whether to stop immediately when a test fails. Nonempty means to
|
# Whether to stop immediately when a test fails. Nonempty means to
|
||||||
# stop, empty means not to stop.
|
# stop, empty means not to stop.
|
||||||
ifndef stop-on-test-failure
|
ifndef stop-on-test-failure
|
||||||
|
@ -33,6 +33,10 @@ test
|
|||||||
Note that this will rebuild the test if needed, but will not
|
Note that this will rebuild the test if needed, but will not
|
||||||
rebuild what "make all" would have rebuilt.
|
rebuild what "make all" would have rebuilt.
|
||||||
|
|
||||||
|
build-math-static-tests
|
||||||
|
Enable extra math tests for static linking. Use like this:
|
||||||
|
make test t=math/test-float-exp10-static build-math-static-tests=yes
|
||||||
|
|
||||||
--
|
--
|
||||||
Other useful hints:
|
Other useful hints:
|
||||||
|
|
||||||
|
120
math/Makefile
120
math/Makefile
@ -593,8 +593,10 @@ endif
|
|||||||
|
|
||||||
libm-vec-tests = $(addprefix test-,$(libmvec-tests))
|
libm-vec-tests = $(addprefix test-,$(libmvec-tests))
|
||||||
libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
|
libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
|
||||||
test-extras += $(libm-test-support)
|
libm-test-support-static = $(foreach t,$(test-types),libm-test-support-$(t)-static)
|
||||||
extra-test-objs += $(addsuffix .o, $(libm-test-support))
|
test-extras += $(libm-test-support) $(libm-test-support-static)
|
||||||
|
extra-test-objs += $(addsuffix .o, $(libm-test-support)) \
|
||||||
|
$(addsuffix .o, $(libm-test-support-static))
|
||||||
libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests))
|
libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests))
|
||||||
test-extras += $(libm-vec-test-wrappers)
|
test-extras += $(libm-vec-test-wrappers)
|
||||||
extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
|
extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
|
||||||
@ -664,12 +666,10 @@ libm-test-funcs-auto = \
|
|||||||
y1 \
|
y1 \
|
||||||
yn \
|
yn \
|
||||||
# libm-test-funcs-auto
|
# libm-test-funcs-auto
|
||||||
libm-test-funcs-noauto = \
|
libm-test-funcs-noauto-base = \
|
||||||
canonicalize \
|
canonicalize \
|
||||||
ceil \
|
ceil \
|
||||||
cimag \
|
cimag \
|
||||||
compat_totalorder \
|
|
||||||
compat_totalordermag \
|
|
||||||
conj \
|
conj \
|
||||||
copysign \
|
copysign \
|
||||||
cproj \
|
cproj \
|
||||||
@ -740,6 +740,11 @@ libm-test-funcs-noauto = \
|
|||||||
trunc \
|
trunc \
|
||||||
ufromfp \
|
ufromfp \
|
||||||
ufromfpx \
|
ufromfpx \
|
||||||
|
# libm-test-funcs-noauto-base
|
||||||
|
libm-test-funcs-noauto = \
|
||||||
|
$(libm-test-funcs-noauto-base) \
|
||||||
|
compat_totalorder \
|
||||||
|
compat_totalordermag \
|
||||||
# libm-test-funcs-noauto
|
# libm-test-funcs-noauto
|
||||||
libm-test-funcs-compat = \
|
libm-test-funcs-compat = \
|
||||||
compat_totalorder \
|
compat_totalorder \
|
||||||
@ -816,6 +821,71 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \
|
|||||||
$(make-target-directory)
|
$(make-target-directory)
|
||||||
$(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
|
$(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
|
||||||
|
|
||||||
|
|
||||||
|
libm-test-funcs-auto-static = \
|
||||||
|
$(libm-test-funcs-auto) \
|
||||||
|
# libm-test-funcs-auto-static
|
||||||
|
libm-test-funcs-noauto-static = \
|
||||||
|
$(libm-test-funcs-noauto-base) \
|
||||||
|
# libm-test-funcs-noauto-static
|
||||||
|
libm-test-funcs-narrow-static = \
|
||||||
|
$(libm-test-funcs-narrow) \
|
||||||
|
# libm-test-funcs-narrow-static
|
||||||
|
libm-test-funcs-all-static = $(libm-test-funcs-auto-static) $(libm-test-funcs-noauto-static)
|
||||||
|
|
||||||
|
libm-test-c-auto-static = $(foreach f,$(libm-test-funcs-auto-static),libm-test-$(f)-static.c)
|
||||||
|
libm-test-c-noauto-static = $(foreach f,$(libm-test-funcs-noauto-static),libm-test-$(f)-static.c)
|
||||||
|
libm-test-c-narrow-static = $(foreach f,$(libm-test-funcs-narrow-static),\
|
||||||
|
libm-test-narrow-$(f)-static.c)
|
||||||
|
generated += $(libm-test-c-auto-static) $(libm-test-c-noauto-static) $(libm-test-c-narrow-static)
|
||||||
|
|
||||||
|
libm-tests-normal-static = $(foreach t,$(libm-tests-base-normal),\
|
||||||
|
$(foreach f,$(libm-test-funcs-all-static),\
|
||||||
|
$(t)-$(f)-static))
|
||||||
|
libm-tests-narrow-static = $(foreach t,$(libm-tests-base-narrow-static),\
|
||||||
|
$(foreach f,$(libm-test-funcs-narrow-static),\
|
||||||
|
$(t)-$(f)-static))
|
||||||
|
libm-tests-vector-static = $(foreach t,$(libmvec-tests-static),\
|
||||||
|
$(foreach f,$($(t)-funcs),test-$(t)-$(f)-static))
|
||||||
|
libm-tests-static = $(libm-tests-normal-static) $(libm-tests-narrow-static) $(libm-tests-vector-static)
|
||||||
|
libm-tests-for-type-static = $(foreach f,$(libm-test-funcs-all-static),\
|
||||||
|
test-$(1)-$(f)-static test-i$(1)-$(f)-static) \
|
||||||
|
$(filter test-$(1)-%,$(libm-tests-vector-static) \
|
||||||
|
$(libm-tests-narrow-static))
|
||||||
|
|
||||||
|
libm-tests.o += $(addsuffix .o,$(libm-tests-static))
|
||||||
|
|
||||||
|
ifeq ($(build-math-static-tests),yes)
|
||||||
|
tests-static += $(libm-tests-static)
|
||||||
|
generated += $(addsuffix .c,$(libm-tests)) \
|
||||||
|
$(foreach t,$(test-types),libm-test-support-$(t)-static.c)
|
||||||
|
endif
|
||||||
|
|
||||||
|
libm-test-c-auto-obj-static = $(addprefix $(objpfx),$(libm-test-c-auto-static))
|
||||||
|
libm-test-c-noauto-obj-static = $(addprefix $(objpfx),$(libm-test-c-noauto-static))
|
||||||
|
libm-test-c-narrow-obj-static = $(addprefix $(objpfx),$(libm-test-c-narrow-static))
|
||||||
|
|
||||||
|
# Use the same input test definitions for both dynamic and static tests.
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
$(libm-test-c-noauto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
|
||||||
|
gen-libm-test.py
|
||||||
|
$(make-target-directory)
|
||||||
|
$(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
$(libm-test-c-auto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
|
||||||
|
gen-libm-test.py \
|
||||||
|
auto-libm-test-out$$(subst -static,,%)
|
||||||
|
$(make-target-directory)
|
||||||
|
$(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
$(libm-test-c-narrow-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
|
||||||
|
gen-libm-test.py \
|
||||||
|
auto-libm-test-out$$(subst -static,,%)
|
||||||
|
$(make-target-directory)
|
||||||
|
$(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
|
||||||
|
|
||||||
# Tests for totalorder compat symbols reuse the table of tests as
|
# Tests for totalorder compat symbols reuse the table of tests as
|
||||||
# processed by gen-libm-test.py, so add dependencies on the generated
|
# processed by gen-libm-test.py, so add dependencies on the generated
|
||||||
# .c files.
|
# .c files.
|
||||||
@ -1044,6 +1114,18 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
|
|||||||
echo "#include <libm-test-$$func.c>"; \
|
echo "#include <libm-test-$$func.c>"; \
|
||||||
) > $@
|
) > $@
|
||||||
|
|
||||||
|
$(foreach t,$(libm-tests-normal-static),$(objpfx)$(t).c): $(objpfx)test-%.c:
|
||||||
|
type_func=$*; \
|
||||||
|
type=$${type_func%%-*}; \
|
||||||
|
func=$${type_func#*-}; \
|
||||||
|
( \
|
||||||
|
echo "#include <test-$$type.h>"; \
|
||||||
|
echo "#include <test-math-exceptions.h>"; \
|
||||||
|
echo "#include <test-math-errno.h>"; \
|
||||||
|
echo "#include <test-math-scalar.h>"; \
|
||||||
|
echo "#include <libm-test-$$func.c>"; \
|
||||||
|
) > $@
|
||||||
|
|
||||||
$(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
|
$(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
|
||||||
type_pair_func=$*; \
|
type_pair_func=$*; \
|
||||||
type_pair=$${type_pair_func%-*}; \
|
type_pair=$${type_pair_func%-*}; \
|
||||||
@ -1078,6 +1160,13 @@ $(foreach t,$(test-types),\
|
|||||||
echo "#include <libm-test-support.c>"; \
|
echo "#include <libm-test-support.c>"; \
|
||||||
) > $@
|
) > $@
|
||||||
|
|
||||||
|
$(foreach t,$(test-types),\
|
||||||
|
$(objpfx)libm-test-support-$(t)-static.c): $(objpfx)libm-test-support-%.c:
|
||||||
|
( \
|
||||||
|
echo "#include <test-$*.h>"; \
|
||||||
|
echo "#include <libm-test-support.c>"; \
|
||||||
|
) > $@
|
||||||
|
|
||||||
$(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h
|
$(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h
|
||||||
|
|
||||||
define o-iterator-doit
|
define o-iterator-doit
|
||||||
@ -1087,6 +1176,13 @@ endef
|
|||||||
object-suffixes-left := $(libm-tests-base)
|
object-suffixes-left := $(libm-tests-base)
|
||||||
include $(o-iterator)
|
include $(o-iterator)
|
||||||
|
|
||||||
|
define o-iterator-doit
|
||||||
|
$(foreach f,$(libm-test-funcs-all-static),\
|
||||||
|
$(objpfx)$(o)-$(f)-static.o): $(objpfx)$(o)%.o: $(objpfx)libm-test%.c
|
||||||
|
endef
|
||||||
|
object-suffixes-left := $(libm-tests-base)
|
||||||
|
include $(o-iterator)
|
||||||
|
|
||||||
define o-iterator-doit
|
define o-iterator-doit
|
||||||
$(foreach f,$(libm-test-funcs-narrow),\
|
$(foreach f,$(libm-test-funcs-narrow),\
|
||||||
$(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \
|
$(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \
|
||||||
@ -1102,6 +1198,13 @@ endef
|
|||||||
object-suffixes-left := $(libm-tests-base-normal)
|
object-suffixes-left := $(libm-tests-base-normal)
|
||||||
include $(o-iterator)
|
include $(o-iterator)
|
||||||
|
|
||||||
|
define o-iterator-doit
|
||||||
|
$(foreach f,$(libm-test-funcs-all-static),\
|
||||||
|
$(objpfx)$(o)-$(f)-static.o): CFLAGS += $(libm-test-no-inline-cflags)
|
||||||
|
endef
|
||||||
|
object-suffixes-left := $(libm-tests-base-normal)
|
||||||
|
include $(o-iterator)
|
||||||
|
|
||||||
define o-iterator-doit
|
define o-iterator-doit
|
||||||
$(foreach f,$(libm-test-funcs-narrow),\
|
$(foreach f,$(libm-test-funcs-narrow),\
|
||||||
$(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-no-inline-cflags)
|
$(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-no-inline-cflags)
|
||||||
@ -1123,6 +1226,13 @@ endef
|
|||||||
object-suffixes-left := $(test-types)
|
object-suffixes-left := $(test-types)
|
||||||
include $(o-iterator)
|
include $(o-iterator)
|
||||||
|
|
||||||
|
define o-iterator-doit
|
||||||
|
$(addprefix $(objpfx),\
|
||||||
|
$(call libm-tests-for-type-static,$(o))): $(objpfx)libm-test-support-$(o)-static.o
|
||||||
|
endef
|
||||||
|
object-suffixes-left := $(test-types)
|
||||||
|
include $(o-iterator)
|
||||||
|
|
||||||
define o-iterator-doit
|
define o-iterator-doit
|
||||||
$(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags)
|
$(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags)
|
||||||
endef
|
endef
|
||||||
|
1
math/test-double-static.h
Normal file
1
math/test-double-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-double.h"
|
1
math/test-float-static.h
Normal file
1
math/test-float-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-float.h"
|
1
math/test-float128-static.h
Normal file
1
math/test-float128-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-float128.h"
|
1
math/test-float32-static.h
Normal file
1
math/test-float32-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-float32.h"
|
1
math/test-float32x-static.h
Normal file
1
math/test-float32x-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-float32x.h"
|
1
math/test-float64-static.h
Normal file
1
math/test-float64-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-float64.h"
|
1
math/test-float64x-static.h
Normal file
1
math/test-float64x-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-float64x.h"
|
1
math/test-ibm128-static.h
Normal file
1
math/test-ibm128-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-ibm128.h"
|
1
math/test-ldouble-static.h
Normal file
1
math/test-ldouble-static.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "test-ldouble.h"
|
Loading…
Reference in New Issue
Block a user