xref: /src/tests/sys/capsicum/Makefile (revision df68a09ea2ec18ee975fb937d46a18250d4663c8)
1.include <src.opts.mk>
2
3TESTSDIR=	${TESTSBASE}/sys/capsicum
4
5ATF_TESTS_C+=	bindat_connectat
6ATF_TESTS_C+=	ioctls_test
7
8CFLAGS+=	-I${SRCTOP}/tests
9
10.if ${MK_GOOGLETEST} != no
11
12GTESTS+=	capsicum-test
13GTESTS_WRAPPER_SH.capsicum-test=	functional
14# This test script runs the same test suite twice, once as root and once as an
15# unprivileged user.  Serialize them since some tests access global namespaces,
16# e.g., mqueuefs, and can trample on each other.
17TEST_METADATA.functional+=	is_exclusive="true"
18TEST_METADATA.functional+=	required_kmods="mqueuefs"
19
20SRCS.capsicum-test+=	\
21	capsicum-test-main.cc \
22	capsicum-test.cc \
23	capability-fd.cc \
24	copy_file_range.cc \
25	fexecve.cc \
26	procdesc.cc \
27	capmode.cc \
28	fcntl.cc \
29	ioctl.cc \
30	openat.cc \
31	sysctl.cc \
32	select.cc \
33	mqueue.cc \
34	socket.cc \
35	sctp.cc \
36	capability-fd-pair.cc \
37	overhead.cc \
38	rename.cc
39
40LIBADD.capsicum-test+=	gtest pthread procstat
41TEST_METADATA.capsicum-test=	required_user="unprivileged"
42
43.for p in mini-me mini-me.noexec mini-me.setuid
44PROGS+=		$p
45NO_SHARED.$p=
46SRCS.$p=	mini-me.c
47.endfor
48.if ${MK_ASAN} != "no" || ${MK_UBSAN} != "no"
49# mini-me.o is linked into a static binary so we can't use sanitizers.
50# Note: We have to set CFLAGS here since it will be built as part of
51# _PROGS_COMMON_OBJS and therefore NO_SHARED.$p does not disable ASAN/UBSAN.
52CFLAGS.mini-me.c+=	-fno-sanitize=address -fno-sanitize=undefined
53.endif
54
55BINDIR=	${TESTSDIR}
56
57BINMODE.mini-me.noexec=	${NOBINMODE}
58BINMODE.mini-me.setuid=	4555
59
60WARNS.capsicum-test=	3
61
62.endif # MK_GOOGLETEST
63
64.include <bsd.test.mk>
65