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>
master
Ran Benita 2016-03-13 20:56:58 +02:00
parent 1c6d21b45f
commit fa1b454328
2 changed files with 31 additions and 3 deletions

View File

@ -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

24
test/symbols-leak-test.bash Executable file
View File

@ -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)