[PATCH v2 libinput] add simple symbols leak checker

Marek Chalupa mchqwerty at gmail.com
Mon Feb 2 04:16:23 PST 2015


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.

v2. use noinst_SCRIPTS instead of dummy target
    drop .sh suffix
    generate the script from .in file
    use -u swich when running diff

Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
---
 test/Makefile.am          |  8 +++++++-
 test/symbols-leak-test.in | 20 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100755 test/symbols-leak-test.in

diff --git a/test/Makefile.am b/test/Makefile.am
index 5b9c7ab..51a0798 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -50,7 +50,13 @@ 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
+
+symbols-leak-test: symbols-leak-test.in
+	$(AM_V_GEN)$(SED) \
+		-e 's|@top_srcdir[@]|$(top_srcdir)|g' $< > $@
+	chmod +x $@
 
 .NOTPARALLEL:
 
diff --git a/test/symbols-leak-test.in b/test/symbols-leak-test.in
new file mode 100755
index 0000000..98f3fd9
--- /dev/null
+++ b/test/symbols-leak-test.in
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+### simple check for exported symbols
+
+# make sure the paths are alright
+cd `dirname $0`
+
+cat @top_srcdir@/src/libinput.sym | \
+	grep '^\s\+libinput_.*' | \
+	sed -e 's/^\s\+\(.*\);/\1/' |  sort > libinput.sym.symbols
+cat @top_srcdir@/src/*.c | \
+	grep LIBINPUT_EXPORT -A 1 | grep '^libinput_.*' | \
+	sed -e 's/(.*//' | sort > exported.symbols
+
+diff -a -u libinput.sym.symbols exported.symbols
+CODE=$?
+
+rm libinput.sym.symbols exported.symbols
+
+exit $CODE
-- 
2.2.2



More information about the wayland-devel mailing list