config_h.set('HAVE_VERSIONSORT', '1')
endif
+if cc.get_define('SYS_pidfd_open', prefix: '#include <sys/syscall.h>') != ''
+ config_h.set('HAVE_PIDFD_OPEN', '1')
+endif
+
+if cc.has_function('sigabbrev_np', prefix: '#define _GNU_SOURCE 1\n#include <string.h>')
+ 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()')
# 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())
'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,
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',
# 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',
--- /dev/null
+/*
+ * 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 <errno.h>
+#include <sys/epoll.h>
+#include <sys/timerfd.h>
+#include <sys/sysinfo.h>
+#include <sys/wait.h>
+#ifdef HAVE_PIDFD_OPEN
+#include <sys/syscall.h>
+#endif
+#include <fcntl.h>
+#include <stdlib.h>
+#include <signal.h>
+
+#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;
+}
--- /dev/null
+/*
+ * 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);
#include <sys/resource.h>
#include <sys/time.h>
-#include <check.h>
#include <signal.h>
#include <valgrind/valgrind.h>
#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 <check.h>
START_TEST(litest_assert_trigger)
{
#include "config.h"
-#include <check.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include "util-files.h"
#include "litest.h"
+#include "litest-runner.h"
#include "litest-int.h"
#include "libinput-util.h"
#include "quirks.h"
void *teardown;
struct range range;
+ int rangeval;
bool deviceless;
};
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
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)
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
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;
+
+ 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_insert(&suite->tests, &t->node);
+ list_append(&suite->tests, &t->node);
+ } while (++rangeval < range->upper);
}
static void
.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)
{
vfprintf(stderr, format, args);
}
+#if 0
static void
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;
-
- data_path = getenv("LIBINPUT_QUIRKS_DIR");
- if (!data_path)
- data_path = LIBINPUT_QUIRKS_DIR;
-
- 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) {
- list_for_each(t, &s->tests, node) {
- Suite *suite;
- TCase *tc;
- char *sname, *tname;
+ struct litest_runner *runner = litest_runner_new();
- count = (count + 1) % max;
- if (max != 1 && (count % max) != which)
- continue;
+ litest_runner_set_num_parallel(runner, jobs > 0 ? jobs : 0);
+ litest_runner_set_verbose(runner, verbose);
+ litest_runner_set_timeout(runner, 30);
- 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 (!sr)
- goto out;
-
- 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_unref(quirks_context);
-
- 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]);
+ list_for_each(s, suites, node) {
+ struct test *t;
+ list_for_each(t, &s->tests, node) {
+ struct litest_runner_test_description tdesc;
+
+ 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++;
}
}
- /* parent process only */
- while (wait(&status) != -1 && errno != ECHILD) {
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
- failed = 1;
+ if (ntests > 0) {
+ const char *data_path = getenv("LIBINPUT_QUIRKS_DIR");
+ if (!data_path)
+ data_path = LIBINPUT_QUIRKS_DIR;
+
+ 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);
}
- for (f = 0; f < max_forks; f++) {
- char buf[1024] = {0};
- int rc;
+ litest_runner_destroy(runner);
- 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
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);
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 *
const struct rlimit corelimit = { 0, 0 };
enum litest_mode mode;
int tty_mode = -1;
- int failed_tests;
int rc;
const char *meson_testthreads;
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
#include <stdbool.h>
#include <stdarg.h>
-#include <check.h>
#include <libevdev/libevdev.h>
#include <libevdev/libevdev-uinput.h>
#include <libinput.h>
#include <math.h>
-#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;
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
/* 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;
#include <config.h>
-#include <check.h>
#include <libinput.h>
#include <valgrind/valgrind.h>
!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];
!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);
!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];
uint64_t time_usec;
if (litest_slot_count(dev) < 3)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
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);
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);
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);
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);
if (!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
#include "config.h"
-#include <check.h>
#include <stdio.h>
#include "libinput-util.h"
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);
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);
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);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
}
if (!has_buttons)
- return;
+ return LITEST_NOT_APPLICABLE;
ev = libinput_get_event(li);
litest_assert_notnull(ev);
/* 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);
unsigned int count = 0;
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_LEFT))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
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);
unsigned int key;
if (!pad_has_keys(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
#include <config.h>
#include <stdio.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
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);
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.
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);
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);
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);
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);
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);
enum libinput_config_status status;
if (!libinput_device_pointer_has_button(d, BTN_MIDDLE))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_middleemu(dev);
if (!libinput_device_pointer_has_button(device->libinput_device,
BTN_MIDDLE))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_middleemu(device);
disable_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);
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);
device->libinput_device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libinput_device_pointer_has_button(device->libinput_device,
BTN_MIDDLE))
- return;
+ return LITEST_NOT_APPLICABLE;
disable_button_scrolling(device);
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);
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);
device->libinput_device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
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++) {
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);
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);
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);
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);
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);
device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
device,
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libinput_device_pointer_has_button(dev->libinput_device,
button))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_middleemu(dev);
disable_button_scrolling(dev);
if (!libinput_device_pointer_has_button(dev->libinput_device,
button))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_middleemu(dev);
disable_button_scrolling(dev);
if (!libinput_device_pointer_has_button(dev->libinput_device,
button))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_middleemu(dev);
disable_button_scrolling(dev);
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);
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);
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);
#include <config.h>
-#include <check.h>
#include <libinput.h>
#include "libinput-util.h"
#include <config.h>
-#include <check.h>
#include <fcntl.h>
#include <libinput.h>
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,
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),
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
struct libinput_event *event;
if (!switch_has_lid(sw))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = litest_add_device(li, LITEST_KEYBOARD);
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);
int rc;
if (!switch_has_lid(sw))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = litest_add_device(li, LITEST_KEYBOARD);
int rc;
if (!switch_has_lid(sw))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard1 = litest_add_device(li,
LITEST_KEYBOARD_BLADE_STEALTH_VIDEOSWITCH);
struct libinput *li = sw->libinput;
if (!switch_has_tablet_mode(sw))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_grab_device(sw);
litest_switch_action(sw,
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);
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);
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);
struct libinput *li = sw->libinput;
if (!switch_has_tablet_mode(sw))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_switch_action(sw,
LIBINPUT_SWITCH_TABLET_MODE,
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);
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);
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);
struct libinput *li = sw->libinput;
if (!switch_has_tablet_mode(sw))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_grab_device(sw);
litest_switch_action(sw,
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);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
};
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);
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);
};
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
};
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libevdev_has_event_code(dev->evdev,
EV_REL,
REL_WHEEL))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libevdev_has_event_code(dev->evdev,
EV_KEY,
BTN_TOOL_AIRBRUSH))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libevdev_has_event_code(dev->evdev,
EV_KEY,
BTN_TOOL_AIRBRUSH))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libevdev_has_event_code(dev->evdev,
EV_ABS,
ABS_Z))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!libevdev_has_event_code(dev->evdev,
EV_ABS,
ABS_Z))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
double x, y, dx, dy, mdx, mdy;
if (!device_has_calibration(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
double x, y;
if (!device_has_calibration(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
};
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);
*/
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;
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,
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);
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;
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);
other = paired_device(dev);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
finger = litest_add_device(li, other);
other = paired_device(dev);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
tablet = litest_add_device(li, other);
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);
other = paired_device(dev);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
tablet = litest_add_device(li, other);
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);
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);
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);
other = paired_device(tablet);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
finger = litest_add_device(li, other);
litest_drain_events(li);
other = paired_device(tablet);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
finger = litest_add_device(li, other);
litest_drain_events(li);
other = paired_device(tablet);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
finger = litest_add_device(li, other);
litest_drain_events(li);
other = paired_device(tablet);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
finger = litest_add_device(li, other);
litest_drain_events(li);
other = paired_device(tablet);
if (other == LITEST_NO_DEVICE)
- return;
+ return LITEST_NOT_APPLICABLE;
tablet_from = !!(transition & bit(0));
touch_from = !!(transition & bit(1));
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));
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
};
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);
};
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);
};
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);
};
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);
};
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);
};
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);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
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);
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 */
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);
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);
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);
struct libinput *li = dev->libinput;
if (litest_slot_count(dev) < 4)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_clickfinger(dev);
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);
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);
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);
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);
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);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = litest_add_device(li, LITEST_KEYBOARD);
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);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
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);
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;
/* 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);
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);
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;
struct libinput_event *event;
if (!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
litest_drain_events(li);
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);
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);
if (!litest_has_2fg_scroll(dev) ||
!litest_has_btnareas(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
litest_enable_buttonareas(dev);
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);
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);
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);
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);
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);
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);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
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);
struct libinput *li = dev->libinput;
if (!litest_has_palm_detect_size(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_edge_scroll(dev);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
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);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
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);
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);
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);
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);
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);
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);
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);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
if (!litest_has_palm_detect_size(dev) ||
!litest_has_2fg_scroll(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_2fg_scroll(dev);
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);
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);
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);
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);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_enable_clickfinger(dev);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_disable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
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);
};
if (!touchpad_has_palm_pressure(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
};
if (!touchpad_has_palm_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_clickfinger(dev);
litest_disable_tap(dev->libinput_device);
};
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);
};
if (!touchpad_has_touch_size(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_clickfinger(dev);
litest_disable_tap(dev->libinput_device);
};
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);
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);
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);
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);
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);
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);
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);
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);
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);
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++) {
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);
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);
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);
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);
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);
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);
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
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);
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);
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);
};
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
};
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
};
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
};
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
};
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_disable_tap(touchpad->libinput_device);
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);
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);
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);
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);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_edge_scroll(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_edge_scroll(touchpad);
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));
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));
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
disable_dwt(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
enable_dwt(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
enable_dwt(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
enable_dwt(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
enable_dwt(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
disable_dwt(touchpad);
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
- return;
+ return LITEST_NOT_APPLICABLE;
disable_dwt(touchpad);
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);
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);
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);
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);
litest_disable_hold_gestures(dev->libinput_device);
if (libevdev_get_num_slots(dev->evdev) < 3)
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
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);
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);
litest_disable_hold_gestures(dev->libinput_device);
if (!has_thumb_detect(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
double threshold = 12.0;
if (!touchpad_has_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
};
if (!touchpad_has_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
};
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
};
if (!touchpad_has_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
};
if (!touchpad_has_pressure(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_enable_tap(dev->libinput_device);
litest_disable_hold_gestures(dev->libinput_device);
/* 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);
};
if (!touchpad_has_touch_size(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
};
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);
if (!touchpad_has_touch_size(dev) ||
litest_touchpad_is_external(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!touchpad_has_touch_size(dev) ||
litest_touchpad_is_external(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
if (!touchpad_has_touch_size(dev) ||
litest_touchpad_is_external(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
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);
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);
struct libinput *li = dev->libinput;
if (!has_thumb_detect(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
if (litest_has_clickfinger(dev))
litest_enable_clickfinger(dev);
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);
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))
};
if (!has_thumb_detect(dev))
- return;
+ return LITEST_NOT_APPLICABLE;
litest_drain_events(li);
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);
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);
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>
#include <config.h>
-#include <check.h>
#include <errno.h>
#include <fcntl.h>
#include <libinput.h>