summaryrefslogtreecommitdiff
path: root/regress/lib/libm/msun/Makefile
blob: 1894ef6a352ba1b02feb0bf7e9f56c769184bad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#	$OpenBSD: Makefile,v 1.4 2021/10/22 18:00:22 mbuhl Exp $

# Copyright (c) 2021 Moritz Buhl <mbuhl@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

# Each test program in PROGS may define several numbered subtests.
# In a first step compile all programs and extract their parameters.
# For each PROG define new regression subtests based on the test number.

.if defined(NUMBERS)
REGRESS_TARGETS =	${NUMBERS:C/(.*)/run-${PROG}-\1 cleanup-${PROG}-\1/}
.else
REGRESS_TARGETS =	${PROGS:S/^/run-/}
.endif

PROGS =
PROGS+= cexp_test
PROGS+= conj_test
PROGS+= csqrt_test
PROGS+= ctrig_test
PROGS+= exponential_test
PROGS+= fenv_test
PROGS+= fma_test
PROGS+= fmaxmin_test
PROGS+= ilogb_test
PROGS+= invctrig_test
PROGS+= invtrig_test
PROGS+= logarithm_test
PROGS+= lrint_test
PROGS+= lround_test
PROGS+= nan_test
PROGS+= nearbyint_test
PROGS+= next_test
PROGS+= rem_test
PROGS+= trig_test

# failing tests
FAILING = run-csqrt_test-{1,2,3} run-ctrig_test-{2,3,4,6} \
	run-exponential_test-1 run-fma_test-7 run-invctrig_test-{1,2,3,4} \
	run-invtrig_test-{1,2,3,5,6} run-logarithm_test-1 run-lround_test-1 \
	run-nan_test-1 run-nearbyint_test-1 run-next_test-5 run-rem_test-3

. if ${MACHINE} == amd64
FAILING+=	run-cexp_test-{1,7}
FAILING+=	run-ctrig_test-1
FAILING+=	run-invtrig_test-7
FAILING+=	run-next_test-{1,2,4}
FAILING+=	run-trig_test-3
. elif ${MACHINE} == arm64
FAILING+=	run-cexp_test-{1,7}
FAILING+=	run-ctrig_test-{1,5}
FAILING+=	run-fma_test-{1,2,4,5,6,7}
FAILING+=	run-invtrig_test-7
FAILING+=	run-logarithm_test-5
FAILING+=	run-lrint_test-1
FAILING+=	run-next_test-{1,2,4}
FAILING+=	run-rem_test-1
FAILING+=	run-trig_test-{1,2}
. elif ${MACHINE} == i386
FAILING+=	run-cexp_test-{1,7}
FAILING+=	run-ctrig_test-{1,5}
FAILING+=	run-fma_test-{1,6}
FAILING+=	run-invtrig_test-4
FAILING+=	run-logarithm_test-3
FAILING+=	run-lrint_test-1
FAILING+=	run-next_test-{1,2,4}
. elif ${MACHINE} == powerpc64
FAILING+=	run-ctrig_test-{1,5}
FAILING+=	run-invtrig_test-7
FAILING+=	run-trig_test-2
. elif ${MACHINE} == sparc64
FAILING+=	run-ctrig_test-5
FAILING+=	run-fma_test-{1,2,4,5,6}
FAILING+=	run-invtrig_test-7
FAILING+=	run-logarithm_test-5
FAILING+=	run-lrint_test-1
FAILING+=	run-next_test-{1,2,4,5}
FAILING+=	run-rem_test-{1,2}
FAILING+=	run-trig_test-{1,2}
. endif

. for t in run-cexp_test-{2,3,4}
${t}:
	# cexp functions don't handle inf and nan cases
	@echo DISABLED
. endfor

. for t in ${FAILING}
${t}:
	# XXX: Doesn't work for unknown reasons
	@echo DISABLED
. endfor


LDADD=	-lm
DPADD=	${LIBM}
CFLAGS+=	-fno-builtin

.for t in ${TESTS}
REGRESS_TARGETS+=	run-$t
run-$t: $t
	./$t
.endfor

. for p in ${PROGS}
SRCS_$p =		$p.c atf-c.c
. endfor

SRCS_rem_test += fls.c

.for p in ${PROGS}
run-$p: $p
	ulimit -c unlimited && \
	ntests="`./$p -n`" && \
	echo "1..$$ntests" && \
	tnumbers="`jot -ns' ' - 1 $$ntests`" && \
	${.MAKE} -C ${.CURDIR} PROG=$p NUMBERS="$$tnumbers" regress
.endfor

.if defined(NUMBERS)
CUR_USER !=		id -g

. for n in ${NUMBERS}
DESCR_$n !=		eval `./${PROG} -i $n` && echo $$DESCR
REQ_USER_$n !=		eval `./${PROG} -i $n` && echo $$REQ_USER

.  if ${REQ_USER_$n} == "root"
REGRESS_ROOT_TARGETS +=	run-${PROG}-$n
.  endif

run-${PROG}-$n:
	@echo "$n ${DESCR_$n}"
.  if ${REQ_USER_$n} == "root"
	${SUDO} ./${PROG} -r $n
.  elif ${REQ_USER_$n} == "unprivileged" && ${CUR_USER} == 0
	${SUDO} su ${BUILDUSER} -c exec ./${PROG} -r $n
.  elif ${REQ_USER_$n} == "unprivileged" || ${REQ_USER_$n} == ""
	./${PROG} -r $n
.  else
	# bad REQ_USER: ${REQ_USER_$n}
	false
.  endif

cleanup-${PROG}-$n:
	-./${PROG} -c $n

. endfor
.endif

.include <bsd.regress.mk>