test: add a test that all symbol version file is updated It is easy to forget to update these files when adding new symbols. Stolen with slight changes from libinput (commit by Marek Chalupa): https://cgit.freedesktop.org/wayland/libinput/commit/?id=a9f216ab47ea2f643f20ed741b741a2b5766eba3 Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
diff --git a/Makefile.am b/Makefile.am
index 3e3a0c1..b77d0d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,8 @@ EXTRA_DIST = \
doc/doxygen-extra.css \
xkbcommon.map \
xkbcommon-x11.map \
- PACKAGING
+ PACKAGING \
+ test/symbols-leak-test.bash
AM_CPPFLAGS = \
-DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' \
@@ -181,7 +182,8 @@ libtest_la_SOURCES = \
AM_TESTS_ENVIRONMENT = \
XKB_LOG_LEVEL=debug; export XKB_LOG_LEVEL; \
XKB_LOG_VERBOSITY=10; export XKB_LOG_VERBOSITY; \
- $(XORG_MALLOC_DEBUG_ENV)
+ $(XORG_MALLOC_DEBUG_ENV) \
+ top_srcdir=$(top_srcdir)
build_run_tests = \
test/keysym \
@@ -201,6 +203,8 @@ build_run_tests = \
build_only_tests = \
test/rmlvo-to-kccgst \
test/print-compiled-keymap
+run_only_tests = \
+ test/symbols-leak-test.bash
TESTS_LDADD = libtest.la
@@ -248,7 +252,7 @@ test_interactive_x11_CFLAGS = $(TESTS_X11_CFLAGS)
endif ENABLE_X11
check_PROGRAMS = $(build_run_tests) $(build_only_tests)
-TESTS = $(build_run_tests)
+TESTS = $(build_run_tests) $(run_only_tests)
##
# Benchmarks
diff --git a/test/symbols-leak-test.bash b/test/symbols-leak-test.bash
new file mode 100755
index 0000000..eac0da5
--- /dev/null
+++ b/test/symbols-leak-test.bash
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+
+# Check that all exported symbols are specified in the symbol
+# version scripts. If this fails, please update the appropriate
+# (adding new version nodes when needed).
+
+# xkbcommon symbols
+diff -a -u \
+ <(cat "$top_srcdir"/xkbcommon.map | \
+ grep '^\s\+xkb_.*' | \
+ sed -e 's/^\s\+\(.*\);/\1/' | sort) \
+ <(cat "$top_srcdir"/src/{,xkbcomp,compose}/*.c | \
+ grep XKB_EXPORT -A 1 | grep '^xkb_.*' | \
+ sed -e 's/(.*//' | sort)
+
+# xkbcommon-x11 symbols
+diff -a -u \
+ <(cat "$top_srcdir"/xkbcommon-x11.map | \
+ grep '^\s\+xkb_.*' | \
+ sed -e 's/^\s\+\(.*\);/\1/' | sort) \
+ <(cat "$top_srcdir"/src/x11/*.c | \
+ grep XKB_EXPORT -A 1 | grep '^xkb_.*' | \
+ sed -e 's/(.*//' | sort)