[PATCH libinput 1/8] test/path: Avoid creating ignored test devices

Jonas Ådahl jadahl at gmail.com
Wed Jul 16 13:39:06 PDT 2014


Some tests doesn't use or doesn't need to use the test device
automatically created when adding a test case for certain types of
devices. For these tests, to shorten test run time, don't create the
test devices that would be ignored.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 test/path.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/test/path.c b/test/path.c
index 99b474e..9cc5b04 100644
--- a/test/path.c
+++ b/test/path.c
@@ -244,12 +244,11 @@ END_TEST
 
 START_TEST(path_add_invalid_path)
 {
-	struct litest_device *dev = litest_current_device();
-	struct libinput *li = dev->libinput;
+	struct libinput *li;
 	struct libinput_event *event;
 	struct libinput_device *device;
 
-	litest_drain_events(li);
+	li = litest_create_context();
 
 	device = libinput_path_add_device(li, "/tmp/");
 	ck_assert(device == NULL);
@@ -258,6 +257,8 @@ START_TEST(path_add_invalid_path)
 
 	while ((event = libinput_get_event(li)))
 		ck_abort();
+
+	libinput_unref(li);
 }
 END_TEST
 
@@ -798,24 +799,23 @@ END_TEST
 
 int main (int argc, char **argv) {
 
-	litest_add("path:create", path_create_NULL, LITEST_ANY, LITEST_ANY);
-	litest_add("path:create", path_create_invalid, LITEST_ANY, LITEST_ANY);
-	litest_add("path:create", path_create_destroy, LITEST_ANY, LITEST_ANY);
-	litest_add("path:suspend", path_suspend, LITEST_ANY, LITEST_ANY);
-	litest_add("path:suspend", path_double_suspend, LITEST_ANY, LITEST_ANY);
-	litest_add("path:suspend", path_double_resume, LITEST_ANY, LITEST_ANY);
-	litest_add("path:suspend", path_add_device_suspend_resume, LITEST_ANY, LITEST_ANY);
-	litest_add("path:suspend", path_add_device_suspend_resume_fail, LITEST_ANY, LITEST_ANY);
-	litest_add("path:suspend", path_add_device_suspend_resume_remove_device, LITEST_ANY, LITEST_ANY);
+	litest_add_no_device("path:create", path_create_NULL);
+	litest_add_no_device("path:create", path_create_invalid);
+	litest_add_no_device("path:create", path_create_destroy);
+	litest_add_no_device("path:suspend", path_suspend);
+	litest_add_no_device("path:suspend", path_double_suspend);
+	litest_add_no_device("path:suspend", path_double_resume);
+	litest_add_no_device("path:suspend", path_add_device_suspend_resume);
+	litest_add_no_device("path:suspend", path_add_device_suspend_resume_fail);
+	litest_add_no_device("path:suspend", path_add_device_suspend_resume_remove_device);
 	litest_add("path:seat events", path_added_seat, LITEST_ANY, LITEST_ANY);
 	litest_add("path:device events", path_added_device, LITEST_ANY, LITEST_ANY);
 	litest_add("path:device events", path_device_sysname, LITEST_ANY, LITEST_ANY);
 	litest_add("path:device events", path_add_device, LITEST_ANY, LITEST_ANY);
-	litest_add("path:device events", path_add_invalid_path, LITEST_ANY, LITEST_ANY);
+	litest_add_no_device("path:device events", path_add_invalid_path);
 	litest_add("path:device events", path_remove_device, LITEST_ANY, LITEST_ANY);
 	litest_add("path:device events", path_double_remove_device, LITEST_ANY, LITEST_ANY);
-	litest_add("path:seat", path_seat_recycle,
-		   LITEST_DISABLE_DEVICE, LITEST_DISABLE_DEVICE);
+	litest_add_no_device("path:seat", path_seat_recycle);
 
 	return litest_run(argc, argv);
 }
-- 
1.8.5.1



More information about the wayland-devel mailing list