xref: /netbsd-src/external/lgpl3/mpfr/dist/tests/Makefile.am (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1# Copyright 2000-2020 Free Software Foundation, Inc.
2# This Makefile.am is free software; the Free Software Foundation
3# gives unlimited permission to copy and/or distribute it,
4# with or without modifications, as long as this notice is preserved.
5
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
8# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9# PARTICULAR PURPOSE.
10
11
12# Since we do not require GNU "make", let's select the POSIX behavior to
13# uniformize the behavior a bit more with various "make" implementations
14# and ease maintenance. This target should be removed only if one day,
15# we need to require GNU "make".
16.POSIX:
17
18AUTOMAKE_OPTIONS = 1.6 gnu
19
20output_info = { \
21  if [ -d $(top_srcdir)/.svn ]; then \
22    output=`svnversion $(top_srcdir) 2> /dev/null`; \
23    if [ -n "$$output" ]; then \
24      echo "[svnversion] $$output"; \
25    fi; \
26  fi; \
27  grep -v '^\(PASS\|FAIL\) ' tversion.log 2> /dev/null || true; \
28}
29
30TESTS_NO_TVERSION = tabort_prec_max tassert tabort_defalloc1		\
31     tabort_defalloc2 talloc tinternals tinits tisqrt tsgn tcheck	\
32     tisnan texceptions tset_exp tset mpf_compat mpfr_compat reuse	\
33     tabs tacos tacosh tadd tadd1sp tadd_d tadd_ui tagm tai		\
34     talloc-cache tasin tasinh tatan tatanh taway tbeta tbuildopt	\
35     tcan_round tcbrt tcmp tcmp2 tcmp_d tcmp_ld tcmp_ui tcmpabs		\
36     tcomparisons tconst_catalan tconst_euler tconst_log2 tconst_pi	\
37     tcopysign tcos tcosh tcot tcoth tcsc tcsch td_div td_sub tdigamma	\
38     tdim tdiv tdiv_d tdiv_ui tdot teint teq terandom terandom_chisq    \
39     terf texp texp10 texp2 texpm1 tfactorial tfits tfma tfmma tfmod    \
40     tfms tfpif tfprintf tfrac tfrexp tgamma tgamma_inc tget_d          \
41     tget_d_2exp tget_f tget_flt tget_ld_2exp tget_q tget_set_d64       \
42     tget_set_d128 tget_sj tget_str tget_z tgmpop tgrandom thyperbolic  \
43     thypot tinp_str							\
44     tj0 tj1 tjn tl2b tlgamma tli2 tlngamma tlog tlog10 tlog1p tlog2	\
45     tlog_ui tmin_prec tminmax tmodf tmul tmul_2exp tmul_d tmul_ui	\
46     tnext tnrandom tnrandom_chisq tout_str toutimpl tpow tpow3		\
47     tpow_all tpow_z tprec_round tprintf trandom trandom_deviate	\
48     trec_sqrt tremquo trint trndna troot trootn_ui tsec tsech		\
49     tset_d tset_f tset_float128 tset_ld tset_q tset_si tset_sj		\
50     tset_str tset_z tset_z_exp tsi_op tsin tsin_cos tsinh tsinh_cosh	\
51     tsprintf tsqr tsqrt tsqrt_ui tstckintc tstdint tstrtofr		\
52     tsub tsub1sp tsub_d tsub_ui tsubnormal tsum tswap ttan ttanh	\
53     ttotal_order ttrunc tui_div tui_pow tui_sub turandom tvalist	\
54     ty0 ty1 tyn tzeta tzeta_ui
55
56check_PROGRAMS = tversion $(TESTS_NO_TVERSION)
57
58LOGS_NO_TVERSION = $(TESTS_NO_TVERSION:%=%.log)
59
60# Before Automake 1.13, we ran tversion at the beginning and at the end
61# of the tests, and output from tversion appeared at the same place as
62# the tests results (make output). With Automake 1.13+, the tests are
63# parallelized by default and their output is sent to log files instead
64# of the make output, so that the user could no longer see information
65# from tversion. To mimic the old behavior, we now run tversion at the
66# beginning and output the contents. Also output the contents after the
67# tests, but when a test fails, they will not be shown.
68tversion_special: tversion.log
69	@$(output_info)
70$(LOGS_NO_TVERSION): tversion_special
71check:
72	@$(output_info)
73
74AM_CPPFLAGS = -DSRCDIR='"$(srcdir)"'
75
76EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.dat tmul.dat \
77	tfpif_r1.dat tfpif_r2.dat
78
79CLEANFILES = tfpif_rw.dat tfprintf_out.txt tout_str_out.txt toutimpl_out.txt tprintf_out.txt
80
81LDADD = libfrtests.la $(MPFR_LIBM) $(MPFR_LIBQUADMATH) $(top_builddir)/src/libmpfr.la
82AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
83
84# LOADLIBES (documented in the "GNU make" manual and equivalent to LDLIBS)
85# enables to compile a program foo.c in the test directory by simply doing
86# "make foo".
87# Warning! This is not guaranteed to work, as libtool is not used. In
88# particular, this may not work as expected under GNU/Linux if --with-gmp
89# has been used, unless the directory is in your $LD_LIBRARY_PATH.
90# Moreover, dependencies are not tracked. Thus you may want to run
91# "make tversion" (for instance) just before, to make sure that every
92# dependency has been rebuilt.
93LOADLIBES=$(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(top_builddir)/tests/.libs/libfrtests.a $(top_builddir)/src/.libs/libmpfr.a $(LIBS) $(MPFR_LIBM)
94
95check_LTLIBRARIES = libfrtests.la
96libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c random2.c
97
98$(top_builddir)/src/libmpfr.la:
99	cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la
100
101TESTS = $(check_PROGRAMS)
102
103# Set DISPLAY='' as it is not needed and it can yield error messages when
104# running the tests with LOG_COMPILER=wine (for builds with MinGW). See:
105#   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914822
106#   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914949
107# $(VALGRIND) is still there to be able to use a wrapper such as valgrind
108# in case old Automake. With Automake 1.13+, where a parallel test harness
109# is generated, use LOG_COMPILER instead. For additional information, see:
110# https://www.gnu.org/software/automake/manual/automake.html#Parallel-Test-Harness
111#
112# Note: We do not use "env -u DISPLAY" as the -u option is a GNU extension
113# and not supported by NetBSD. Setting DISPLAY='' is not equivalent, but
114# it also avoids the bogus "Invalid MIT-MAGIC-COOKIE-1 key" error message
115# that can make the parsing of the output fail.
116TESTS_ENVIRONMENT = env DISPLAY='' MPFR_QUIET=1 $(VALGRIND)
117
118# The -no-install option prevents libtool from generating wrapper scripts
119# for the tests.
120# This is useful to easily run individual test scripts under valgrind or gdb.
121# See discussion
122#   https://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00247.html
123# and
124#   https://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00081.html
125# in particular.
126#
127# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
128# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
129# library is already installed in the corresponding lib directory: its
130# purpose is to make sure that the local .libs comes first in the library
131# search path (otherwise the tests are linked against the old MPFR library
132# by the LINK command -- see the generated Makefile). See:
133#   https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00042.html
134#   https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00043.html
135#   https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00044.html
136#   https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00066.html
137#   https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00065.html
138# and
139#   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
140#   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18662
141#
142AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
143
144.PHONY: tversion_special
145