[PATCH libinput 2/5] test: if no teardown func is set, use the default

Peter Hutterer peter.hutterer at who-t.net
Mon Mar 31 20:47:06 PDT 2014


Reduces the amount of boilerplate code.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest-bcm5974.c               | 2 +-
 test/litest-generic-highres-touch.c | 2 +-
 test/litest-keyboard.c              | 2 +-
 test/litest-mouse.c                 | 2 +-
 test/litest-synaptics-st.c          | 2 +-
 test/litest-trackpoint.c            | 2 +-
 test/litest-wacom-touch.c           | 2 +-
 test/litest.c                       | 3 ++-
 8 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/litest-bcm5974.c b/test/litest-bcm5974.c
index 6b7a22b..ff822f9 100644
--- a/test/litest-bcm5974.c
+++ b/test/litest-bcm5974.c
@@ -131,6 +131,6 @@ struct litest_test_device litest_bcm5974_device = {
 	.features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
 	.shortname = "bcm5974",
 	.setup = litest_bcm5974_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_bcm5974,
 };
diff --git a/test/litest-generic-highres-touch.c b/test/litest-generic-highres-touch.c
index bb226d6..4d21b0d 100644
--- a/test/litest-generic-highres-touch.c
+++ b/test/litest-generic-highres-touch.c
@@ -123,6 +123,6 @@ struct litest_test_device litest_generic_highres_touch_device = {
 	.features = LITEST_TOUCH,
 	.shortname = "generic-highres-touch",
 	.setup = litest_generic_highres_touch_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_generic_highres_touch,
 };
diff --git a/test/litest-keyboard.c b/test/litest-keyboard.c
index dd91158..ab05014 100644
--- a/test/litest-keyboard.c
+++ b/test/litest-keyboard.c
@@ -109,6 +109,6 @@ struct litest_test_device litest_keyboard_device = {
 	.features = LITEST_KEYS,
 	.shortname = "default keyboard",
 	.setup = litest_keyboard_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_keyboard,
 };
diff --git a/test/litest-mouse.c b/test/litest-mouse.c
index 2fde095..2f70767 100644
--- a/test/litest-mouse.c
+++ b/test/litest-mouse.c
@@ -70,6 +70,6 @@ struct litest_test_device litest_mouse_device = {
 	.features = LITEST_POINTER | LITEST_BUTTON | LITEST_WHEEL,
 	.shortname = "mouse",
 	.setup = litest_mouse_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_mouse,
 };
diff --git a/test/litest-synaptics-st.c b/test/litest-synaptics-st.c
index d13d9a2..de56c22 100644
--- a/test/litest-synaptics-st.c
+++ b/test/litest-synaptics-st.c
@@ -126,6 +126,6 @@ struct litest_test_device litest_synaptics_touchpad_device = {
 	.features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SINGLE_TOUCH,
 	.shortname = "synaptics ST",
 	.setup = litest_synaptics_touchpad_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_synaptics_touchpad,
 };
diff --git a/test/litest-trackpoint.c b/test/litest-trackpoint.c
index e0b79c5..1c0fb0a 100644
--- a/test/litest-trackpoint.c
+++ b/test/litest-trackpoint.c
@@ -61,6 +61,6 @@ struct litest_test_device litest_trackpoint_device = {
 	.features = LITEST_POINTER | LITEST_BUTTON,
 	.shortname = "trackpoint",
 	.setup = litest_trackpoint_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_trackpoint,
 };
diff --git a/test/litest-wacom-touch.c b/test/litest-wacom-touch.c
index 01a5a5d..e9119a9 100644
--- a/test/litest-wacom-touch.c
+++ b/test/litest-wacom-touch.c
@@ -122,6 +122,6 @@ struct litest_test_device litest_wacom_touch_device = {
 	.features = LITEST_TOUCH,
 	.shortname = "wacom-touch",
 	.setup = litest_wacom_touch_setup,
-	.teardown = litest_generic_device_teardown,
+	.teardown = NULL,
 	.create = litest_create_wacom_touch,
 };
diff --git a/test/litest.c b/test/litest.c
index f7fe24e..6767952 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -119,7 +119,8 @@ litest_add_tcase_for_device(struct suite *suite,
 	t->name = strdup(test_name);
 	t->tc = tcase_create(test_name);
 	list_insert(&suite->tests, &t->node);
-	tcase_add_checked_fixture(t->tc, dev->setup, dev->teardown);
+	tcase_add_checked_fixture(t->tc, dev->setup,
+				  dev->teardown ? dev->teardown : litest_generic_device_teardown);
 	tcase_add_test(t->tc, func);
 	suite_add_tcase(suite->suite, t->tc);
 }
-- 
1.9.0



More information about the wayland-devel mailing list