mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-30 22:20:07 +01:00
test: move all the _setup() functions into a special section
This way we can loop through them instead of having to add them manually. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
3f5ff113a8
commit
ce80e40006
19 changed files with 48 additions and 51 deletions
|
|
@ -3700,6 +3700,21 @@ litest_init_test_devices(void)
|
|||
}
|
||||
}
|
||||
|
||||
extern const struct test_collection __start_test_collection_section,
|
||||
__stop_test_collection_section;
|
||||
|
||||
static void
|
||||
setup_tests(void)
|
||||
{
|
||||
const struct test_collection *c;
|
||||
|
||||
for (c = &__start_test_collection_section;
|
||||
c < &__stop_test_collection_section;
|
||||
c++) {
|
||||
c->setup();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
|
@ -3735,23 +3750,7 @@ main(int argc, char **argv)
|
|||
if (mode == LITEST_MODE_ERROR)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
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();
|
||||
litest_setup_tests_lid();
|
||||
setup_tests();
|
||||
|
||||
if (mode == LITEST_MODE_LIST) {
|
||||
litest_list_tests(&all_tests);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,20 @@ struct test_device {
|
|||
__VA_ARGS__ \
|
||||
};
|
||||
|
||||
struct test_collection {
|
||||
const char *name;
|
||||
void (*setup)(void);
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#define TEST_COLLECTION(name) \
|
||||
static void (name##_setup)(void); \
|
||||
static const struct test_collection _test_collection \
|
||||
__attribute__ ((used)) \
|
||||
__attribute__ ((section ("test_collection_section"))) = { \
|
||||
#name, name##_setup \
|
||||
}; \
|
||||
static void (name##_setup)(void)
|
||||
|
||||
extern void litest_setup_tests_udev(void);
|
||||
extern void litest_setup_tests_path(void);
|
||||
extern void litest_setup_tests_pointer(void);
|
||||
|
|
|
|||
|
|
@ -1577,8 +1577,7 @@ START_TEST(device_seat_phys_name)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_device(void)
|
||||
TEST_COLLECTION(device)
|
||||
{
|
||||
struct range abs_range = { 0, ABS_MISC };
|
||||
struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
|
||||
|
|
|
|||
|
|
@ -1057,8 +1057,7 @@ START_TEST(gestures_3fg_buttonarea_scroll_btntool)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_gestures(void)
|
||||
TEST_COLLECTION(gestures)
|
||||
{
|
||||
/* N, NE, ... */
|
||||
struct range cardinals = { 0, 8 };
|
||||
|
|
|
|||
|
|
@ -476,8 +476,7 @@ START_TEST(keyboard_no_scroll)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_keyboard(void)
|
||||
TEST_COLLECTION(keyboard)
|
||||
{
|
||||
litest_add_no_device("keyboard:seat key count", keyboard_seat_key_count);
|
||||
litest_add_no_device("keyboard:key counting", keyboard_ignore_no_pressed_release);
|
||||
|
|
|
|||
|
|
@ -200,8 +200,7 @@ START_TEST(log_axisrange_warning)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_log(void)
|
||||
TEST_COLLECTION(log)
|
||||
{
|
||||
struct range axes = { ABS_X, ABS_Y + 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -1492,8 +1492,7 @@ START_TEST(timer_flush)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_misc(void)
|
||||
TEST_COLLECTION(misc)
|
||||
{
|
||||
litest_add_no_device("events:conversion", event_conversion_device_notify);
|
||||
litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE);
|
||||
|
|
|
|||
|
|
@ -917,8 +917,7 @@ START_TEST(pad_mode_group_has_no_toggle)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_pad(void)
|
||||
TEST_COLLECTION(tablet_pad)
|
||||
{
|
||||
litest_add("pad:cap", pad_cap, LITEST_TABLET_PAD, LITEST_ANY);
|
||||
litest_add("pad:cap", pad_no_cap, LITEST_ANY, LITEST_TABLET_PAD);
|
||||
|
|
|
|||
|
|
@ -981,8 +981,7 @@ START_TEST(path_ignore_device)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_path(void)
|
||||
TEST_COLLECTION(path)
|
||||
{
|
||||
litest_add_no_device("path:create", path_create_NULL);
|
||||
litest_add_no_device("path:create", path_create_invalid);
|
||||
|
|
|
|||
|
|
@ -2534,8 +2534,7 @@ START_TEST(debounce_spurious_switch_to_otherbutton)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_pointer(void)
|
||||
TEST_COLLECTION(pointer)
|
||||
{
|
||||
struct range axis_range = {ABS_X, ABS_Y + 1};
|
||||
struct range compass = {0, 7}; /* cardinal directions */
|
||||
|
|
|
|||
|
|
@ -1040,8 +1040,8 @@ START_TEST(dock_toggle)
|
|||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
void
|
||||
litest_setup_tests_lid(void)
|
||||
|
||||
TEST_COLLECTION(switch)
|
||||
{
|
||||
struct range switches = { LIBINPUT_SWITCH_LID,
|
||||
LIBINPUT_SWITCH_TABLET_MODE + 1};
|
||||
|
|
|
|||
|
|
@ -4682,8 +4682,7 @@ START_TEST(huion_static_btn_tool_pen_disable_quirk_on_prox_out)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_tablet(void)
|
||||
TEST_COLLECTION(tablet)
|
||||
{
|
||||
struct range with_timeout = { 0, 2 };
|
||||
|
||||
|
|
|
|||
|
|
@ -945,8 +945,7 @@ START_TEST(touch_release_on_unplug)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_touch(void)
|
||||
TEST_COLLECTION(touch)
|
||||
{
|
||||
struct range axes = { ABS_X, ABS_Y + 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -1978,8 +1978,7 @@ START_TEST(clickpad_middleemulation_click_disable_while_down)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_touchpad_buttons(void)
|
||||
TEST_COLLECTION(touchpad_buttons)
|
||||
{
|
||||
litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY);
|
||||
|
|
|
|||
|
|
@ -3383,8 +3383,7 @@ START_TEST(touchpad_tap_palm_dwt_tap)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_touchpad_tap(void)
|
||||
TEST_COLLECTION(touchpad_tap)
|
||||
{
|
||||
struct range multitap_range = {3, 5};
|
||||
struct range tap_map_range = { LIBINPUT_CONFIG_TAP_MAP_LRM,
|
||||
|
|
|
|||
|
|
@ -5758,8 +5758,7 @@ START_TEST(touchpad_speed_ignore_finger_edgescroll)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_touchpad(void)
|
||||
TEST_COLLECTION(touchpad)
|
||||
{
|
||||
struct range axis_range = {ABS_X, ABS_Y + 1};
|
||||
struct range twice = {0, 2 };
|
||||
|
|
|
|||
|
|
@ -259,8 +259,7 @@ START_TEST(trackball_rotation_accel)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_trackball(void)
|
||||
TEST_COLLECTION(trackball)
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -379,8 +379,7 @@ START_TEST(trackpoint_palmdetect_require_min_events)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_trackpoint(void)
|
||||
TEST_COLLECTION(trackpoint)
|
||||
{
|
||||
litest_add("trackpoint:middlebutton", trackpoint_middlebutton, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||
litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||
|
|
|
|||
|
|
@ -646,8 +646,7 @@ START_TEST(udev_ignore_device)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests_udev(void)
|
||||
TEST_COLLECTION(udev)
|
||||
{
|
||||
litest_add_no_device("udev:create", udev_create_NULL);
|
||||
litest_add_no_device("udev:create", udev_create_seat0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue