diff options
Diffstat (limited to 'tests/Makefile.localtest')
-rw-r--r-- | tests/Makefile.localtest | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/Makefile.localtest b/tests/Makefile.localtest new file mode 100644 index 0000000..89ce2c3 --- /dev/null +++ b/tests/Makefile.localtest @@ -0,0 +1,66 @@ +# +# Makefile to run tests with system binaries +# USE: make -f Makefile.localtest tests CRYPTSETUP_PATH=/sbin +# (append TESTSUITE_NOSKIP=y to avoid treating skipped tests as success) +# +CPPFLAGS=-I../lib/ -I../lib/luks1 -DHAVE_DECL_DM_TASK_RETRY_REMOVE -DKERNEL_KEYRING \ + -DHAVE_SYS_SYSMACROS_H -DNO_CRYPTSETUP_PATH +CFLAGS=-O2 -g -Wall -D_GNU_SOURCE +LDLIBS=-lcryptsetup -ldevmapper +TESTS=$(wildcard *-test *-test2) api-test api-test-2 all-symbols-test unit-utils-crypt-test +TESTS_UTILS=differ unit-utils-io unit-wipe + +ifneq ($(RUN_SSH_PLUGIN_TEST),) +TESTS += ssh-test-plugin +endif + +ifneq ($(RUN_SYSTEMD_PLUGIN_TEST),) +TESTS += systemd-test-plugin +TESTS_UTILS += fake_systemd_tpm_path.so +endif + +check-programs: $(TESTS_UTILS) $(TESTS) + +differ: differ.o + $(CC) -o $@ $^ + +api-test: api-test.o test_utils.o + $(CC) -o $@ $^ $(LDLIBS) + +api-test-2: api-test-2.o test_utils.o + $(CC) -o $@ $^ $(LDLIBS) + +unit-wipe: unit-wipe.o + $(CC) -o $@ $^ $(LDLIBS) + +unit-utils-io: unit-utils-io.o ../lib/utils_io.o + $(CC) -o $@ $^ + +unit-utils-crypt-test: unit-utils-crypt.o ../lib/utils_crypt.o + $(CC) -o $@ $^ $(LDLIBS) + +test-symbols-list.h: generate-symbols-list + ./generate-symbols-list ../lib/libcryptsetup.sym > test-symbols-list.h + +all-symbols-test.o: test-symbols-list.h + $(CC) -c $*.c + +all-symbols-test: all-symbols-test.o + $(CC) -o $@ $^ -ldl + +fake_systemd_tpm_path.so: fake_systemd_tpm_path.c + $(CC) -fPIC -shared -D_GNU_SOURCE -o fake_systemd_tpm_path.so fake_systemd_tpm_path.c + +tests: $(TESTS_UTILS) $(TESTS) + @for test in $(sort $(TESTS)); do \ + echo [$$test]; \ + ./$$test; \ + [ $(if $(TESTSUITE_NOSKIP),,$$? -ne 77 -a) $$? -ne 0 ] && exit 1; \ + true; \ + done; + +clean: + rm -f *.o $(TESTS_UTILS) api-test api-test-2 unit-utils-crypt-test \ + all-symbols-test test-symbols-list.h + +.PHONY: clean |