about summary refs log tree commit diff
path: root/math/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-06-28 14:20:21 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-06-28 14:20:21 +0000
commit2dd0aec531ad03e8e1642f8642930451b23fe2ba (patch)
tree269fb8bbec8b2830f52aba1e5065b43740fd82cb /math/Makefile
parent073e8fa7739ed453d6854b834f290c263a6cdb9f (diff)
downloadglibc-2dd0aec531ad03e8e1642f8642930451b23fe2ba.tar.gz
glibc-2dd0aec531ad03e8e1642f8642930451b23fe2ba.tar.xz
glibc-2dd0aec531ad03e8e1642f8642930451b23fe2ba.zip
Add more thorough generated tgmath.h test.
This patch adds a more thorough test of tgmath.h macros, verifying
both the return type and the function called for all the cases of
valid argument types.  (Cases with current problems - I've just filed
four bugs - are disabled or omitted pending fixing those problems.)
The test uses a Python generator (works with both Python 2 and 3) to
generate a C file which is then built and run as a test in the usual
way (and that C file includes its own dummy definitions of libm
functions similar to existing tgmath.h tests).  The motivation is to
make it easier to add tests of tgmath.h for _Float128 when adding
tgmath.h support for that type; the _FloatN / _FloatNx support is
present in the script, but disabled until the tgmath.h support is
written.

Tested for x86_64, and for arm to check things in the long double =
double case.  (In that case, it's OK to call either double or long
double functions when the selected type is double or long double, as
long as the return type of the macro is exactly correct.)

	* math/gen-tgmath-tests.py: New file.
	* math/Makefile [PYTHON] (tests): Add test-tgmath3.
	[PYTHON] (generated): Add test-tgmath3.c.
	[PYTHON] (CFLAGS-test-tgmath3.c): New variable.
	[PYTHON] ($(objpfx)test-tgmath3.c): New rule.
Diffstat (limited to 'math/Makefile')
-rw-r--r--math/Makefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/math/Makefile b/math/Makefile
index 9aca4e04ec..e09b0c0545 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -290,6 +290,15 @@ $(libm-test-c-auto-obj): $(objpfx)libm-test%.c: libm-test%.inc \
 libm-test-incs = $(foreach f,$(libm-test-funcs-all),libm-test-$(f).inc)
 endif
 
+ifdef PYTHON
+tests += test-tgmath3
+generated += test-tgmath3.c
+CFLAGS-test-tgmath3.c = -fno-builtin
+
+$(objpfx)test-tgmath3.c: gen-tgmath-tests.py
+	$(PYTHON) $< > $@
+endif
+
 libm-test-fast-math-cflags = -fno-builtin -D__FAST_MATH__ -DTEST_FAST_MATH
 libm-test-vec-cflags = $(libm-test-fast-math-cflags) -fno-inline \
 		       -ffloat-store -D_OPENMP=201307 -Wno-unknown-pragmas