1#
2# Test programs for the RAID library
3#
4# selftest - Runs the same selftest and speedtest executed at the module startup.
5# fulltest - Runs a more extensive test that checks all the built-in functions.
6# speedtest - Runs a more complete speed test.
7# invtest - Runs an extensive matrix inversion test of all the 377.342.351.231
8#           possible square submatrices of the Cauchy matrix used.
9# covtest - Runs a coverage test.
10# sdecovtest - Runs a coverage test with the sde emulator.
11#
12
13MACHINE = $(shell uname -m)
14ifeq ($(MACHINE),i686)
15SDE = sde
16else
17SDE = sde64
18endif
19CC = gcc
20LD = ld
21CFLAGS = -I.. -Wall -Wextra -g
22ifeq ($(COVERAGE),)
23CFLAGS += -O2
24else
25CFLAGS += -O0 --coverage -DCOVERAGE=1 -DNDEBUG=1
26endif
27OBJS = raid.o check.o int.o intz.o x86.o x86z.o tables.o memory.o test.o helper.o module.o tag.o
28
29%.o: ../%.c
30	$(CC) $(CFLAGS) -c -o $@ $<
31
32all: fulltest speedtest selftest invtest
33
34fulltest: $(OBJS) fulltest.o
35	$(CC) $(CFLAGS) -o fulltest $^
36
37speedtest: $(OBJS) speedtest.o
38	$(CC) $(CFLAGS) -o speedtest $^
39
40selftest: $(OBJS) selftest.o
41	$(CC) $(CFLAGS) -o selftest $^
42
43invtest: $(OBJS) invtest.o
44	$(CC) $(CFLAGS) -o invtest $^
45
46mktables: mktables.o
47	$(CC) $(CFLAGS) -o mktables $^
48
49tables.c: mktables
50	./mktables > tables.c
51
52# Use this target to run a coverage test using lcov
53covtest:
54	$(MAKE) clean
55	$(MAKE) lcov_reset
56	$(MAKE) COVERAGE=1 all
57	./fulltest
58	./selftest
59	./speedtest
60	$(MAKE) lcov_capture
61	$(MAKE) lcov_html
62
63# Use this target to run a coverage test using lcov and the sde
64sdecovtest:
65	$(MAKE) clean
66	$(MAKE) lcov_reset
67	$(MAKE) COVERAGE=1 all
68	$(SDE) -p4p -- ./fulltest
69	$(SDE) -mrm -- ./fulltest
70	$(SDE) -nhm -- ./fulltest
71	$(SDE) -hsw -- ./fulltest
72	$(SDE) -p4p -- ./selftest
73	$(SDE) -mrm -- ./selftest
74	$(SDE) -nhm -- ./selftest
75	$(SDE) -hsw -- ./selftest
76	$(SDE) -hsw -- ./speedtest
77	$(MAKE) lcov_capture
78	$(MAKE) lcov_html
79
80lcov_reset:
81	lcov --directory . -z
82	rm -f lcov.info
83
84lcov_capture:
85	lcov --directory . --capture --rc lcov_branch_coverage=1 -o lcov.info
86
87lcov_html:
88	rm -rf coverage
89	mkdir coverage
90	genhtml --branch-coverage -o coverage lcov.info
91
92clean:
93	rm -f *.o mktables tables.c
94	rm -f *.gcda *.gcno lcov.info
95	rm -rf coverage
96
97distclean: clean
98	rm -f fulltest speedtest selftest invtest
99
100