[PATCH libinput 03/13] test: merge all tests into a single binary

Peter Hutterer peter.hutterer at who-t.net
Tue Aug 2 02:40:48 UTC 2016


Call it a libinput-test-suite-runner, in subsequent patches we'll handle doing
parallel tests ourselves instead of relying on automake features.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 doc/test-suite.dox      |  14 +++----
 test/Makefile.am        | 104 ++++++++++--------------------------------------
 test/device.c           |   2 +-
 test/gestures.c         |   2 +-
 test/keyboard.c         |   2 +-
 test/litest.c           |  17 +++++++-
 test/litest.h           |  20 ++++++++--
 test/log.c              |   2 +-
 test/misc.c             |   2 +-
 test/pad.c              |   2 +-
 test/path.c             |   2 +-
 test/pointer.c          |   2 +-
 test/tablet.c           |   2 +-
 test/touch.c            |   2 +-
 test/touchpad-buttons.c |   2 +-
 test/touchpad-tap.c     |   2 +-
 test/touchpad.c         |   2 +-
 test/trackball.c        |   2 +-
 test/trackpoint.c       |   2 +-
 test/udev.c             |   2 +-
 20 files changed, 78 insertions(+), 109 deletions(-)

diff --git a/doc/test-suite.dox b/doc/test-suite.dox
index 30dd157..104e2a9 100644
--- a/doc/test-suite.dox
+++ b/doc/test-suite.dox
@@ -4,8 +4,8 @@
 The libinput test suite is based on
 [Check](http://check.sourceforge.net/doc/check_html/) and runs automatically
 during `make check`. Check itself is wrapped into a libinput-specific test
-suite called *litest*. Tests are found in `$srcdir/test/`, the test binaries are
-prefixed with `test-` and can be run individually. 
+suite called *litest*. Tests are found in `$srcdir/test/`, the main test
+suite is `libinput-test-suite-runner`.
 
 @section test-config X.Org config to avoid interference
 
@@ -30,7 +30,7 @@ litest's tests are grouped by test groups and devices. A test group is e.g.
 Each test function is (usually) run with one or more specific devices.
 The `--list` commandline argument shows the list of suites and tests.
 @code
-$ ./test/test-device --list
+$ ./test/libinput-test-suite-runner --list
 device:wheel:
 	wheel only
 	blackwidow
@@ -56,7 +56,7 @@ The `--filter-test` argument enables selective running of tests through
 basic shell-style function name matching. For example:
 
 @code
-$ ./test/test-touchpad --filter-test="*1fg_tap*"
+$ ./test/libinput-test-suite-runner --filter-test="*1fg_tap*"
 @endcode
 
 The `--filter-device` argument enables selective running of tests through
@@ -64,7 +64,7 @@ basic shell-style device name matching. The device names matched are the
 litest-specific shortnames, see the output of `--list`. For example:
 
 @code
-$ ./test/test-touchpad --filter-device="synaptics*"
+$ ./test/libinput-test-suite-runner --filter-device="synaptics*"
 @endcode
 
 The `--filter-group` argument enables selective running of test groups
@@ -72,7 +72,7 @@ through basic shell-style test group matching. The test groups matched are
 litest-specific test groups, see the output of `--list`. For example:
 
 @code
-$ ./test/test-touchpad --filter-group="touchpad:*hover*"
+$ ./test/libinput-test-suite-runner --filter-group="touchpad:*hover*"
 @endcode
 
 The `--filter-device` and `--filter-group` arguments can be combined with
@@ -85,7 +85,7 @@ output, see libinput_log_set_priority() for details. The `LITEST_VERBOSE`
 environment variable, if set, also enables verbose mode.
 
 @code
-$ ./test/test-device --verbose
+$ ./test/libinput-test-suite-runner --verbose
 $ LITEST_VERBOSE=1 make check
 @endcode
 
diff --git a/test/Makefile.am b/test/Makefile.am
index fda0c5d..32e379a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -77,24 +77,8 @@ liblitest_la_LIBADD += $(LIBUNWIND_LIBS) -ldl
 liblitest_la_CFLAGS += $(LIBUNWIND_CFLAGS)
 endif
 
-run_tests = \
-	test-touchpad \
-	test-touchpad-tap \
-	test-touchpad-buttons \
-	test-pad \
-	test-tablet \
-	test-device \
-	test-gestures \
-	test-pointer \
-	test-touch \
-	test-trackball \
-	test-trackpoint \
-	test-udev \
-	test-path \
-	test-log \
-	test-misc \
-	test-keyboard \
-	test-litest-selftest
+run_tests = libinput-test-suite-runner \
+	    test-litest-selftest
 
 build_tests = \
 	test-build-cxx \
@@ -108,70 +92,26 @@ TESTS = $(run_tests) symbols-leak-test
 
 .NOTPARALLEL:
 
-test_udev_SOURCES = udev.c
-test_udev_LDADD = $(TEST_LIBS)
-test_udev_LDFLAGS = -no-install
-
-test_path_SOURCES = path.c
-test_path_LDADD = $(TEST_LIBS)
-test_path_LDFLAGS = -no-install
-
-test_pointer_SOURCES = pointer.c
-test_pointer_LDADD = $(TEST_LIBS)
-test_pointer_LDFLAGS = -no-install
-
-test_touch_SOURCES = touch.c
-test_touch_LDADD = $(TEST_LIBS)
-test_touch_LDFLAGS = -no-install
-
-test_log_SOURCES = log.c
-test_log_LDADD = $(TEST_LIBS)
-test_log_LDFLAGS = -no-install
-
-test_tablet_SOURCES = tablet.c
-test_tablet_LDADD = $(TEST_LIBS)
-test_tablet_LDFLAGS = -static
-
-test_pad_SOURCES = pad.c
-test_pad_LDADD = $(TEST_LIBS)
-test_pad_LDFLAGS = -static
-
-test_touchpad_SOURCES = touchpad.c
-test_touchpad_LDADD = $(TEST_LIBS)
-test_touchpad_LDFLAGS = -no-install
-
-test_touchpad_tap_SOURCES = touchpad-tap.c
-test_touchpad_tap_LDADD = $(TEST_LIBS)
-test_touchpad_tap_LDFLAGS = -no-install
-
-test_touchpad_buttons_SOURCES = touchpad-buttons.c
-test_touchpad_buttons_LDADD = $(TEST_LIBS)
-test_touchpad_buttons_LDFLAGS = -no-install
-
-test_trackpoint_SOURCES = trackpoint.c
-test_trackpoint_LDADD = $(TEST_LIBS)
-test_trackpoint_LDFLAGS = -no-install
-
-test_trackball_SOURCES = trackball.c
-test_trackball_LDADD = $(TEST_LIBS)
-test_trackball_LDFLAGS = -no-install
-
-test_misc_SOURCES = misc.c
-test_misc_CFLAGS= $(AM_CFLAGS) -DLIBINPUT_LT_VERSION="\"$(LIBINPUT_LT_VERSION)\""
-test_misc_LDADD = $(TEST_LIBS)
-test_misc_LDFLAGS = -no-install
-
-test_keyboard_SOURCES = keyboard.c
-test_keyboard_LDADD = $(TEST_LIBS)
-test_keyboard_LDFLAGS = -no-install
-
-test_device_SOURCES = device.c
-test_device_LDADD = $(TEST_LIBS)
-test_device_LDFLAGS = -no-install
-
-test_gestures_SOURCES = gestures.c
-test_gestures_LDADD = $(TEST_LIBS)
-test_gestures_LDFLAGS = -no-install
+libinput_test_suite_runner_SOURCES = udev.c \
+				     path.c \
+				     pointer.c \
+				     touch.c \
+				     log.c \
+				     tablet.c \
+				     pad.c \
+				     touchpad.c \
+				     touchpad-tap.c \
+				     touchpad-buttons.c \
+				     trackpoint.c \
+				     trackball.c \
+				     misc.c \
+				     keyboard.c \
+				     device.c \
+				     gestures.c
+
+libinput_test_suite_runner_CFLAGS = $(AM_CFLAGS) -DLIBINPUT_LT_VERSION="\"$(LIBINPUT_LT_VERSION)\""
+libinput_test_suite_runner_LDADD = $(TEST_LIBS)
+libinput_test_suite_runner_LDFLAGS = -no-install
 
 test_litest_selftest_SOURCES = litest-selftest.c litest.c litest-int.h litest.h
 test_litest_selftest_CFLAGS = -DLITEST_DISABLE_BACKTRACE_LOGGING -DLITEST_NO_MAIN $(liblitest_la_CFLAGS)
diff --git a/test/device.c b/test/device.c
index 809d8cf..01f794f 100644
--- a/test/device.c
+++ b/test/device.c
@@ -1347,7 +1347,7 @@ START_TEST(device_quirks_apple_magicmouse)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_device(void)
 {
 	struct range abs_range = { 0, ABS_MISC };
 	struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
diff --git a/test/gestures.c b/test/gestures.c
index fa280a4..0b132c3 100644
--- a/test/gestures.c
+++ b/test/gestures.c
@@ -1215,7 +1215,7 @@ START_TEST(gestures_3fg_buttonarea_scroll_btntool)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_gestures(void)
 {
 	/* N, NE, ... */
 	struct range cardinals = { 0, 8 };
diff --git a/test/keyboard.c b/test/keyboard.c
index f3aa9df..780506a 100644
--- a/test/keyboard.c
+++ b/test/keyboard.c
@@ -379,7 +379,7 @@ START_TEST(keyboard_no_buttons)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_keyboard(void)
 {
 	litest_add_no_device("keyboard:seat key count", keyboard_seat_key_count);
 	litest_add_no_device("keyboard:key counting", keyboard_ignore_no_pressed_release);
diff --git a/test/litest.c b/test/litest.c
index 3875dd0..2187901 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -3143,7 +3143,22 @@ main(int argc, char **argv)
 	if (mode == LITEST_MODE_ERROR)
 		return EXIT_FAILURE;
 
-	litest_setup_tests();
+	litest_setup_tests_udev();
+	litest_setup_tests_path();
+	litest_setup_tests_pointer();
+	litest_setup_tests_touch();
+	litest_setup_tests_log();
+	litest_setup_tests_tablet();
+	litest_setup_tests_pad();
+	litest_setup_tests_touchpad();
+	litest_setup_tests_touchpad_tap();
+	litest_setup_tests_touchpad_buttons();
+	litest_setup_tests_trackpoint();
+	litest_setup_tests_trackball();
+	litest_setup_tests_misc();
+	litest_setup_tests_keyboard();
+	litest_setup_tests_device();
+	litest_setup_tests_gestures();
 
 	if (mode == LITEST_MODE_LIST) {
 		litest_list_tests(&all_tests);
diff --git a/test/litest.h b/test/litest.h
index bf50e8c..2ada8f6 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -35,6 +35,23 @@
 #include <libinput.h>
 #include <math.h>
 
+extern void litest_setup_tests_udev(void);
+extern void litest_setup_tests_path(void);
+extern void litest_setup_tests_pointer(void);
+extern void litest_setup_tests_touch(void);
+extern void litest_setup_tests_log(void);
+extern void litest_setup_tests_tablet(void);
+extern void litest_setup_tests_pad(void);
+extern void litest_setup_tests_touchpad(void);
+extern void litest_setup_tests_touchpad_tap(void);
+extern void litest_setup_tests_touchpad_buttons(void);
+extern void litest_setup_tests_trackpoint(void);
+extern void litest_setup_tests_trackball(void);
+extern void litest_setup_tests_misc(void);
+extern void litest_setup_tests_keyboard(void);
+extern void litest_setup_tests_device(void);
+extern void litest_setup_tests_gestures(void);
+
 void
 litest_fail_condition(const char *file,
 		      int line,
@@ -334,9 +351,6 @@ _litest_add_ranged_no_device(const char *name,
 			     void *func,
 			     const struct range *range);
 
-extern void
-litest_setup_tests(void);
-
 struct litest_device *
 litest_create_device(enum litest_device_type which);
 
diff --git a/test/log.c b/test/log.c
index 908af7e..9dca152 100644
--- a/test/log.c
+++ b/test/log.c
@@ -141,7 +141,7 @@ START_TEST(log_priority)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_log(void)
 {
 	litest_add_no_device("log:defaults", log_default_priority);
 	litest_add_no_device("log:logging", log_handler_invoked);
diff --git a/test/misc.c b/test/misc.c
index dec4ee4..791ebc3 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -935,7 +935,7 @@ START_TEST(library_version)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_misc(void)
 {
 	litest_add_no_device("events:conversion", event_conversion_device_notify);
 	litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE);
diff --git a/test/pad.c b/test/pad.c
index 67caa71..e2651e6 100644
--- a/test/pad.c
+++ b/test/pad.c
@@ -632,7 +632,7 @@ START_TEST(pad_mode_group_has_no_toggle)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_pad(void)
 {
 	litest_add("pad:cap", pad_cap, LITEST_TABLET_PAD, LITEST_ANY);
 	litest_add("pad:cap", pad_no_cap, LITEST_ANY, LITEST_TABLET_PAD);
diff --git a/test/path.c b/test/path.c
index 21b5fa0..221c175 100644
--- a/test/path.c
+++ b/test/path.c
@@ -938,7 +938,7 @@ START_TEST(path_seat_recycle)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_path(void)
 {
 	litest_add_no_device("path:create", path_create_NULL);
 	litest_add_no_device("path:create", path_create_invalid);
diff --git a/test/pointer.c b/test/pointer.c
index f8651a7..ac67ab9 100644
--- a/test/pointer.c
+++ b/test/pointer.c
@@ -1723,7 +1723,7 @@ START_TEST(pointer_time_usec)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_pointer(void)
 {
 	struct range axis_range = {ABS_X, ABS_Y + 1};
 	struct range compass = {0, 7}; /* cardinal directions */
diff --git a/test/tablet.c b/test/tablet.c
index 04eb307..b91d5cb 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -3676,7 +3676,7 @@ START_TEST(relative_calibration)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_tablet(void)
 {
 	litest_add("tablet:tool", tool_ref, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
 	litest_add_no_device("tablet:tool", tool_capabilities);
diff --git a/test/touch.c b/test/touch.c
index cc1cfb2..ac2f29f 100644
--- a/test/touch.c
+++ b/test/touch.c
@@ -720,7 +720,7 @@ START_TEST(touch_fuzz)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_touch(void)
 {
 	struct range axes = { ABS_X, ABS_Y + 1};
 
diff --git a/test/touchpad-buttons.c b/test/touchpad-buttons.c
index d72278b..2beb637 100644
--- a/test/touchpad-buttons.c
+++ b/test/touchpad-buttons.c
@@ -1805,7 +1805,7 @@ START_TEST(clickpad_middleemulation_click_disable_while_down)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_touchpad_buttons(void)
 {
 	litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
 	litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY);
diff --git a/test/touchpad-tap.c b/test/touchpad-tap.c
index 8383aa9..d09189f 100644
--- a/test/touchpad-tap.c
+++ b/test/touchpad-tap.c
@@ -1959,7 +1959,7 @@ START_TEST(touchpad_drag_lock_default_unavailable)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_touchpad_tap(void)
 {
 	struct range multitap_range = {3, 8};
 
diff --git a/test/touchpad.c b/test/touchpad.c
index 57e4712..fe685c1 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -4136,7 +4136,7 @@ START_TEST(touchpad_jump_finger_motion)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_touchpad(void)
 {
 	struct range axis_range = {ABS_X, ABS_Y + 1};
 
diff --git a/test/trackball.c b/test/trackball.c
index d3238cf..28639ad 100644
--- a/test/trackball.c
+++ b/test/trackball.c
@@ -260,7 +260,7 @@ START_TEST(trackball_rotation_accel)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_trackball(void)
 {
 	litest_add("trackball:rotation", trackball_rotation_config_defaults, LITEST_TRACKBALL, LITEST_ANY);
 	litest_add("trackball:rotation", trackball_rotation_config_invalid_range, LITEST_TRACKBALL, LITEST_ANY);
diff --git a/test/trackpoint.c b/test/trackpoint.c
index 4098f6f..a9d01c4 100644
--- a/test/trackpoint.c
+++ b/test/trackpoint.c
@@ -281,7 +281,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_trackpoint(void)
 {
 	litest_add("trackpoint:middlebutton", trackpoint_middlebutton, LITEST_POINTINGSTICK, LITEST_ANY);
 	litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY);
diff --git a/test/udev.c b/test/udev.c
index 7c294c5..5a74436 100644
--- a/test/udev.c
+++ b/test/udev.c
@@ -507,7 +507,7 @@ START_TEST(udev_seat_recycle)
 END_TEST
 
 void
-litest_setup_tests(void)
+litest_setup_tests_udev(void)
 {
 	litest_add_no_device("udev:create", udev_create_NULL);
 	litest_add_no_device("udev:create", udev_create_seat0);
-- 
2.7.4



More information about the wayland-devel mailing list