1*35c0087fSmiod# $OpenBSD: Makefile,v 1.16 2024/03/04 19:35:13 miod Exp $ 24c142d94Sbluhm 3c36e572eSmbuhl# Copyright (c) 2021 Moritz Buhl <mbuhl@openbsd.org> 4c36e572eSmbuhl# 5c36e572eSmbuhl# Permission to use, copy, modify, and distribute this software for any 6c36e572eSmbuhl# purpose with or without fee is hereby granted, provided that the above 7c36e572eSmbuhl# copyright notice and this permission notice appear in all copies. 8c36e572eSmbuhl# 9c36e572eSmbuhl# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10c36e572eSmbuhl# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11c36e572eSmbuhl# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12c36e572eSmbuhl# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13c36e572eSmbuhl# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14c36e572eSmbuhl# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15c36e572eSmbuhl# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 164c142d94Sbluhm 17c36e572eSmbuhl# Each test program in PROGS may define several numbered subtests. 18c36e572eSmbuhl# In a first step compile all programs and extract their parameters. 19c36e572eSmbuhl# For each PROG define new regression subtests based on the test number. 20c36e572eSmbuhl 21c36e572eSmbuhl.if defined(NUMBERS) 22c36e572eSmbuhlREGRESS_TARGETS = ${NUMBERS:C/(.*)/run-${PROG}-\1 cleanup-${PROG}-\1/} 23c36e572eSmbuhl.else 24c36e572eSmbuhlREGRESS_TARGETS = ${PROGS:S/^/run-/} 25c36e572eSmbuhl.endif 26c36e572eSmbuhl 27c36e572eSmbuhlPROGS = 28c36e572eSmbuhlPROGS+= cexp_test 29c36e572eSmbuhlPROGS+= conj_test 30c36e572eSmbuhlPROGS+= csqrt_test 31c36e572eSmbuhlPROGS+= ctrig_test 32c36e572eSmbuhlPROGS+= exponential_test 33c36e572eSmbuhlPROGS+= fenv_test 34c36e572eSmbuhlPROGS+= fma_test 35c36e572eSmbuhlPROGS+= fmaxmin_test 36c36e572eSmbuhlPROGS+= ilogb_test 37c36e572eSmbuhlPROGS+= invctrig_test 38c36e572eSmbuhlPROGS+= invtrig_test 39c36e572eSmbuhlPROGS+= logarithm_test 40c36e572eSmbuhlPROGS+= lrint_test 41c36e572eSmbuhlPROGS+= lround_test 42c36e572eSmbuhlPROGS+= nan_test 43c36e572eSmbuhlPROGS+= nearbyint_test 44c36e572eSmbuhlPROGS+= next_test 45c36e572eSmbuhlPROGS+= rem_test 46c36e572eSmbuhlPROGS+= trig_test 47c36e572eSmbuhl 48c36e572eSmbuhl# failing tests 499eddb8ffSmbuhlFAILING = run-cexp_test-{2,3,4} run-csqrt_test-{1,2,3} \ 50*35c0087fSmiod run-ctrig_test-{2,3,6} run-fma_test-7 \ 519eddb8ffSmbuhl run-invctrig_test-{1,2,3,4} run-invtrig_test-{1,2,3,5,6} \ 52*35c0087fSmiod run-lround_test-1 run-nan_test-1 run-next_test-5 run-rem_test-3 53c36e572eSmbuhl 54*35c0087fSmiod. if ${MACHINE} == alpha 55*35c0087fSmiodFAILING+= run-conj_test-1 56*35c0087fSmiodFAILING+= run-ctrig_test-{4,5} 57*35c0087fSmiodFAILING+= run-exponential_test-1 58*35c0087fSmiodFAILING+= run-fenv_test-{2,3,4,6,7,8} 59*35c0087fSmiodFAILING+= run-fma_test-{1,2,4,5,6} 60*35c0087fSmiodFAILING+= run-fmaxmin_test-{7,11} 61*35c0087fSmiodFAILING+= run-invtrig_test-{4,7} 62*35c0087fSmiodFAILING+= run-lrint_test-1 63*35c0087fSmiodFAILING+= run-nearbyint_test-1 64*35c0087fSmiodFAILING+= run-next_test-{1,4} 65*35c0087fSmiodFAILING+= run-rem_test-1 66*35c0087fSmiodFAILING+= run-trig_test-2 67*35c0087fSmiod. elif ${MACHINE} == amd64 68c36e572eSmbuhlFAILING+= run-cexp_test-{1,7} 69*35c0087fSmiodFAILING+= run-ctrig_test-{1,4} 7078e4aa5dSmbuhlFAILING+= run-exponential_test-1 71c36e572eSmbuhlFAILING+= run-invtrig_test-7 72*35c0087fSmiodFAILING+= run-logarithm_test-1 73c36e572eSmbuhlFAILING+= run-next_test-{1,2,4} 74c36e572eSmbuhl. elif ${MACHINE} == arm64 75c36e572eSmbuhlFAILING+= run-cexp_test-{1,7} 76*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 7778e4aa5dSmbuhlFAILING+= run-exponential_test-1 78c36e572eSmbuhlFAILING+= run-fma_test-{1,2,4,5,6,7} 79c36e572eSmbuhlFAILING+= run-invtrig_test-7 80*35c0087fSmiodFAILING+= run-logarithm_test-{1,5} 81c36e572eSmbuhlFAILING+= run-lrint_test-1 8219d78d21SantonFAILING+= run-nearbyint_test-1 83c36e572eSmbuhlFAILING+= run-next_test-{1,2,4} 849eddb8ffSmbuhlFAILING+= run-rem_test-{1,2} 85ba8a5712SgnezdoFAILING+= run-trig_test-1 8641cf59d4Smbuhl. elif ${MACHINE} == armv7 8741cf59d4SmbuhlFAILING+= run-cexp_test-7 88*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 8941cf59d4SmbuhlFAILING+= run-exponential_test-1 9041cf59d4SmbuhlFAILING+= run-invtrig_test-7 91*35c0087fSmiodFAILING+= run-logarithm_test-1 9241cf59d4SmbuhlFAILING+= run-lrint_test-1 9319d78d21SantonFAILING+= run-nearbyint_test-1 9441cf59d4SmbuhlFAILING+= run-trig_test-1 95*35c0087fSmiod. elif ${MACHINE} == hppa 96*35c0087fSmiodFAILING+= run-ctrig_test-{4,5} 97*35c0087fSmiodFAILING+= run-exponential_test-1 98*35c0087fSmiodFAILING+= run-fmaxmin_test-11 99*35c0087fSmiodFAILING+= run-invtrig_test-7 100*35c0087fSmiodFAILING+= run-lrint_test-1 101*35c0087fSmiodFAILING+= run-next_test-4 102*35c0087fSmiodFAILING+= run-trig_test-3 103c36e572eSmbuhl. elif ${MACHINE} == i386 104c36e572eSmbuhlFAILING+= run-cexp_test-{1,7} 105*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 106c36e572eSmbuhlFAILING+= run-fma_test-{1,6} 107c36e572eSmbuhlFAILING+= run-invtrig_test-4 108*35c0087fSmiodFAILING+= run-logarithm_test-{1,3} 109c36e572eSmbuhlFAILING+= run-lrint_test-1 11019d78d21SantonFAILING+= run-nearbyint_test-1 111c36e572eSmbuhlFAILING+= run-next_test-{1,2,4} 1125f37f7e4Smiod. elif ${MACHINE_ARCH} == m88k 1135f37f7e4SmiodFAILING+= run-cexp_test-7 114*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 1155f37f7e4SmiodFAILING+= run-exponential_test-1 1165f37f7e4SmiodFAILING+= run-fma_test-{1,3,6} 1175f37f7e4SmiodFAILING+= run-fmaxmin_test-{1,12} 1185f37f7e4SmiodFAILING+= run-invtrig_test-7 119*35c0087fSmiodFAILING+= run-logarithm_test-{1,3} 1205f37f7e4SmiodFAILING+= run-lrint_test-1 1215f37f7e4SmiodFAILING+= run-nearbyint_test-1 1225f37f7e4SmiodFAILING+= run-next_test-4 123c36e572eSmbuhl. elif ${MACHINE} == powerpc64 1249eddb8ffSmbuhlFAILING+= run-cexp_test-7 125*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 12678e4aa5dSmbuhlFAILING+= run-exponential_test-1 127c36e572eSmbuhlFAILING+= run-invtrig_test-7 128*35c0087fSmiodFAILING+= run-logarithm_test-1 12991768759Smbuhl. elif ${MACHINE} == macppc 13091768759SmbuhlFAILING+= run-cexp_test-7 131*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 13291768759SmbuhlFAILING+= run-exponential_test-1 13391768759SmbuhlFAILING+= run-fenv_test-{7,8} 13491768759SmbuhlFAILING+= run-invtrig_test-7 135*35c0087fSmiodFAILING+= run-logarithm_test-{1,3} 13691768759SmbuhlFAILING+= run-lrint_test-1 137*35c0087fSmiod. elif ${MACHINE_ARCH} == sh 138c36e572eSmbuhlFAILING+= run-ctrig_test-5 139*35c0087fSmiodFAILING+= run-exponential_test-{1,2,4} 140*35c0087fSmiodFAILING+= run-fenv_test-{1,2,3,4,5,6,7,8} 141*35c0087fSmiodFAILING+= run-fma_test-{1,3,4,5,6} 142*35c0087fSmiodFAILING+= run-invtrig_test-{4,7} 143*35c0087fSmiodFAILING+= run-logarithm_test-1 144*35c0087fSmiodFAILING+= run-lrint_test-1 145*35c0087fSmiodFAILING+= run-nearbyint_test-1 146*35c0087fSmiodFAILING+= run-next_test-{1,3,4} 147*35c0087fSmiodFAILING+= run-rem_test-1 148*35c0087fSmiodFAILING+= run-trig_test-{1,2} 149*35c0087fSmiod. elif ${MACHINE} == sparc64 150*35c0087fSmiodFAILING+= run-ctrig_test-{4,5} 15178e4aa5dSmbuhlFAILING+= run-exponential_test-1 152c36e572eSmbuhlFAILING+= run-fma_test-{1,2,4,5,6} 1539eddb8ffSmbuhlFAILING+= run-invtrig_test-{4,7} 154*35c0087fSmiodFAILING+= run-logarithm_test-{1,5} 155c36e572eSmbuhlFAILING+= run-lrint_test-1 1566e6e522eSmbuhlFAILING+= run-next_test-{1,2,4} 1576e6e522eSmbuhlFAILING+= run-rem_test-{1,2} 1586e6e522eSmbuhlFAILING+= run-trig_test-{1,2} 1596e6e522eSmbuhl. elif ${MACHINE} == octeon 1606e6e522eSmbuhlFAILING+= run-cexp_test-7 161*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 1626e6e522eSmbuhlFAILING+= run-exponential_test-1 1636e6e522eSmbuhlFAILING+= run-fma_test-{1,2,3,4,5,6} 1646e6e522eSmbuhlFAILING+= run-invtrig_test-{4,7} 165*35c0087fSmiodFAILING+= run-logarithm_test-{1,5} 1666e6e522eSmbuhlFAILING+= run-lrint_test-1 16719d78d21SantonFAILING+= run-nearbyint_test-1 1686e6e522eSmbuhlFAILING+= run-next_test-{1,2,3,4} 1696e6e522eSmbuhlFAILING+= run-rem_test-{1,2} 1706e6e522eSmbuhlFAILING+= run-trig_test-{1,2} 1716e6e522eSmbuhl. elif ${MACHINE} == riscv64 1726e6e522eSmbuhlFAILING+= run-cexp_test-7 173*35c0087fSmiodFAILING+= run-ctrig_test-{1,4,5} 1746e6e522eSmbuhlFAILING+= run-exponential_test-1 1756e6e522eSmbuhlFAILING+= run-fma_test-{1,2,4,5,6} 1766e6e522eSmbuhlFAILING+= run-ilogb_test-3 1776e6e522eSmbuhlFAILING+= run-invtrig_test-{4,7} 178*35c0087fSmiodFAILING+= run-logarithm_test-{1,5} 1796e6e522eSmbuhlFAILING+= run-lrint_test-1 18019d78d21SantonFAILING+= run-nearbyint_test-1 1816e6e522eSmbuhlFAILING+= run-next_test-{1,2,4} 182c36e572eSmbuhlFAILING+= run-rem_test-{1,2} 183c36e572eSmbuhlFAILING+= run-trig_test-{1,2} 184c36e572eSmbuhl. endif 185c36e572eSmbuhl 1869eddb8ffSmbuhlREGRESS_EXPECTED_FAILURES!= echo ${FAILING} 187c36e572eSmbuhl 1884c142d94SbluhmLDADD= -lm 1894c142d94SbluhmDPADD= ${LIBM} 190c36e572eSmbuhlCFLAGS+= -fno-builtin 1914c142d94Sbluhm 1924c142d94Sbluhm.for t in ${TESTS} 1934c142d94SbluhmREGRESS_TARGETS+= run-$t 1944c142d94Sbluhmrun-$t: $t 1954c142d94Sbluhm ./$t 1964c142d94Sbluhm.endfor 1974c142d94Sbluhm 198c36e572eSmbuhl. for p in ${PROGS} 199c36e572eSmbuhlSRCS_$p = $p.c atf-c.c 200c36e572eSmbuhl. endfor 201c36e572eSmbuhl 202c36e572eSmbuhlSRCS_rem_test += fls.c 203c36e572eSmbuhl 204c36e572eSmbuhl.for p in ${PROGS} 205c36e572eSmbuhlrun-$p: $p 206c36e572eSmbuhl ulimit -c unlimited && \ 207c36e572eSmbuhl ntests="`./$p -n`" && \ 208c36e572eSmbuhl echo "1..$$ntests" && \ 209c36e572eSmbuhl tnumbers="`jot -ns' ' - 1 $$ntests`" && \ 210c36e572eSmbuhl ${.MAKE} -C ${.CURDIR} PROG=$p NUMBERS="$$tnumbers" regress 211c36e572eSmbuhl.endfor 212c36e572eSmbuhl 213c36e572eSmbuhl.if defined(NUMBERS) 214c36e572eSmbuhlCUR_USER != id -g 215c36e572eSmbuhl 216c36e572eSmbuhl. for n in ${NUMBERS} 217c36e572eSmbuhlDESCR_$n != eval `./${PROG} -i $n` && echo $$DESCR 218c36e572eSmbuhlREQ_USER_$n != eval `./${PROG} -i $n` && echo $$REQ_USER 219c36e572eSmbuhl 220c36e572eSmbuhl. if ${REQ_USER_$n} == "root" 221c36e572eSmbuhlREGRESS_ROOT_TARGETS += run-${PROG}-$n 222c36e572eSmbuhl. endif 223c36e572eSmbuhl 224c36e572eSmbuhlrun-${PROG}-$n: 225c36e572eSmbuhl @echo "$n ${DESCR_$n}" 226c36e572eSmbuhl. if ${REQ_USER_$n} == "root" 227c36e572eSmbuhl ${SUDO} ./${PROG} -r $n 228c36e572eSmbuhl. elif ${REQ_USER_$n} == "unprivileged" && ${CUR_USER} == 0 229c36e572eSmbuhl ${SUDO} su ${BUILDUSER} -c exec ./${PROG} -r $n 230c36e572eSmbuhl. elif ${REQ_USER_$n} == "unprivileged" || ${REQ_USER_$n} == "" 231c36e572eSmbuhl ./${PROG} -r $n 232c36e572eSmbuhl. else 233c36e572eSmbuhl # bad REQ_USER: ${REQ_USER_$n} 234c36e572eSmbuhl false 235c36e572eSmbuhl. endif 236c36e572eSmbuhl 237c36e572eSmbuhlcleanup-${PROG}-$n: 238c36e572eSmbuhl -./${PROG} -c $n 239c36e572eSmbuhl 240c36e572eSmbuhl. endfor 241c36e572eSmbuhl.endif 242c36e572eSmbuhl 2434c142d94Sbluhm.include <bsd.regress.mk> 244