test: tidy up the symbols leak test

This hasn't been a real .in file since the autotools removal, so rename it to
reflect that. And since we can call it with arguments from meson, let's do so
in the most sensible manner - passing the full paths in as required rather
than relying on a directory layout within the script.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-07-12 08:42:53 +10:00
parent fa66edcd73
commit 6b73d93ca4
3 changed files with 20 additions and 31 deletions

View file

@ -726,10 +726,9 @@ test('tools-builddir-lookup-installed',
############ tests ############ ############ tests ############
test_symbols_leak = find_program('test/symbols-leak-test.in')
test('symbols-leak-test', test('symbols-leak-test',
test_symbols_leak, find_program('test/symbols-leak-test'),
args : [ meson.current_source_dir() ]) args : [ join_paths(dir_src, 'libinput.sym'), dir_src])
# build-test only # build-test only
executable('test-build-pedantic', executable('test-build-pedantic',

18
test/symbols-leak-test Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash -e
#
# simple check for exported symbols
#
# Usage: symbols-leak-test /path/to/mapfile /path/to/libinput/src
mapfile="$1"
shift
srcdir="$1"
shift
diff -a -u \
<(cat "$mapfile" | \
grep '^\s\+libinput_.*' | \
sed -e 's/^\s\+\(.*\);/\1/' | sort) \
<(cat "$srcdir"/*.c | \
grep LIBINPUT_EXPORT -A 1 | grep '^libinput_.*' | \
sed -e 's/(.*//' | sort)

View file

@ -1,28 +0,0 @@
#!/bin/bash
### simple check for exported symbols
# Allow running this after the configure.ac replacement or directly with an
# argument for the top_srcdir
TOP_SRCDIR="@top_srcdir@"
case "$TOP_SRCDIR" in
@*)
TOP_SRCDIR="$1"
;;
*)
;;
esac
# 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)