add simple symbols leak checker
authorMarek Chalupa <mchqwerty@gmail.com>
Thu, 12 Feb 2015 14:25:36 +0000 (09:25 -0500)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 13 Feb 2015 00:20:44 +0000 (10:20 +1000)
This patch adds simple script that compares libinput.sym file to the
functions that are marked by LIBINPUT_EXPORT. This script is added
to make check target.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
.gitignore
configure.ac
test/Makefile.am
test/symbols-leak-test.in [new file with mode: 0755]

index 3ea8576b7732fe1b44c726e3099f914a56a334dd..2253d4546ec7da41bb42db4173194f3054a5e5ec 100644 (file)
@@ -27,4 +27,5 @@ doc/libinput.doxygen
 doc/html
 tags
 test/test-*
+test/symbols-leak-test*
 test-driver
index f47c5a49b2c52ff59f755ce7cff58d67454d670c..1e60e58549e85bc7a819f2693d01ce5b6a1b18f1 100644 (file)
@@ -164,6 +164,9 @@ AC_CONFIG_FILES([Makefile
                 src/libinput-version.h
                 test/Makefile
                 tools/Makefile])
+AC_CONFIG_FILES([test/symbols-leak-test],
+               [chmod +x test/symbols-leak-test])
+
 AC_OUTPUT
 
 AC_MSG_RESULT([
index 5b9c7ab64e1f6073096cc2c76a15c720a59c1035..5743ca4f021f8281e42a224664f3386baff9d36b 100644 (file)
@@ -50,7 +50,8 @@ build_tests = \
        test-build-std-gnuc90
 
 noinst_PROGRAMS = $(build_tests) $(run_tests)
-TESTS = $(run_tests)
+noinst_SCRIPTS = symbols-leak-test
+TESTS = $(run_tests) symbols-leak-test
 
 .NOTPARALLEL:
 
diff --git a/test/symbols-leak-test.in b/test/symbols-leak-test.in
new file mode 100755 (executable)
index 0000000..448ef2f
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+### simple check for exported symbols
+
+# make bash exit if any command will exit with non-0 return value
+set -e
+
+# make sure the paths are alright
+cd `dirname $0`
+
+diff -a -u \
+       <(cat @top_srcdir@/src/libinput.sym | \
+               grep '^\s\+libinput_.*' | \
+               sed -e 's/^\s\+\(.*\);/\1/' |  sort) \
+       <(cat @top_srcdir@/src/*.c | \
+               grep LIBINPUT_EXPORT -A 1 | grep '^libinput_.*' | \
+               sed -e 's/(.*//' | sort)