Debian Codegraph @

tests/Makefile.localtest

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #
2 # Makefile to run tests with system binaries
3 # USE: make -f Makefile.localtest tests CRYPTSETUP_PATH=/sbin
4 # (append TESTSUITE_NOSKIP=y to avoid treating skipped tests as success)
5 #
6 CPPFLAGS=-I../lib/ -I../lib/luks1 -DHAVE_DECL_DM_TASK_RETRY_REMOVE -DKERNEL_KEYRING \
7 -DHAVE_SYS_SYSMACROS_H -DNO_CRYPTSETUP_PATH -DNO_CRYPT_BACKEND
8 CFLAGS=-O2 -g -Wall -D_GNU_SOURCE
9 LDLIBS=-lcryptsetup -ldevmapper
10 TESTS=$(wildcard *-test *-test2) api-test api-test-2 all-symbols-test unit-utils-crypt-test
11 TESTS_UTILS=differ unit-utils-io unit-wipe crypto-check
12
13 ifneq ($(RUN_SSH_PLUGIN_TEST),)
14 TESTS += ssh-test-plugin
15 endif
16
17 ifneq ($(RUN_SYSTEMD_PLUGIN_TEST),)
18 TESTS += systemd-test-plugin
19 TESTS_UTILS += fake_systemd_tpm_path.so
20 endif
21
22 check-programs: $(TESTS_UTILS) $(TESTS)
23
24 differ: differ.o
25 $(CC) -o $@ $^
26
27 crypto-check: crypto-check.o
28 $(CC) -o $@ $^
29
30 api-test: api-test.o test_utils.o
31 $(CC) -o $@ $^ $(LDLIBS)
32
33 api-test-2: api-test-2.o test_utils.o
34 $(CC) -o $@ $^ $(LDLIBS)
35
36 unit-wipe: unit-wipe.o
37 $(CC) -o $@ $^ $(LDLIBS)
38
39 unit-utils-io: unit-utils-io.o ../lib/utils_io.o
40 $(CC) -o $@ $^
41
42 unit-utils-crypt-test: unit-utils-crypt.o ../lib/utils_crypt.o
43 $(CC) -o $@ $^ $(LDLIBS)
44
45 test-symbols-list.h: generate-symbols-list
46 ./generate-symbols-list ../lib/libcryptsetup.sym > test-symbols-list.h
47
48 all-symbols-test.o: test-symbols-list.h
49 $(CC) -c $*.c
50
51 all-symbols-test: all-symbols-test.o
52 $(CC) -o $@ $^ -ldl
53
54 fake_systemd_tpm_path.so: fake_systemd_tpm_path.c
55 $(CC) -fPIC -shared -D_GNU_SOURCE -o fake_systemd_tpm_path.so fake_systemd_tpm_path.c
56
57 tests: $(TESTS_UTILS) $(TESTS)
58 @for test in $(sort $(TESTS)); do \
59 echo [$$test]; \
60 ./$$test; \
61 [ $(if $(TESTSUITE_NOSKIP),,$$? -ne 77 -a) $$? -ne 0 ] && exit 1; \
62 true; \
63 done;
64
65 clean:
66 rm -f *.o $(TESTS_UTILS) api-test api-test-2 unit-utils-crypt-test \
67 all-symbols-test test-symbols-list.h
68
69 .PHONY: clean