[PATCH libevdev 2/2] test: add basic link test

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 11 19:27:50 PST 2013


This test doesn't do anything but compile and link against libevdev. It's a
simple protection to avoid linker errors. If we ever have libs we depend on
and they don't get resolved properly, this test should warn us in time.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
This happened in a different library - it was missing the ldflags and thus
all users had unresolved symbols if they didn't link to the same libraries
explicitly. Doesn't happen here but better safe than sorry.

 test/.gitignore  | 1 +
 test/Makefile.am | 6 +++++-
 test/test-link.c | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 test/test-link.c

diff --git a/test/.gitignore b/test/.gitignore
index 08a722d..42cb139 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,3 +1,4 @@
 gcov-report.txt
 test-libevdev
+test-link
 test-compile-pedantic
diff --git a/test/Makefile.am b/test/Makefile.am
index cc9d6bd..3e81169 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,6 @@
 if BUILD_TESTS
 run_tests = test-libevdev
-build_tests = test-compile-pedantic
+build_tests = test-compile-pedantic test-link
 
 noinst_PROGRAMS = $(run_tests) $(build_tests)
 
@@ -39,6 +39,10 @@ test_libevdev_LDADD =  $(CHECK_LIBS) $(GCOV_LDFLAGS)
 test_compile_pedantic_SOURCES = test-compile-pedantic.c
 test_compile_pedantic_CFLAGS = $(AM_CPPFLAGS) -pedantic -Werror -std=c90
 
+test_link_SOURCES = test-link.c
+test_link_CFLAGS = -I$(top_srcdir)
+test_link_LDADD = $(top_builddir)/libevdev/libevdev.la
+
 if GCOV_ENABLED
 
 CLEANFILES = gcov-report.txt
diff --git a/test/test-link.c b/test/test-link.c
new file mode 100644
index 0000000..a66ea86
--- /dev/null
+++ b/test/test-link.c
@@ -0,0 +1,6 @@
+#include <stddef.h>
+#include <libevdev/libevdev.h>
+
+int main(void) {
+	return libevdev_new_from_fd(0, NULL);
+}
-- 
1.8.3.1



More information about the Input-tools mailing list