[PATCH v3 libinput] add simple symbols leak checker

Marek Chalupa mchqwerty at gmail.com
Mon Feb 9 01:44:47 PST 2015


On Fri, Feb 6, 2015 at 5:32 AM, Peter Hutterer <peter.hutterer at who-t.net>
wrote:

> On Thu, Feb 05, 2015 at 09:33:19AM +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.
> >
> > 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
> >
> > 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 803d573..dea65bf 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])
> > +
>
> hmm, any particular reason you didn't add this to the AC_CONFIG_FILES right
> above?
>

Yep, adding it to the one above did not work. It threw an error about
"multiple definition" of the "target".


>
> >  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..4b315ed
> > --- /dev/null
> > +++ b/test/symbols-leak-test.in
> > @@ -0,0 +1,17 @@
> > +#!/bin/bash
> > +
> > +### simple check for exported symbols
> > +
> > +# make sure the paths are alright
> > +cd `dirname $0`
>
> do you still need this? you don't use any tmp files anymore now.
>

Not when make check runs the script, but if you run the symbols-leak-test
manually, you'd get an error if you wouldn't change working directory to
test/


>
> > +
> > +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)
> > +CODE=$?
> > +
> > +exit $CODE
>
> if you use set -e you can skip CODE and exit, bash will exit if any command
> has a non-zero status
>

good point, will do it..


>
> Cheers,
>    Peter
>

Thanks,
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150209/c518d211/attachment.html>


More information about the wayland-devel mailing list