forked from drath/libratbag
Two components are added here: a test driver that takes a struct ratbag_test_device and sets that device up as a ratbag device. That device is returned to the tests and then checked for sanity. The ratbag_device_new_test_device() requires the environment variable RATBAG_TEST set, otherwise we abort. It's also 'hidden' in a separate source file, so it won't show up in doxygen. And if the test are disabled, this function does nothing and the test driver never gets registered. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
66 lines
1.7 KiB
Makefile
66 lines
1.7 KiB
Makefile
if BUILD_TESTS
|
|
AM_CPPFLAGS = -I$(top_srcdir)/include \
|
|
-I$(top_srcdir)/src \
|
|
$(CHECK_CFLAGS) \
|
|
$(LIBEVDEV_CFLAGS)
|
|
|
|
AM_CFLAGS = $(GCC_CFLAGS)
|
|
AM_CXXFLAGS = $(GCC_CXXFLAGS)
|
|
|
|
TEST_LIBS = $(CHECK_LIBS) $(LIBEVDEV_LIBS) $(top_builddir)/src/libratbag.la
|
|
|
|
run_tests = \
|
|
test-context \
|
|
test-device
|
|
|
|
build_tests = \
|
|
test-build-cxx \
|
|
test-build-linker \
|
|
test-build-pedantic-c99 \
|
|
test-build-std-gnuc90
|
|
|
|
noinst_PROGRAMS = $(build_tests) $(run_tests)
|
|
noinst_SCRIPTS = symbols-leak-test
|
|
TESTS = $(run_tests) symbols-leak-test
|
|
|
|
test_context_SOURCES = test-context.c
|
|
test_context_LDADD = $(TEST_LIBS)
|
|
test_context_LDFLAGS = -no-install
|
|
|
|
test_device_SOURCES = test-device.c
|
|
test_device_LDADD = $(TEST_LIBS)
|
|
test_device_LDFLAGS = -no-install
|
|
|
|
# build-test only
|
|
test_build_pedantic_c99_SOURCES = build-pedantic.c
|
|
test_build_pedantic_c99_CFLAGS = -std=c99 -pedantic -Werror
|
|
|
|
test_build_std_gnuc90_SOURCES = build-pedantic.c
|
|
test_build_std_gnuc90_CFLAGS = -std=gnu90 -Werror
|
|
|
|
# test for linking with the minimal linker flags
|
|
test_build_linker_SOURCES = build-pedantic.c
|
|
test_build_linker_CFLAGS = -I$(top_srcdir)/src
|
|
test_build_linker_LDADD = $(top_builddir)/src/libratbag.la
|
|
|
|
# test including from C++
|
|
test_build_cxx_SOURCES = build-cxx.cc
|
|
test_build_cxx_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(AM_CXXFLAGS)
|
|
|
|
AM_TESTS_ENVIRONMENT=RATBAG_TEST=1; export RATBAG_TEST;
|
|
|
|
if HAVE_VALGRIND
|
|
VALGRIND_FLAGS=--leak-check=full \
|
|
--quiet \
|
|
--error-exitcode=3 \
|
|
--suppressions=$(srcdir)/valgrind.suppressions
|
|
|
|
valgrind:
|
|
$(MAKE) check-TESTS LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)" CK_FORK=no USING_VALGRIND=yes
|
|
|
|
check: valgrind
|
|
|
|
endif
|
|
endif
|
|
EXTRA_DIST=valgrind.suppressions
|