[PATCH libinput v4 1/2] add simple symbols leak checker

Marek Chalupa mchqwerty at gmail.com
Thu Feb 12 06:25:36 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

v3. use AC_CONFIG_FILES to generate scripts from .in file
    use pipes instead of creating files

v4. use set -e instead of manually returning the exit code

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

diff --git a/configure.ac b/configure.ac
index f47c5a4..1a852e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,6 +164,8 @@ 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([
diff --git a/test/Makefile.am b/test/Makefile.am
index 5b9c7ab..5743ca4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -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
index 0000000..448ef2f
--- /dev/null
+++ b/test/symbols-leak-test.in
@@ -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)
-- 
2.1.0



More information about the wayland-devel mailing list