[PATCH] newlib: libm: integrate tests subdir

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Integrate the old libm/test/ subdir into the main build.  It hasn't
been used in a long time causing the code to rot a bit.  I've fixed
some of those, but it still fails for many ports, so it's disabled
by default.  People who want to take a closer look can run:
$ make libm/test/test
---
 newlib/Makefile.am            |   2 +
 newlib/Makefile.in            | 395 +++++++++++++++++++++++++++++++++-
 newlib/libm/Makefile.inc      |   1 +
 newlib/libm/test/Makefile.in  | 202 -----------------
 newlib/libm/test/Makefile.inc |  85 ++++++++
 newlib/libm/test/math.c       |   6 -
 newlib/libm/test/test.h       |   5 +
 newlib/libm/test/test_is.c    |   1 -
 8 files changed, 479 insertions(+), 218 deletions(-)
 delete mode 100644 newlib/libm/test/Makefile.in
 create mode 100644 newlib/libm/test/Makefile.inc

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index b8335d88a1fb..a3545d41a54b 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -6,8 +6,10 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 # Variables that will accumulate in subdirs.
 CLEANFILES =
 EXTRA_DIST =
+EXTRA_PROGRAMS =
 PHONY =
 SUFFIXES =
+check_PROGRAMS =
 info_TEXINFOS =
 noinst_DATA =
 INSTALL_DATA_LOCAL =
diff --git a/newlib/libm/Makefile.inc b/newlib/libm/Makefile.inc
index e43ec7855087..de63b8674c22 100644
--- a/newlib/libm/Makefile.inc
+++ b/newlib/libm/Makefile.inc
@@ -47,6 +47,7 @@ endif
 include %D%/common/Makefile.inc
 include %D%/complex/Makefile.inc
 include %D%/fenv/Makefile.inc
+include %D%/test/Makefile.inc
 
 if HAVE_LIBM_MACHINE_AARCH64
 include %D%/machine/aarch64/Makefile.inc
diff --git a/newlib/libm/test/Makefile.in b/newlib/libm/test/Makefile.in
deleted file mode 100644
index 1f086fc68e13..000000000000
--- a/newlib/libm/test/Makefile.in
+++ /dev/null
@@ -1,202 +0,0 @@
-# Makefile for newlib/libm/test.
-# Copyright (c) 1994, 2002 Red Hat Incorporated.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-# 
-#    Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 
-#    Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 
-#    The name of Red Hat Incorporated may not be used to endorse
-#    or promote products derived from this software without specific
-#    prior written permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED.  IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-TOP=..
-SRCTOP=..
-
-#### Host, target, and site specific Makefile fragments come in here.
-###
-
-
-OFILES=test.o  string.o  convert.o conv_vec.o iconv_vec.o test_is.o dvec.o sprint_vec.o sprint_ivec.o math2.o test_ieee.o
-
-VEC_OFILES=\
-	math.o \
-	atan2_vec.o \
-	atan2f_vec.o \
-	jn_vec.o \
-	jnf_vec.o \
-	log2_vec.o \
-	log2f_vec.o \
-	yn_vec.o \
-	ynf_vec.o \
-	acos_vec.o	\
-	acosf_vec.o	\
-	acosh_vec.o	\
-	acoshf_vec.o	\
-	asin_vec.o	\
-	asinf_vec.o	\
-	asinh_vec.o	\
-	asinhf_vec.o	\
-	atan_vec.o	\
-	atanf_vec.o	\
-	atanh_vec.o	\
-	atanhf_vec.o	\
-	ceil_vec.o	\
-	ceilf_vec.o	\
-	cos_vec.o	\
-	cosf_vec.o	\
-	cosh_vec.o	\
-	coshf_vec.o	\
-	erf_vec.o	\
-	erfc_vec.o	\
-	erfcf_vec.o	\
-	erff_vec.o	\
-	exp_vec.o	\
-	expf_vec.o	\
-	fabs_vec.o	\
-	fabsf_vec.o	\
-	floor_vec.o	\
-	floorf_vec.o	\
-	gamma_vec.o	\
-	gammaf_vec.o	\
-	j0_vec.o	\
-	j0f_vec.o	\
-	j1_vec.o	\
-	j1f_vec.o	\
-	log10_vec.o	\
-	log10f_vec.o	\
-	log1p_vec.o	\
-	log1pf_vec.o	\
-	log_vec.o	\
-	logf_vec.o	\
-	sin_vec.o	\
-	sinf_vec.o	\
-	sinh_vec.o	\
-	sinhf_vec.o	\
-	sqrt_vec.o	\
-	sqrtf_vec.o	\
-	tan_vec.o	\
-	tanf_vec.o	\
-	tanh_vec.o	\
-	tanhf_vec.o	\
-	y0_vec.o	\
-	y0f_vec.o	\
-	y1_vec.o	\
-	y1f_vec.o	\
-	hypotf_vec.o	\
-	hypot_vec.o	\
-	fmod_vec.o	\
-	fmodf_vec.o	
-
-
-all:$(OFILES)  $(VEC_OFILES)
-	$(CROSS_LD) -o test ../../crt0.o $(OFILES) $(VEC_OFILES) ../../libc.a ../../libm.a
-
-
-clean mostlyclean:
-	$(RM) $(OFILES) $(VEC_OFILES) *~
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile config.status
-
-
-Makefile:Makefile.in
-	$(SHELL) config.status
-
-# to support SunOS VPATH
-acos_vec.o: acos_vec.c
-acosf_vec.o: acosf_vec.c
-acosh_vec.o: acosh_vec.c
-acoshf_vec.o: acoshf_vec.c
-asin_vec.o: asin_vec.c
-asinf_vec.o: asinf_vec.c
-asinh_vec.o: asinh_vec.c
-asinhf_vec.o: asinhf_vec.c
-atan2_vec.o: atan2_vec.c
-atan2f_vec.o: atan2f_vec.c
-atan_vec.o: atan_vec.c
-atanf_vec.o: atanf_vec.c
-atanh_vec.o: atanh_vec.c
-atanhf_vec.o: atanhf_vec.c
-ceil_vec.o: ceil_vec.c
-ceilf_vec.o: ceilf_vec.c
-conv_vec.o: conv_vec.c
-convert.o: convert.c
-cos_vec.o: cos_vec.c
-cosf_vec.o: cosf_vec.c
-cosh_vec.o: cosh_vec.c
-coshf_vec.o: coshf_vec.c
-dcvt.o: dcvt.c
-dvec.o: dvec.c
-erf_vec.o: erf_vec.c
-erfc_vec.o: erfc_vec.c
-erfcf_vec.o: erfcf_vec.c
-erff_vec.o: erff_vec.c
-exp_vec.o: exp_vec.c
-expf_vec.o: expf_vec.c
-fabs_vec.o: fabs_vec.c
-fabsf_vec.o: fabsf_vec.c
-floor_vec.o: floor_vec.c
-floorf_vec.o: floorf_vec.c
-fmod_vec.o: fmod_vec.c
-fmodf_vec.o: fmodf_vec.c
-gamma_vec.o: gamma_vec.c
-gammaf_vec.o: gammaf_vec.c
-hypot_vec.o: hypot_vec.c
-hypotf_vec.o: hypotf_vec.c
-iconv_vec.o: iconv_vec.c
-j0_vec.o: j0_vec.c
-j0f_vec.o: j0f_vec.c
-j1_vec.o: j1_vec.c
-j1f_vec.o: j1f_vec.c
-jn_vec.o: jn_vec.c
-jnf_vec.o: jnf_vec.c
-log10_vec.o: log10_vec.c
-log10f_vec.o: log10f_vec.c
-log1p_vec.o: log1p_vec.c
-log1pf_vec.o: log1pf_vec.c
-log2_vec.o: log2_vec.c
-log2f_vec.o: log2f_vec.c
-log_vec.o: log_vec.c
-logf_vec.o: logf_vec.c
-math.o: math.c
-math2.o: math2.c
-sin_vec.o: sin_vec.c
-sinf_vec.o: sinf_vec.c
-sinh_vec.o: sinh_vec.c
-sinhf_vec.o: sinhf_vec.c
-sprint_ivec.o: sprint_ivec.c
-sprint_vec.o: sprint_vec.c
-sqrt_vec.o: sqrt_vec.c
-sqrtf_vec.o: sqrtf_vec.c
-string.o: string.c
-tan_vec.o: tan_vec.c
-tanf_vec.o: tanf_vec.c
-tanh_vec.o: tanh_vec.c
-tanhf_vec.o: tanhf_vec.c
-test.o: test.c
-test_ieee.o: test_ieee.c
-test_is.o: test_is.c
-y0_vec.o: y0_vec.c
-y0f_vec.o: y0f_vec.c
-y1_vec.o: y1_vec.c
-y1f_vec.o: y1f_vec.c
-yn_vec.o: yn_vec.c
-ynf_vec.o: ynf_vec.c
diff --git a/newlib/libm/test/Makefile.inc b/newlib/libm/test/Makefile.inc
new file mode 100644
index 000000000000..ddf09c9314a1
--- /dev/null
+++ b/newlib/libm/test/Makefile.inc
@@ -0,0 +1,85 @@
+# Some of the tests in here depend on functionality that only a few ports
+# provide.  Disable building it by default until that's figured out.
+#check_PROGRAMS += %D%/test
+EXTRA_PROGRAMS += %D%/test
+
+%C%_test_SOURCES = \
+	%D%/test.c \
+	%D%/string.c \
+	%D%/convert.c \
+	%D%/conv_vec.c \
+	%D%/iconv_vec.c \
+	%D%/test_is.c \
+	%D%/dvec.c \
+	%D%/sprint_vec.c \
+	%D%/sprint_ivec.c \
+	%D%/math2.c \
+	%D%/test_ieee.c \
+	%D%/math.c \
+	%D%/atan2_vec.c \
+	%D%/atan2f_vec.c \
+	%D%/jn_vec.c \
+	%D%/jnf_vec.c \
+	%D%/log2_vec.c \
+	%D%/log2f_vec.c \
+	%D%/yn_vec.c \
+	%D%/ynf_vec.c \
+	%D%/acos_vec.c \
+	%D%/acosf_vec.c \
+	%D%/acosh_vec.c \
+	%D%/acoshf_vec.c \
+	%D%/asin_vec.c \
+	%D%/asinf_vec.c \
+	%D%/asinh_vec.c \
+	%D%/asinhf_vec.c \
+	%D%/atan_vec.c \
+	%D%/atanf_vec.c \
+	%D%/atanh_vec.c \
+	%D%/atanhf_vec.c \
+	%D%/ceil_vec.c \
+	%D%/ceilf_vec.c \
+	%D%/cos_vec.c \
+	%D%/cosf_vec.c \
+	%D%/cosh_vec.c \
+	%D%/coshf_vec.c \
+	%D%/erf_vec.c \
+	%D%/erfc_vec.c \
+	%D%/erfcf_vec.c \
+	%D%/erff_vec.c \
+	%D%/exp_vec.c \
+	%D%/expf_vec.c \
+	%D%/fabs_vec.c \
+	%D%/fabsf_vec.c \
+	%D%/floor_vec.c \
+	%D%/floorf_vec.c \
+	%D%/gamma_vec.c \
+	%D%/gammaf_vec.c \
+	%D%/j0_vec.c \
+	%D%/j0f_vec.c \
+	%D%/j1_vec.c \
+	%D%/j1f_vec.c \
+	%D%/log10_vec.c \
+	%D%/log10f_vec.c \
+	%D%/log1p_vec.c \
+	%D%/log1pf_vec.c \
+	%D%/log_vec.c \
+	%D%/logf_vec.c \
+	%D%/sin_vec.c \
+	%D%/sinf_vec.c \
+	%D%/sinh_vec.c \
+	%D%/sinhf_vec.c \
+	%D%/sqrt_vec.c \
+	%D%/sqrtf_vec.c \
+	%D%/tan_vec.c \
+	%D%/tanf_vec.c \
+	%D%/tanh_vec.c \
+	%D%/tanhf_vec.c \
+	%D%/y0_vec.c \
+	%D%/y0f_vec.c \
+	%D%/y1_vec.c \
+	%D%/y1f_vec.c \
+	%D%/hypotf_vec.c \
+	%D%/hypot_vec.c \
+	%D%/fmod_vec.c \
+	%D%/fmodf_vec.c
+%C%_test_LDADD = $(CRT0) libm.a libc.a
diff --git a/newlib/libm/test/math.c b/newlib/libm/test/math.c
index cd8441cc5535..5cea2adffcf5 100644
--- a/newlib/libm/test/math.c
+++ b/newlib/libm/test/math.c
@@ -24,15 +24,11 @@
 #include <errno.h>
 #include <stdio.h>
 
-int inacc;
-
 int merror;
 double mretval = 64;
 int traperror = 1;
 char *mname;
 
-int verbose;
-
 void translate_to (FILE *file,
 	    double r)
 {
@@ -101,7 +97,6 @@ thedouble (long msw,
 }
 
 int calc;
-int reduce;
 
 
 frontline (FILE *f,
@@ -171,7 +166,6 @@ finish (FILE *f,
     frontline(f, mag, p, result, merror, errno, args , name);
   }
 } 
-int redo;  
 
 run_vector_1 (int vector,
        one_line_type *p,
diff --git a/newlib/libm/test/test.h b/newlib/libm/test/test.h
index e95c6b4c462b..48d3fcd38ffd 100644
--- a/newlib/libm/test/test.h
+++ b/newlib/libm/test/test.h
@@ -7,6 +7,11 @@
 #include <ieeefp.h>
 #include <stdio.h>
 
+extern int inacc;
+extern int redo;
+extern int reduce;
+extern int verbose;
+
 void checkf();
 void enter();
 
diff --git a/newlib/libm/test/test_is.c b/newlib/libm/test/test_is.c
index ac8f79c490d9..6d4f52c638d7 100644
--- a/newlib/libm/test/test_is.c
+++ b/newlib/libm/test/test_is.c
@@ -1930,7 +1930,6 @@ int def_toascii (int i) { return toascii(i); }
 int def__tolower (int i) { return _tolower(i); }
 int def__toupper (int i) { return _toupper(i); }
 
-extern int inacc;
 void
 test_is_set (int (*func)(),
        char *name,
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.