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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
build_tests = test-compile-pedantic test-link
if ENABLE_STATIC_LINK_TEST
build_tests += test-static-link
endif
noinst_PROGRAMS = $(build_tests)
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/libevdev
AM_LDFLAGS =
test_compile_pedantic_SOURCES = test-compile-pedantic.c
test_compile_pedantic_CFLAGS = $(AM_CPPFLAGS) -pedantic -Werror -std=c89
test_link_SOURCES = test-link.c
test_link_CFLAGS = -I$(top_srcdir)
test_link_LDADD = $(top_builddir)/libevdev/libevdev.la
test_static_link_SOURCES = test-link.c
test_static_link_CFLAGS = -I$(top_srcdir)
test_static_link_LDADD = $(top_builddir)/libevdev/libevdev.la
test_static_link_LDFLAGS = $(AM_LDFLAGS) -static
check_local_deps =
if ENABLE_RUNTIME_TESTS
run_tests = \
test-libevdev \
test-kernel \
test-uinput \
test-event-codes \
test-libevdev-internals \
$(NULL)
.NOTPARALLEL:
noinst_PROGRAMS += $(run_tests)
TESTS = $(run_tests)
common_sources = \
test-common-uinput.c \
test-common-uinput.h \
test-common.c \
test-common.h
# include builddir for event-names.h
AM_CPPFLAGS += $(CHECK_CFLAGS) $(GCOV_CFLAGS)
AM_LDFLAGS += $(GCOV_LDFLAGS)
test_event_codes_SOURCES = \
test-main.c \
test-event-codes.c \
test-event-names.c \
$(common_sources)
test_event_codes_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
test_event_codes_LDFLAGS = -no-install
test_libevdev_internals_SOURCES = \
test-main.c \
test-int-queue.c \
$(common_sources)
test_libevdev_internals_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
test_libevdev_internals_LDFLAGS = -no-install
test_uinput_SOURCES = \
test-main.c \
test-uinput.c \
$(common_sources)
test_uinput_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
test_uinput_LDFLAGS = -no-install
test_libevdev_SOURCES = \
test-main.c \
test-libevdev-init.c \
test-libevdev-has-event.c \
test-libevdev-events.c \
$(common_sources)
test_libevdev_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
test_libevdev_LDFLAGS = -no-install
test_kernel_SOURCES = \
test-main.c \
test-kernel.c \
$(common_sources)
test_kernel_CFLAGS = -I$(top_srcdir)
test_kernel_LDADD = $(CHECK_LIBS) $(top_builddir)/libevdev/libevdev.la
if HAVE_VALGRIND
VALGRIND_FLAGS=--leak-check=full \
--quiet \
--error-exitcode=3 \
--suppressions=$(srcdir)/valgrind.suppressions
valgrind:
$(MAKE) check-TESTS CK_TIMEOUT_MULTIPLIER=10 LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)"
check_local_deps += valgrind
endif
EXTRA_DIST = valgrind.suppressions generate-gcov-report.sh
if GCOV_ENABLED
CLEANFILES = gcov-reports/*.gcov gcov-reports/summary.txt *.gcno *.gcda
gcov-report: generate-gcov-report.sh check-TESTS
$(AM_V_GEN)$(srcdir)/generate-gcov-report.sh gcov-reports $(top_builddir)/libevdev $(builddir)
gcov: gcov-report
@cat gcov-reports/summary.txt
check_local_deps += gcov
else
gcov-report.txt:
@true
gcov:
@true
endif # GCOV_ENABLED
.PHONY: gcov gcov-clean gcov-report
endif # ENABLE_RUNTIME_TESTS
if ENABLE_STATIC_SYMBOL_LEAKS_TEST
# Hack to check for leaking symbols in the static library.
# See https://bugs.freedesktop.org/show_bug.cgi?id=82785
# Note the spaces in the expressions! After the first grep, each line
# is " T symbol_name"
static-symbol-leaks: test-static-link
$(AM_V_GEN)(\
$(NM) --extern-only $(builddir)/test-static-link | \
grep -o -e " T .*" | \
grep -v -e " main$$" \
-e " atexit" \
-e " *gcov.*" \
-e " _.*" \
-e " libevdev_*" && \
echo "Leaking symbols found" && \
exit 1 || exit 0 \
)
check_local_deps += static-symbol-leaks
endif # HAVE_NM
check-local: $(check_local_deps)
|