11.96Skre# $NetBSD: Makefile,v 1.96 2025/07/17 19:50:40 kre Exp $
21.1Sjmmv
31.1SjmmvNOMAN=		# defined
41.1Sjmmv
51.1Sjmmv.include <bsd.own.mk>
61.1Sjmmv
71.1SjmmvTESTSDIR=	${TESTSBASE}/kernel
81.1Sjmmv
91.43SkamilTESTS_SUBDIRS+=	kqueue
101.83SriastradTESTS_C+=	t_cloexec
111.96SkreTESTS_C+=	t_clofork
121.83Sriastrad#TESTS_C+=	t_epoll
131.85SriastradTESTS_C+=	t_execregs
141.73SchristosTESTS_C+=	t_fcntl
151.77Srjs.if ${MKRUMP} != "no"
161.76SriastradTESTS_C+=	t_fdrestart
171.77Srjs.endif
181.80SchristosTESTS_C+=	t_kauth_pr_47598
191.80SchristosTESTS_C+=	t_ksem
201.62SchristosTESTS_C+=	t_lock
211.31SpgoyetteTESTS_C+=	t_lockf
221.74SchristosTESTS_C+=	t_memfd_create
231.27SpgoyetteTESTS_C+=	t_mqueue
241.82SkreTESTS_C+=	t_nanosleep
251.80SchristosTESTS_C+=	t_open_pr_57260
261.59SkamilTESTS_C+=	t_proccwd
271.80SchristosTESTS_C+=	t_pty
281.80SchristosTESTS_C+=	t_semtimedop
291.78SphoTESTS_C+=	t_signal_and_sp
301.28SpgoyetteTESTS_C+=	t_sysv
311.22SchristosTESTS_C+=	t_subr_prf
321.35SgsonTESTS_C+=	t_sysctl
331.49SchristosTESTS_C+=	t_timeleft
341.79Sbad.if ${MKRUMP} != "no"
351.79SbadTESTS_C+=	t_unmount
361.79Sbad.endif
371.53SkamilTESTS_C+=	t_zombie
381.1Sjmmv
391.81SmsaitohTESTS_SH=	t_fexecve
401.80SchristosTESTS_SH+=	t_fpufork
411.47SchristosTESTS_SH+=	t_interp
421.68SjruohoTESTS_SH+=	t_magic_symlinks
431.67SjruohoTESTS_SH+=	t_nointerpreter
441.60SchristosTESTS_SH+=	t_origin
451.50SchristosTESTS_SH+=	t_procpath
461.80SchristosTESTS_SH+=	t_ps_strings
471.95Sriastrad.if ${MKKMOD} != "no"
481.95SriastradTESTS_SH+=	t_setjmp
491.95Sriastrad.endif
501.70Smartin.if ${MKRUMP} != "no"
511.69SyamaguchTESTS_SH+=	t_simplehook
521.70Smartin.endif
531.80SchristosTESTS_SH+=	t_trapsignal
541.80SchristosTESTS_SH+=	t_umountstress
551.81SmsaitohTESTS_SH+=	t_umount
561.10Spgoyette
571.10SpgoyetteBINDIR=		${TESTSDIR}
581.83SriastradPROGS+=		h_cloexec
591.85SriastradPROGS+=		h_execregs
601.88SriastradPROGS+=		h_execsp_dynamic
611.88SriastradPROGS+=		h_execsp_static
621.83SriastradPROGS+=		h_fexecve
631.80SchristosPROGS+=		h_fpufork
641.80SchristosPROGS+=		h_getprocpath
651.63SchristosPROGS+=		h_ps_strings1
661.10SpgoyettePROGS+=		h_ps_strings2
671.48SchristosPROGS+=		h_segv
681.52Snakayama
691.52SnakayamaSCRIPTSDIR=	${TESTSDIR}
701.52SnakayamaSCRIPTS=	h_interpreter.sh
711.1Sjmmv
721.76SriastradLDADD.t_fdrestart+=	-lpthread
731.76SriastradLDADD.t_fdrestart+=	-lrumpnet_local
741.76SriastradLDADD.t_fdrestart+=	-lrumpnet_net
751.76SriastradLDADD.t_fdrestart+=	-lrumpnet_netinet
761.76SriastradLDADD.t_fdrestart+=	-lrumpnet
771.76SriastradLDADD.t_fdrestart+=	${LIBRUMPBASE}
781.76Sriastrad
791.29SnakayamaLDADD.t_mqueue+= -lrt
801.29Snakayama
811.79SbadLDADD.t_unmount+=	-lrumpfs_tmpfs
821.79SbadLDADD.t_unmount+=	${LIBRUMPBASE}
831.79Sbad
841.26Schristos
851.37Smatt.if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
861.26SchristosTESTS_SUBDIRS+=	tty
871.26Schristos
881.26SchristosTESTS_C+=	t_extattrctl
891.26SchristosTESTS_C+=	t_filedesc
901.26SchristosTESTS_C+=	t_rnd
911.66SchristosLDADD.t_extattrctl+= ${LIBRUMPBASE}
921.26SchristosLDADD.t_filedesc+=  ${LDADD.t_rnd}
931.66SchristosLDADD.t_rnd+=  -lrumpdev_rnd -lrumpdev ${LIBRUMPBASE}
941.26Schristos
951.26Schristos.endif
961.26Schristos
971.51SchristosLDADD.t_timeleft+=	-lpthread
981.51Schristos
991.44SkamilCPPFLAGS+=	-D_KERNTYPES
1001.79SbadCPPFLAGS.t_unmount.c+=	-D_KMEMUSER -D__EXPOSE_MOUNT
1011.2Spooka
1021.89Sriastrad.if exists(${.PARSEDIR}/arch/${MACHINE_ARCH})
1031.88SriastradARCHDIR:=		${.PARSEDIR}/arch/${MACHINE_ARCH}
1041.89Sriastrad.else
1051.89SriastradARCHDIR:=		${.PARSEDIR}/arch/${MACHINE_CPU}
1061.89Sriastrad.endif
1071.88Sriastrad.PATH:			${ARCHDIR}
1081.88Sriastrad
1091.88Sriastrad.if exists(${ARCHDIR}/stack_pointer.h)
1101.88SriastradCPPFLAGS.t_signal_and_sp.c+=	-I${ARCHDIR} -DHAVE_STACK_POINTER_H
1111.88Sriastrad.endif
1121.88Sriastrad
1131.88SriastradSRCS.t_signal_and_sp+=		t_signal_and_sp.c
1141.90Sriastrad.if exists(${ARCHDIR}/contextspfunc.S)
1151.90SriastradCPPFLAGS.t_signal_and_sp.c+=	-DHAVE_CONTEXTSPFUNC
1161.90SriastradSRCS.t_signal_and_sp+=		contextspfunc.S
1171.90Sriastrad.endif
1181.88Sriastrad.if exists(${ARCHDIR}/signalsphandler.S)
1191.88SriastradCPPFLAGS.t_signal_and_sp.c+=	-DHAVE_SIGNALSPHANDLER
1201.88SriastradSRCS.t_signal_and_sp+=		signalsphandler.S
1211.88Sriastrad.endif
1221.90Sriastrad.if exists(${ARCHDIR}/threadspfunc.S)
1231.90SriastradCPPFLAGS.t_signal_and_sp.c+=	-DHAVE_THREADSPFUNC
1241.90SriastradSRCS.t_signal_and_sp+=		threadspfunc.S
1251.90SriastradLDADD.t_signal_and_sp+=		-pthread
1261.90Sriastrad.endif
1271.88Sriastrad
1281.88SriastradSRCS.h_execsp_dynamic+=		h_execsp.c
1291.88SriastradSRCS.h_execsp_static+=		h_execsp.c
1301.88Sriastrad.if exists(${ARCHDIR}/execsp.S)
1311.88SriastradCPPFLAGS.t_signal_and_sp.c+=	-DHAVE_EXECSP
1321.88SriastradSRCS.h_execsp_dynamic+=		execsp.S
1331.88SriastradSRCS.h_execsp_static+=		execsp.S
1341.88SriastradLDFLAGS.h_execsp_dynamic+=	-Wl,-e,execsp_start
1351.88SriastradLDFLAGS.h_execsp_static+=	-Wl,-e,execsp_start
1361.88Sriastrad.else
1371.88SriastradCPPFLAGS.h_execsp.c+=		-Dexecsp_main=main
1381.78Spho.endif
1391.88SriastradLDSTATIC.h_execsp_static=	-static
1401.78Spho
1411.89Sriastrad.if ${MACHINE_CPU} == "mips"
1421.90SriastradCPPFLAGS.contextspfunc.S+=	-I${NETBSDSRCDIR}/lib/libc/arch/mips
1431.89SriastradCPPFLAGS.execsp.S+=		-I${NETBSDSRCDIR}/lib/libc/arch/mips
1441.89SriastradCPPFLAGS.signalsphandler.S+=	-I${NETBSDSRCDIR}/lib/libc/arch/mips
1451.89Sriastrad.endif
1461.89Sriastrad
1471.1Sjmmv.PATH:			${NETBSDSRCDIR}/sys/kern
1481.1SjmmvTESTS_C+=		t_extent
1491.1SjmmvSRCS.t_extent=		t_extent.c subr_extent.c
1501.39SchristosCPPFLAGS.t_extent.c=	-D_EXTENT_TESTING -D__POOL_EXPOSE -D_KERNTYPES
1511.39SchristosCPPFLAGS.subr_extent.c=	-D_EXTENT_TESTING -D__POOL_EXPOSE -D_KERNTYPES
1521.1Sjmmv
1531.84SriastradTESTS_C+=		t_time_arith
1541.84SriastradSRCS.t_time_arith=	t_time_arith.c subr_time_arith.c
1551.84SriastradCPPFLAGS.t_time_arith.c+=	-I${NETBSDSRCDIR}/sys -D_TIME_TESTING
1561.84SriastradCPPFLAGS.subr_time_arith.c+=	-I${NETBSDSRCDIR}/sys -D_TIME_TESTING
1571.84SriastradLDADD.t_time_arith+=	-lutil
1581.84Sriastrad
1591.22Schristost_subr_prf.c: gen_t_subr_prf ${NETBSDSRCDIR}/sys/kern/subr_prf.c
1601.22Schristos	${HOST_SH} ${.ALLSRC} ${.TARGET}
1611.61Skamil.if ${MKSANITIZER:Uno} == "yes"
1621.61Skamil	# These symbols will be redefined by MKSANITIZER
1631.61Skamil	${TOOL_SED} -i '/undef .*printf/d' ${.TARGET}
1641.61Skamil.endif
1651.61Skamil
1661.36StlsCPPFLAGS.t_subr_prf.c=	-Wno-pointer-sign	# XXX platform vs kernel SHA2
1671.22Schristos
1681.58Smrg# Test explicitly tests failure modes.
1691.72SlukemCPPFLAGS.t_subr_prf.c+=	${CC_WNO_FORMAT_TRUNCATION}
1701.58Smrg
1711.61SkamilSANITIZER_RENAME_CLASSES+=		t_subr_prf
1721.61SkamilSANITIZER_RENAME_FILES.t_subr_prf+=	t_subr_prf.c
1731.61SkamilSANITIZER_RENAME_SYMBOL.t_subr_prf+=	snprintf
1741.61SkamilSANITIZER_RENAME_SYMBOL.t_subr_prf+=	vsnprintf
1751.61SkamilSANITIZER_RENAME_SYMBOL.t_subr_prf+=	sprintf
1761.61SkamilSANITIZER_RENAME_SYMBOL.t_subr_prf+=	vsnprintf
1771.61SkamilSANITIZER_RENAME_SYMBOL.t_subr_prf+=	vasprintf
1781.61Skamil
1791.22SchristosCLEANFILES+=	t_subr_prf.c
1801.22Schristos
1811.54SriastradLDADD.h_segv+=	-lm
1821.54Sriastrad
1831.85Sriastrad.if exists(arch/${MACHINE_ARCH}/execregs.h)
1841.85SriastradCPPFLAGS.t_execregs.c+=	-I${ARCHDIR}
1851.86SriastradCPPFLAGS.t_execregs.c+=	-I${.CURDIR}/../lib/libc/gen # isqemu.h
1861.85SriastradCPPFLAGS.t_execregs.c+=	-DHAVE_EXECREGS_TEST
1871.85SriastradSRCS.t_execregs+=	t_execregs.c
1881.85SriastradSRCS.t_execregs+=	execregs.c
1891.87SriastradLDSTATIC.h_execregs=	-static
1901.87SriastradLDFLAGS.h_execregs+=	-Wl,-e,execregs_start
1911.85Sriastrad.else
1921.85SriastradSRCS.h_execregs=	h_execregs_unimpl.c
1931.85Sriastrad.endif
1941.85Sriastrad
1951.95Sriastrad.if ${MKKMOD} != "no"
1961.95SriastradSUBDIR+=	setjmp_tester
1971.95Sriastrad.endif
1981.95Sriastrad
1991.1Sjmmv.include <bsd.test.mk>
200