summaryrefslogtreecommitdiff
path: root/test/Makefile.am
blob: a232f861642abdbee3abf79665309abcf972e3b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
if BUILD_TESTS
noinst_PROGRAMS = test-libevdev

TESTS = $(noinst_PROGRAMS)

libevdev_sources = $(top_srcdir)/libevdev/libevdev.c \
		   $(top_srcdir)/libevdev/libevdev.h \
		   $(top_srcdir)/libevdev/libevdev-names.c \
		   $(top_srcdir)/libevdev/libevdev-uinput.h \
		   $(top_srcdir)/libevdev/libevdev-uinput.c \
		   $(top_srcdir)/libevdev/libevdev-uinput-int.h \
		   $(top_srcdir)/libevdev/libevdev-util.h \
		   $(top_srcdir)/libevdev/libevdev-int.h
common_sources = $(libevdev_sources) \
		 test-common-uinput.c \
		 test-common-uinput.h \
		 test-common.c \
		 test-common.h

# include builddir for event-names.h
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/libevdev $(CHECK_CFLAGS) $(GCOV_CFLAGS)

test_libevdev_SOURCES = \
			test-main.c \
			test-event-names.c \
			test-event-codes.c \
			test-libevdev-init.c \
			test-libevdev-has-event.c \
			test-int-queue.c \
			test-libevdev-events.c \
			test-uinput.c \
			$(common_sources)

test_libevdev_LDADD =  $(CHECK_LIBS) $(GCOV_LDFLAGS)

if GCOV_ENABLED

CLEANFILES = gcov-report.txt

gcov-clean:
	@rm -f *.gcov

gcov-report.txt: gcov-clean check-TESTS
	$(AM_V_GEN)(rm -rf $@; \
		echo "========== coverage report ========" >> $@; \
		for file in `find $(top_srcdir)/libevdev -name "*.c" -printf "%P\n"`; do \
			gcov $$file > /dev/null; \
			if test -f $$file.gcov; then \
				total=`grep -v " -:" $$file.gcov | wc -l`; \
				missing=`grep "#####" $$file.gcov | wc -l`; \
				hit=$$((total - missing)); \
				echo -e "$$file: total lines: $$total not tested: $$missing ($$((($$hit * 100)/$$total))%)"; \
			fi \
		done >> $@; \
		echo "========== =============== ========" >> $@; \
	)

gcov: gcov-report.txt
	@cat gcov-report.txt

check-local: gcov

else

gcov-report.txt:
	@true

gcov:
	@true

gcov-clean:
	@true

endif

.PHONY: gcov gcov-clean gcov-report.txt

clean-local: gcov-clean
	rm -f *.gcno *.gcda

endif