70d75d7acf
The following change imports google/capsicum-test@9333154 from GitHub, omitting the embedded version of googletest, as well as the incomplete libcasper. This test suite helps verify capsicum(3) support via functional tests written in the GoogleTest test framework. Kernel support for capsicum(4) is tested by side-effect of testing capsicum(3). NB: as discussed in a previous [closed] PR [1], the casper(3) tests are incomplete/buggy and will not pass on FreeBSD. Thus, I have no intention of integrating them into the build/test on FreeBSD as-is. The import command used was: ``` curl -L https://github.com/google/capsicum-test/tarball/9333154 | tar --strip-components=1 -xvzf - -C dist/ rm -Rf dist/*/ ``` 1. https://github.com/google/capsicum-test/pull/26 Reviewed by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D19261
37 lines
1.6 KiB
Makefile
37 lines
1.6 KiB
Makefile
all: capsicum-test smoketest mini-me mini-me.noexec mini-me.setuid $(EXTRA_PROGS)
|
|
OBJECTS=capsicum-test-main.o capsicum-test.o capability-fd.o fexecve.o procdesc.o capmode.o fcntl.o ioctl.o openat.o sysctl.o select.o mqueue.o socket.o sctp.o capability-fd-pair.o linux.o overhead.o rename.o
|
|
|
|
GTEST_DIR=gtest-1.8.1
|
|
GTEST_INCS=-I$(GTEST_DIR)/include -I$(GTEST_DIR)
|
|
GTEST_FLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1
|
|
CXXFLAGS+=$(ARCHFLAG) -Wall -g $(GTEST_INCS) $(GTEST_FLAGS) --std=c++11
|
|
CFLAGS+=$(ARCHFLAG) -Wall -g
|
|
|
|
capsicum-test: $(OBJECTS) libgtest.a $(LOCAL_LIBS)
|
|
$(CXX) $(CXXFLAGS) -g -o $@ $(OBJECTS) libgtest.a -lpthread -lrt $(LIBSCTP) $(LIBCAPRIGHTS)
|
|
|
|
# Small statically-linked program for fexecve tests
|
|
# (needs to be statically linked so that execve()ing it
|
|
# doesn't involve ld.so traversing the filesystem).
|
|
mini-me: mini-me.c
|
|
$(CC) $(CFLAGS) -static -o $@ $<
|
|
mini-me.noexec: mini-me
|
|
cp mini-me $@ && chmod -x $@
|
|
mini-me.setuid: mini-me
|
|
rm -f $@ && cp mini-me $@&& sudo chown root $@ && sudo chmod u+s $@
|
|
|
|
# Simple C test of Capsicum syscalls
|
|
SMOKETEST_OBJECTS=smoketest.o
|
|
smoketest: $(SMOKETEST_OBJECTS) $(LOCAL_LIBS)
|
|
$(CC) $(CFLAGS) -o $@ $(SMOKETEST_OBJECTS) $(LIBCAPRIGHTS)
|
|
|
|
test: capsicum-test mini-me mini-me.noexec mini-me.setuid $(EXTRA_PROGS)
|
|
./capsicum-test
|
|
gtest-all.o:
|
|
$(CXX) $(ARCHFLAG) -I$(GTEST_DIR)/include -I$(GTEST_DIR) $(GTEST_FLAGS) -c ${GTEST_DIR}/src/gtest-all.cc
|
|
libgtest.a: gtest-all.o
|
|
$(AR) -rv libgtest.a gtest-all.o
|
|
|
|
clean:
|
|
rm -rf gtest-all.o libgtest.a capsicum-test mini-me mini-me.noexec smoketest $(SMOKETEST_OBJECTS) $(OBJECTS) $(LOCAL_CLEAN) $(EXTRA_PROGS)
|