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

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 21 17:55:32 PST 2015


On Wed, Jan 21, 2015 at 12:11:21PM +0100, Marek Chalupa wrote:
> 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.

good idea, thanks

> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> ---
>  test/Makefile.am          |  7 ++++++-
>  test/symbols-leak-test.sh | 17 +++++++++++++++++
>  2 files changed, 23 insertions(+), 1 deletion(-)
>  create mode 100755 test/symbols-leak-test.sh
> 
> diff --git a/test/Makefile.am b/test/Makefile.am
> index 1b7ba87..2bd3e13 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -48,8 +48,13 @@ build_tests = \
>  	test-build-pedantic-c99 \
>  	test-build-std-gnuc90
>  
> +

drop this please

>  noinst_PROGRAMS = $(build_tests) $(run_tests)
> -TESTS = $(run_tests)
> +TESTS = $(run_tests) symbols-leak-test.sh
> +
> +# symbol-leak-test.sh needs a dummy target, or we'll get error
> +# while make check
> +symbols-leak-test.sh:

if you add the script as noinst_SCRIPTS, you shouldn't need the extra
target.

>  
>  .NOTPARALLEL:
>  
> diff --git a/test/symbols-leak-test.sh b/test/symbols-leak-test.sh
> new file mode 100755
> index 0000000..d32cffa
> --- /dev/null
> +++ b/test/symbols-leak-test.sh
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +
> +# simple check for exported symbols
> +
> +# make sure the paths are alright
> +cd `dirname $0`
> +
> +cat ../src/libinput.sym| grep '^\s\+libinput_.*' | sed -e 's/^\s\+\(.*\);/\1/' |  sort > libinput.sym.symbols
> +
> +cat ../src/*.c | grep LIBINPUT_EXPORT -A 1 | grep '^libinput_.*' | sed -e 's/(.*//' | sort > exported.symbols

I think you need a .in file for this, this would break on make distcheck
with the builddir elsewhere. so instead of ../ you need to use $srcdir etc.

> +
> +diff -a libinput.sym.symbols exported.symbols
> +CODE=$?

Use -u as well for diff pls, that's what ppl are used to.

Cheers,
   Peter

> +
> +rm libinput.sym.symbols exported.symbols
> +
> +exit $CODE
> -- 
> 2.2.1
> 


More information about the wayland-devel mailing list