diff --git a/meson.build b/meson.build index 32b9837c..d5715aec 100644 --- a/meson.build +++ b/meson.build @@ -115,6 +115,14 @@ if cc.has_header_symbol('dirent.h', 'versionsort', prefix : prefix) config_h.set('HAVE_VERSIONSORT', '1') endif +if cc.get_define('SYS_pidfd_open', prefix: '#include ') != '' + config_h.set('HAVE_PIDFD_OPEN', '1') +endif + +if cc.has_function('sigabbrev_np', prefix: '#define _GNU_SOURCE 1\n#include ') + config_h.set('HAVE_SIGABBREV_NP', '1') +endif + if not cc.has_header_symbol('errno.h', 'program_invocation_short_name', prefix : prefix) if cc.has_header_symbol('stdlib.h', 'getprogname') config_h.set('program_invocation_short_name', 'getprogname()') @@ -725,7 +733,7 @@ executable('libinput-test', # This is the test suite runner, we allow disabling that one because of # dependencies if get_option('tests') - dep_check = dependency('check', version : '>= 0.9.10') + dep_check = dependency('check', version : '>= 0.9.10', required: false) gstack = find_program('gstack', required : false) config_h.set10('HAVE_GSTACK', gstack.found()) @@ -838,13 +846,13 @@ if get_option('tests') 'test/litest-device-xen-virtual-pointer.c', 'test/litest-device-vmware-virtual-usb-mouse.c', 'test/litest-device-yubikey.c', + 'test/litest-runner.c', 'test/litest.c', ] dep_dl = cc.find_library('dl') deps_litest = [ dep_libinput, - dep_check, dep_udev, dep_libevdev, dep_dl, @@ -861,27 +869,30 @@ if get_option('tests') meson.current_build_dir() / '90-libinput-fuzz-override-litest.rules') - def_no_main = '-DLITEST_NO_MAIN' - def_disable_backtrace = '-DLITEST_DISABLE_BACKTRACE_LOGGING' - defs_litest_selftest = [ - def_no_main, - def_disable_backtrace, - '-Wno-unused', - ] - test_litest_selftest_sources = [ - 'test/litest-selftest.c', - 'test/litest.c', - ] - test_litest_selftest = executable('test-litest-selftest', - test_litest_selftest_sources, - include_directories : [includes_src, includes_include], - dependencies : deps_litest, - c_args : defs_litest_selftest, - install : false) - test('test-litest-selftest', - test_litest_selftest, - suite : ['all'], - timeout : 100) + if dep_check.found() + def_no_main = '-DLITEST_NO_MAIN' + def_disable_backtrace = '-DLITEST_DISABLE_BACKTRACE_LOGGING' + defs_litest_selftest = [ + def_no_main, + def_disable_backtrace, + '-Wno-unused', + ] + test_litest_selftest_sources = [ + 'test/litest-selftest.c', + 'test/litest-runner.c', + 'test/litest.c', + ] + test_litest_selftest = executable('test-litest-selftest', + test_litest_selftest_sources, + include_directories : [includes_src, includes_include], + dependencies : [deps_litest, dep_check], + c_args : defs_litest_selftest, + install : false) + test('test-litest-selftest', + test_litest_selftest, + suite : ['all'], + timeout : 100) + endif def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a) test_library_version = executable('test-library-version', @@ -897,6 +908,7 @@ if get_option('tests') # Could be fixed, but for now: meh 'test/litest-device-mouse.c', 'test/test-utils.c', + 'test/litest-runner.c', 'test/litest.c', ] test_utils = executable('libinput-test-utils', diff --git a/test/litest-runner.c b/test/litest-runner.c new file mode 100644 index 00000000..afa9fe66 --- /dev/null +++ b/test/litest-runner.c @@ -0,0 +1,886 @@ +/* + * Copyright © 2024 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#ifdef HAVE_PIDFD_OPEN +#include +#endif +#include +#include +#include + +#include "litest-runner.h" + +#include "util-files.h" +#include "util-list.h" +#include "util-stringbuf.h" + +/* musl doesn't have this one but it's not that important */ +#ifndef HAVE_SIGABBREV_NP +#define sigabbrev_np(...) "???" +#endif + +static struct litest_runner *global_runner = NULL; + +enum litest_runner_logfds { + FD_STDOUT, + FD_STDERR, + FD_LOG, + _FD_LAST, +}; + +struct litest_runner_test { + struct litest_runner_test_description desc; + struct list node; + + enum litest_runner_result result; + int sig_or_errno; + + struct stringbuf logs[_FD_LAST]; + pid_t pid; /* the test's PID, if any */ + int read_fds[_FD_LAST]; /* logging fds while the test is running */ + + int epollfd; + int pidfd; + int timerfd; + + struct { + uint64_t start_millis; + uint64_t end_millis; + } times; +}; + +struct litest_runner { + size_t max_forks; + unsigned int timeout; + bool verbose; + + int terminating; + + struct list tests; /* struct litest_runner_test */ + struct list tests_running; /* struct litest_runner_test */ + struct list tests_complete; /* struct litest_runner_test */ + + struct { + time_t start; + time_t end; + uint64_t start_millis; + } times; +}; + + +/** + * A global variable that the tests can use + * to write log data to. Defaults to stdout + * but if used by the tests it shows up as separate + * from stdout in the logs. + */ +int testlog_fd = STDOUT_FILENO; + +static void +close_pipes(int fds[_FD_LAST]) +{ + for (int i = 0; i < _FD_LAST; i++) { + fsync(fds[i]); + xclose(&fds[i]); + } +} + +static int +init_pipes(int read_fds[_FD_LAST], int write_fds[_FD_LAST]) +{ + int r; + int i; + int pipe_max_size = 4194304; + + for (i = 0; i < _FD_LAST; i++) { + read_fds[i] = -1; + write_fds[i] = -1; + } + +#ifdef __linux__ + { + FILE *f; + f = fopen("/proc/sys/fs/pipe-max-size", "re"); + if (f) { + if (fscanf(f, "%d", &r) == 1) + pipe_max_size = min(r, pipe_max_size); + fclose(f); + } + } +#endif + + for (i = 0; i < _FD_LAST; i++) { + int pipe[2]; + + r = pipe2(pipe, O_CLOEXEC | O_NONBLOCK); + if (r < 0) + goto error; + read_fds[i] = pipe[0]; + write_fds[i] = pipe[1]; +#ifdef __linux__ + /* Max pipe buffers, to avoid scrambling if reading lags. + * Can't use blocking write fds, since reading too slow + * then affects execution. + */ + fcntl(write_fds[i], F_SETPIPE_SZ, pipe_max_size); +#endif + } + + return 0; +error: + r = -errno; + close_pipes(read_fds); + close_pipes(write_fds); + return r; +} + +static const char * +litest_runner_result_as_str(enum litest_runner_result result) +{ + switch (result) { + CASE_RETURN_STRING(LITEST_PASS); + CASE_RETURN_STRING(LITEST_NOT_APPLICABLE); + CASE_RETURN_STRING(LITEST_FAIL); + CASE_RETURN_STRING(LITEST_SYSTEM_ERROR); + CASE_RETURN_STRING(LITEST_TIMEOUT); + CASE_RETURN_STRING(LITEST_SKIP); + } + + litest_abort_msg("Unknown result %d", result); + return NULL; +} + +static void +litest_runner_test_close(struct litest_runner_test *t) +{ + for (size_t i = 0; i < ARRAY_LENGTH(t->read_fds); i++) { + xclose(&t->read_fds[i]); + } + xclose(&t->epollfd); + xclose(&t->pidfd); + xclose(&t->timerfd); +} + +static void +litest_runner_test_destroy(struct litest_runner_test *t) +{ + list_remove(&t->node); + close_pipes(t->read_fds); + if (t->pid != 0) { + kill(t->pid, SIGTERM); + t->pid = 0; + } + litest_runner_test_close(t); + for (int i = 0; i < _FD_LAST; i++) { + stringbuf_reset(&t->logs[i]); + } + free(t); +} + +static void +litest_runner_detach_tests(struct litest_runner *runner) +{ + struct litest_runner_test *t; + + list_for_each_safe(t, &runner->tests, node) { + t->pid = 0; + } + list_for_each_safe(t, &runner->tests_complete, node) { + t->pid = 0; + } + list_for_each_safe(t, &runner->tests_running, node) { + t->pid = 0; + } +} + +void +litest_runner_destroy(struct litest_runner *runner) +{ + struct litest_runner_test *t; + list_for_each_safe(t, &runner->tests, node) { + litest_runner_test_destroy(t); + } + list_for_each_safe(t, &runner->tests_complete, node) { + litest_runner_test_destroy(t); + } + list_for_each_safe(t, &runner->tests_running, node) { + litest_runner_test_destroy(t); + } + free(runner); +} + +static enum litest_runner_result +litest_runner_test_run(const struct litest_runner_test_description *desc) +{ + const struct litest_runner_test_env env = { + .rangeval = desc->rangeval, + }; + + if (desc->setup) + desc->setup(desc); + + enum litest_runner_result result = desc->func(&env); + + if (desc->teardown) + desc->teardown(desc); + + return result; +} + +static void +sighandler_forked_child(int signal) +{ + struct sigaction act; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + act.sa_handler = SIG_DFL; + sigaction(signal, &act, NULL); + + /* abort() was probably called by litest_assert... which inserts + * the backtrace anyway - we only need to backtrace the other signals + */ + if (signal != SIGABRT) + litest_backtrace(); + + raise(signal); +} + +static int +litest_runner_fork_test(struct litest_runner *runner, + struct litest_runner_test *t) +{ + pid_t pid; + struct sigaction act; + int write_fds[_FD_LAST]; + int r; + + r = init_pipes(t->read_fds, write_fds); + if (r < 0) { + return -1; + } + + pid = fork(); + if (pid < 0) { + int r = -errno; + close_pipes(t->read_fds); + close_pipes(write_fds); + return r; + } + + if (pid > 0) { /* parent */ + close_pipes(write_fds); + t->pid = pid; + return pid; + } + + /* child */ + close_pipes(t->read_fds); + + /* Catch any crashers so we can insert a backtrace */ + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + act.sa_handler = sighandler_forked_child; + sigaction(SIGSEGV, &act, NULL); + sigaction(SIGBUS, &act, NULL); + sigaction(SIGSEGV, &act, NULL); + sigaction(SIGABRT, &act, NULL); + /* SIGALARM is used for our timeout */ + sigaction(SIGALRM, &act, NULL); + + r = dup2(write_fds[FD_STDERR], STDERR_FILENO); + litest_assert_errno_success(r); + setlinebuf(stderr); + r = dup2(write_fds[FD_STDOUT], STDOUT_FILENO); + litest_assert_errno_success(r); + setlinebuf(stdout); + + /* For convenience in the tests, let this be a global variable. */ + testlog_fd = write_fds[FD_LOG]; + + /* We're forked so we have a full copy of everything - but all we want + * to do is avoid valgrind complaining about memleaks in the child + * process. So let's cleanup everything, copy the one thing we + * care about and proceed to the exit */ + struct litest_runner_test_description desc = t->desc; + litest_runner_detach_tests(runner); + litest_runner_destroy(runner); + + /* Now run the actual test */ + enum litest_runner_result result = litest_runner_test_run(&desc); + + close_pipes(write_fds); + + exit(result); +} + +static bool +litest_runner_test_collect_child(struct litest_runner_test *t) +{ + int r; + int status; + + r = waitpid(t->pid, &status, WNOHANG); + if (r <= 0) + return false; + + t->pid = 0; + + if (WIFEXITED(status)) { + t->result = WEXITSTATUS(status); + switch (t->result) { + case LITEST_PASS: + case LITEST_SKIP: + case LITEST_NOT_APPLICABLE: + case LITEST_FAIL: + case LITEST_TIMEOUT: + case LITEST_SYSTEM_ERROR: + break; + /* if a test execve's itself allow for the normal + * exit codes to map to the results */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wswitch" + case 0: + t->result = LITEST_PASS; + break; + #pragma GCC diagnostic pop + default: { + char msg[64]; + snprintf(msg, sizeof(msg), "Invalid test exit status %d", t->result); + stringbuf_append_string(&t->logs[FD_LOG], msg); + t->result = LITEST_FAIL; + break; + } + } + return true; + } + + if (WIFSIGNALED(status)) { + t->sig_or_errno = WTERMSIG(status); + t->result = (t->sig_or_errno == t->desc.args.signal) ? LITEST_PASS : LITEST_FAIL; + } else { + t->result = LITEST_FAIL; + } + + uint64_t now = 0; + now_in_us(&now); + t->times.end_millis = us2ms(now); + + t->pid = 0; + + return true; +} + +static int +litest_runner_test_setup_monitoring(struct litest_runner *runner, + struct litest_runner_test *t) +{ + int pidfd = -1, timerfd = -1, epollfd = -1; + struct epoll_event ev[10]; + size_t nevents = 0; + int r = 0; + +#ifdef HAVE_PIDFD_OPEN + pidfd = syscall(SYS_pidfd_open, t->pid, 0); +#else + errno = ENOSYS; +#endif + /* If we don't have pidfd, we use a timerfd to ping us every 200ms */ + if (pidfd < 0 && errno == ENOSYS) { + pidfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + if (pidfd == -1) { + r = -errno; + goto error; + } + r = timerfd_settime(pidfd, 0, + &((struct itimerspec ){ + .it_interval.tv_nsec = 200 * 1000 * 1000, + .it_value.tv_nsec = 200 * 1000 * 1000, + }), NULL); + if (r < 0) { + r = -errno; + goto error; + } + } + + /* Each test has an epollfd with: + * - a timerfd so we can kill() it if it hangs + * - a pidfd so we get notified when the test exits + * - a pipe for stdout and a pipe for stderr + * - a pipe for logging (the various pwtest functions) + * - a pipe for the daemon's stdout + */ + timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + if (timerfd < 0) { + r = -errno; + goto error; + } + timerfd_settime(timerfd, 0, &((struct itimerspec ){ .it_value.tv_sec = runner->timeout}), NULL); + + epollfd = epoll_create(1); + if (epollfd < 0) + goto error; + ev[nevents++] = (struct epoll_event){ .events = EPOLLIN, .data.fd = pidfd }; + ev[nevents++] = (struct epoll_event){ .events = EPOLLIN, .data.fd = t->read_fds[FD_STDOUT] }; + ev[nevents++] = (struct epoll_event){ .events = EPOLLIN, .data.fd = t->read_fds[FD_STDERR] }; + ev[nevents++] = (struct epoll_event){ .events = EPOLLIN, .data.fd = t->read_fds[FD_LOG] }; + ev[nevents++] = (struct epoll_event){ .events = EPOLLIN, .data.fd = timerfd }; + + for (size_t i = 0; i < nevents; i++) { + r = epoll_ctl(epollfd, EPOLL_CTL_ADD, ev[i].data.fd, &ev[i]); + if (r < 0) { + r = -errno; + goto error; + } + } + + t->epollfd = epollfd; + t->pidfd = pidfd; + t->timerfd = timerfd; + + r = 0; + +error: + if (r) { + xclose(&pidfd); + xclose(&timerfd); + xclose(&epollfd); + } + + return -r; +} + +static int +litest_runner_test_check_status(struct litest_runner_test *t) +{ + struct epoll_event e; + + if (t->pid == 0) /* nofork case */ + return 0; + + while (true) { + /* FIXME: this is a busy wait ... */ + int r = epoll_wait(t->epollfd, &e, 1, 50); + if (r == 0) + return -EAGAIN; + + if (r == -1) { + goto error; + } + + if (e.data.fd == t->pidfd) { + uint64_t buf; + int ignore = read(t->pidfd, &buf, sizeof(buf)); /* for timerfd fallback */ + (void)ignore; + if (litest_runner_test_collect_child(t)) { + break; + } + } else if (e.data.fd == t->timerfd) { + /* SIGALARM so we get the backtrace */ + kill(t->pid, SIGALRM); + t->result = LITEST_TIMEOUT; + waitpid(t->pid, NULL, 0); + t->pid = 0; + break; + } else { + for (int i = 0; i < _FD_LAST; i++) { + if (e.data.fd == t->read_fds[i]) { + stringbuf_append_from_fd(&t->logs[i], e.data.fd, 1024); + } + } + } + }; + + errno = 0; +error: + return -errno; +} + +static void +litest_runner_test_update_errno(struct litest_runner_test *t, int error) +{ + if (error) + t->sig_or_errno = -error; + + if (error == SIGTERM) { + char msg[64]; + snprintf(msg, sizeof(msg), "litest: tests terminated by signal\n"); + stringbuf_append_string(&t->logs[FD_LOG], msg); + t->result = LITEST_SYSTEM_ERROR; + } + + for (size_t i = 0; i < ARRAY_LENGTH(t->read_fds); i++) { + stringbuf_append_from_fd(&t->logs[i], t->read_fds[i], 1024); + } +} + +static int +litest_runner_run_test(struct litest_runner *runner, struct litest_runner_test *t) +{ + int r = 0; + + t->result = LITEST_SYSTEM_ERROR; + + uint64_t now = 0; + now_in_us(&now); + t->times.start_millis = us2ms(now); + + if (runner->max_forks == 0) { + t->result = litest_runner_test_run(&t->desc); + } else { + r = litest_runner_fork_test(runner, t); + if (r >= 0) + r = litest_runner_test_setup_monitoring(runner, t); + litest_runner_test_update_errno(t, -r); + } + + if (r >= 0) { + list_remove(&t->node); + list_append(&runner->tests_running, &t->node); + } + + return r; +} + +static void +print_lines(FILE *fp, const char *log, const char *prefix) +{ + size_t nlines = 0; + char **lines = strv_from_string (log, "\n", &nlines); + + for (size_t i = 0; i < nlines; i++) { + fprintf(fp, "%s%s\n", prefix, lines[i]); + } + strv_free(lines); +} + +static void +litest_runner_log_test_result(struct litest_runner *runner, struct litest_runner_test *t) +{ + const char *color = NULL; + const char *status = NULL; + + litest_assert_int_ge(t->result, (enum litest_runner_result)LITEST_PASS); + litest_assert_int_le(t->result, (enum litest_runner_result)LITEST_SYSTEM_ERROR); + + switch (t->result) { + case LITEST_PASS: color = ANSI_BRIGHT_GREEN; break; + case LITEST_FAIL: color = ANSI_BRIGHT_RED; break; + case LITEST_SKIP: color = ANSI_BRIGHT_YELLOW; break; + case LITEST_NOT_APPLICABLE: color = ANSI_BLUE; break; + case LITEST_TIMEOUT: color = ANSI_BRIGHT_CYAN; break; + case LITEST_SYSTEM_ERROR: color = ANSI_BRIGHT_MAGENTA; break; + } + + fprintf(stderr, " - name: \"%s\"\n", t->desc.name); + int min = t->desc.args.range.lower, + max = t->desc.args.range.upper; + if (range_is_valid(&t->desc.args.range)) + fprintf(stderr, " rangeval: %d # %d..%d\n", t->desc.rangeval, min, max); + + fprintf(stderr, + " duration: %ld # (ms), total test run time: %02d:%02d\n", + t->times.end_millis - t->times.start_millis, + (ms2s(t->times.end_millis - runner->times.start_millis)) / 60, + (ms2s(t->times.end_millis - runner->times.start_millis)) % 60); + + status = litest_runner_result_as_str(t->result); + fprintf(stderr, " status: %s%s%s\n", + isatty(STDERR_FILENO) ? color : "", + &status[7], /* skip LITEST_ prefix */ + isatty(STDERR_FILENO) ? ANSI_NORMAL : ""); + + switch (t->result) { + case LITEST_PASS: + case LITEST_SKIP: + case LITEST_NOT_APPLICABLE: + if (!runner->verbose) + return; + break; + default: + break; + } + + if (t->sig_or_errno > 0) + fprintf(stderr, " signal: %d # SIG%s \n", + t->sig_or_errno, + sigabbrev_np(t->sig_or_errno)); + else if (t->sig_or_errno < 0) + fprintf(stderr, " errno: %d # %s\n", + -t->sig_or_errno, + strerror(-t->sig_or_errno)); + if (!stringbuf_is_empty(&t->logs[FD_LOG])) { + fprintf(stderr, " log: |\n"); + print_lines(stderr, t->logs[FD_LOG].data, " "); + } + if (!stringbuf_is_empty(&t->logs[FD_STDOUT])) { + fprintf(stderr, " stdout: |\n"); + print_lines(stderr, t->logs[FD_STDOUT].data, " "); + } + if (!stringbuf_is_empty(&t->logs[FD_STDERR])) { + fprintf(stderr, " stderr: |\n"); + print_lines(stderr, t->logs[FD_STDERR].data, " "); + } +} + +struct litest_runner * +litest_runner_new(void) +{ + struct litest_runner *runner = zalloc(sizeof *runner); + + list_init(&runner->tests); + list_init(&runner->tests_complete); + list_init(&runner->tests_running); + runner->timeout = LITEST_RUNNER_DEFAULT_TIMEOUT; + runner->max_forks = get_nprocs() * 2; + + return runner; +} + +void +litest_runner_set_timeout(struct litest_runner *runner, + unsigned int timeout) +{ + runner->timeout = timeout; +} + +void +litest_runner_set_num_parallel(struct litest_runner *runner, + size_t num_jobs) +{ + runner->max_forks = num_jobs; +} + +void +litest_runner_set_verbose(struct litest_runner *runner, + bool verbose) +{ + runner->verbose = verbose; +} + +void +litest_runner_add_test(struct litest_runner *runner, + const struct litest_runner_test_description *desc) +{ + struct litest_runner_test *t = zalloc(sizeof(*t)); + + t->desc = *desc; + t->epollfd = -1; + t->pidfd = -1; + t->timerfd = -1; + + for (int i = 0; i < _FD_LAST; i++) { + stringbuf_init(&t->logs[i]); + } + + for (size_t i = 0; i < ARRAY_LENGTH(t->read_fds); i++) { + t->read_fds[i] = -1; + } + + list_append(&runner->tests, &t->node); +} + +static int +litest_runner_check_finished_tests(struct litest_runner *runner) +{ + struct litest_runner_test *running; + size_t count = 0; + + list_for_each_safe(running, &runner->tests_running, node) { + int r = litest_runner_test_check_status(running); + if (r == -EAGAIN) + continue; + + uint64_t now = 0; + now_in_us(&now); + running->times.end_millis = us2ms(now); + + if (r < 0) + litest_runner_test_update_errno(running, -r); + + litest_runner_log_test_result(runner, running); + litest_runner_test_close(running); + list_remove(&running->node); + list_append(&runner->tests_complete, &running->node); + count++; + } + + return count; +} + +static void +runner_sighandler(int sig) +{ + struct litest_runner_test *t; + struct litest_runner *runner = global_runner; + + list_for_each(t, &runner->tests_running, node) { + if (t->pid != 0) { + kill(t->pid, SIGTERM); + t->pid = 0; + } + } + + global_runner->terminating = true; +} + +static inline void +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 = runner_sighandler; + rc = sigaction(sig, &act, &oact); + litest_assert_int_ne(rc, -1); +} + +enum litest_runner_result +litest_runner_run_tests(struct litest_runner *runner) +{ + struct litest_runner_test *t; + size_t available_jobs = max(runner->max_forks, 1); + char timestamp[64]; + struct tm *ltime; + + global_runner = runner; /* sigh, need this for signal handling */ + + setup_sighandler(SIGINT); + + uint64_t now = 0; + now_in_us(&now); + + runner->times.start_millis = us2ms(now); + runner->times.start = time(NULL); + ltime = localtime(&runner->times.start); + strftime(timestamp, sizeof(timestamp), "%FT%H:%M", ltime); + fprintf(stderr, "start: %ld # \"%s\"\n", runner->times.start, timestamp); + fprintf(stderr, "jobs: %zd\n", runner->max_forks); + fprintf(stderr, "tests:\n"); + list_for_each_safe(t, &runner->tests, node) { + int r = litest_runner_run_test(runner, t); + if (r >= 0) { + available_jobs--; + } + + /* Wait for something to become available */ + while (available_jobs == 0 && !runner->terminating) { + int complete = litest_runner_check_finished_tests(runner); + available_jobs += complete; + } + + if (runner->terminating) { + break; + } + } + + while (!runner->terminating && !list_empty(&runner->tests_running)) { + litest_runner_check_finished_tests(runner); + } + + + size_t npass = 0, nfail = 0, nskip = 0, nna = 0; + size_t ncomplete = 0; + + list_for_each(t, &runner->tests_complete, node) { + ncomplete++; + switch (t->result) { + case LITEST_PASS: + npass++; + break; + case LITEST_NOT_APPLICABLE: + nna++; + break; + case LITEST_FAIL: + case LITEST_SYSTEM_ERROR: + case LITEST_TIMEOUT: + nfail++; + break; + case LITEST_SKIP: + nskip++; + break; + } + } + + + runner->times.end = time(NULL); + ltime = localtime(&runner->times.end); + strftime(timestamp, sizeof(timestamp), "%FT%H:%M", ltime); + fprintf(stderr, "end: %ld # \"%s\"\n", runner->times.end, timestamp); + fprintf(stderr, + "duration: %ld # (s) %02ld:%02ld\n", + runner->times.end - runner->times.start, + (runner->times.end - runner->times.start) / 60, + (runner->times.end - runner->times.start) % 60); + fprintf(stderr, "summary:\n"); + fprintf(stderr, " completed: %zd\n", ncomplete); + fprintf(stderr, " pass: %zd\n", npass); + fprintf(stderr, " na: %zd\n", nna); + fprintf(stderr, " fail: %zd\n", nfail); + fprintf(stderr, " skip: %zd\n", nskip); + if (nfail > 0) { + fprintf(stderr, " failed:\n"); + list_for_each(t, &runner->tests_complete, node) { + switch (t->result) { + case LITEST_FAIL: + case LITEST_SYSTEM_ERROR: + case LITEST_TIMEOUT: + fprintf(stderr, " - \"%s\"\n", t->desc.name); + break; + default: + break; + } + } + } + + enum litest_runner_result result = LITEST_PASS; + + /* Didn't finish */ + if (!list_empty(&runner->tests) || !list_empty(&runner->tests_running)) { + result = LITEST_SYSTEM_ERROR; + } else { + list_for_each(t, &runner->tests_complete, node) { + switch (t->result) { + case LITEST_PASS: + case LITEST_NOT_APPLICABLE: + break; + default: + result = LITEST_FAIL; + break; + } + } + } + /* Status is always prefixed with LITEST_ */ + fprintf(stderr, " status: %s\n", &litest_runner_result_as_str(result)[7]); + + return result; +} diff --git a/test/litest-runner.h b/test/litest-runner.h new file mode 100644 index 00000000..d88b6442 --- /dev/null +++ b/test/litest-runner.h @@ -0,0 +1,84 @@ +/* + * Copyright © 2024 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once + +#include "config.h" + +#include "litest.h" +#include "util-range.h" + +#define LITEST_RUNNER_DEFAULT_TIMEOUT 30 + +/** + * Result returned from tests or suites. + */ +enum litest_runner_result { + LITEST_PASS = 75, /**< test successful */ + LITEST_FAIL = 76, /**< test failed. Should not be returned directly, + Use the litest_ macros instead */ + LITEST_SKIP = 77, /**< test was skipped */ + LITEST_NOT_APPLICABLE = 78, /**< test does not apply */ + LITEST_TIMEOUT = 79, /**< test aborted after timeout */ + LITEST_SYSTEM_ERROR = 80, /**< unrelated error occurred */ +}; + +/** + * This struct is passed into every test. + */ +struct litest_runner_test_env { + int rangeval; /* The current value within the args.range (or 0) */ +}; + +struct litest_runner_test_description { + char name[256]; /* The name of the test */ + int rangeval; /* The current value within the args.range (or 0) */ + + /* test function and corresponding setup/teardown, if any */ + enum litest_runner_result (*func)(const struct litest_runner_test_env *); + void (*setup)(const struct litest_runner_test_description *); + void (*teardown)(const struct litest_runner_test_description *); + + struct { + struct range range; /* The range this test applies to */ + int signal; /* expected signal for fail tests */ + } args; +}; + +struct litest_runner; + +struct litest_runner *litest_runner_new(void); + +/** + * Default is nprocs * 2. + * Setting this to 0 means *no* forking. Setting this to 1 means only one test + * is run at a time but in a child process. + */ +void litest_runner_set_num_parallel(struct litest_runner *runner, size_t num_jobs); +void litest_runner_set_timeout(struct litest_runner *runner, unsigned int timeout); +void litest_runner_set_verbose(struct litest_runner *runner, bool verbose); +void litest_runner_add_test(struct litest_runner *runner, + const struct litest_runner_test_description *t); +enum litest_runner_result litest_runner_run_tests(struct litest_runner *runner); + +void litest_runner_destroy(struct litest_runner *runner); diff --git a/test/litest-selftest.c b/test/litest-selftest.c index 3c84548c..9c3403ae 100644 --- a/test/litest-selftest.c +++ b/test/litest-selftest.c @@ -2,12 +2,16 @@ #include #include -#include #include #include #include "litest.h" +/* This is a bit messy but until we've completely switched over + * to the litest runner it's easier like this */ +#undef START_TEST +#undef END_TEST +#include START_TEST(litest_assert_trigger) { diff --git a/test/litest.c b/test/litest.c index 02a4252c..00e069cc 100644 --- a/test/litest.c +++ b/test/litest.c @@ -24,7 +24,6 @@ #include "config.h" -#include #include #include #include @@ -58,6 +57,7 @@ #include "util-files.h" #include "litest.h" +#include "litest-runner.h" #include "litest-int.h" #include "libinput-util.h" #include "quirks.h" @@ -264,6 +264,7 @@ struct test { void *teardown; struct range range; + int rangeval; bool deviceless; }; @@ -396,22 +397,31 @@ litest_add_tcase_for_device(struct suite *suite, const struct litest_test_device *dev, const struct range *range) { - struct test *t; + const struct range no_range = range_init_empty(); if (run_deviceless) return; - t = zalloc(sizeof(*t)); - t->name = safe_strdup(funcname); - t->devname = safe_strdup(dev->shortname); - t->func = func; - t->setup = dev->setup; - t->teardown = dev->teardown ? - dev->teardown : litest_generic_device_teardown; - if (range) - t->range = *range; + if (!range) + range = &no_range; - list_insert(&suite->tests, &t->node); + int rangeval = range->lower; + do { + struct test *t; + + t = zalloc(sizeof(*t)); + t->name = safe_strdup(funcname); + t->devname = safe_strdup(dev->shortname); + t->func = func; + t->setup = dev->setup; + t->teardown = dev->teardown ? + dev->teardown : litest_generic_device_teardown; + if (range) + t->range = *range; + t->rangeval = rangeval; + + list_append(&suite->tests, &t->node); + } while (++rangeval < range->upper); } static void @@ -420,8 +430,8 @@ litest_add_tcase_no_device(struct suite *suite, const char *funcname, const struct range *range) { - struct test *t; const char *test_name = funcname; + const struct range no_range = range_init_empty(); if (filter_device && fnmatch(filter_device, test_name, 0) != 0) @@ -430,16 +440,25 @@ litest_add_tcase_no_device(struct suite *suite, if (run_deviceless) return; - t = zalloc(sizeof(*t)); - t->name = safe_strdup(test_name); - t->devname = safe_strdup("no device"); - t->func = func; - if (range) - t->range = *range; - t->setup = NULL; - t->teardown = NULL; + if (!range) + range = &no_range; - list_insert(&suite->tests, &t->node); + int rangeval = range->lower; + do { + struct test *t; + + t = zalloc(sizeof(*t)); + t->name = safe_strdup(test_name); + t->devname = safe_strdup("no device"); + t->func = func; + if (range) + t->range = *range; + t->rangeval = rangeval; + t->setup = NULL; + t->teardown = NULL; + + list_append(&suite->tests, &t->node); + } while (++rangeval < range->upper); } static void @@ -448,24 +467,33 @@ litest_add_tcase_deviceless(struct suite *suite, const char *funcname, const struct range *range) { - struct test *t; const char *test_name = funcname; + const struct range no_range = range_init_empty(); if (filter_device && fnmatch(filter_device, test_name, 0) != 0) return; - t = zalloc(sizeof(*t)); - t->deviceless = true; - t->name = safe_strdup(test_name); - t->devname = safe_strdup("deviceless"); - t->func = func; - if (range) - t->range = *range; - t->setup = NULL; - t->teardown = NULL; + if (!range) + range = &no_range; - list_insert(&suite->tests, &t->node); + int rangeval = range->lower; + do { + struct test *t; + + t = zalloc(sizeof(*t)); + t->deviceless = true; + t->name = safe_strdup(test_name); + t->devname = safe_strdup("deviceless"); + t->func = func; + if (range) + t->range = *range; + t->rangeval = rangeval; + t->setup = NULL; + t->teardown = NULL; + + list_append(&suite->tests, &t->node); + } while (++rangeval < range->upper); } static void @@ -860,40 +888,6 @@ static struct libinput_interface interface = { .close_restricted = close_restricted, }; -static void -litest_signal(int sig) -{ - struct created_file *f; - - list_for_each_safe(f, &created_files_list, link) { - created_file_unlink(f); - list_remove(&f->link); - /* 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) { @@ -928,6 +922,7 @@ quirk_log_handler(struct libinput *unused, vfprintf(stderr, format, args); } +#if 0 static void litest_export_xml(SRunner *sr, const char *xml_prefix) { @@ -989,189 +984,66 @@ litest_export_xml(SRunner *sr, const char *xml_prefix) close(fd); free(filename); } +#endif static int -litest_run_suite(struct list *suites, int which, int max, int error_fd) +litest_run_suite(struct list *suites, int njobs) { - int failed = 0; - SRunner *sr = NULL; + size_t ntests = 0; + enum litest_runner_result result = LITEST_SKIP; struct suite *s; - struct test *t; - int count = -1; - struct name { - struct list node; - char *name; - }; - struct name *n; - struct list testnames; - const char *data_path; + struct litest_runner *runner = litest_runner_new(); - data_path = getenv("LIBINPUT_QUIRKS_DIR"); - if (!data_path) - data_path = LIBINPUT_QUIRKS_DIR; + litest_runner_set_num_parallel(runner, jobs > 0 ? jobs : 0); + litest_runner_set_verbose(runner, verbose); + litest_runner_set_timeout(runner, 30); - quirks_context = quirks_init_subsystem(data_path, - NULL, - quirk_log_handler, - NULL, - QLOG_LIBINPUT_LOGGING); - - /* Check just takes the suite/test name pointers but doesn't strdup - * them - we have to keep them around */ - list_init(&testnames); - - /* For each test, create one test suite with one test case, then - add it to the test runner. The only benefit suites give us in - check is that we can filter them, but our test runner has a - --filter-group anyway. */ list_for_each(s, suites, node) { + struct test *t; list_for_each(t, &s->tests, node) { - Suite *suite; - TCase *tc; - char *sname, *tname; + struct litest_runner_test_description tdesc; - count = (count + 1) % max; - if (max != 1 && (count % max) != which) - continue; - - xasprintf(&sname, - "%s:%s:%s", - s->name, - t->name, - t->devname); - litest_assert_ptr_notnull(sname); - n = zalloc(sizeof(*n)); - n->name = sname; - list_insert(&testnames, &n->node); - - xasprintf(&tname, - "%s:%s", - t->name, - t->devname); - litest_assert_ptr_notnull(tname); - n = zalloc(sizeof(*n)); - n->name = tname; - list_insert(&testnames, &n->node); - - tc = tcase_create(tname); - tcase_add_checked_fixture(tc, - t->setup, - t->teardown); - if (t->range.upper != t->range.lower) - tcase_add_loop_test(tc, - t->func, - t->range.lower, - t->range.upper); - else - tcase_add_test(tc, t->func); - - suite = suite_create(sname); - suite_add_tcase(suite, tc); - - if (!sr) - sr = srunner_create(suite); - else - srunner_add_suite(sr, suite); + if (range_is_valid(&t->range)) { + snprintf(tdesc.name, sizeof(tdesc.name), + "%s:%s:%s:%d", + s->name, + t->name, + t->devname, + t->rangeval); + } else { + snprintf(tdesc.name, sizeof(tdesc.name), + "%s:%s:%s", + s->name, + t->name, + t->devname); + } + tdesc.func = t->func; + tdesc.setup = t->setup; + tdesc.teardown = t->teardown; + tdesc.args.range = t->range; + tdesc.rangeval = t->rangeval; + litest_runner_add_test(runner, &tdesc); + ntests++; } } - if (!sr) - goto out; + if (ntests > 0) { + const char *data_path = getenv("LIBINPUT_QUIRKS_DIR"); + if (!data_path) + data_path = LIBINPUT_QUIRKS_DIR; - srunner_run_all(sr, CK_ENV); - if (xml_prefix) - litest_export_xml(sr, xml_prefix); - - - failed = srunner_ntests_failed(sr); - if (failed) { - TestResult **trs; - - trs = srunner_failures(sr); - for (int i = 0; i < failed; i++) { - char tname[256]; - char *c = tname; - - /* tr_tcname is in the form "suite:testcase", let's - * convert this to "suite(testcase)" to make - * double-click selection in the terminal a bit - * easier. */ - snprintf(tname, sizeof(tname), "%s)", tr_tcname(trs[i])); - if ((c = index(c, ':'))) - *c = '('; - - dprintf(error_fd, - ":: Failure: %s:%d: %s\n", - tr_lfile(trs[i]), - tr_lno(trs[i]), - tname); - } - free(trs); - } - srunner_free(sr); -out: - list_for_each_safe(n, &testnames, node) { - free(n->name); - free(n); + quirks_context = quirks_init_subsystem(data_path, + NULL, + quirk_log_handler, + NULL, + QLOG_LIBINPUT_LOGGING); + result = litest_runner_run_tests(runner); + quirks_context_unref(quirks_context); } - quirks_context_unref(quirks_context); + litest_runner_destroy(runner); - return failed; -} - -static int -litest_fork_subtests(struct list *tests, int max_forks) -{ - int failed = 0; - int status; - pid_t pid; - int f; - int pipes[max_forks]; - - for (f = 0; f < max_forks; f++) { - int rc; - int pipefd[2]; - - rc = pipe2(pipefd, O_NONBLOCK); - assert(rc != -1); - - pid = fork(); - if (pid == 0) { - close(pipefd[0]); - failed = litest_run_suite(tests, - f, - max_forks, - pipefd[1]); - - litest_free_test_list(&all_test_suites); - exit(failed); - /* child always exits here */ - } else { - pipes[f] = pipefd[0]; - close(pipefd[1]); - } - } - - /* parent process only */ - while (wait(&status) != -1 && errno != ECHILD) { - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) - failed = 1; - } - - for (f = 0; f < max_forks; f++) { - char buf[1024] = {0}; - int rc; - - while ((rc = read(pipes[f], buf, sizeof(buf) - 1)) > 0) { - buf[rc] = '\0'; - fprintf(stderr, "%s", buf); - } - - close(pipes[f]); - } - - return failed; + return result; } static inline int @@ -1226,10 +1098,9 @@ out: return lock_fd; } -static inline int +static inline enum litest_runner_result litest_run(struct list *suites) { - int failed = 0; int inhibit_lock_fd; list_init(&created_files_list); @@ -1248,20 +1119,15 @@ litest_run(struct list *suites) litest_setup_quirks(&created_files_list, mode); } - litest_setup_sighandler(SIGINT); - inhibit_lock_fd = inhibit(); - if (jobs == 1) - failed = litest_run_suite(suites, 1, 1, STDERR_FILENO); - else - failed = litest_fork_subtests(suites, jobs); + enum litest_runner_result result = litest_run_suite(suites, jobs); close(inhibit_lock_fd); litest_remove_udev_rules(&created_files_list); - return failed; + return result; } static struct input_absinfo * @@ -4942,7 +4808,6 @@ main(int argc, char **argv) const struct rlimit corelimit = { 0, 0 }; enum litest_mode mode; int tty_mode = -1; - int failed_tests; int rc; const char *meson_testthreads; @@ -4989,12 +4854,19 @@ main(int argc, char **argv) tty_mode = disable_tty(); - failed_tests = litest_run(&all_test_suites); + enum litest_runner_result result = litest_run(&all_test_suites); litest_free_test_list(&all_test_suites); restore_tty(tty_mode); - return min(failed_tests, 255); + switch (result) { + case LITEST_PASS: + return EXIT_SUCCESS; + case LITEST_SKIP: + return 77; + default: + return result; + } } #endif diff --git a/test/litest.h b/test/litest.h index 4697eb68..7d2b1aa0 100644 --- a/test/litest.h +++ b/test/litest.h @@ -29,22 +29,25 @@ #include #include -#include #include #include #include #include -#ifndef ck_assert_notnull -#define ck_assert_notnull(ptr) ck_assert_ptr_ne(ptr, NULL) -#endif - -#include "check-double-macros.h" - #include "libinput-private-config.h" #include "libinput-util.h" #include "quirks.h" +#include "litest-runner.h" + +#define START_TEST(func_) \ + static enum litest_runner_result func_(const struct litest_runner_test_env *test_env_) { \ + int _i __attribute__((unused)) = test_env_->rangeval; + +#define END_TEST \ + return LITEST_PASS; \ + } + struct test_device { const char *name; struct litest_test_device *device; diff --git a/test/test-device.c b/test/test-device.c index e45eeb69..ad102b24 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -92,7 +91,7 @@ START_TEST(device_sendevents_config_touchpad_superset) /* The wacom devices in the test suite are external */ if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || litest_touchpad_is_external(dev)) - return; + return LITEST_NOT_APPLICABLE; device = dev->libinput_device; diff --git a/test/test-gestures.c b/test/test-gestures.c index 0ecefc81..e50a946a 100644 --- a/test/test-gestures.c +++ b/test/test-gestures.c @@ -23,7 +23,6 @@ #include -#include #include #include @@ -976,7 +975,7 @@ START_TEST(gestures_swipe_3fg_btntool) !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; dir_x = cardinals[cardinal][0]; dir_y = cardinals[cardinal][1]; @@ -1066,7 +1065,7 @@ START_TEST(gestures_swipe_3fg_btntool_pinch_like) !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -1136,7 +1135,7 @@ START_TEST(gestures_swipe_4fg_btntool) !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; dir_x = cardinals[cardinal][0]; dir_y = cardinals[cardinal][1]; @@ -1252,7 +1251,7 @@ START_TEST(gestures_time_usec) uint64_t time_usec; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -1287,7 +1286,7 @@ START_TEST(gestures_3fg_buttonarea_scroll_btntool) struct libinput *li = dev->libinput; if (litest_slot_count(dev) > 2) - return; + return LITEST_NOT_APPLICABLE; litest_enable_buttonareas(dev); litest_enable_2fg_scroll(dev); @@ -1337,7 +1336,7 @@ START_TEST(gestures_swipe_3fg_unaccel) const double max_factor = 5.34; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); litest_touch_down(dev, 0, 40, 20); @@ -1587,7 +1586,7 @@ START_TEST(gestures_hold_once_on_double_tap) if (!libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_drain_events(li); @@ -1634,11 +1633,11 @@ START_TEST(gestures_hold_once_tap_n_drag) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; if (!libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_drag_lock(dev->libinput_device); @@ -1720,7 +1719,7 @@ START_TEST(gestures_hold_and_motion_before_timeout) if (!libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -1756,7 +1755,7 @@ START_TEST(gestures_hold_and_motion_after_timeout) if (!libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); diff --git a/test/test-keyboard.c b/test/test-keyboard.c index 537e0c96..3c36a0a3 100644 --- a/test/test-keyboard.c +++ b/test/test-keyboard.c @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include "libinput-util.h" @@ -289,7 +288,7 @@ START_TEST(keyboard_keys_bad_device) if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) - return; + return LITEST_NOT_APPLICABLE; for (code = 0; code < KEY_CNT; code++) { has_key = libinput_device_keyboard_has_key(device, code); @@ -307,7 +306,7 @@ START_TEST(keyboard_time_usec) uint64_t time_usec; if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(dev->libinput); @@ -371,7 +370,7 @@ START_TEST(keyboard_frame_order) if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A) || !libevdev_has_event_code(dev->evdev, EV_KEY, KEY_LEFTSHIFT)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); diff --git a/test/test-log.c b/test/test-log.c index e1ec235e..a7ecca50 100644 --- a/test/test-log.c +++ b/test/test-log.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/test/test-misc.c b/test/test-misc.c index 63f0d8c2..aada187f 100644 --- a/test/test-misc.c +++ b/test/test-misc.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/test/test-pad.c b/test/test-pad.c index cd71458f..faf22a0b 100644 --- a/test/test-pad.c +++ b/test/test-pad.c @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -84,7 +83,7 @@ START_TEST(pad_time) } if (!has_buttons) - return; + return LITEST_NOT_APPLICABLE; ev = libinput_get_event(li); litest_assert_notnull(ev); @@ -186,7 +185,7 @@ START_TEST(pad_button_intuos) /* Intuos button mapping is sequential up from BTN_0 and continues * with BTN_A */ if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_0)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -244,7 +243,7 @@ START_TEST(pad_button_bamboo) unsigned int count = 0; if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_LEFT)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -545,7 +544,7 @@ START_TEST(pad_dial_hi_res) int accumulated = 0; if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL_HI_RES)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -1034,7 +1033,7 @@ START_TEST(pad_keys) unsigned int key; if (!pad_has_keys(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); diff --git a/test/test-path.c b/test/test-path.c index 3d710e20..391fba6d 100644 --- a/test/test-path.c +++ b/test/test-path.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/test/test-pointer.c b/test/test-pointer.c index 60572338..13efedf5 100644 --- a/test/test-pointer.c +++ b/test/test-pointer.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -742,7 +741,7 @@ START_TEST(pointer_scroll_wheel_hires) if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL_HI_RES) && !libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL_HI_RES)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(dev->libinput); @@ -789,7 +788,7 @@ START_TEST(pointer_scroll_wheel_hires_send_only_lores) if (!libevdev_has_event_code(dev->evdev, EV_REL, lores_code) && !libevdev_has_event_code(dev->evdev, EV_REL, hires_code)) - return; + return LITEST_NOT_APPLICABLE; /* Device claims to have HI_RES, but doesn't send events for it. Make * sure we handle this correctly. @@ -824,7 +823,7 @@ START_TEST(pointer_scroll_wheel_inhibit_small_deltas) if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL_HI_RES) && !libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL_HI_RES)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(dev->libinput); @@ -871,7 +870,7 @@ START_TEST(pointer_scroll_wheel_inhibit_dir_change) if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL_HI_RES) && !libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL_HI_RES)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(dev->libinput); @@ -984,7 +983,7 @@ START_TEST(pointer_scroll_natural_defaults_noscroll) struct litest_device *dev = litest_current_device(); if (libinput_device_config_scroll_has_natural_scroll(dev->libinput_device)) - return; + return LITEST_NOT_APPLICABLE; litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); litest_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); @@ -1047,7 +1046,7 @@ START_TEST(pointer_scroll_has_axis_invalid) litest_drain_events(dev->libinput); if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) - return; + return LITEST_NOT_APPLICABLE; litest_event(dev, EV_REL, REL_WHEEL, 1); litest_event(dev, EV_SYN, SYN_REPORT, 0); @@ -1222,7 +1221,7 @@ START_TEST(pointer_left_handed_defaults) if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) - return; + return LITEST_NOT_APPLICABLE; rc = libinput_device_config_left_handed_is_available(d); litest_assert_int_ne(rc, 0); @@ -1312,7 +1311,7 @@ START_TEST(pointer_left_handed_during_click_multiple_buttons) enum libinput_config_status status; if (!libinput_device_pointer_has_button(d, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(dev); @@ -1460,7 +1459,7 @@ START_TEST(pointer_scroll_button_no_event_before_timeout) if (!libinput_device_pointer_has_button(device->libinput_device, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(device); disable_button_scrolling(device); @@ -1505,7 +1504,7 @@ START_TEST(pointer_scroll_button_middle_emulation) LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_scroll_set_method(device, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); @@ -1945,7 +1944,7 @@ START_TEST(pointer_scroll_button_lock_middlebutton) enum mb_buttonorder buttonorder = _i; /* ranged test */ if (!libinput_device_config_middle_emulation_is_available(dev->libinput_device)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_middleemu(dev); @@ -2505,7 +2504,7 @@ START_TEST(middlebutton) device->libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -2543,7 +2542,7 @@ START_TEST(middlebutton_nostart_while_down) if (!libinput_device_pointer_has_button(device->libinput_device, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; disable_button_scrolling(device); @@ -2551,7 +2550,7 @@ START_TEST(middlebutton_nostart_while_down) device->libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_button_click_debounced(device, li, BTN_MIDDLE, true); litest_drain_events(li); @@ -2597,7 +2596,7 @@ START_TEST(middlebutton_timeout) device->libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { litest_drain_events(li); @@ -2637,7 +2636,7 @@ START_TEST(middlebutton_doubleclick) device->libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -2678,13 +2677,13 @@ START_TEST(middlebutton_middleclick) if (!libinput_device_pointer_has_button(device->libinput_device, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_middle_emulation_set_enabled( device->libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; /* one button down, then middle -> release buttons */ for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { @@ -2743,13 +2742,13 @@ START_TEST(middlebutton_middleclick_during) if (!libinput_device_pointer_has_button(device->libinput_device, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_middle_emulation_set_enabled( device->libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -2808,7 +2807,7 @@ START_TEST(middlebutton_default_enabled) if (!libinput_device_pointer_has_button(dev->libinput_device, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; available = libinput_device_config_middle_emulation_is_available(device); litest_assert(available); @@ -2873,13 +2872,13 @@ START_TEST(middlebutton_default_touchpad) if (streq(name, "litest AlpsPS/2 ALPS GlidePoint") || streq(name, "litest AlpsPS/2 ALPS DualPoint TouchPad")) - return; + return LITEST_NOT_APPLICABLE; available = libinput_device_config_middle_emulation_is_available(device); litest_assert(!available); if (libinput_device_pointer_has_button(device, BTN_MIDDLE)) - return; + return LITEST_NOT_APPLICABLE; state = libinput_device_config_middle_emulation_get_enabled( device); @@ -2947,16 +2946,16 @@ START_TEST(middlebutton_button_scrolling) device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_scroll_set_method(device, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_scroll_set_button(device, BTN_LEFT); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3019,16 +3018,16 @@ START_TEST(middlebutton_button_scrolling_middle) device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_scroll_set_method(device, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_scroll_set_button(device, BTN_LEFT); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3071,7 +3070,7 @@ START_TEST(middlebutton_device_remove_while_down) device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3102,7 +3101,7 @@ START_TEST(middlebutton_device_remove_while_one_is_down) device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3150,7 +3149,7 @@ START_TEST(debounce_bounce) if (!libinput_device_pointer_has_button(dev->libinput_device, button)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(dev); disable_button_scrolling(dev); @@ -3197,7 +3196,7 @@ START_TEST(debounce_bounce_high_delay) if (!libinput_device_pointer_has_button(dev->libinput_device, button)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(dev); disable_button_scrolling(dev); @@ -3330,7 +3329,7 @@ START_TEST(debounce_spurious) if (!libinput_device_pointer_has_button(dev->libinput_device, button)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(dev); disable_button_scrolling(dev); @@ -3512,7 +3511,7 @@ START_TEST(debounce_spurious_dont_enable_on_otherbutton) struct libinput *li = dev->libinput; if (!libinput_device_config_middle_emulation_is_available(device)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(dev); disable_button_scrolling(dev); @@ -3586,7 +3585,7 @@ START_TEST(debounce_spurious_cancel_debounce_otherbutton) struct libinput *li = dev->libinput; if (!libinput_device_config_middle_emulation_is_available(device)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_middleemu(dev); disable_button_scrolling(dev); @@ -3646,7 +3645,7 @@ START_TEST(debounce_spurious_switch_to_otherbutton) struct libinput *li = dev->libinput; if (!libinput_device_config_middle_emulation_is_available(device)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); debounce_trigger_spurious(dev, li); diff --git a/test/test-quirks.c b/test/test-quirks.c index e4691035..0d92e6d6 100644 --- a/test/test-quirks.c +++ b/test/test-quirks.c @@ -23,7 +23,6 @@ #include -#include #include #include "libinput-util.h" diff --git a/test/test-switch.c b/test/test-switch.c index 25479678..f9930f16 100644 --- a/test/test-switch.c +++ b/test/test-switch.c @@ -23,7 +23,6 @@ #include -#include #include #include @@ -53,7 +52,7 @@ START_TEST(switch_has_cap) if (dev->which == LITEST_TABLET_MODE_UNRELIABLE) { litest_assert(!libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_SWITCH)); - return; + return LITEST_NOT_APPLICABLE; } litest_assert(libinput_device_has_capability(dev->libinput_device, @@ -67,7 +66,7 @@ START_TEST(switch_has_lid_switch) struct litest_device *dev = litest_current_device(); if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_LID)) - return; + return LITEST_NOT_APPLICABLE; litest_assert_int_eq(libinput_device_switch_has_switch(dev->libinput_device, LIBINPUT_SWITCH_LID), @@ -93,7 +92,7 @@ START_TEST(switch_has_tablet_mode_switch) int has_switch; if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_TABLET_MODE)) - return; + return LITEST_NOT_APPLICABLE; has_switch = libinput_device_switch_has_switch(dev->libinput_device, LIBINPUT_SWITCH_TABLET_MODE); @@ -148,7 +147,7 @@ START_TEST(switch_toggle_double) enum libinput_switch sw = _i; /* ranged test */ if (libinput_device_switch_has_switch(dev->libinput_device, sw) <= 0) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -194,10 +193,10 @@ START_TEST(switch_down_on_init) enum libinput_switch sw = _i; /* ranged test */ if (libinput_device_switch_has_switch(dev->libinput_device, sw) <= 0) - return; + return LITEST_NOT_APPLICABLE; if (sw == LIBINPUT_SWITCH_LID && !lid_switch_is_reliable(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_grab_device(dev); litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); @@ -239,10 +238,10 @@ START_TEST(switch_not_down_on_init) enum libinput_switch sw = LIBINPUT_SWITCH_LID; if (libinput_device_switch_has_switch(dev->libinput_device, sw) <= 0) - return; + return LITEST_NOT_APPLICABLE; if (sw == LIBINPUT_SWITCH_LID && lid_switch_is_reliable(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_grab_device(dev); litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); @@ -282,7 +281,7 @@ START_TEST(switch_disable_touchpad) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_disable_tap(touchpad->libinput_device); @@ -322,7 +321,7 @@ START_TEST(switch_disable_touchpad_during_touch) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_disable_tap(touchpad->libinput_device); @@ -354,7 +353,7 @@ START_TEST(switch_disable_touchpad_edge_scroll) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_enable_edge_scroll(touchpad); @@ -394,7 +393,7 @@ START_TEST(switch_disable_touchpad_edge_scroll_interrupt) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_enable_edge_scroll(touchpad); @@ -434,7 +433,7 @@ START_TEST(switch_disable_touchpad_already_open) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); @@ -469,7 +468,7 @@ START_TEST(switch_dont_resume_disabled_touchpad) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_disable_tap(touchpad->libinput_device); @@ -510,7 +509,7 @@ START_TEST(switch_dont_resume_disabled_touchpad_external_mouse) enum libinput_switch which = _i; /* ranged test */ if (libinput_device_switch_has_switch(sw->libinput_device, which) <= 0) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); mouse = litest_add_device(li, LITEST_MOUSE); @@ -558,7 +557,7 @@ START_TEST(lid_open_on_key) struct libinput_event *event; if (!switch_has_lid(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); @@ -601,7 +600,7 @@ START_TEST(lid_open_on_key_touchpad_enabled) struct libinput *li = sw->libinput; if (!switch_has_lid(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); @@ -727,7 +726,7 @@ START_TEST(lid_update_hw_on_key) int rc; if (!switch_has_lid(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); @@ -850,7 +849,7 @@ START_TEST(lid_update_hw_on_key_multiple_keyboards) int rc; if (!switch_has_lid(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard1 = litest_add_device(li, LITEST_KEYBOARD_BLADE_STEALTH_VIDEOSWITCH); @@ -923,7 +922,7 @@ START_TEST(tablet_mode_disable_touchpad_on_init) struct libinput *li = sw->libinput; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; litest_grab_device(sw); litest_switch_action(sw, @@ -966,7 +965,7 @@ START_TEST(tablet_mode_disable_touchpad_on_resume) bool have_switch_toggle = false; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_disable_tap(touchpad->libinput_device); @@ -1034,7 +1033,7 @@ START_TEST(tablet_mode_enable_touchpad_on_resume) struct libinput_event *event; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; touchpad = switch_init_paired_touchpad(li); litest_disable_tap(touchpad->libinput_device); @@ -1089,7 +1088,7 @@ START_TEST(tablet_mode_disable_keyboard) struct libinput *li = sw->libinput; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); litest_drain_events(li); @@ -1142,7 +1141,7 @@ START_TEST(tablet_mode_disable_keyboard_on_init) struct libinput *li = sw->libinput; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; litest_switch_action(sw, LIBINPUT_SWITCH_TABLET_MODE, @@ -1179,7 +1178,7 @@ START_TEST(tablet_mode_disable_keyboard_on_resume) bool have_switch_toggle = false; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); litest_drain_events(li); @@ -1245,7 +1244,7 @@ START_TEST(tablet_mode_enable_keyboard_on_resume) struct libinput *li = sw->libinput; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); litest_grab_device(sw); @@ -1289,7 +1288,7 @@ START_TEST(tablet_mode_disable_trackpoint) struct libinput *li = sw->libinput; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; trackpoint = litest_add_device(li, LITEST_TRACKPOINT); litest_drain_events(li); @@ -1335,7 +1334,7 @@ START_TEST(tablet_mode_disable_trackpoint_on_init) struct libinput *li = sw->libinput; if (!switch_has_tablet_mode(sw)) - return; + return LITEST_NOT_APPLICABLE; litest_grab_device(sw); litest_switch_action(sw, @@ -1375,7 +1374,7 @@ START_TEST(dock_toggle) struct libinput *li = sw->libinput; if (!libevdev_has_event_code(sw->evdev, EV_SW, SW_DOCK)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); diff --git a/test/test-tablet.c b/test/test-tablet.c index a9f22f18..d5696c8e 100644 --- a/test/test-tablet.c +++ b/test/test-tablet.c @@ -24,7 +24,6 @@ #include -#include #include #include #include @@ -277,7 +276,7 @@ START_TEST(tip_down_up_eraser) }; if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER)) - return; + return LITEST_NOT_APPLICABLE; litest_tablet_set_tool_type(dev, BTN_TOOL_RUBBER); @@ -2105,7 +2104,7 @@ START_TEST(left_handed_artpen_rotation) if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_Z)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_left_handed_set(dev->libinput_device, 1); litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); @@ -2990,7 +2989,7 @@ START_TEST(tool_direct_switch_skip_tool_update) }; if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3110,7 +3109,7 @@ START_TEST(tool_direct_switch_with_forced_proxout) }; if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3360,7 +3359,7 @@ START_TEST(mouse_wheel) if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3442,7 +3441,7 @@ START_TEST(airbrush_tool) if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_AIRBRUSH)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3479,7 +3478,7 @@ START_TEST(airbrush_slider) if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_AIRBRUSH)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3527,7 +3526,7 @@ START_TEST(artpen_tool) if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_Z)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3563,7 +3562,7 @@ START_TEST(artpen_rotation) if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_Z)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3748,7 +3747,7 @@ START_TEST(tablet_calibration_set_matrix_delta) double x, y, dx, dy, mdx, mdy; if (!device_has_calibration(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -3831,7 +3830,7 @@ START_TEST(tablet_calibration_set_matrix) double x, y; if (!device_has_calibration(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -4107,7 +4106,7 @@ START_TEST(tablet_pressure_min_max) }; if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE)) - return; + return LITEST_NOT_APPLICABLE; litest_tablet_proximity_in(dev, 5, 50, axes); litest_drain_events(li); @@ -4847,11 +4846,11 @@ START_TEST(tilt_fixed_points) */ const struct input_absinfo *abs = libevdev_get_abs_info(dev->evdev, ABS_TILT_X); if (abs->minimum >= 0) - return; + return LITEST_NOT_APPLICABLE; /* If the tablet reports physical resolutions we don't need to test them */ if (abs->resolution != 0) - return; + return LITEST_NOT_APPLICABLE; /* see tablet_fix_tilt() */ bool is_adjusted = (int)absinfo_range(abs) % 2 == 0; @@ -5129,7 +5128,7 @@ START_TEST(relative_calibration) enum libinput_config_status status; if (!libinput_device_config_calibration_has_matrix(dev->libinput_device)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_calibration_set_matrix( dev->libinput_device, @@ -5289,7 +5288,7 @@ START_TEST(touch_arbitration) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; struct litest_device *finger = litest_add_device(li, other); litest_drain_events(li); @@ -5322,14 +5321,14 @@ START_TEST(touch_arbitration_outside_rect) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_drain_events(li); is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT); if (is_touchpad) - return; + return LITEST_NOT_APPLICABLE; x = 20; y = 70; @@ -5399,14 +5398,14 @@ START_TEST(touch_arbitration_remove_after) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_drain_events(li); is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT); if (is_touchpad) - return; + return LITEST_NOT_APPLICABLE; litest_tablet_proximity_in(dev, 50, 50, axes); litest_drain_events(li); @@ -5437,7 +5436,7 @@ START_TEST(touch_arbitration_stop_touch) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); @@ -5525,7 +5524,7 @@ START_TEST(touch_arbitration_suspend_touch_device) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; tablet = litest_add_device(li, other); @@ -5605,7 +5604,7 @@ START_TEST(touch_arbitration_remove_touch) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_touch_down(finger, 0, 30, 30); @@ -5641,7 +5640,7 @@ START_TEST(touch_arbitration_remove_tablet) other = paired_device(dev); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; tablet = litest_add_device(li, other); @@ -5699,7 +5698,7 @@ START_TEST(touch_arbitration_keep_ignoring) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_tablet_proximity_in(tablet, 10, 10, axes); @@ -5739,7 +5738,7 @@ START_TEST(touch_arbitration_late_touch_lift) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT); @@ -5782,7 +5781,7 @@ START_TEST(touch_arbitration_swap_device) enum litest_device_type paired = paired_device(tablet); if (paired == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; /* First, add a normal touchscreen */ struct litest_device *touchscreen = litest_add_device(li, LITEST_GENERIC_MULTITOUCH_SCREEN); @@ -5938,7 +5937,7 @@ START_TEST(tablet_rotation_left_handed) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_drain_events(li); @@ -5989,7 +5988,7 @@ START_TEST(tablet_rotation_left_handed_configuration) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_drain_events(li); @@ -6044,7 +6043,7 @@ START_TEST(tablet_rotation_left_handed_while_in_prox) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_drain_events(li); @@ -6138,7 +6137,7 @@ START_TEST(tablet_rotation_left_handed_while_touch_down) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; finger = litest_add_device(li, other); litest_drain_events(li); @@ -6205,7 +6204,7 @@ START_TEST(tablet_rotation_left_handed_add_touchpad) other = paired_device(tablet); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; tablet_from = !!(transition & bit(0)); touch_from = !!(transition & bit(1)); @@ -6259,11 +6258,11 @@ START_TEST(tablet_rotation_left_handed_add_tablet) bool enabled_from, enabled_to; if (libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT)) - return; + return LITEST_NOT_APPLICABLE; other = paired_device(finger); if (other == LITEST_NO_DEVICE) - return; + return LITEST_NOT_APPLICABLE; tablet_from = !!(transition & bit(0)); touch_from = !!(transition & bit(1)); diff --git a/test/test-totem.c b/test/test-totem.c index 7f7dc3b1..63355953 100644 --- a/test/test-totem.c +++ b/test/test-totem.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/test/test-touch.c b/test/test-touch.c index 7069fad1..22d7487e 100644 --- a/test/test-touch.c +++ b/test/test-touch.c @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -1136,7 +1135,7 @@ START_TEST(touch_palm_detect_tool_palm) }; if (!touch_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); @@ -1163,7 +1162,7 @@ START_TEST(touch_palm_detect_tool_palm_on_off) }; if (!touch_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); @@ -1194,7 +1193,7 @@ START_TEST(touch_palm_detect_tool_palm_keep_type) }; if (!touch_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); @@ -1225,7 +1224,7 @@ START_TEST(touch_palm_detect_tool_palm_2fg) }; if (!touch_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_down(dev, 1, 50, 50); @@ -1261,7 +1260,7 @@ START_TEST(touch_palm_detect_tool_palm_on_off_2fg) }; if (!touch_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_down(dev, 1, 50, 50); @@ -1305,7 +1304,7 @@ START_TEST(touch_palm_detect_tool_palm_keep_type_2fg) }; if (!touch_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_down(dev, 1, 50, 50); diff --git a/test/test-touchpad-buttons.c b/test/test-touchpad-buttons.c index ed0e7bfa..14470ae6 100644 --- a/test/test-touchpad-buttons.c +++ b/test/test-touchpad-buttons.c @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -38,7 +37,7 @@ START_TEST(touchpad_button) struct libinput *li = dev->libinput; if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_LEFT)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -160,7 +159,7 @@ START_TEST(touchpad_click_defaults_none) if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) - return; + return LITEST_NOT_APPLICABLE; /* call this test for non-clickpads and non-touchpads */ @@ -214,7 +213,7 @@ START_TEST(touchpad_1fg_clickfinger_no_touch) if (dev->which == LITEST_SYNAPTICS_PHANTOMCLICKS) { /* The XPS 15 9500 touchpad has the ModelTouchpadPhantomClicks * quirk enabled and doesn't generate events without touches. */ - return; + return LITEST_NOT_APPLICABLE; } litest_enable_clickfinger(dev); @@ -304,7 +303,7 @@ START_TEST(touchpad_3fg_clickfinger) unsigned int button = 0; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_set_clickfinger_map(dev, map); @@ -353,7 +352,7 @@ START_TEST(touchpad_3fg_clickfinger_btntool) if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_set_clickfinger_map(dev, map); @@ -403,7 +402,7 @@ START_TEST(touchpad_4fg_clickfinger) struct libinput *li = dev->libinput; if (litest_slot_count(dev) < 4) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); @@ -435,7 +434,7 @@ START_TEST(touchpad_4fg_clickfinger_btntool_2slots) if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); @@ -467,7 +466,7 @@ START_TEST(touchpad_4fg_clickfinger_btntool_3slots) if (litest_slot_count(dev) != 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); @@ -572,7 +571,7 @@ START_TEST(touchpad_3fg_clickfinger_distance) unsigned int button = 0; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_set_clickfinger_map(dev, map); @@ -619,7 +618,7 @@ START_TEST(touchpad_3fg_clickfinger_distance_btntool) unsigned int button = 0; if (litest_slot_count(dev) > 2) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_set_clickfinger_map(dev, map); @@ -1240,10 +1239,10 @@ START_TEST(clickpad_finger_pin) abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); litest_assert_notnull(abs); if (abs->resolution == 0) - return; + return LITEST_NOT_APPLICABLE; if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) - return; + return LITEST_NOT_APPLICABLE; dist = 100.0/max(w, h); diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c index 3e721590..8536fbeb 100644 --- a/test/test-touchpad-tap.c +++ b/test/test-touchpad-tap.c @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -69,9 +68,9 @@ START_TEST(touchpad_doubletap) button2 = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers2 > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -210,7 +209,7 @@ START_TEST(touchpad_multitap) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -300,7 +299,7 @@ START_TEST(touchpad_multitap_n_drag_move) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -409,10 +408,10 @@ START_TEST(touchpad_multitap_n_drag_2fg) unsigned int button = 0; if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -526,7 +525,7 @@ START_TEST(touchpad_multitap_n_drag_click) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -627,7 +626,7 @@ START_TEST(touchpad_multitap_timeout) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -717,7 +716,7 @@ START_TEST(touchpad_multitap_n_drag_timeout) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -828,7 +827,7 @@ START_TEST(touchpad_multitap_n_drag_high_delay) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -924,7 +923,7 @@ START_TEST(touchpad_multitap_n_drag_tap) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -1039,7 +1038,7 @@ START_TEST(touchpad_multitap_n_drag_tap_click) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -1161,7 +1160,7 @@ START_TEST(touchpad_tap_n_drag) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_drag_lock(dev->libinput_device); @@ -1243,7 +1242,7 @@ START_TEST(touchpad_tap_n_drag_draglock) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -1325,10 +1324,10 @@ START_TEST(touchpad_tap_n_drag_draglock_tap) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers2 > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -1431,7 +1430,7 @@ START_TEST(touchpad_tap_n_drag_draglock_tap_click) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -1516,7 +1515,7 @@ START_TEST(touchpad_tap_n_drag_draglock_timeout) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -1587,7 +1586,7 @@ START_TEST(touchpad_tap_n_drag_draglock_sticky) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock_sticky(dev->libinput_device); @@ -1670,7 +1669,7 @@ START_TEST(touchpad_tap_n_drag_2fg) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_drag_lock(dev->libinput_device); @@ -1748,7 +1747,7 @@ START_TEST(touchpad_tap_n_drag_2fg_scroll) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_enable_tap(dev->libinput_device); @@ -1828,7 +1827,7 @@ START_TEST(touchpad_tap_n_drag_draglock_2fg_scroll) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_enable_tap(dev->libinput_device); @@ -1914,7 +1913,7 @@ START_TEST(touchpad_tap_n_drag_3fg_btntool) if (litest_slot_count(dev) > 2 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2012,7 +2011,7 @@ START_TEST(touchpad_tap_n_drag_3fg) unsigned int button = 0; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2098,7 +2097,7 @@ START_TEST(touchpad_tap_n_drag_3fg_swipe) unsigned int button = 0; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2189,7 +2188,7 @@ START_TEST(touchpad_tap_n_drag_draglock_3fg_swipe) unsigned int button = 0; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_drag_lock(dev->libinput_device); @@ -2713,7 +2712,7 @@ START_TEST(touchpad_double_tap_click) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2789,7 +2788,7 @@ START_TEST(touchpad_tap_n_drag_click) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2872,7 +2871,7 @@ START_TEST(touchpad_3fg_tap) int i; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_set_tap_map(dev->libinput_device, map); @@ -2937,7 +2936,7 @@ START_TEST(touchpad_3fg_tap_tap_again) int i; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2991,7 +2990,7 @@ START_TEST(touchpad_3fg_tap_quickrelease) struct libinput *li = dev->libinput; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -3030,14 +3029,14 @@ START_TEST(touchpad_3fg_tap_pressure_btntool) if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; /* libinput doesn't export when it uses pressure detection, so we * need to reconstruct this here. Specifically, semi-mt devices are * non-mt in libinput, so if they have ABS_PRESSURE, they'll use it. */ if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_edge_scroll(dev); @@ -3091,18 +3090,18 @@ START_TEST(touchpad_3fg_tap_hover_btntool) if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; /* libinput doesn't export when it uses pressure detection, so we * need to reconstruct this here. Specifically, semi-mt devices are * non-mt in libinput, so if they have ABS_PRESSURE, they'll use it. */ if (libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) - return; + return LITEST_NOT_APPLICABLE; if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT) && libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_edge_scroll(dev); @@ -3145,7 +3144,7 @@ START_TEST(touchpad_3fg_tap_btntool) if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_set_tap_map(dev->libinput_device, map); @@ -3196,7 +3195,7 @@ START_TEST(touchpad_3fg_tap_btntool_inverted) if (litest_slot_count(dev) > 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_set_tap_map(dev->libinput_device, map); @@ -3247,7 +3246,7 @@ START_TEST(touchpad_3fg_tap_btntool_pointerjump) if (litest_slot_count(dev) > 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_set_tap_map(dev->libinput_device, map); @@ -3391,7 +3390,7 @@ START_TEST(touchpad_3fg_tap_after_scroll) struct libinput *li = dev->libinput; if (litest_slot_count(dev) <= 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_enable_tap(dev->libinput_device); @@ -3428,7 +3427,7 @@ START_TEST(touchpad_4fg_tap) int i; if (litest_slot_count(dev) <= 4) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -3460,7 +3459,7 @@ START_TEST(touchpad_4fg_tap_quickrelease) struct libinput *li = dev->libinput; if (litest_slot_count(dev) <= 4) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -3497,7 +3496,7 @@ START_TEST(touchpad_move_after_touch) int nfingers = _i; /* ranged test */ if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -3568,7 +3567,7 @@ START_TEST(touchpad_5fg_tap) int i; if (litest_slot_count(dev) < 5) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -3602,7 +3601,7 @@ START_TEST(touchpad_5fg_tap_quickrelease) struct libinput *li = dev->libinput; if (litest_slot_count(dev) < 5) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -3958,7 +3957,7 @@ START_TEST(touchpad_drag_disabled) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_tap_drag(dev->libinput_device); @@ -4033,7 +4032,7 @@ START_TEST(touchpad_drag_disabled_immediate) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_tap_drag(dev->libinput_device); @@ -4113,7 +4112,7 @@ START_TEST(touchpad_drag_disabled_multitap_no_drag) unsigned int button = 0; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_tap_drag(dev->libinput_device); @@ -4293,7 +4292,7 @@ START_TEST(touchpad_tap_palm_on_idle) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4320,7 +4319,7 @@ START_TEST(touchpad_tap_palm_on_touch) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4348,7 +4347,7 @@ START_TEST(touchpad_tap_palm_on_touch_hold_timeout) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4379,7 +4378,7 @@ START_TEST(touchpad_tap_palm_on_touch_hold_move) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4412,10 +4411,10 @@ START_TEST(touchpad_tap_palm_on_tapped) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4494,10 +4493,10 @@ START_TEST(touchpad_tap_palm_on_tapped_palm_down) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4578,13 +4577,13 @@ START_TEST(touchpad_tap_palm_on_tapped_doubletap) button2 = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers2 + 1 > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4707,10 +4706,10 @@ START_TEST(touchpad_tap_palm_on_drag) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4792,10 +4791,10 @@ START_TEST(touchpad_tap_palm_on_drag_2fg) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4883,7 +4882,7 @@ START_TEST(touchpad_tap_palm_on_touch_2) other = (which + 1) % 2; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4924,7 +4923,7 @@ START_TEST(touchpad_tap_palm_on_touch_2_retouch) other = (which + 1) % 2; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -4968,10 +4967,10 @@ START_TEST(touchpad_tap_palm_on_touch_3) int this = which % 3; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5015,10 +5014,10 @@ START_TEST(touchpad_tap_palm_on_touch_3_retouch) int this = which % 3; if (litest_slot_count(dev) < 3) - return; + return LITEST_NOT_APPLICABLE; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5067,10 +5066,10 @@ START_TEST(touchpad_tap_palm_on_touch_4) int this = which % 4; if (litest_slot_count(dev) < 4) - return; + return LITEST_NOT_APPLICABLE; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5107,10 +5106,10 @@ START_TEST(touchpad_tap_palm_after_tap) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5188,10 +5187,10 @@ START_TEST(touchpad_tap_palm_multitap) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5274,10 +5273,10 @@ START_TEST(touchpad_tap_palm_multitap_timeout) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5359,10 +5358,10 @@ START_TEST(touchpad_tap_palm_multitap_down_again) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers + 1 > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5475,10 +5474,10 @@ START_TEST(touchpad_tap_palm_multitap_click) unsigned int button = 0; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (nfingers > litest_slot_count(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5567,7 +5566,7 @@ START_TEST(touchpad_tap_palm_click_then_tap) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5618,7 +5617,7 @@ START_TEST(touchpad_tap_palm_dwt_tap) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; keyboard = litest_add_device(li, LITEST_KEYBOARD); @@ -5659,7 +5658,7 @@ START_TEST(touchpad_tap_palm_3fg_start) if (litest_slot_count(dev) < 3 || !litest_has_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); diff --git a/test/test-touchpad.c b/test/test-touchpad.c index 24d7939a..da0f8875 100644 --- a/test/test-touchpad.c +++ b/test/test-touchpad.c @@ -23,7 +23,6 @@ #include -#include #include #include #include @@ -142,7 +141,7 @@ START_TEST(touchpad_2fg_scroll) struct libinput *li = dev->libinput; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_disable_hold_gestures(dev->libinput_device); @@ -187,7 +186,7 @@ START_TEST(touchpad_2fg_scroll_initially_diagonal) double ydelta; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_assert_int_eq(libinput_device_get_size(dev->libinput_device, &w, &h), 0); ratio = w/h; @@ -310,7 +309,7 @@ START_TEST(touchpad_2fg_scroll_axis_lock) /* 10 degrees off from horiz/vert should count as straight */ if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -338,7 +337,7 @@ START_TEST(touchpad_2fg_scroll_axis_lock_switch) enum libinput_pointer_axis axis; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -401,7 +400,7 @@ START_TEST(touchpad_2fg_scroll_slow_distance) bool last_hi_res_event_found, last_low_res_event_found; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; last_hi_res_event_found = false; last_low_res_event_found = false; @@ -472,7 +471,7 @@ START_TEST(touchpad_2fg_scroll_source) struct libinput_event *event; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -496,7 +495,7 @@ START_TEST(touchpad_2fg_scroll_semi_mt) struct libinput *li = dev->libinput; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -520,7 +519,7 @@ START_TEST(touchpad_2fg_scroll_return_to_motion) struct libinput *li = dev->libinput; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -567,7 +566,7 @@ START_TEST(touchpad_2fg_scroll_from_btnareas) if (!litest_has_2fg_scroll(dev) || !litest_has_btnareas(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_enable_buttonareas(dev); @@ -630,7 +629,7 @@ START_TEST(touchpad_scroll_natural_2fg) struct libinput *li = dev->libinput; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -753,7 +752,7 @@ START_TEST(touchpad_edge_scroll_horiz) litest_touch_up(dev, 0); if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); litest_enable_edge_scroll(dev); @@ -820,7 +819,7 @@ START_TEST(touchpad_edge_scroll_no_horiz) struct libinput *li = dev->libinput; if (touchpad_has_horiz_edge_scroll_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); litest_enable_edge_scroll(dev); @@ -1079,7 +1078,7 @@ START_TEST(touchpad_edge_scroll_within_buttonareas) struct libinput *li = dev->libinput; if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_buttonareas(dev); litest_enable_edge_scroll(dev); @@ -1108,7 +1107,7 @@ START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll) struct libinput_event *event; if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_buttonareas(dev); litest_enable_edge_scroll(dev); @@ -1158,7 +1157,7 @@ START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll) struct libinput_event *event; if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_enable_edge_scroll(dev); @@ -1241,7 +1240,7 @@ START_TEST(touchpad_palm_detect_at_edge) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1269,7 +1268,7 @@ START_TEST(touchpad_palm_detect_at_top) struct libinput *li = dev->libinput; if (!touchpad_has_top_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1289,7 +1288,7 @@ START_TEST(touchpad_no_palm_detect_at_edge_for_edge_scrolling) struct libinput *li = dev->libinput; if (!litest_has_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_edge_scroll(dev); @@ -1310,7 +1309,7 @@ START_TEST(touchpad_palm_detect_at_bottom_corners) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1340,7 +1339,7 @@ START_TEST(touchpad_palm_detect_at_top_corners) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1372,7 +1371,7 @@ START_TEST(touchpad_palm_detect_palm_stays_palm) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1393,7 +1392,7 @@ START_TEST(touchpad_palm_detect_top_palm_stays_palm) struct libinput *li = dev->libinput; if (!touchpad_has_top_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1414,7 +1413,7 @@ START_TEST(touchpad_palm_detect_palm_becomes_pointer) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1440,7 +1439,7 @@ START_TEST(touchpad_palm_detect_top_palm_becomes_pointer) struct libinput *li = dev->libinput; if (!touchpad_has_top_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1464,7 +1463,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_edges) struct libinput *li = dev->libinput; if (!litest_has_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1494,7 +1493,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_top) struct libinput *li = dev->libinput; if (!touchpad_has_top_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1524,7 +1523,7 @@ START_TEST(touchpad_palm_detect_no_tap_top_edge) struct libinput *li = dev->libinput; if (!touchpad_has_top_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1545,7 +1544,7 @@ START_TEST(touchpad_palm_detect_tap_hardbuttons) struct libinput *li = dev->libinput; if (!litest_has_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1587,7 +1586,7 @@ START_TEST(touchpad_palm_detect_tap_softbuttons) struct libinput *li = dev->libinput; if (!litest_has_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_buttonareas(dev); @@ -1646,7 +1645,7 @@ START_TEST(touchpad_palm_detect_tap_clickfinger) struct libinput *li = dev->libinput; if (!litest_has_palm_detect_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_clickfinger(dev); @@ -1692,7 +1691,7 @@ START_TEST(touchpad_no_palm_detect_2fg_scroll) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1719,7 +1718,7 @@ START_TEST(touchpad_palm_detect_both_edges) if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); @@ -1754,7 +1753,7 @@ START_TEST(touchpad_palm_detect_tool_palm) struct libinput *li = dev->libinput; if (!touchpad_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); @@ -1775,7 +1774,7 @@ START_TEST(touchpad_palm_detect_tool_palm_on_off) struct libinput *li = dev->libinput; if (!touchpad_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_touch_down(dev, 0, 50, 50); litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); @@ -1802,7 +1801,7 @@ START_TEST(touchpad_palm_detect_tool_palm_tap_after) struct libinput *li = dev->libinput; if (!touchpad_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1845,7 +1844,7 @@ START_TEST(touchpad_palm_detect_tool_palm_tap) struct libinput *li = dev->libinput; if (!touchpad_has_tool_palm(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1891,7 +1890,7 @@ START_TEST(touchpad_palm_detect_pressure) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -1915,7 +1914,7 @@ START_TEST(touchpad_palm_detect_pressure_late_tap) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_clickfinger(dev); @@ -1949,7 +1948,7 @@ START_TEST(touchpad_palm_detect_pressure_tap_hold) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_clickfinger(dev); @@ -1984,7 +1983,7 @@ START_TEST(touchpad_palm_detect_pressure_tap_hold_2ndfg) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_enable_clickfinger(dev); @@ -2033,7 +2032,7 @@ START_TEST(touchpad_palm_detect_move_and_tap) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2073,7 +2072,7 @@ START_TEST(touchpad_palm_detect_pressure_late) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2100,7 +2099,7 @@ START_TEST(touchpad_palm_detect_pressure_keep_palm) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2127,7 +2126,7 @@ START_TEST(touchpad_palm_detect_pressure_after_edge) if (!touchpad_has_palm_pressure(dev) || !litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_disable_tap(dev->libinput_device); @@ -2154,7 +2153,7 @@ START_TEST(touchpad_palm_detect_pressure_after_dwt) }; if (!touchpad_has_palm_pressure(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -2216,7 +2215,7 @@ START_TEST(touchpad_palm_clickfinger_pressure) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_disable_tap(dev->libinput_device); @@ -2247,10 +2246,10 @@ START_TEST(touchpad_palm_clickfinger_pressure_2fg) }; if (!touchpad_has_palm_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; if (libevdev_get_num_slots(dev->evdev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_disable_tap(dev->libinput_device); @@ -2300,7 +2299,7 @@ START_TEST(touchpad_palm_clickfinger_size) }; if (!touchpad_has_touch_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_disable_tap(dev->libinput_device); @@ -2333,10 +2332,10 @@ START_TEST(touchpad_palm_clickfinger_size_2fg) }; if (!touchpad_has_touch_size(dev)) - return; + return LITEST_NOT_APPLICABLE; if (libevdev_get_num_slots(dev->evdev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_enable_clickfinger(dev); litest_disable_tap(dev->libinput_device); @@ -2368,7 +2367,7 @@ START_TEST(touchpad_left_handed) if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_left_handed_set(d, 1); litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); @@ -2429,7 +2428,7 @@ START_TEST(touchpad_left_handed_clickpad) enum libinput_config_status status; if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_left_handed_set(d, 1); litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); @@ -2483,7 +2482,7 @@ START_TEST(touchpad_left_handed_clickfinger) enum libinput_config_status status; if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_left_handed_set(d, 1); litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); @@ -2527,7 +2526,7 @@ START_TEST(touchpad_left_handed_tapping) enum libinput_config_status status; if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2562,7 +2561,7 @@ START_TEST(touchpad_left_handed_tapping_2fg) enum libinput_config_status status; if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -2599,7 +2598,7 @@ START_TEST(touchpad_left_handed_delayed) enum libinput_config_status status; if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); litest_button_click(dev, BTN_LEFT, 1); @@ -2654,7 +2653,7 @@ START_TEST(touchpad_left_handed_clickpad_delayed) enum libinput_config_status status; if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); litest_touch_down(dev, 0, 10, 90); @@ -2714,7 +2713,7 @@ START_TEST(touchpad_left_handed_rotation) bool rotate = touchpad_has_rotation(dev->evdev); if (!libinput_device_config_left_handed_is_available(d)) - return; + return LITEST_NOT_APPLICABLE; status = libinput_device_config_left_handed_set(d, 1); litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); @@ -3686,7 +3685,7 @@ START_TEST(touchpad_fingers_down_before_init) BTN_TOOL_QUINTTAP}; if (!libevdev_has_event_code(dev->evdev, EV_KEY, map[finger_count])) - return; + return LITEST_NOT_APPLICABLE; /* Fingers down but before we have the real context */ for (int i = 0; i < finger_count; i++) { @@ -3801,7 +3800,7 @@ START_TEST(touchpad_dwt) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -3838,7 +3837,7 @@ START_TEST(touchpad_dwt_ext_and_int_keyboard) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(touchpad->libinput_device); litest_disable_hold_gestures(touchpad->libinput_device); @@ -3881,7 +3880,7 @@ START_TEST(touchpad_dwt_enable_touch) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -3920,7 +3919,7 @@ START_TEST(touchpad_dwt_touch_hold) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -3958,7 +3957,7 @@ START_TEST(touchpad_dwt_key_hold) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -3986,7 +3985,7 @@ START_TEST(touchpad_dwt_key_hold_timeout) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4031,7 +4030,7 @@ START_TEST(touchpad_dwt_key_hold_timeout_existing_touch_cornercase) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; /* Note: this tests for the current behavior of a cornercase, and * the behaviour is essentially a bug. If this test fails it may be @@ -4087,7 +4086,7 @@ START_TEST(touchpad_dwt_key_hold_timeout_existing_touch) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4129,7 +4128,7 @@ START_TEST(touchpad_dwt_type) int i; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4168,7 +4167,7 @@ START_TEST(touchpad_dwt_type_short_timeout) int i; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4223,7 +4222,7 @@ START_TEST(touchpad_dwt_modifier_no_dwt) }; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4258,7 +4257,7 @@ START_TEST(touchpad_dwt_shift_combo_triggers_dwt) }; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4310,7 +4309,7 @@ START_TEST(touchpad_dwt_modifier_combo_no_dwt) }; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4357,7 +4356,7 @@ START_TEST(touchpad_dwt_modifier_combo_dwt_after) }; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4408,7 +4407,7 @@ START_TEST(touchpad_dwt_modifier_combo_dwt_remains) }; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4456,7 +4455,7 @@ START_TEST(touchpad_dwt_fkeys_no_dwt) unsigned int key; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4491,7 +4490,7 @@ START_TEST(touchpad_dwt_tap) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_enable_tap(touchpad->libinput_device); @@ -4522,7 +4521,7 @@ START_TEST(touchpad_dwt_tap_drag) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_enable_tap(touchpad->libinput_device); @@ -4557,7 +4556,7 @@ START_TEST(touchpad_dwt_click) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_disable_tap(touchpad->libinput_device); @@ -4589,7 +4588,7 @@ START_TEST(touchpad_dwt_edge_scroll) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_edge_scroll(touchpad); @@ -4635,7 +4634,7 @@ START_TEST(touchpad_dwt_edge_scroll_interrupt) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_edge_scroll(touchpad); @@ -4687,7 +4686,7 @@ START_TEST(touchpad_dwt_config_default_on) if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) { litest_assert(!libinput_device_config_dwt_is_available(device)); - return; + return LITEST_NOT_APPLICABLE; } litest_assert(libinput_device_config_dwt_is_available(device)); @@ -4717,7 +4716,7 @@ START_TEST(touchpad_dwtp_config_default_on) if (litest_touchpad_is_external(dev)) { litest_assert(!libinput_device_config_dwtp_is_available(device)); - return; + return LITEST_NOT_APPLICABLE; } litest_assert(libinput_device_config_dwtp_is_available(device)); @@ -4815,7 +4814,7 @@ START_TEST(touchpad_dwt_disabled) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; disable_dwt(touchpad); @@ -4845,7 +4844,7 @@ START_TEST(touchpad_dwt_disable_during_touch) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; enable_dwt(touchpad); @@ -4888,7 +4887,7 @@ START_TEST(touchpad_dwt_disable_before_touch) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; enable_dwt(touchpad); @@ -4920,7 +4919,7 @@ START_TEST(touchpad_dwt_disable_during_key_release) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; enable_dwt(touchpad); @@ -4955,7 +4954,7 @@ START_TEST(touchpad_dwt_disable_during_key_hold) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; enable_dwt(touchpad); @@ -4988,7 +4987,7 @@ START_TEST(touchpad_dwt_enable_during_touch) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; disable_dwt(touchpad); @@ -5023,7 +5022,7 @@ START_TEST(touchpad_dwt_enable_before_touch) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; disable_dwt(touchpad); @@ -5054,7 +5053,7 @@ START_TEST(touchpad_dwt_enable_during_tap) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(touchpad->libinput_device); disable_dwt(touchpad); @@ -5093,7 +5092,7 @@ START_TEST(touchpad_dwt_remove_kbd_while_active) struct libinput *li = touchpad->libinput; if (!has_disable_while_typing(touchpad)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(touchpad->libinput_device); enable_dwt(touchpad); @@ -5372,7 +5371,7 @@ START_TEST(touchpad_thumb_lower_area_movement) struct libinput *li = dev->libinput; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5397,7 +5396,7 @@ START_TEST(touchpad_thumb_lower_area_movement_rethumb) struct libinput *li = dev->libinput; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5426,7 +5425,7 @@ START_TEST(touchpad_thumb_speed_empty_slots) litest_disable_hold_gestures(dev->libinput_device); if (libevdev_get_num_slots(dev->evdev) < 3) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -5466,7 +5465,7 @@ START_TEST(touchpad_thumb_area_clickfinger) struct libinput_event *event; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5521,7 +5520,7 @@ START_TEST(touchpad_thumb_area_btnarea) struct libinput_event *event; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_disable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -5558,7 +5557,7 @@ START_TEST(touchpad_thumb_no_doublethumb) litest_disable_hold_gestures(dev->libinput_device); if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6213,7 +6212,7 @@ START_TEST(touchpad_pressure) double threshold = 12.0; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6245,7 +6244,7 @@ START_TEST(touchpad_pressure_2fg) }; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6276,7 +6275,7 @@ START_TEST(touchpad_pressure_2fg_st) }; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; /* This is a bit of a weird test. We expect two fingers to be down as * soon as doubletap is set, regardless of pressure. But we don't @@ -6310,7 +6309,7 @@ START_TEST(touchpad_pressure_tap) }; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -6334,7 +6333,7 @@ START_TEST(touchpad_pressure_tap_2fg) }; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -6362,7 +6361,7 @@ START_TEST(touchpad_pressure_tap_2fg_1fg_light) }; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -6406,10 +6405,10 @@ START_TEST(touchpad_pressure_btntool) /* we only have tripletap, can't test 4 slots because nothing will * happen */ if (libevdev_get_num_slots(dev->evdev) != 2) - return; + return LITEST_NOT_APPLICABLE; if (!touchpad_has_pressure(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_tap(dev->libinput_device); litest_disable_hold_gestures(dev->libinput_device); @@ -6514,7 +6513,7 @@ START_TEST(touchpad_touch_size) }; if (!touchpad_has_touch_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6547,7 +6546,7 @@ START_TEST(touchpad_touch_size_2fg) }; if (!touchpad_has_touch_size(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); @@ -6588,7 +6587,7 @@ START_TEST(touchpad_palm_detect_touch_size) if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6620,7 +6619,7 @@ START_TEST(touchpad_palm_detect_touch_size_late) if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6661,7 +6660,7 @@ START_TEST(touchpad_palm_detect_touch_size_keep_palm) if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6700,7 +6699,7 @@ START_TEST(touchpad_palm_detect_touch_size_after_edge) litest_touchpad_is_external(dev) || !litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_2fg_scroll(dev); litest_drain_events(li); @@ -6731,7 +6730,7 @@ START_TEST(touchpad_palm_detect_touch_size_after_dwt) if (!touchpad_has_touch_size(touchpad) || litest_touchpad_is_external(touchpad)) - return; + return LITEST_NOT_APPLICABLE; keyboard = dwt_init_paired_keyboard(li, touchpad); litest_drain_events(li); @@ -6769,7 +6768,7 @@ START_TEST(touchpad_speed_ignore_finger) struct libinput *li = dev->libinput; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; if (litest_has_clickfinger(dev)) litest_enable_clickfinger(dev); @@ -6795,10 +6794,10 @@ START_TEST(touchpad_speed_allow_nearby_finger) struct libinput *li = dev->libinput; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; if (!litest_has_2fg_scroll(dev)) - return; + return LITEST_NOT_APPLICABLE; if (litest_has_clickfinger(dev)) litest_enable_clickfinger(dev); @@ -6827,7 +6826,7 @@ START_TEST(touchpad_speed_ignore_finger_edgescroll) struct libinput *li = dev->libinput; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_enable_edge_scroll(dev); if (litest_has_clickfinger(dev)) @@ -6861,7 +6860,7 @@ START_TEST(touchpad_speed_ignore_hovering_finger) }; if (!has_thumb_detect(dev)) - return; + return LITEST_NOT_APPLICABLE; litest_drain_events(li); @@ -6928,7 +6927,7 @@ START_TEST(touchpad_suspend_abba) enum suspend other; if (first == SUSPEND_EXT_MOUSE && litest_touchpad_is_external(tp)) - return; + return LITEST_NOT_APPLICABLE; lid = litest_add_device(li, LITEST_LID_SWITCH); tabletmode = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS); @@ -7068,7 +7067,7 @@ START_TEST(touchpad_suspend_abab) enum suspend other; if (first == SUSPEND_EXT_MOUSE && litest_touchpad_is_external(tp)) - return; + return LITEST_NOT_APPLICABLE; lid = litest_add_device(li, LITEST_LID_SWITCH); tabletmode = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS); diff --git a/test/test-trackball.c b/test/test-trackball.c index ea089250..6693c469 100644 --- a/test/test-trackball.c +++ b/test/test-trackball.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/test/test-trackpoint.c b/test/test-trackpoint.c index 3bb5f7c8..ab9c057d 100644 --- a/test/test-trackpoint.c +++ b/test/test-trackpoint.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/test/test-udev.c b/test/test-udev.c index 22307026..e9aab96e 100644 --- a/test/test-udev.c +++ b/test/test-udev.c @@ -23,7 +23,6 @@ #include -#include #include #include #include