Commit 9dbeb9d0 authored by Peter Hutterer's avatar Peter Hutterer

test: move main() into litest

This allows us to filter things based on argv before setting up tests, etc.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 015151de
......@@ -946,7 +946,8 @@ START_TEST(device_wheel_only)
}
END_TEST
int main (int argc, char **argv)
void
litest_setup_tests(void)
{
struct range abs_range = { 0, ABS_MISC };
struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
......@@ -987,6 +988,4 @@ int main (int argc, char **argv)
litest_add_no_device("device:invalid devices", abs_mt_device_missing_res);
litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE);
return litest_run(argc, argv);
}
......@@ -310,14 +310,12 @@ START_TEST(keyboard_keys_bad_device)
}
END_TEST
int
main(int argc, char **argv)
void
litest_setup_tests(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);
litest_add_no_device("keyboard:key counting", keyboard_key_auto_release);
litest_add("keyboard:keys", keyboard_has_key, LITEST_KEYS, LITEST_ANY);
litest_add("keyboard:keys", keyboard_keys_bad_device, LITEST_ANY, LITEST_ANY);
return litest_run(argc, argv);
}
......@@ -462,7 +462,7 @@ static const struct option opts[] = {
{ 0, 0, 0, 0}
};
int
static int
litest_run(int argc, char **argv)
{
struct suite *s, *snext;
......@@ -1886,3 +1886,11 @@ litest_semi_mt_touch_up(struct litest_device *d,
litest_event(d, EV_SYN, SYN_REPORT, 0);
}
int
main(int argc, char **argv)
{
litest_setup_tests();
return litest_run(argc, argv);
}
......@@ -130,7 +130,7 @@ void litest_add_ranged_no_device(const char *name,
void *func,
const struct range *range);
int litest_run(int argc, char **argv);
extern void litest_setup_tests(void);
struct litest_device * litest_create_device(enum litest_device_type which);
struct litest_device * litest_add_device(struct libinput *libinput,
enum litest_device_type which);
......
......@@ -139,12 +139,11 @@ START_TEST(log_priority)
}
END_TEST
int main (int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add_no_device("log:defaults", log_default_priority);
litest_add_no_device("log:logging", log_handler_invoked);
litest_add_no_device("log:logging", log_handler_NULL);
litest_add_no_device("log:logging", log_priority);
return litest_run(argc, argv);
}
......@@ -583,7 +583,8 @@ START_TEST(trackpoint_accel_parser)
}
END_TEST
int main (int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add_no_device("events:conversion", event_conversion_device_notify);
litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE);
......@@ -600,6 +601,4 @@ int main (int argc, char **argv)
litest_add_no_device("misc:dpi parser", dpi_parser);
litest_add_no_device("misc:wheel click parser", wheel_click_parser);
litest_add_no_device("misc:trackpoint accel parser", trackpoint_accel_parser);
return litest_run(argc, argv);
}
......@@ -874,8 +874,8 @@ START_TEST(path_seat_recycle)
}
END_TEST
int
main(int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add_no_device("path:create", path_create_NULL);
litest_add_no_device("path:create", path_create_invalid);
......@@ -896,6 +896,4 @@ main(int argc, char **argv)
litest_add_for_device("path:device events", path_remove_device, LITEST_SYNAPTICS_CLICKPAD);
litest_add_for_device("path:device events", path_double_remove_device, LITEST_SYNAPTICS_CLICKPAD);
litest_add_no_device("path:seat", path_seat_recycle);
return litest_run(argc, argv);
}
......@@ -1261,7 +1261,8 @@ START_TEST(middlebutton_default_disabled)
}
END_TEST
int main (int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add("pointer:motion", pointer_motion_relative, LITEST_RELATIVE, LITEST_ANY);
litest_add("pointer:motion", pointer_motion_absolute, LITEST_ABSOLUTE, LITEST_ANY);
......@@ -1299,6 +1300,4 @@ int main (int argc, char **argv)
litest_add("pointer:middlebutton", middlebutton_default_clickpad, LITEST_CLICKPAD, LITEST_ANY);
litest_add("pointer:middlebutton", middlebutton_default_touchpad, LITEST_TOUCHPAD, LITEST_CLICKPAD);
litest_add("pointer:middlebutton", middlebutton_default_disabled, LITEST_ANY, LITEST_BUTTON);
return litest_run(argc, argv);
}
......@@ -582,8 +582,8 @@ START_TEST(touch_protocol_a_2fg_touch)
}
END_TEST
int
main(int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add("touch:frame", touch_frame_events, LITEST_TOUCH, LITEST_ANY);
litest_add_no_device("touch:abs-transform", touch_abs_transform);
......@@ -604,6 +604,4 @@ main(int argc, char **argv)
litest_add("touch:protocol a", touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY);
litest_add("touch:protocol a", touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY);
litest_add("touch:protocol a", touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY);
return litest_run(argc, argv);
}
......@@ -4530,7 +4530,8 @@ START_TEST(touchpad_trackpoint_no_trackpoint)
}
END_TEST
int main(int argc, char **argv)
void
litest_setup_tests(void)
{
struct range multitap_range = {3, 8};
......@@ -4674,6 +4675,4 @@ int main(int argc, char **argv)
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_softbuttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_2fg_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_no_trackpoint, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
return litest_run(argc, argv);
}
......@@ -130,12 +130,11 @@ START_TEST(trackpoint_scroll_source)
}
END_TEST
int main(int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add("trackpoint:middlebutton", trackpoint_middlebutton, LITEST_POINTINGSTICK, LITEST_ANY);
litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY);
litest_add("trackpoint:scroll", trackpoint_scroll, LITEST_POINTINGSTICK, LITEST_ANY);
litest_add("trackpoint:scroll", trackpoint_scroll_source, LITEST_POINTINGSTICK, LITEST_ANY);
return litest_run(argc, argv);
}
......@@ -502,8 +502,8 @@ START_TEST(udev_seat_recycle)
}
END_TEST
int
main(int argc, char **argv)
void
litest_setup_tests(void)
{
litest_add_no_device("udev:create", udev_create_NULL);
litest_add_no_device("udev:create", udev_create_seat0);
......@@ -518,6 +518,4 @@ main(int argc, char **argv)
litest_add_for_device("udev:suspend", udev_suspend_resume, LITEST_SYNAPTICS_CLICKPAD);
litest_add_for_device("udev:device events", udev_device_sysname, LITEST_SYNAPTICS_CLICKPAD);
litest_add_for_device("udev:seat", udev_seat_recycle, LITEST_SYNAPTICS_CLICKPAD);
return litest_run(argc, argv);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment