Commit ea115e3c authored by Peter Hutterer's avatar Peter Hutterer

Merge branch 'wip/litest-use-sections-for-tests-v2'

parents 23a611ea ad5df72d
......@@ -633,17 +633,16 @@ if get_option('tests')
def_no_main,
def_disable_backtrace
]
test_litest_selftest_sources = [
test_litest_selftest_sources = lib_litest_sources + [
'test/litest-selftest.c',
'test/litest.c',
'test/litest-int.h',
'test/litest.h'
]
deps_litest_selftest = [dep_litest]
test_litest_selftest = executable('test-litest-selftest',
test_litest_selftest_sources,
include_directories : [includes_src, includes_include],
dependencies : deps_litest_selftest,
dependencies : deps_litest,
c_args : defs_litest_selftest,
install : false)
test('test-litest-selftest', test_litest_selftest)
......@@ -653,7 +652,7 @@ if get_option('tests')
test_symbols_leak,
args : [ meson.current_source_dir() ])
libinput_test_runner_sources = [
libinput_test_runner_sources = lib_litest_sources + [
'src/libinput-util.h',
'src/libinput-util.c',
'test/test-udev.c',
......@@ -678,7 +677,7 @@ if get_option('tests')
libinput_test_runner = executable('libinput-test-suite-runner',
libinput_test_runner_sources,
include_directories : [includes_src, includes_include],
dependencies : dep_litest,
dependencies : deps_litest,
c_args : [ def_LT_VERSION ],
install : false)
test('libinput-test-suite-runner',
......
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_keyboard_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ACER_HAWAII_KEYBOARD);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x4f2,
......@@ -194,15 +188,13 @@ static int events[] = {
-1, -1,
};
struct litest_test_device litest_acer_hawaii_keyboard_device = {
TEST_DEVICE("hawaii-keyboard",
.type = LITEST_ACER_HAWAII_KEYBOARD,
.features = LITEST_KEYS,
.shortname = "hawaii-keyboard",
.setup = litest_keyboard_setup,
.interface = NULL,
.name = "Chicony ACER Hawaii Keyboard",
.id = &input_id,
.events = events,
.absinfo = NULL,
};
)
......@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_touchpad_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ACER_HAWAII_TOUCHPAD);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -98,11 +91,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"touchpad_end\"";
struct litest_test_device litest_acer_hawaii_touchpad_device = {
TEST_DEVICE("hawaii-touchpad",
.type = LITEST_ACER_HAWAII_TOUCHPAD,
.features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
.shortname = "hawaii-touchpad",
.setup = litest_touchpad_setup,
.interface = &interface,
.name = "Chicony ACER Hawaii Keyboard Touchpad",
......@@ -110,4 +101,4 @@ struct litest_test_device litest_acer_hawaii_touchpad_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
)
......@@ -30,13 +30,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_alps_dualpoint_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ALPS_DUALPOINT);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -120,11 +113,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"touchpad_end\"";
struct litest_test_device litest_alps_dualpoint_device = {
TEST_DEVICE("alps-dualpoint",
.type = LITEST_ALPS_DUALPOINT,
.features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SEMI_MT,
.shortname = "alps dualpoint",
.setup = litest_alps_dualpoint_setup,
.interface = &interface,
.name = "AlpsPS/2 ALPS DualPoint TouchPad",
......@@ -132,4 +123,4 @@ struct litest_test_device litest_alps_dualpoint_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
)
......@@ -30,13 +30,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_alps_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ALPS_SEMI_MT);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -110,15 +103,13 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 }
};
struct litest_test_device litest_alps_device = {
TEST_DEVICE("alps-semi-mt",
.type = LITEST_ALPS_SEMI_MT,
.features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SEMI_MT,
.shortname = "alps semi-mt",
.setup = litest_alps_setup,
.interface = &interface,
.name = "AlpsPS/2 ALPS GlidePoint",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
)
......@@ -30,12 +30,6 @@
* This is the keyboard device for this mouse.
*/
static void litest_anker_mouse_kbd_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ANKER_MOUSE_KBD);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x4d9,
......@@ -209,15 +203,13 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 },
};
struct litest_test_device litest_anker_mouse_kbd_device = {
TEST_DEVICE("anker-kbd",
.type = LITEST_ANKER_MOUSE_KBD,
.features = LITEST_KEYS | LITEST_WHEEL,
.shortname = "anker_kbd",
.setup = litest_anker_mouse_kbd_setup,
.interface = NULL,
.name = "USB Laser Game Mouse",
.id = &input_id,
.absinfo = absinfo,
.events = events,
};
)
......@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_appletouch_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_APPLETOUCH);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -100,11 +93,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"touchpad_end\"";
struct litest_test_device litest_appletouch_device = {
TEST_DEVICE("appletouch",
.type = LITEST_APPLETOUCH,
.features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SINGLE_TOUCH,
.shortname = "appletouch",
.setup = litest_appletouch_setup,
.interface = &interface,
.name = "appletouch",
......@@ -112,4 +103,4 @@ struct litest_test_device litest_appletouch_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
)
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_apple_keyboard_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_APPLE_KEYBOARD);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x5ac,
......@@ -223,15 +217,13 @@ static int events[] = {
-1, -1
};
struct litest_test_device litest_apple_keyboard_device = {
TEST_DEVICE("apple-keyboard",
.type = LITEST_APPLE_KEYBOARD,
.features = LITEST_KEYS,
.shortname = "apple_keyboard",
.setup = litest_apple_keyboard_setup,
.interface = NULL,
.name = "Apple Inc. Apple Internal Keyboard / Trackpad",
.id = &input_id,
.events = events,
.absinfo = NULL,
};
)
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_magicmouse_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_MAGICMOUSE);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
......@@ -106,11 +100,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"mouse_end\"";
struct litest_test_device litest_magicmouse_device = {
TEST_DEVICE("litest-magicmouse-device",
.type = LITEST_MAGICMOUSE,
.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
.shortname = "magicmouse",
.setup = litest_magicmouse_setup,
.interface = &interface,
.name = "Apple Magic Mouse",
......@@ -118,4 +110,4 @@ struct litest_test_device litest_magicmouse_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
)
......@@ -29,12 +29,6 @@
/* Note: this is the second event node of this mouse only, the first event
* node is just a normal mouse */
static void litest_mouse_gladius_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_MOUSE_GLADIUS);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x0b05,
......@@ -318,15 +312,13 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 }
};
struct litest_test_device litest_mouse_gladius_device = {
TEST_DEVICE("mouse-gladius",
.type = LITEST_MOUSE_GLADIUS,
.features = LITEST_RELATIVE | LITEST_WHEEL | LITEST_KEYS,
.shortname = "mouse_gladius",
.setup = litest_mouse_gladius_setup,
.interface = NULL,
.name = "ASUS ROG GLADIUS",
.id = &input_id,
.absinfo = absinfo,
.events = events,
};
)
......@@ -30,13 +30,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_atmel_hover_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ATMEL_HOVER);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -128,15 +121,13 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 }
};
struct litest_test_device litest_atmel_hover_device = {
TEST_DEVICE("atmel-hover",
.type = LITEST_ATMEL_HOVER,
.features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_CLICKPAD | LITEST_HOVER,
.shortname = "atmel hover",
.setup = litest_atmel_hover_setup,
.interface = &interface,
.name = "Atmel maXTouch Touchpad",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
)
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_bcm5974_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_BCM5974);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -121,16 +115,14 @@ static int events[] = {
-1, -1
};
struct litest_test_device litest_bcm5974_device = {
TEST_DEVICE("bcm5974",
.type = LITEST_BCM5974,
.features = LITEST_TOUCHPAD | LITEST_CLICKPAD |
LITEST_BUTTON | LITEST_APPLE_CLICKPAD,
.shortname = "bcm5974",
.setup = litest_bcm5974_setup,
.interface = &interface,
.name = "bcm5974",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
)
......@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_calibrated_touchscreen_setup(void)
{
struct litest_device *d =
litest_create_device(LITEST_CALIBRATED_TOUCHSCREEN);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
......@@ -87,11 +80,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"calibrated_touchscreen_end\"";
struct litest_test_device litest_calibrated_touchscreen_device = {
TEST_DEVICE("calibrated-touchscreen",
.type = LITEST_CALIBRATED_TOUCHSCREEN,
.features = LITEST_TOUCH,
.shortname = "calibrated-touchscreen",
.setup = litest_calibrated_touchscreen_setup,
.interface = &interface,
.name = "Calibrated Touchscreen",
......@@ -99,4 +90,4 @@ struct litest_test_device litest_calibrated_touchscreen_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
)
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_cyborg_rat_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_CYBORG_RAT);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x6a3,
......@@ -55,15 +49,13 @@ static int events[] = {
-1 , -1,
};
struct litest_test_device litest_cyborg_rat_device = {
TEST_DEVICE("cyborg-rat",
.type = LITEST_CYBORG_RAT,
.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
.shortname = "cyborg_rat",
.setup = litest_cyborg_rat_setup,
.interface = NULL,
.name = "Saitek Cyborg R.A.T.5 Mouse",
.id = &input_id,
.absinfo = NULL,
.events = events,
};
)
......@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_elantech_touchpad_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_ELANTECH_TOUCHPAD);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -105,15 +98,13 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 }
};
struct litest_test_device litest_elantech_touchpad_device = {
TEST_DEVICE("elantech",
.type = LITEST_ELANTECH_TOUCHPAD,
.features = LITEST_TOUCHPAD | LITEST_BUTTON,
.shortname = "elantech",
.setup = litest_elantech_touchpad_setup,
.interface = &interface,
.name = "ETPS/2 Elantech Touchpad",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
)
......@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_generic_singletouch_touch_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_GENERIC_SINGLETOUCH);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -72,15 +65,13 @@ static int events[] = {
-1, -1,
};
struct litest_test_device litest_generic_singletouch_device = {
TEST_DEVICE("generic-singletouch",
.type = LITEST_GENERIC_SINGLETOUCH,
.features = LITEST_SINGLE_TOUCH,
.shortname = "generic-singletouch",
.setup = litest_generic_singletouch_touch_setup,
.interface = &interface,
.name = "generic_singletouch",
.id = &input_id,
.events = events,
.absinfo = absinfo,
};
)
......@@ -26,13 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void
litest_gpio_keys_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_GPIO_KEYS);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x19,
.vendor = 0x1,
......@@ -59,11 +52,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"switch_end\"";
struct litest_test_device litest_gpio_keys_device = {
TEST_DEVICE("gpio-keys",
.type = LITEST_GPIO_KEYS,
.features = LITEST_SWITCH,
.shortname = "gpio keys",
.setup = litest_gpio_keys_setup,
.interface = NULL,
.name = "gpio-keys",
......@@ -72,4 +63,4 @@ struct litest_test_device litest_gpio_keys_device = {
.absinfo = NULL,
.udev_rule = udev_rule,
};
)
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_huion_tablet_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_HUION_TABLET);
litest_set_current_device(d);
}
static struct input_event proximity_in[] = {
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
......@@ -104,11 +98,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"huion_end\"";
struct litest_test_device litest_huion_tablet_device = {
TEST_DEVICE("huion-tablet",
.type = LITEST_HUION_TABLET,
.features = LITEST_TABLET,
.shortname = "huion-tablet",
.setup = litest_huion_tablet_setup,
.interface = &interface,
.name = "HUION PenTablet Pen",
......@@ -116,4 +108,4 @@ struct litest_test_device litest_huion_tablet_device = {
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
)
......@@ -26,12 +26,6 @@
#include "litest.h"
#include "litest-int.h"
static void litest_mouse_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_IGNORED_MOUSE);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x17ef,
......@@ -58,11 +52,9 @@ static const char udev_rule[] =
"\n"
"LABEL=\"mouse_end\"";
struct litest_test_device litest_ignored_mouse_device = {
TEST_DEVICE("ignored-mouse",
.type = LITEST_IGNORED_MOUSE,
.features = LITEST_IGNORED | LITEST_BUTTON | LITEST_RELATIVE,
.shortname = "ignored-mouse",
.setup = litest_mouse_setup,
.interface = NULL,
.name = "Ignored Mouse",
......@@ -70,4 +62,4 @@ struct litest_test_device litest_ignored_mouse_device = {
.absinfo = NULL,
.events = events,
.udev_rule = udev_rule,
};
)
......@@ -26,13 +26,9 @@
#include "litest.h"
#include "litest-int.h"
static void all_codes_create(struct litest_device *d);
#define NAME "All event codes keyboard"
static void litest_keyboard_all_codes_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_KEYBOARD_ALL_CODES);
litest_set_current_device(d);
}
static void all_codes_create(struct litest_device *d);
static struct input_id input_id = {
.bustype = 0x11,
......@@ -40,19 +36,17 @@ static struct input_id input_id = {
.product = 0x1,
};
struct litest_test_device litest_keyboard_all_codes_device = {
TEST_DEVICE("keyboard-all-codes",
.type = LITEST_KEYBOARD_ALL_CODES,
.features = LITEST_KEYS,
.shortname = "keyboard all event codes",
.setup = litest_keyboard_all_codes_setup,
.interface = NULL,
.create = all_codes_create,
.name = "All event codes keyboard",
.name = NAME,
.id = &input_id,
.events = NULL,
.absinfo = NULL,
};
)
static void
all_codes_create(struct litest_device *d)
......@@ -72,8 +66,8 @@ all_codes_create(struct litest_device *d)
events[idx++] = -1;
events[idx++] = -1;
d->uinput = litest_create_uinput_device_from_description(litest_keyboard_all_codes_device.name,
litest_keyboard_all_codes_device.id,
d->uinput = litest_create_uinput_device_from_description(NAME,
&input_id,
NULL,
events);
}
......@@ -32,12 +32,6 @@
* file.
*/
static void litest_blackwidow_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_KEYBOARD_BLACKWIDOW);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x1532,
......@@ -335,15 +329,13 @@ static struct input_absinfo absinfo[] = {
{ .value = -1 },
};
struct litest_test_device litest_keyboard_blackwidow_device = {
TEST_DEVICE("blackwidow",
.type = LITEST_KEYBOARD_BLACKWIDOW,
.features = LITEST_KEYS | LITEST_WHEEL,
.shortname = "blackwidow",
.setup = litest_blackwidow_setup,
.interface = NULL,
.name = "Razer Razer BlackWidow 2013",
.id = &input_id,
.absinfo = absinfo,
.events = events,
};
)
......@@ -29,13 +29,6 @@
/* Recording from https://bugs.freedesktop.org/show_bug.cgi?id=102039
* This is the 'video switch' of 2 devices exported by this keyboard.
*/
static void litest_blade_stealth_setup(void)
{
struct litest_device *d;
d = litest_create_device(LITEST_KEYBOARD_BLADE_STEALTH_VIDEOSWITCH);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x3,
......@@ -214,14 +207,12 @@ static int events[] = {
-1 , -1,
};