• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1build_tests = test-compile-pedantic test-link
2
3if ENABLE_STATIC_LINK_TEST
4build_tests += test-static-link
5endif
6
7noinst_PROGRAMS = $(build_tests)
8
9AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/libevdev
10AM_LDFLAGS =
11
12test_compile_pedantic_SOURCES = test-compile-pedantic.c
13test_compile_pedantic_CFLAGS = $(AM_CPPFLAGS) -pedantic -Werror -std=c89
14
15test_link_SOURCES = test-link.c
16test_link_CFLAGS = -I$(top_srcdir)
17test_link_LDADD = $(top_builddir)/libevdev/libevdev.la
18
19test_static_link_SOURCES = test-link.c
20test_static_link_CFLAGS = -I$(top_srcdir)
21test_static_link_LDADD = $(top_builddir)/libevdev/libevdev.la
22test_static_link_LDFLAGS = $(AM_LDFLAGS) -static
23
24check_local_deps =
25
26if ENABLE_RUNTIME_TESTS
27run_tests = \
28	    test-libevdev \
29	    test-kernel \
30	    test-uinput \
31	    test-event-codes \
32	    test-libevdev-internals \
33	    $(NULL)
34
35.NOTPARALLEL:
36
37noinst_PROGRAMS += $(run_tests)
38
39TESTS = $(run_tests)
40
41common_sources = \
42		 test-common-uinput.c \
43		 test-common-uinput.h \
44		 test-common.c \
45		 test-common.h
46
47# include builddir for event-names.h
48AM_CPPFLAGS += $(CHECK_CFLAGS) $(GCOV_CFLAGS)
49AM_LDFLAGS += $(GCOV_LDFLAGS)
50
51test_event_codes_SOURCES = \
52			test-main.c \
53			test-event-codes.c \
54			test-event-names.c \
55			test-context.c \
56			$(common_sources)
57test_event_codes_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
58test_event_codes_LDFLAGS = -no-install
59
60test_libevdev_internals_SOURCES = \
61			test-main.c \
62			test-int-queue.c \
63			$(common_sources)
64test_libevdev_internals_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
65test_libevdev_internals_LDFLAGS = -no-install
66
67test_uinput_SOURCES = \
68			test-main.c \
69			test-uinput.c \
70			$(common_sources)
71test_uinput_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
72test_uinput_LDFLAGS = -no-install
73
74test_libevdev_SOURCES = \
75			test-main.c \
76			test-libevdev-init.c \
77			test-libevdev-has-event.c \
78			test-libevdev-events.c \
79			$(common_sources)
80
81test_libevdev_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
82test_libevdev_LDFLAGS = -no-install
83
84test_kernel_SOURCES = \
85		      test-main.c \
86		      test-kernel.c \
87		      $(common_sources)
88
89test_kernel_CFLAGS = -I$(top_srcdir)
90test_kernel_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
91
92if HAVE_VALGRIND
93VALGRIND_FLAGS=--leak-check=full \
94		--quiet \
95		--error-exitcode=3 \
96		--suppressions=$(srcdir)/valgrind.suppressions
97
98valgrind:
99	        $(MAKE) check-TESTS CK_TIMEOUT_MULTIPLIER=10 LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)"
100
101check_local_deps += valgrind
102
103endif
104
105if GCOV_ENABLED
106
107CLEANFILES = gcov-reports/*.gcov gcov-reports/summary.txt *.gcno *.gcda
108
109gcov-report: generate-gcov-report.sh check-TESTS
110	$(AM_V_GEN)$(srcdir)/generate-gcov-report.sh gcov-reports $(top_builddir)/libevdev $(builddir)
111
112gcov: gcov-report
113	@cat gcov-reports/summary.txt
114
115check_local_deps += gcov
116
117else
118
119gcov-report.txt:
120	@true
121
122gcov:
123	@true
124
125
126endif # GCOV_ENABLED
127
128.PHONY: gcov gcov-clean gcov-report
129
130endif # ENABLE_RUNTIME_TESTS
131
132if ENABLE_STATIC_SYMBOL_LEAKS_TEST
133static-symbol-leaks: test-static-link test-static-symbols-leak.sh
134	$(AM_V_GEN) $(srcdir)/test-static-symbols-leak.sh $(builddir)
135
136check_local_deps += static-symbol-leaks
137
138endif # HAVE_NM
139
140EXTRA_DIST = valgrind.suppressions  generate-gcov-report.sh test-static-symbols-leak.sh
141
142check-local: $(check_local_deps)
143
144