mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-01 17:30:09 +01:00
Merge branch 'wip/litest-serial-parallel-v3'
This commit is contained in:
commit
96b3489f23
21 changed files with 400 additions and 371 deletions
|
|
@ -194,9 +194,6 @@ if test "x$build_tests" = "xyes"; then
|
|||
AC_DEFINE_UNQUOTED(HAVE_ADDR2LINE, 1, [addr2line found])
|
||||
AC_DEFINE_UNQUOTED(ADDR2LINE, ["$ADDR2LINE"], [Path to addr2line])
|
||||
fi
|
||||
|
||||
AC_DEFINE(LITEST_UDEV_LOCKFILE, ["/tmp/litest-udev.lock"],
|
||||
[Lock file used to restrict udev reloads during tests])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes])
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,15 @@
|
|||
The libinput test suite is based on
|
||||
[Check](http://check.sourceforge.net/doc/check_html/) and runs automatically
|
||||
during `make check`. Check itself is wrapped into a libinput-specific test
|
||||
suite called *litest*. Tests are found in `$srcdir/test/`, the test binaries are
|
||||
prefixed with `test-` and can be run individually.
|
||||
suite called *litest*. Tests are found in `$srcdir/test/`, the main test
|
||||
suite is `libinput-test-suite-runner`.
|
||||
|
||||
The test suite has a make-like job control enabled by the `-j` or `--jobs`
|
||||
flag and will fork off as many parallel processes as given by this flag. The
|
||||
default if unspecified is 8. When debugging a specific test case failure it
|
||||
is recommended to employ test filtures (see @ref test-filtering) and disable
|
||||
parallel tests. The test suite automatically disables parallel make when run
|
||||
in gdb.
|
||||
|
||||
@section test-config X.Org config to avoid interference
|
||||
|
||||
|
|
@ -30,7 +37,7 @@ litest's tests are grouped by test groups and devices. A test group is e.g.
|
|||
Each test function is (usually) run with one or more specific devices.
|
||||
The `--list` commandline argument shows the list of suites and tests.
|
||||
@code
|
||||
$ ./test/test-device --list
|
||||
$ ./test/libinput-test-suite-runner --list
|
||||
device:wheel:
|
||||
wheel only
|
||||
blackwidow
|
||||
|
|
@ -56,7 +63,7 @@ The `--filter-test` argument enables selective running of tests through
|
|||
basic shell-style function name matching. For example:
|
||||
|
||||
@code
|
||||
$ ./test/test-touchpad --filter-test="*1fg_tap*"
|
||||
$ ./test/libinput-test-suite-runner --filter-test="*1fg_tap*"
|
||||
@endcode
|
||||
|
||||
The `--filter-device` argument enables selective running of tests through
|
||||
|
|
@ -64,7 +71,7 @@ basic shell-style device name matching. The device names matched are the
|
|||
litest-specific shortnames, see the output of `--list`. For example:
|
||||
|
||||
@code
|
||||
$ ./test/test-touchpad --filter-device="synaptics*"
|
||||
$ ./test/libinput-test-suite-runner --filter-device="synaptics*"
|
||||
@endcode
|
||||
|
||||
The `--filter-group` argument enables selective running of test groups
|
||||
|
|
@ -72,7 +79,7 @@ through basic shell-style test group matching. The test groups matched are
|
|||
litest-specific test groups, see the output of `--list`. For example:
|
||||
|
||||
@code
|
||||
$ ./test/test-touchpad --filter-group="touchpad:*hover*"
|
||||
$ ./test/libinput-test-suite-runner --filter-group="touchpad:*hover*"
|
||||
@endcode
|
||||
|
||||
The `--filter-device` and `--filter-group` arguments can be combined with
|
||||
|
|
@ -85,7 +92,7 @@ output, see libinput_log_set_priority() for details. The `LITEST_VERBOSE`
|
|||
environment variable, if set, also enables verbose mode.
|
||||
|
||||
@code
|
||||
$ ./test/test-device --verbose
|
||||
$ ./test/libinput-test-suite-runner --verbose
|
||||
$ LITEST_VERBOSE=1 make check
|
||||
@endcode
|
||||
|
||||
|
|
|
|||
106
test/Makefile.am
106
test/Makefile.am
|
|
@ -77,24 +77,8 @@ liblitest_la_LIBADD += $(LIBUNWIND_LIBS) -ldl
|
|||
liblitest_la_CFLAGS += $(LIBUNWIND_CFLAGS)
|
||||
endif
|
||||
|
||||
run_tests = \
|
||||
test-touchpad \
|
||||
test-touchpad-tap \
|
||||
test-touchpad-buttons \
|
||||
test-pad \
|
||||
test-tablet \
|
||||
test-device \
|
||||
test-gestures \
|
||||
test-pointer \
|
||||
test-touch \
|
||||
test-trackball \
|
||||
test-trackpoint \
|
||||
test-udev \
|
||||
test-path \
|
||||
test-log \
|
||||
test-misc \
|
||||
test-keyboard \
|
||||
test-litest-selftest
|
||||
run_tests = libinput-test-suite-runner \
|
||||
test-litest-selftest
|
||||
|
||||
build_tests = \
|
||||
test-build-cxx \
|
||||
|
|
@ -106,72 +90,26 @@ noinst_PROGRAMS = $(build_tests) $(run_tests)
|
|||
noinst_SCRIPTS = symbols-leak-test
|
||||
TESTS = $(run_tests) symbols-leak-test
|
||||
|
||||
.NOTPARALLEL:
|
||||
libinput_test_suite_runner_SOURCES = udev.c \
|
||||
path.c \
|
||||
pointer.c \
|
||||
touch.c \
|
||||
log.c \
|
||||
tablet.c \
|
||||
pad.c \
|
||||
touchpad.c \
|
||||
touchpad-tap.c \
|
||||
touchpad-buttons.c \
|
||||
trackpoint.c \
|
||||
trackball.c \
|
||||
misc.c \
|
||||
keyboard.c \
|
||||
device.c \
|
||||
gestures.c
|
||||
|
||||
test_udev_SOURCES = udev.c
|
||||
test_udev_LDADD = $(TEST_LIBS)
|
||||
test_udev_LDFLAGS = -no-install
|
||||
|
||||
test_path_SOURCES = path.c
|
||||
test_path_LDADD = $(TEST_LIBS)
|
||||
test_path_LDFLAGS = -no-install
|
||||
|
||||
test_pointer_SOURCES = pointer.c
|
||||
test_pointer_LDADD = $(TEST_LIBS)
|
||||
test_pointer_LDFLAGS = -no-install
|
||||
|
||||
test_touch_SOURCES = touch.c
|
||||
test_touch_LDADD = $(TEST_LIBS)
|
||||
test_touch_LDFLAGS = -no-install
|
||||
|
||||
test_log_SOURCES = log.c
|
||||
test_log_LDADD = $(TEST_LIBS)
|
||||
test_log_LDFLAGS = -no-install
|
||||
|
||||
test_tablet_SOURCES = tablet.c
|
||||
test_tablet_LDADD = $(TEST_LIBS)
|
||||
test_tablet_LDFLAGS = -static
|
||||
|
||||
test_pad_SOURCES = pad.c
|
||||
test_pad_LDADD = $(TEST_LIBS)
|
||||
test_pad_LDFLAGS = -static
|
||||
|
||||
test_touchpad_SOURCES = touchpad.c
|
||||
test_touchpad_LDADD = $(TEST_LIBS)
|
||||
test_touchpad_LDFLAGS = -no-install
|
||||
|
||||
test_touchpad_tap_SOURCES = touchpad-tap.c
|
||||
test_touchpad_tap_LDADD = $(TEST_LIBS)
|
||||
test_touchpad_tap_LDFLAGS = -no-install
|
||||
|
||||
test_touchpad_buttons_SOURCES = touchpad-buttons.c
|
||||
test_touchpad_buttons_LDADD = $(TEST_LIBS)
|
||||
test_touchpad_buttons_LDFLAGS = -no-install
|
||||
|
||||
test_trackpoint_SOURCES = trackpoint.c
|
||||
test_trackpoint_LDADD = $(TEST_LIBS)
|
||||
test_trackpoint_LDFLAGS = -no-install
|
||||
|
||||
test_trackball_SOURCES = trackball.c
|
||||
test_trackball_LDADD = $(TEST_LIBS)
|
||||
test_trackball_LDFLAGS = -no-install
|
||||
|
||||
test_misc_SOURCES = misc.c
|
||||
test_misc_CFLAGS= $(AM_CFLAGS) -DLIBINPUT_LT_VERSION="\"$(LIBINPUT_LT_VERSION)\""
|
||||
test_misc_LDADD = $(TEST_LIBS)
|
||||
test_misc_LDFLAGS = -no-install
|
||||
|
||||
test_keyboard_SOURCES = keyboard.c
|
||||
test_keyboard_LDADD = $(TEST_LIBS)
|
||||
test_keyboard_LDFLAGS = -no-install
|
||||
|
||||
test_device_SOURCES = device.c
|
||||
test_device_LDADD = $(TEST_LIBS)
|
||||
test_device_LDFLAGS = -no-install
|
||||
|
||||
test_gestures_SOURCES = gestures.c
|
||||
test_gestures_LDADD = $(TEST_LIBS)
|
||||
test_gestures_LDFLAGS = -no-install
|
||||
libinput_test_suite_runner_CFLAGS = $(AM_CFLAGS) -DLIBINPUT_LT_VERSION="\"$(LIBINPUT_LT_VERSION)\""
|
||||
libinput_test_suite_runner_LDADD = $(TEST_LIBS)
|
||||
libinput_test_suite_runner_LDFLAGS = -no-install
|
||||
|
||||
test_litest_selftest_SOURCES = litest-selftest.c litest.c litest-int.h litest.h
|
||||
test_litest_selftest_CFLAGS = -DLITEST_DISABLE_BACKTRACE_LOGGING -DLITEST_NO_MAIN $(liblitest_la_CFLAGS)
|
||||
|
|
@ -206,7 +144,7 @@ VALGRIND_FLAGS=--leak-check=full \
|
|||
--error-exitcode=3 \
|
||||
--suppressions=$(srcdir)/valgrind.suppressions
|
||||
|
||||
valgrind: all
|
||||
valgrind: check-am
|
||||
$(MAKE) check-TESTS TEST_SUITE_LOG="test-suite-valgrind.log" LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)" CK_FORK=no USING_VALGRIND=yes
|
||||
|
||||
check: valgrind
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ START_TEST(device_reenable_syspath_changed)
|
|||
{
|
||||
struct libinput *li;
|
||||
struct litest_device *litest_device;
|
||||
struct libinput_device *device1, *device2;
|
||||
struct libinput_device *device1;
|
||||
enum libinput_config_status status;
|
||||
struct libinput_event *event;
|
||||
|
||||
|
|
@ -315,12 +315,6 @@ START_TEST(device_reenable_syspath_changed)
|
|||
litest_drain_events(li);
|
||||
|
||||
litest_device = litest_add_device(li, LITEST_MOUSE);
|
||||
device2 = litest_device->libinput_device;
|
||||
/* Note: if the sysname isn't the same, some other device got added
|
||||
* or removed while this test was running. This is unlikely and
|
||||
* would result in a false positive, so let's fail the test here */
|
||||
ck_assert_str_eq(libinput_device_get_sysname(device1),
|
||||
libinput_device_get_sysname(device2));
|
||||
|
||||
status = libinput_device_config_send_events_set_mode(device1,
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
|
||||
|
|
@ -1347,7 +1341,7 @@ START_TEST(device_quirks_apple_magicmouse)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_device(void)
|
||||
{
|
||||
struct range abs_range = { 0, ABS_MISC };
|
||||
struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT };
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ START_TEST(gestures_3fg_buttonarea_scroll_btntool)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_gestures(void)
|
||||
{
|
||||
/* N, NE, ... */
|
||||
struct range cardinals = { 0, 8 };
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ START_TEST(keyboard_no_buttons)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_keyboard(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);
|
||||
|
|
|
|||
495
test/litest.c
495
test/litest.c
|
|
@ -34,6 +34,7 @@
|
|||
#include <fnmatch.h>
|
||||
#include <getopt.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -62,14 +63,23 @@
|
|||
#define UDEV_TEST_DEVICE_RULE_FILE UDEV_RULES_D \
|
||||
"/91-litest-test-device-REMOVEME.rules"
|
||||
|
||||
static int jobs = 8;
|
||||
static int in_debugger = -1;
|
||||
static int verbose = 0;
|
||||
const char *filter_test = NULL;
|
||||
const char *filter_device = NULL;
|
||||
const char *filter_group = NULL;
|
||||
|
||||
static inline void litest_remove_model_quirks(void);
|
||||
static void litest_init_udev_rules(void);
|
||||
struct created_file {
|
||||
struct list link;
|
||||
char *path;
|
||||
};
|
||||
|
||||
struct list created_files_list; /* list of all files to remove at the end of
|
||||
the test run */
|
||||
|
||||
static void litest_init_udev_rules(struct list *created_files_list);
|
||||
static void litest_remove_udev_rules(struct list *created_files_list);
|
||||
|
||||
/* defined for the litest selftest */
|
||||
#ifndef LITEST_DISABLE_BACKTRACE_LOGGING
|
||||
|
|
@ -316,6 +326,7 @@ struct suite {
|
|||
struct list tests;
|
||||
char *name;
|
||||
Suite *suite;
|
||||
bool used;
|
||||
};
|
||||
|
||||
static struct litest_device *current_device;
|
||||
|
|
@ -477,49 +488,6 @@ litest_reload_udev_rules(void)
|
|||
litest_system("udevadm hwdb --update");
|
||||
}
|
||||
|
||||
static int
|
||||
litest_udev_rule_filter(const struct dirent *entry)
|
||||
{
|
||||
return strneq(entry->d_name,
|
||||
UDEV_RULE_PREFIX,
|
||||
strlen(UDEV_RULE_PREFIX));
|
||||
}
|
||||
|
||||
static void
|
||||
litest_drop_udev_rules(void)
|
||||
{
|
||||
int n;
|
||||
int rc;
|
||||
struct dirent **entries;
|
||||
char path[PATH_MAX];
|
||||
|
||||
n = scandir(UDEV_RULES_D,
|
||||
&entries,
|
||||
litest_udev_rule_filter,
|
||||
alphasort);
|
||||
if (n <= 0)
|
||||
return;
|
||||
|
||||
while (n--) {
|
||||
rc = snprintf(path, sizeof(path),
|
||||
"%s/%s",
|
||||
UDEV_RULES_D,
|
||||
entries[n]->d_name);
|
||||
if (rc > 0 &&
|
||||
(size_t)rc == strlen(UDEV_RULES_D) +
|
||||
strlen(entries[n]->d_name) + 1)
|
||||
unlink(path);
|
||||
else
|
||||
fprintf(stderr,
|
||||
"Failed to delete %s. Remaining tests are unreliable\n",
|
||||
entries[n]->d_name);
|
||||
free(entries[n]);
|
||||
}
|
||||
free(entries);
|
||||
|
||||
litest_reload_udev_rules();
|
||||
}
|
||||
|
||||
static void
|
||||
litest_add_tcase_for_device(struct suite *suite,
|
||||
const char *funcname,
|
||||
|
|
@ -549,13 +517,6 @@ 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);
|
||||
/* we can't guarantee that we clean up properly if a test fails, the
|
||||
udev rules used for a previous test may still be in place. Add an
|
||||
unchecked fixture to always clean up all rules before/after a
|
||||
test case completes */
|
||||
tcase_add_unchecked_fixture(t->tc,
|
||||
litest_drop_udev_rules,
|
||||
litest_drop_udev_rules);
|
||||
tcase_add_checked_fixture(t->tc, dev->setup,
|
||||
dev->teardown ? dev->teardown : litest_generic_device_teardown);
|
||||
if (range)
|
||||
|
|
@ -617,6 +578,7 @@ get_suite(const char *name)
|
|||
assert(s != NULL);
|
||||
s->name = strdup(name);
|
||||
s->suite = suite_create(s->name);
|
||||
s->used = false;
|
||||
|
||||
list_init(&s->tests);
|
||||
list_insert(&all_tests, &s->node);
|
||||
|
|
@ -789,35 +751,6 @@ _litest_add_ranged_for_device(const char *name,
|
|||
litest_abort_msg("Invalid test device type");
|
||||
}
|
||||
|
||||
static int
|
||||
is_debugger_attached(void)
|
||||
{
|
||||
int status;
|
||||
int rc;
|
||||
int pid = fork();
|
||||
|
||||
if (pid == -1)
|
||||
return 0;
|
||||
|
||||
if (pid == 0) {
|
||||
int ppid = getppid();
|
||||
if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0) {
|
||||
waitpid(ppid, NULL, 0);
|
||||
ptrace(PTRACE_CONT, NULL, NULL);
|
||||
ptrace(PTRACE_DETACH, ppid, NULL, NULL);
|
||||
rc = 0;
|
||||
} else {
|
||||
rc = 1;
|
||||
}
|
||||
_exit(rc);
|
||||
} else {
|
||||
waitpid(pid, &status, 0);
|
||||
rc = WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
litest_log_handler(struct libinput *libinput,
|
||||
enum libinput_log_priority pri,
|
||||
|
|
@ -842,6 +775,28 @@ litest_log_handler(struct libinput *libinput,
|
|||
litest_abort_msg("libinput bug triggered, aborting.\n");
|
||||
}
|
||||
|
||||
static char *
|
||||
litest_init_device_udev_rules(struct litest_test_device *dev);
|
||||
|
||||
static void
|
||||
litest_init_all_device_udev_rules(struct list *created_files)
|
||||
{
|
||||
struct litest_test_device **dev = devices;
|
||||
|
||||
while (*dev) {
|
||||
char *udev_file;
|
||||
|
||||
udev_file = litest_init_device_udev_rules(*dev);
|
||||
if (udev_file) {
|
||||
struct created_file *file = zalloc(sizeof(*file));
|
||||
litest_assert(file);
|
||||
file->path = udev_file;
|
||||
list_insert(created_files, &file->link);
|
||||
}
|
||||
dev++;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
open_restricted(const char *path, int flags, void *userdata)
|
||||
{
|
||||
|
|
@ -860,42 +815,61 @@ struct libinput_interface interface = {
|
|||
.close_restricted = close_restricted,
|
||||
};
|
||||
|
||||
static inline int
|
||||
litest_run(int argc, char **argv)
|
||||
static void
|
||||
litest_signal(int sig)
|
||||
{
|
||||
struct created_file *f, *tmp;
|
||||
|
||||
list_for_each_safe(f, tmp, &created_files_list, link) {
|
||||
list_remove(&f->link);
|
||||
unlink(f->path);
|
||||
/* in the sighandler, we can't free */
|
||||
}
|
||||
|
||||
if (fork() == 0) {
|
||||
/* child, we can run system() */
|
||||
litest_reload_udev_rules();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_setup_sighandler(int sig)
|
||||
{
|
||||
struct sigaction act, oact;
|
||||
int rc;
|
||||
|
||||
sigemptyset(&act.sa_mask);
|
||||
sigaddset(&act.sa_mask, sig);
|
||||
act.sa_flags = 0;
|
||||
act.sa_handler = litest_signal;
|
||||
rc = sigaction(sig, &act, &oact);
|
||||
litest_assert_int_ne(rc, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
litest_free_test_list(struct list *tests)
|
||||
{
|
||||
struct suite *s, *snext;
|
||||
int failed;
|
||||
SRunner *sr = NULL;
|
||||
|
||||
if (list_empty(&all_tests)) {
|
||||
fprintf(stderr,
|
||||
"Error: filters are too strict, no tests to run.\n");
|
||||
return 1;
|
||||
}
|
||||
/* quirk needed for check: test suites can only get freed by adding
|
||||
* them to a test runner and freeing the runner. Without this,
|
||||
* valgrind complains */
|
||||
list_for_each(s, tests, node) {
|
||||
if (s->used)
|
||||
continue;
|
||||
|
||||
if (in_debugger == -1) {
|
||||
in_debugger = is_debugger_attached();
|
||||
if (in_debugger)
|
||||
setenv("CK_FORK", "no", 0);
|
||||
}
|
||||
|
||||
list_for_each(s, &all_tests, node) {
|
||||
if (!sr)
|
||||
sr = srunner_create(s->suite);
|
||||
else
|
||||
srunner_add_suite(sr, s->suite);
|
||||
}
|
||||
|
||||
if (getenv("LITEST_VERBOSE"))
|
||||
verbose = 1;
|
||||
|
||||
litest_init_udev_rules();
|
||||
|
||||
srunner_run_all(sr, CK_ENV);
|
||||
failed = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
|
||||
list_for_each_safe(s, snext, &all_tests, node) {
|
||||
list_for_each_safe(s, snext, tests, node) {
|
||||
struct test *t, *tnext;
|
||||
|
||||
list_for_each_safe(t, tnext, &s->tests, node) {
|
||||
|
|
@ -908,9 +882,98 @@ litest_run(int argc, char **argv)
|
|||
free(s->name);
|
||||
free(s);
|
||||
}
|
||||
}
|
||||
|
||||
litest_remove_model_quirks();
|
||||
litest_reload_udev_rules();
|
||||
static int
|
||||
litest_run_suite(char *argv0, struct list *tests, int which, int max)
|
||||
{
|
||||
int failed = 0;
|
||||
SRunner *sr = NULL;
|
||||
struct suite *s;
|
||||
int argvlen = strlen(argv0);
|
||||
int count = -1;
|
||||
|
||||
if (max > 1)
|
||||
snprintf(argv0, argvlen, "libinput-test-%-50d", which);
|
||||
|
||||
list_for_each(s, tests, node) {
|
||||
++count;
|
||||
if (max != 1 && (count % max) != which) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sr)
|
||||
sr = srunner_create(s->suite);
|
||||
else
|
||||
srunner_add_suite(sr, s->suite);
|
||||
|
||||
s->used = true;
|
||||
}
|
||||
|
||||
if (!sr)
|
||||
return 0;
|
||||
|
||||
srunner_run_all(sr, CK_ENV);
|
||||
failed = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
return failed;
|
||||
}
|
||||
|
||||
static int
|
||||
litest_fork_subtests(char *argv0, struct list *tests, int max_forks)
|
||||
{
|
||||
int failed = 0;
|
||||
int status;
|
||||
pid_t pid;
|
||||
int f;
|
||||
|
||||
for (f = 0; f < max_forks; f++) {
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
failed = litest_run_suite(argv0, tests, f, max_forks);
|
||||
litest_free_test_list(&all_tests);
|
||||
exit(failed);
|
||||
/* child always exits here */
|
||||
}
|
||||
}
|
||||
|
||||
/* parent process only */
|
||||
while (wait(&status) != -1 && errno != ECHILD) {
|
||||
if (WEXITSTATUS(status) != 0)
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
static inline int
|
||||
litest_run(int argc, char **argv)
|
||||
{
|
||||
int failed = 0;
|
||||
|
||||
list_init(&created_files_list);
|
||||
|
||||
if (list_empty(&all_tests)) {
|
||||
fprintf(stderr,
|
||||
"Error: filters are too strict, no tests to run.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (getenv("LITEST_VERBOSE"))
|
||||
verbose = 1;
|
||||
|
||||
litest_init_udev_rules(&created_files_list);
|
||||
|
||||
litest_setup_sighandler(SIGINT);
|
||||
|
||||
if (jobs == 1)
|
||||
failed = litest_run_suite(argv[0], &all_tests, 1, 1);
|
||||
else
|
||||
failed = litest_fork_subtests(argv[0], &all_tests, jobs);
|
||||
|
||||
litest_free_test_list(&all_tests);
|
||||
|
||||
litest_remove_udev_rules(&created_files_list);
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
|
@ -984,10 +1047,16 @@ merge_events(const int *orig, const int *override)
|
|||
return events;
|
||||
}
|
||||
|
||||
static inline void
|
||||
static inline struct created_file *
|
||||
litest_copy_file(const char *dest, const char *src, const char *header)
|
||||
{
|
||||
int in, out, length;
|
||||
struct created_file *file;
|
||||
|
||||
file = zalloc(sizeof(*file));
|
||||
litest_assert(file);
|
||||
file->path = strdup(dest);
|
||||
litest_assert(file->path);
|
||||
|
||||
out = open(dest, O_CREAT|O_WRONLY, 0644);
|
||||
litest_assert_int_gt(out, -1);
|
||||
|
|
@ -1003,10 +1072,12 @@ litest_copy_file(const char *dest, const char *src, const char *header)
|
|||
litest_assert_int_gt(sendfile(out, in, NULL, 40960), 0);
|
||||
close(out);
|
||||
close(in);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
static inline void
|
||||
litest_install_model_quirks(void)
|
||||
litest_install_model_quirks(struct list *created_files_list)
|
||||
{
|
||||
const char *warning =
|
||||
"#################################################################\n"
|
||||
|
|
@ -1016,27 +1087,26 @@ litest_install_model_quirks(void)
|
|||
"# running, remove this file and update your hwdb: \n"
|
||||
"# sudo udevadm hwdb --update\n"
|
||||
"#################################################################\n\n";
|
||||
litest_copy_file(UDEV_MODEL_QUIRKS_RULE_FILE,
|
||||
LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE,
|
||||
warning);
|
||||
litest_copy_file(UDEV_MODEL_QUIRKS_HWDB_FILE,
|
||||
LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE,
|
||||
warning);
|
||||
litest_copy_file(UDEV_TEST_DEVICE_RULE_FILE,
|
||||
LIBINPUT_TEST_DEVICE_RULES_FILE,
|
||||
warning);
|
||||
}
|
||||
struct created_file *file;
|
||||
|
||||
static inline void
|
||||
litest_remove_model_quirks(void)
|
||||
{
|
||||
unlink(UDEV_MODEL_QUIRKS_RULE_FILE);
|
||||
unlink(UDEV_MODEL_QUIRKS_HWDB_FILE);
|
||||
unlink(UDEV_TEST_DEVICE_RULE_FILE);
|
||||
file = litest_copy_file(UDEV_MODEL_QUIRKS_RULE_FILE,
|
||||
LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE,
|
||||
warning);
|
||||
list_insert(created_files_list, &file->link);
|
||||
|
||||
file = litest_copy_file(UDEV_MODEL_QUIRKS_HWDB_FILE,
|
||||
LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE,
|
||||
warning);
|
||||
list_insert(created_files_list, &file->link);
|
||||
|
||||
file = litest_copy_file(UDEV_TEST_DEVICE_RULE_FILE,
|
||||
LIBINPUT_TEST_DEVICE_RULES_FILE,
|
||||
warning);
|
||||
list_insert(created_files_list, &file->link);
|
||||
}
|
||||
|
||||
static void
|
||||
litest_init_udev_rules(void)
|
||||
litest_init_udev_rules(struct list *created_files)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
@ -1050,7 +1120,23 @@ litest_init_udev_rules(void)
|
|||
ck_abort_msg("Failed to create udev hwdb directory (%s)\n",
|
||||
strerror(errno));
|
||||
|
||||
litest_install_model_quirks();
|
||||
litest_install_model_quirks(created_files);
|
||||
litest_init_all_device_udev_rules(created_files);
|
||||
litest_reload_udev_rules();
|
||||
}
|
||||
|
||||
static void
|
||||
litest_remove_udev_rules(struct list *created_files_list)
|
||||
{
|
||||
struct created_file *f, *tmp;
|
||||
|
||||
list_for_each_safe(f, tmp, created_files_list, link) {
|
||||
list_remove(&f->link);
|
||||
unlink(f->path);
|
||||
free(f->path);
|
||||
free(f);
|
||||
}
|
||||
|
||||
litest_reload_udev_rules();
|
||||
}
|
||||
|
||||
|
|
@ -1079,8 +1165,6 @@ litest_init_device_udev_rules(struct litest_test_device *dev)
|
|||
litest_assert_int_ge(fputs(dev->udev_rule, f), 0);
|
||||
fclose(f);
|
||||
|
||||
litest_reload_udev_rules();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
@ -1097,7 +1181,6 @@ litest_create(enum litest_device_type which,
|
|||
const struct input_id *id;
|
||||
struct input_absinfo *abs;
|
||||
int *events;
|
||||
char *udev_file;
|
||||
|
||||
dev = devices;
|
||||
while (*dev) {
|
||||
|
|
@ -1112,17 +1195,13 @@ litest_create(enum litest_device_type which,
|
|||
d = zalloc(sizeof(*d));
|
||||
litest_assert(d != NULL);
|
||||
|
||||
udev_file = litest_init_device_udev_rules(*dev);
|
||||
/* device has custom create method */
|
||||
if ((*dev)->create) {
|
||||
(*dev)->create(d);
|
||||
if (abs_override || events_override) {
|
||||
if (udev_file)
|
||||
unlink(udev_file);
|
||||
litest_abort_msg("Custom create cannot be overridden");
|
||||
}
|
||||
|
||||
d->udev_rule_file = udev_file;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
|
@ -1136,7 +1215,6 @@ litest_create(enum litest_device_type which,
|
|||
abs,
|
||||
events);
|
||||
d->interface = (*dev)->interface;
|
||||
d->udev_rule_file = udev_file;
|
||||
free(abs);
|
||||
free(events);
|
||||
|
||||
|
|
@ -1170,58 +1248,6 @@ litest_restore_log_handler(struct libinput *libinput)
|
|||
libinput_log_set_handler(libinput, litest_log_handler);
|
||||
}
|
||||
|
||||
static inline int
|
||||
create_udev_lock_file(void)
|
||||
{
|
||||
int lfd;
|
||||
|
||||
/* Running the multiple tests in parallel usually trips over udev
|
||||
* not being up-to-date. We change the udev rules for every device
|
||||
* created, sometimes this means we end up getting the wrong udev
|
||||
* device, or having wrong properties applied.
|
||||
*
|
||||
* litests use the path interface and there is a window between
|
||||
* creating the device (which triggers udev reloads) and adding the
|
||||
* device to the libinput context where another udev reload may
|
||||
* upset things.
|
||||
*
|
||||
* To avoid this, create a lockfile on device add and device delete
|
||||
* to make sure that we have exclusive access to udev while
|
||||
* the udev rules are reloaded.
|
||||
*/
|
||||
do {
|
||||
lfd = open(LITEST_UDEV_LOCKFILE, O_CREAT|O_EXCL, O_RDWR);
|
||||
|
||||
if (lfd == -1) {
|
||||
struct stat st;
|
||||
time_t now = time(NULL);
|
||||
|
||||
litest_assert_int_eq(errno, EEXIST);
|
||||
msleep(10);
|
||||
|
||||
/* If the lock file is older than 10s, it's a
|
||||
leftover from some aborted test */
|
||||
if (stat(LITEST_UDEV_LOCKFILE, &st) != -1) {
|
||||
if (st.st_mtime < now - 10) {
|
||||
fprintf(stderr,
|
||||
"Removing stale lock file %s.\n",
|
||||
LITEST_UDEV_LOCKFILE);
|
||||
unlink(LITEST_UDEV_LOCKFILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (lfd < 0);
|
||||
|
||||
return lfd;
|
||||
}
|
||||
|
||||
static inline void
|
||||
delete_udev_lock_file(int lfd)
|
||||
{
|
||||
close(lfd);
|
||||
unlink(LITEST_UDEV_LOCKFILE);
|
||||
}
|
||||
|
||||
struct litest_device *
|
||||
litest_add_device_with_overrides(struct libinput *libinput,
|
||||
enum litest_device_type which,
|
||||
|
|
@ -1235,8 +1261,6 @@ litest_add_device_with_overrides(struct libinput *libinput,
|
|||
int rc;
|
||||
const char *path;
|
||||
|
||||
int lfd = create_udev_lock_file();
|
||||
|
||||
d = litest_create(which,
|
||||
name_override,
|
||||
id_override,
|
||||
|
|
@ -1262,9 +1286,6 @@ litest_add_device_with_overrides(struct libinput *libinput,
|
|||
d->interface->min[ABS_Y] = libevdev_get_abs_minimum(d->evdev, ABS_Y);
|
||||
d->interface->max[ABS_Y] = libevdev_get_abs_maximum(d->evdev, ABS_Y);
|
||||
}
|
||||
|
||||
delete_udev_lock_file(lfd);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
|
@ -1321,20 +1342,9 @@ litest_handle_events(struct litest_device *d)
|
|||
void
|
||||
litest_delete_device(struct litest_device *d)
|
||||
{
|
||||
int lfd;
|
||||
|
||||
if (!d)
|
||||
return;
|
||||
|
||||
lfd = create_udev_lock_file();
|
||||
|
||||
if (d->udev_rule_file) {
|
||||
unlink(d->udev_rule_file);
|
||||
free(d->udev_rule_file);
|
||||
d->udev_rule_file = NULL;
|
||||
litest_reload_udev_rules();
|
||||
}
|
||||
|
||||
libinput_device_unref(d->libinput_device);
|
||||
libinput_path_remove_device(d->libinput_device);
|
||||
if (d->owns_context)
|
||||
|
|
@ -1345,8 +1355,6 @@ litest_delete_device(struct litest_device *d)
|
|||
free(d->private);
|
||||
memset(d,0, sizeof(*d));
|
||||
free(d);
|
||||
|
||||
delete_udev_lock_file(lfd);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -3042,6 +3050,7 @@ litest_parse_argv(int argc, char **argv)
|
|||
OPT_FILTER_TEST,
|
||||
OPT_FILTER_DEVICE,
|
||||
OPT_FILTER_GROUP,
|
||||
OPT_JOBS,
|
||||
OPT_LIST,
|
||||
OPT_VERBOSE,
|
||||
};
|
||||
|
|
@ -3049,27 +3058,48 @@ litest_parse_argv(int argc, char **argv)
|
|||
{ "filter-test", 1, 0, OPT_FILTER_TEST },
|
||||
{ "filter-device", 1, 0, OPT_FILTER_DEVICE },
|
||||
{ "filter-group", 1, 0, OPT_FILTER_GROUP },
|
||||
{ "jobs", 1, 0, OPT_JOBS },
|
||||
{ "list", 0, 0, OPT_LIST },
|
||||
{ "verbose", 0, 0, OPT_VERBOSE },
|
||||
{ 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
enum {
|
||||
JOBS_DEFAULT,
|
||||
JOBS_SINGLE,
|
||||
JOBS_CUSTOM
|
||||
} want_jobs = JOBS_DEFAULT;
|
||||
|
||||
if (in_debugger)
|
||||
want_jobs = JOBS_SINGLE;
|
||||
|
||||
while(1) {
|
||||
int c;
|
||||
int option_index = 0;
|
||||
|
||||
c = getopt_long(argc, argv, "", opts, &option_index);
|
||||
c = getopt_long(argc, argv, "j:", opts, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch(c) {
|
||||
case OPT_FILTER_TEST:
|
||||
filter_test = optarg;
|
||||
if (want_jobs == JOBS_DEFAULT)
|
||||
want_jobs = JOBS_SINGLE;
|
||||
break;
|
||||
case OPT_FILTER_DEVICE:
|
||||
filter_device = optarg;
|
||||
if (want_jobs == JOBS_DEFAULT)
|
||||
want_jobs = JOBS_SINGLE;
|
||||
break;
|
||||
case OPT_FILTER_GROUP:
|
||||
filter_group = optarg;
|
||||
if (want_jobs == JOBS_DEFAULT)
|
||||
want_jobs = JOBS_SINGLE;
|
||||
break;
|
||||
case 'j':
|
||||
case OPT_JOBS:
|
||||
jobs = atoi(optarg);
|
||||
want_jobs = JOBS_CUSTOM;
|
||||
break;
|
||||
case OPT_LIST:
|
||||
return LITEST_MODE_LIST;
|
||||
|
|
@ -3082,10 +3112,42 @@ litest_parse_argv(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (want_jobs == JOBS_SINGLE)
|
||||
jobs = 1;
|
||||
|
||||
return LITEST_MODE_TEST;
|
||||
}
|
||||
|
||||
#ifndef LITEST_NO_MAIN
|
||||
static int
|
||||
is_debugger_attached(void)
|
||||
{
|
||||
int status;
|
||||
int rc;
|
||||
int pid = fork();
|
||||
|
||||
if (pid == -1)
|
||||
return 0;
|
||||
|
||||
if (pid == 0) {
|
||||
int ppid = getppid();
|
||||
if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0) {
|
||||
waitpid(ppid, NULL, 0);
|
||||
ptrace(PTRACE_CONT, NULL, NULL);
|
||||
ptrace(PTRACE_DETACH, ppid, NULL, NULL);
|
||||
rc = 0;
|
||||
} else {
|
||||
rc = 1;
|
||||
}
|
||||
_exit(rc);
|
||||
} else {
|
||||
waitpid(pid, &status, 0);
|
||||
rc = WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
litest_list_tests(struct list *tests)
|
||||
{
|
||||
|
|
@ -3110,11 +3172,30 @@ main(int argc, char **argv)
|
|||
setenv("CK_DEFAULT_TIMEOUT", "30", 0);
|
||||
setenv("LIBINPUT_RUNNING_TEST_SUITE", "1", 1);
|
||||
|
||||
in_debugger = is_debugger_attached();
|
||||
if (in_debugger)
|
||||
setenv("CK_FORK", "no", 0);
|
||||
|
||||
mode = litest_parse_argv(argc, argv);
|
||||
if (mode == LITEST_MODE_ERROR)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
litest_setup_tests();
|
||||
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();
|
||||
|
||||
if (mode == LITEST_MODE_LIST) {
|
||||
litest_list_tests(&all_tests);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,23 @@
|
|||
#include <libinput.h>
|
||||
#include <math.h>
|
||||
|
||||
extern void litest_setup_tests_udev(void);
|
||||
extern void litest_setup_tests_path(void);
|
||||
extern void litest_setup_tests_pointer(void);
|
||||
extern void litest_setup_tests_touch(void);
|
||||
extern void litest_setup_tests_log(void);
|
||||
extern void litest_setup_tests_tablet(void);
|
||||
extern void litest_setup_tests_pad(void);
|
||||
extern void litest_setup_tests_touchpad(void);
|
||||
extern void litest_setup_tests_touchpad_tap(void);
|
||||
extern void litest_setup_tests_touchpad_buttons(void);
|
||||
extern void litest_setup_tests_trackpoint(void);
|
||||
extern void litest_setup_tests_trackball(void);
|
||||
extern void litest_setup_tests_misc(void);
|
||||
extern void litest_setup_tests_keyboard(void);
|
||||
extern void litest_setup_tests_device(void);
|
||||
extern void litest_setup_tests_gestures(void);
|
||||
|
||||
void
|
||||
litest_fail_condition(const char *file,
|
||||
int line,
|
||||
|
|
@ -250,8 +267,6 @@ struct litest_device {
|
|||
bool skip_ev_syn;
|
||||
|
||||
void *private; /* device-specific data */
|
||||
|
||||
char *udev_rule_file;
|
||||
};
|
||||
|
||||
struct axis_replacement {
|
||||
|
|
@ -334,9 +349,6 @@ _litest_add_ranged_no_device(const char *name,
|
|||
void *func,
|
||||
const struct range *range);
|
||||
|
||||
extern void
|
||||
litest_setup_tests(void);
|
||||
|
||||
struct litest_device *
|
||||
litest_create_device(enum litest_device_type which);
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ START_TEST(log_priority)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_log(void)
|
||||
{
|
||||
litest_add_no_device("log:defaults", log_default_priority);
|
||||
litest_add_no_device("log:logging", log_handler_invoked);
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ START_TEST(library_version)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_misc(void)
|
||||
{
|
||||
litest_add_no_device("events:conversion", event_conversion_device_notify);
|
||||
litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE);
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ START_TEST(pad_mode_group_has_no_toggle)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_pad(void)
|
||||
{
|
||||
litest_add("pad:cap", pad_cap, LITEST_TABLET_PAD, LITEST_ANY);
|
||||
litest_add("pad:cap", pad_no_cap, LITEST_ANY, LITEST_TABLET_PAD);
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ START_TEST(path_seat_recycle)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_path(void)
|
||||
{
|
||||
litest_add_no_device("path:create", path_create_NULL);
|
||||
litest_add_no_device("path:create", path_create_invalid);
|
||||
|
|
|
|||
|
|
@ -1723,7 +1723,7 @@ START_TEST(pointer_time_usec)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_pointer(void)
|
||||
{
|
||||
struct range axis_range = {ABS_X, ABS_Y + 1};
|
||||
struct range compass = {0, 7}; /* cardinal directions */
|
||||
|
|
|
|||
|
|
@ -3671,7 +3671,7 @@ START_TEST(relative_calibration)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_tablet(void)
|
||||
{
|
||||
litest_add("tablet:tool", tool_ref, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
||||
litest_add_no_device("tablet:tool", tool_capabilities);
|
||||
|
|
|
|||
|
|
@ -720,7 +720,7 @@ START_TEST(touch_fuzz)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_touch(void)
|
||||
{
|
||||
struct range axes = { ABS_X, ABS_Y + 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -1805,7 +1805,7 @@ START_TEST(clickpad_middleemulation_click_disable_while_down)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_touchpad_buttons(void)
|
||||
{
|
||||
litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY);
|
||||
|
|
|
|||
|
|
@ -1959,53 +1959,53 @@ START_TEST(touchpad_drag_lock_default_unavailable)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_touchpad_tap(void)
|
||||
{
|
||||
struct range multitap_range = {3, 8};
|
||||
|
||||
litest_add("tap:1fg", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:1fg", touchpad_1fg_doubletap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap_n_drag_move, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap_n_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add("tap:1fg", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:1fg", touchpad_1fg_tap_n_drag_draglock, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:1fg", touchpad_1fg_tap_n_drag_draglock_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:1fg", touchpad_1fg_tap_n_drag_draglock_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_n_hold_first, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_n_hold_second, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:2fg", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_doubletap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_move, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_hold_first, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_hold_second, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-2fg:2fg", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD);
|
||||
|
||||
litest_add("tap:2fg", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap:2fg", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:2fg", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:2fg", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:2fg", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:3fg", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:3fg", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:3fg", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:3fg", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap:4fg", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:4fg", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:5fg", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap:5fg", touchpad_5fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap-2fg:2fg", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-2fg:2fg", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-2fg:2fg", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-3fg:3fg", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-3fg:3fg", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-3fg:3fg", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-3fg:3fg", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-4fg:4fg", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-4fg:4fg", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-5fg:5fg", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
litest_add("tap-5fg:5fg", touchpad_5fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
|
||||
/* Real buttons don't interfere with tapping, so don't run those for
|
||||
pads with buttons */
|
||||
litest_add("tap:1fg", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap:1fg", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add_ranged("tap:1fg", touchpad_1fg_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add("tap:1fg", touchpad_1fg_tap_n_drag_draglock_tap_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock_tap_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
|
||||
litest_add("tap:config", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY);
|
||||
litest_add("tap:config", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON);
|
||||
|
|
@ -2013,8 +2013,8 @@ litest_setup_tests(void)
|
|||
litest_add("tap:config", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:config", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD);
|
||||
|
||||
litest_add("tap:1fg", clickpad_1fg_tap_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap:2fg", clickpad_2fg_tap_click, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
|
||||
litest_add("tap-1fg:1fg", clickpad_1fg_tap_click, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("tap-2fg:2fg", clickpad_2fg_tap_click, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD);
|
||||
|
||||
litest_add("tap:draglock", touchpad_drag_lock_default_disabled, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:draglock", touchpad_drag_lock_default_unavailable, LITEST_ANY, LITEST_TOUCHPAD);
|
||||
|
|
@ -2025,5 +2025,5 @@ litest_setup_tests(void)
|
|||
litest_add("tap:drag", touchpad_drag_config_enabledisable, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:drag", touchpad_drag_disabled, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("tap:drag", touchpad_drag_disabled_immediate, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add_ranged("tap:drag", touchpad_drag_disabled_multitap_no_drag, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
litest_add_ranged("tap-multitap:drag", touchpad_drag_disabled_multitap_no_drag, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4379,7 +4379,7 @@ START_TEST(touchpad_jump_finger_motion)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_touchpad(void)
|
||||
{
|
||||
struct range axis_range = {ABS_X, ABS_Y + 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ START_TEST(trackball_rotation_accel)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_trackball(void)
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_trackpoint(void)
|
||||
{
|
||||
litest_add("trackpoint:middlebutton", trackpoint_middlebutton, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||
litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY);
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ START_TEST(udev_seat_recycle)
|
|||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
litest_setup_tests_udev(void)
|
||||
{
|
||||
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