2 run_tests = test-libevdev test-kernel
3 build_tests = test-compile-pedantic test-link test-static-link
7 noinst_PROGRAMS = $(run_tests) $(build_tests)
11 libevdev_sources = $(top_srcdir)/libevdev/libevdev.c \
12 $(top_srcdir)/libevdev/libevdev.h \
13 $(top_srcdir)/libevdev/libevdev-names.c \
14 $(top_srcdir)/libevdev/libevdev-uinput.h \
15 $(top_srcdir)/libevdev/libevdev-uinput.c \
16 $(top_srcdir)/libevdev/libevdev-uinput-int.h \
17 $(top_srcdir)/libevdev/libevdev-util.h \
18 $(top_srcdir)/libevdev/libevdev-int.h
19 common_sources = $(libevdev_sources) \
20 test-common-uinput.c \
21 test-common-uinput.h \
25 # include builddir for event-names.h
26 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/libevdev $(CHECK_CFLAGS) $(GCOV_CFLAGS)
27 AM_LDFLAGS = $(GCOV_LDFLAGS)
29 test_libevdev_SOURCES = \
33 test-libevdev-init.c \
34 test-libevdev-has-event.c \
36 test-libevdev-events.c \
40 test_libevdev_LDADD = $(CHECK_LIBS)
42 test_compile_pedantic_SOURCES = test-compile-pedantic.c
43 test_compile_pedantic_CFLAGS = $(AM_CPPFLAGS) -pedantic -Werror -std=c90
45 test_link_SOURCES = test-link.c
46 test_link_CFLAGS = -I$(top_srcdir)
47 test_link_LDADD = $(top_builddir)/libevdev/libevdev.la
49 test_static_link_SOURCES = test-link.c
50 test_static_link_CFLAGS = -I$(top_srcdir)
51 test_static_link_LDADD = $(top_builddir)/libevdev/libevdev.la
52 test_static_link_LDFLAGS = $(AM_LDFLAGS) -static
54 test_kernel_SOURCES = \
57 test_kernel_CFLAGS = -I$(top_srcdir)
58 test_kernel_LDADD = $(CHECK_LIBS)
63 VALGRIND_FLAGS=--leak-check=full \
66 --suppressions=$(srcdir)/valgrind.suppressions
69 $(MAKE) check-TESTS LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)"
71 check_local_deps += valgrind
75 EXTRA_DIST = valgrind.suppressions
79 CLEANFILES = gcov-report.txt
84 gcov-report.txt: gcov-clean check-TESTS
85 $(AM_V_GEN)(rm -rf $@; \
86 echo "========== coverage report ========" >> $@; \
87 for file in `find $(top_srcdir)/libevdev -name "*.c" -printf "%P\n"`; do \
88 gcov $$file > /dev/null; \
89 if test -f $$file.gcov; then \
90 total=`grep -v " -:" $$file.gcov | wc -l`; \
91 missing=`grep "#####" $$file.gcov | wc -l`; \
92 hit=$$((total - missing)); \
93 echo -e "$$file: total lines: $$total not tested: $$missing ($$((($$hit * 100)/$$total))%)"; \
96 echo "========== =============== ========" >> $@; \
102 check_local_deps += gcov
117 .PHONY: gcov gcov-clean gcov-report.txt
119 clean-local: gcov-clean
123 # Hack to check for leaking symbols in the static library.
124 # See https://bugs.freedesktop.org/show_bug.cgi?id=82785
125 # Note the spaces in the expressions! After the first grep, each line
126 # is " T symbol_name"
127 static-symbol-leaks: test-static-link
129 $(NM) --extern-only $(builddir)/test-static-link | \
130 grep -o -e " T .*" | \
131 grep -v -e " main$$" \
135 -e " libevdev_*" && \
136 echo "Leaking symbols found" && \
140 check_local_deps += static-symbol-leaks
143 check-local: $(check_local_deps)