test: add uinput creation tests
[platform/upstream/libevdev.git] / test / Makefile.am
1 if BUILD_TESTS
2 noinst_PROGRAMS = test-libevdev
3
4 TESTS = $(noinst_PROGRAMS)
5
6 libevdev_sources = $(top_srcdir)/libevdev/libevdev.c \
7                    $(top_srcdir)/libevdev/libevdev.h \
8                    $(top_srcdir)/libevdev/libevdev-uinput.h \
9                    $(top_srcdir)/libevdev/libevdev-uinput.c \
10                    $(top_srcdir)/libevdev/libevdev-uinput-int.h \
11                    $(top_srcdir)/libevdev/libevdev-util.h \
12                    $(top_srcdir)/libevdev/libevdev-int.h
13 common_sources = $(libevdev_sources) \
14                  test-common-uinput.c \
15                  test-common-uinput.h \
16                  test-common.c \
17                  test-common.h
18
19 # include builddir for event-names.h
20 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/libevdev $(CHECK_CFLAGS) $(GCOV_CFLAGS)
21
22 test_libevdev_SOURCES = \
23                         test-main.c \
24                         test-event-names.c \
25                         test-libevdev-init.c \
26                         test-libevdev-has-event.c \
27                         test-int-queue.c \
28                         test-libevdev-events.c \
29                         test-uinput.c \
30                         $(common_sources)
31
32 test_libevdev_LDADD =  $(CHECK_LIBS) $(GCOV_LDFLAGS)
33
34 if GCOV_ENABLED
35
36 CLEANFILES = gcov-report.txt
37
38 gcov-clean:
39         @rm -f *.gcov
40
41 gcov-report.txt: gcov-clean check-TESTS
42         $(AM_V_GEN)(rm -rf $@; \
43                 echo "========== coverage report ========" >> $@; \
44                 for file in `find $(top_srcdir)/libevdev -name "*.c" -printf "%P\n"`; do \
45                         gcov $$file > /dev/null; \
46                         if test -f $$file.gcov; then \
47                                 total=`grep -v " -:" $$file.gcov | wc -l`; \
48                                 missing=`grep "#####" $$file.gcov | wc -l`; \
49                                 hit=$$((total - missing)); \
50                                 echo -e "$$file: total lines: $$total not tested: $$missing ($$((($$hit * 100)/$$total))%)"; \
51                         fi \
52                 done >> $@; \
53                 echo "========== =============== ========" >> $@; \
54         )
55
56 gcov: gcov-report.txt
57         @cat gcov-report.txt
58
59 check-local: gcov
60
61 else
62
63 gcov-report.txt:
64         @true
65
66 gcov:
67         @true
68
69 gcov-clean:
70         @true
71
72 endif
73
74 .PHONY: gcov gcov-clean gcov-report.txt
75
76 clean-local: gcov-clean
77         rm -f *.gcno *.gcda
78
79 endif