[PATCH xserver 04/10] tests: Convert test/ to single binary
Peter Hutterer
peter.hutterer at who-t.net
Tue Jan 3 04:07:58 UTC 2017
On Fri, Dec 30, 2016 at 01:30:55PM +0500, Mihail Konev wrote:
> Signed-off-by: Mihail Konev <k.mvc at ya.ru>
fwiw, this one fails in reply_XIGetSelectedEvents
#4 0x000000000040c34b in reply_XIGetSelectedEvents (client=0x7fffffffd7a0,
len=32, data=0x7fffffffd680 "\001<",
userdata=0x0) at protocol-xigetselectedevents.c:85
85 assert(rep->num_masks == test_data.num_masks_expected);
I'm also wondering: the shell script hack - do we need to bother? the tests
are effectively abandoned and merely serve as a canary. So IMO being able to
actually run sub-sets of tests is really something we need to worry about.
I guess your main motivation here is parallel make?
Also, I would prefer that you copy the commit message from 03 into all the
ones so each commit has an explanation of why. Otherwise a future reader has
to figure it out across multiple patches.
Cheers,
Peter
> ---
> test/Makefile.am | 53 +++++++++++++++++++++++---------------------------
> test/common.sh | 3 +++
> test/fixes.c | 4 +++-
> test/fixes.sh | 2 ++
> test/hashtable.sh | 2 ++
> test/hashtabletest.c | 4 +++-
> test/input.c | 4 +++-
> test/input.sh | 2 ++
> test/list.c | 4 +++-
> test/list.sh | 2 ++
> test/misc.c | 4 +++-
> test/misc.sh | 2 ++
> test/signal-logging.c | 4 +++-
> test/signal_logging.sh | 2 ++
> test/string.c | 4 +++-
> test/string.sh | 2 ++
> test/tests.c | 23 ++++++++++++++++++++++
> test/tests.h | 16 +++++++++++++++
> test/touch.c | 4 +++-
> test/touch.sh | 2 ++
> test/xfree86.c | 4 +++-
> test/xfree86.sh | 2 ++
> test/xkb.c | 4 +++-
> test/xkb.sh | 2 ++
> test/xtest.c | 4 +++-
> test/xtest.sh | 2 ++
> 26 files changed, 121 insertions(+), 40 deletions(-)
> create mode 100644 test/common.sh
> create mode 100755 test/fixes.sh
> create mode 100755 test/hashtable.sh
> create mode 100755 test/input.sh
> create mode 100755 test/list.sh
> create mode 100755 test/misc.sh
> create mode 100755 test/signal_logging.sh
> create mode 100755 test/string.sh
> create mode 100644 test/tests.c
> create mode 100644 test/tests.h
> create mode 100755 test/touch.sh
> create mode 100755 test/xfree86.sh
> create mode 100755 test/xkb.sh
> create mode 100755 test/xtest.sh
>
> diff --git a/test/Makefile.am b/test/Makefile.am
> index 064e1c5b736f..811f5928fb5a 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -1,21 +1,19 @@
> if ENABLE_UNIT_TESTS
> SUBDIRS= .
> -TEST_PROGS = list string
> +check_LTLIBRARIES = libxservertest.la
> +noinst_PROGRAMS = simple-xinit tests
> +
> +tests_SOURCES = list.c string.c tests.c
> +
> if XORG
> # Tests that require at least some DDX functions in order to fully link
> # For now, requires xf86 ddx, could be adjusted to use another
> SUBDIRS += xi1 xi2
> -TEST_PROGS += xkb input xtest misc fixes xfree86 signal-logging touch
> +tests_SOURCES += xkb.c input.c xtest.c misc.c fixes.c xfree86.c signal-logging.c touch.c
> if RES
> -TEST_PROGS += hashtabletest
> +tests_SOURCES += hashtabletest.c
> endif
> endif
> -check_LTLIBRARIES = libxservertest.la
> -
> -noinst_PROGRAMS = \
> - simple-xinit \
> - $(TEST_PROGS) \
> - $(NULL)
>
> if XVFB
> XVFB_TESTS = scripts/xvfb-piglit.sh
> @@ -26,20 +24,27 @@ endif
> endif
> endif
>
> -SCRIPT_TESTS = \
> +TESTS = \
> $(XVFB_TESTS) \
> $(XEPHYR_GLAMOR_TESTS) \
> - $(NULL)
> -
> -TESTS = \
> - $(TEST_PROGS) \
> - $(SCRIPT_TESTS) \
> + list.sh \
> + string.sh \
> + xkb.sh \
> + input.sh \
> + xtest.sh \
> + misc.sh \
> + fixes.sh \
> + xfree86.sh \
> + signal_logging.sh \
> + touch.sh \
> + hashtable.sh \
> $(NULL)
>
> TESTS_ENVIRONMENT = \
> XSERVER_DIR=$(abs_top_srcdir) \
> XSERVER_BUILDDIR=$(abs_top_builddir) \
> $(XORG_MALLOC_DEBUG_ENV) \
> + srcdir=$(srcdir) \
> $(NULL)
>
> AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
> @@ -51,22 +56,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
> -I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
> -I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
> endif
> -TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
> +tests_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
>
> if SPECIAL_DTRACE_OBJECTS
> -TEST_LDADD += $(OS_LIB) $(DIX_LIB)
> +tests_LDADD += $(OS_LIB) $(DIX_LIB)
> endif
>
> -xkb_LDADD=$(TEST_LDADD)
> -input_LDADD=$(TEST_LDADD)
> -xtest_LDADD=$(TEST_LDADD)
> -misc_LDADD=$(TEST_LDADD)
> -fixes_LDADD=$(TEST_LDADD)
> -xfree86_LDADD=$(TEST_LDADD)
> -touch_LDADD=$(TEST_LDADD)
> -signal_logging_LDADD=$(TEST_LDADD)
> -hashtabletest_LDADD=$(TEST_LDADD)
> -
> libxservertest_la_LIBADD = $(XSERVER_LIBS)
> if XORG
>
> @@ -153,7 +148,7 @@ endif
> if XQUARTZ
> libxservertest_la_LIBADD += \
> $(top_builddir)/miext/rootless/librootless.la
> -TEST_LDADD += -lXplugin
> +tests_LDADD += -lXplugin
> endif
>
> if XWIN_MULTIWINDOWEXTWM
> @@ -163,7 +158,7 @@ endif
> endif
>
> libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
> -endif
> +endif ENABLE_UNIT_TESTS
>
> EXTRA_DIST = \
> scripts/xvfb-piglit.sh \
> diff --git a/test/common.sh b/test/common.sh
> new file mode 100644
> index 000000000000..892028d9a585
> --- /dev/null
> +++ b/test/common.sh
> @@ -0,0 +1,3 @@
> +testname=${0%.sh}
> +testname=${testname##*/}
> +exec ./tests "$testname"
> diff --git a/test/fixes.c b/test/fixes.c
> index 4ac6750e4179..39b7030d00e1 100644
> --- a/test/fixes.c
> +++ b/test/fixes.c
> @@ -31,6 +31,8 @@
> #include <xfixesint.h>
> #include <X11/extensions/xfixeswire.h>
>
> +#include "tests.h"
> +
> static void
> _fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
> {
> @@ -343,7 +345,7 @@ fixes_pointer_barrier_clamp_test(void)
> }
>
> int
> -main(int argc, char **argv)
> +fixes_test(void)
> {
>
> fixes_pointer_barriers_test();
> diff --git a/test/fixes.sh b/test/fixes.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/fixes.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/hashtable.sh b/test/hashtable.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/hashtable.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/hashtabletest.c b/test/hashtabletest.c
> index 86a0c58c6bb0..620a06a31552 100644
> --- a/test/hashtabletest.c
> +++ b/test/hashtabletest.c
> @@ -8,6 +8,8 @@
> #include "hashtable.h"
> #include "resource.h"
>
> +#include "tests.h"
> +
> static void
> print_xid(void* ptr, void* v)
> {
> @@ -154,7 +156,7 @@ test3(void)
> }
>
> int
> -main(void)
> +hashtable_test(void)
> {
> int ok = test1();
> ok = ok && test2();
> diff --git a/test/input.c b/test/input.c
> index 91ee43c46ad9..6d63d8beb8dc 100644
> --- a/test/input.c
> +++ b/test/input.c
> @@ -43,6 +43,8 @@
> #include "mi.h"
> #include "assert.h"
>
> +#include "tests.h"
> +
> /**
> * Init a device with axes.
> * Verify values set on the device.
> @@ -1904,7 +1906,7 @@ dix_enqueue_events(void)
> }
>
> int
> -main(int argc, char **argv)
> +input_test(void)
> {
> dix_enqueue_events();
> dix_double_fp_conversion();
> diff --git a/test/input.sh b/test/input.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/input.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/list.c b/test/list.c
> index 28d9609eff5a..d6d153ae26ae 100644
> --- a/test/list.c
> +++ b/test/list.c
> @@ -31,6 +31,8 @@
> #include <assert.h>
> #include <stdlib.h>
>
> +#include "tests.h"
> +
> struct parent {
> int a;
> struct xorg_list children;
> @@ -369,7 +371,7 @@ test_nt_list_delete(void)
> }
>
> int
> -main(int argc, char **argv)
> +list_test(void)
> {
> test_xorg_list_init();
> test_xorg_list_add();
> diff --git a/test/list.sh b/test/list.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/list.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/misc.c b/test/misc.c
> index 66330a140614..8d4abf0d8d0f 100644
> --- a/test/misc.c
> +++ b/test/misc.c
> @@ -31,6 +31,8 @@
> #include "dix.h"
> #include "dixstruct.h"
>
> +#include "tests.h"
> +
> ScreenInfo screenInfo;
>
> static void
> @@ -192,7 +194,7 @@ dix_request_size_checks(void)
>
>
> int
> -main(int argc, char **argv)
> +misc_test(void)
> {
> dix_version_compare();
> dix_update_desktop_dimensions();
> diff --git a/test/misc.sh b/test/misc.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/misc.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/signal-logging.c b/test/signal-logging.c
> index 3d2d04801c88..981cb8ba752e 100644
> --- a/test/signal-logging.c
> +++ b/test/signal-logging.c
> @@ -30,6 +30,8 @@
> #include "assert.h"
> #include "misc.h"
>
> +#include "tests.h"
> +
> struct number_format_test {
> uint64_t number;
> char string[21];
> @@ -395,7 +397,7 @@ static void logging_format(void)
> #pragma GCC diagnostic pop /* "-Wformat-security" */
>
> int
> -main(int argc, char **argv)
> +signal_logging_test(void)
> {
> number_formatting();
> logging_format();
> diff --git a/test/signal_logging.sh b/test/signal_logging.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/signal_logging.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/string.c b/test/string.c
> index 93867e04aa0b..2f282cb7c738 100644
> --- a/test/string.c
> +++ b/test/string.c
> @@ -33,6 +33,8 @@
> #include <assert.h>
> #include "os.h"
>
> +#include "tests.h"
> +
> /* Ensure we're testing our functions, even on platforms with libc versions */
> #include <string.h>
> #undef strndup
> @@ -62,7 +64,7 @@ strndup_checks(void)
> }
>
> int
> -main(int argc, char **argv)
> +string_test(void)
> {
> strndup_checks();
>
> diff --git a/test/string.sh b/test/string.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/string.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/tests.c b/test/tests.c
> new file mode 100644
> index 000000000000..c37e66c689b1
> --- /dev/null
> +++ b/test/tests.c
> @@ -0,0 +1,23 @@
> +#include <string.h>
> +#include "tests.h"
> +
> +int main(int argc, char **argv) {
> + if (argc < 2) { return 1; }
> +
> +#define try_command(func) \
> + if (strcmp(argv[1], #func) == 0) { return func ## _test (); };
> +
> + try_command(list);
> + try_command(string);
> + try_command(xkb);
> + try_command(input);
> + try_command(xtest);
> + try_command(misc);
> + try_command(fixes);
> + try_command(xfree86);
> + try_command(signal_logging);
> + try_command(touch);
> + try_command(hashtable);
> +
> + return 1;
> +}
> diff --git a/test/tests.h b/test/tests.h
> new file mode 100644
> index 000000000000..b5cece61cb4f
> --- /dev/null
> +++ b/test/tests.h
> @@ -0,0 +1,16 @@
> +#ifndef TESTS_H
> +#define TESTS_H
> +
> +int list_test(void);
> +int string_test(void);
> +int xkb_test(void);
> +int input_test(void);
> +int xtest_test(void);
> +int misc_test(void);
> +int fixes_test(void);
> +int xfree86_test(void);
> +int signal_logging_test(void);
> +int touch_test(void);
> +int hashtable_test(void);
> +
> +#endif /* TESTS_H */
> diff --git a/test/touch.c b/test/touch.c
> index 19c68784ded4..bb3cd4d5f24d 100644
> --- a/test/touch.c
> +++ b/test/touch.c
> @@ -30,6 +30,8 @@
> #include "assert.h"
> #include "scrnintstr.h"
>
> +#include "tests.h"
> +
> static void
> touch_grow_queue(void)
> {
> @@ -278,7 +280,7 @@ touch_init(void)
> }
>
> int
> -main(int argc, char **argv)
> +touch_test(void)
> {
> touch_grow_queue();
> touch_find_ddxid();
> diff --git a/test/touch.sh b/test/touch.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/touch.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/xfree86.c b/test/xfree86.c
> index a986711834a5..7e3c7fed978f 100644
> --- a/test/xfree86.c
> +++ b/test/xfree86.c
> @@ -30,6 +30,8 @@
> #include "xf86.h"
> #include "xf86Parser.h"
>
> +#include "tests.h"
> +
> static void
> xfree86_option_list_duplicate(void)
> {
> @@ -96,7 +98,7 @@ xfree86_add_comment(void)
> }
>
> int
> -main(int argc, char **argv)
> +xfree86_test(void)
> {
> xfree86_option_list_duplicate();
> xfree86_add_comment();
> diff --git a/test/xfree86.sh b/test/xfree86.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/xfree86.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/xkb.c b/test/xkb.c
> index 9047f594cf25..987db0214f5f 100644
> --- a/test/xkb.c
> +++ b/test/xkb.c
> @@ -48,6 +48,8 @@
> #include "../xkb/xkb.h"
> #include <assert.h>
>
> +#include "tests.h"
> +
> /**
> * Initialize an empty XkbRMLVOSet.
> * Call XkbGetRulesDflts to obtain the default ruleset.
> @@ -164,7 +166,7 @@ xkb_set_get_rules_test(void)
> }
>
> int
> -main(int argc, char **argv)
> +xkb_test(void)
> {
> xkb_set_get_rules_test();
> xkb_get_rules_test();
> diff --git a/test/xkb.sh b/test/xkb.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/xkb.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> diff --git a/test/xtest.c b/test/xtest.c
> index e9fabfbb9c2c..5e06fd279ae8 100644
> --- a/test/xtest.c
> +++ b/test/xtest.c
> @@ -35,6 +35,8 @@
> #include "xserver-properties.h"
> #include "syncsrv.h"
>
> +#include "tests.h"
> +
> /**
> */
>
> @@ -123,7 +125,7 @@ xtest_properties(void)
> }
>
> int
> -main(int argc, char **argv)
> +xtest_test(void)
> {
> xtest_init_devices();
> xtest_properties();
> diff --git a/test/xtest.sh b/test/xtest.sh
> new file mode 100755
> index 000000000000..dd9106615e6a
> --- /dev/null
> +++ b/test/xtest.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +. $srcdir/common.sh
> --
> 2.9.2
>
More information about the xorg-devel
mailing list