Commit graph

602 commits

Author SHA1 Message Date
Peter Hutterer
6ab2999be9 test: detect linebreaks in log messages
If a single log message is composed of multiple calls (as are all from
evdev_log_*), don't prefix multiple times.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
0bd36f2542 test: add color to litest verbose output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
937541cb82 test: align litest output messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
eb8cfa301a test: add missing linebreak to error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-14 12:33:15 +10:00
Peter Hutterer
be30b28a12 Merge branch 'gcov-tests'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 12:27:39 +10:00
Peter Hutterer
2dd9b77c9d test: add helper functions to filter an event
Simplest implementation for what we need right now, it turns off an event on
the evdev device and turns it back on again. This allows us to change bits in
the 'normal' event stream, such as changing the tool type without triggering
proximity events for the BTN_TOOL_PEN that all test devices send by default.

This won't work for absolute devices because we need to re-enable with a
struct input_absinfo. But we don't need that ability for now anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 11:54:03 +10:00
Peter Hutterer
f2f616a1fc touchpad: mark the Apple onebutton touchpad as clickfinger-default
We don't initialize click methods on devices with physical buttons. This model
is a special case, it's not a clickpad but it only has one button (because one
button is all you ever need and whatnot).

https://bugs.freedesktop.org/show_bug.cgi?id=99283

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 09:26:07 +10:00
Peter Hutterer
00d6b908d3 Merge branch 'touchpad-pressure-based-v2' 2017-02-03 11:41:06 +10:00
Peter Hutterer
b9b0f368cb test: fix ranged test for 'no device' tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-02 17:11:28 +10:00
Peter Hutterer
dc15a42d6c switch: for surface 3 tablets, write the lid open to the device
These tablets only ever give us a close event, the open event is broken. So
when we detect keyboard events, fix the kernel device's state by writing the
event to the fd.

We still sync the lid state manually, in case this fails and we don't get the
SW_LID through the normal event sequence. If it works fine, the real open
event will just be ignored.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-30 15:26:45 +10:00
Peter Hutterer
c27f9afffc test: make sure touch up resets pressure
Should be overridden by the test devices where something more fine-grained is
needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-30 10:50:28 +10:00
Peter Hutterer
cef3a8705e test: handle semi-mt devices in litest
Don't rely on the devices to handle themselves, just handle it globally

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:45 +10:00
Peter Hutterer
72ac3c1aee test: convert event handling while loops into for loops
No functional changes, just enables us to use 'continue' instead of piling up
negated conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:02 +10:00
Peter Hutterer
11b37080df test: allow nesting of litest_push_event_frame()
Right now, we fail if we call litest_push_event_frame() when already inside a
frame. For the semi-mt handling we need to do exactly that though, so turn it
into a counting semaphore instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:02 +10:00
Peter Hutterer
618ee6ac94 test: force a pressure of 0 when we hover a touch
As we switch to pressure-based touch detection, we need for all
pressure-capable touchpads to send pressure values. They'll do so by filling
in an axis default but that breaks our current hover code.

Make sure the hover litest helpers force a pressure of 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:01 +10:00
Peter Hutterer
7c8cecdb02 test: add two more touch..._extended functions
So we can set pressure during touch sequences

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:01 +10:00
James Ye
a817098fcb test: add tests for lid switch
Ship a custom udev rule for the test device until systemd v333 is commonplace.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
James Ye
1f0223e9fd Add a "switch" interface for parts of the SW_* range
This will allow switch devices known to libinput to be exposed. Currently,
this is SW_LID.

libinput also handles switch events internally, e.g. a laptop touchpad will
be disabled autmoatically when the lid is closed. This is transparent to
the caller, although the caller will also receive the event. See
https://bugs.freedesktop.org/show_bug.cgi?id=86223
This features is intended to be the main driver for the interface.

Co-Authored-By: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: James Ye <jye836@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
ebeba8e8ff Merge branch 'wip/wheel-tilt-source' 2017-01-20 12:51:53 +10:00
Peter Hutterer
dbb376f74b test: add wheel tilt tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-20 11:45:29 +10:00
Peter Hutterer
35421834c7 test: check the pad button state in litest_is_pad_button_event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-20 10:35:45 +10:00
Peter Hutterer
fcddfc6b11 test: add helper function to install a "bug expected" log handler
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-20 10:35:43 +10:00
Peter Hutterer
6fb1348765 Revert "Remove the workaround for libevdev pre 1.3"
I'm using semaphore CI for build testing and that only provides Ubuntu 14.04
which doesn't have libevdev 1.3 or later.

Since this is a minor workaround for an error case only, revert the commit
again and leave the handling in. Less effort than having to patch around it in
semaphore.

This reverts commit 1e0736daf3.
2017-01-16 10:24:02 +10:00
Peter Hutterer
86c2e56132 test: fix a comment regarding uinput's resolution assignment
This isn't true anymore with kernel 4.5 and libevdev 1.5.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-16 08:59:32 +10:00
Peter Hutterer
1e0736daf3 Remove the workaround for libevdev pre 1.3
1.3 has been out since Sep 2014, that's enough time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-16 08:59:32 +10:00
Peter Hutterer
a294cf4f90 test: add a synaptics RMI4 test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-12 14:45:50 +10:00
Peter Hutterer
91467f7280 test: add test for the vertical position-dependent pinch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-22 07:26:55 +10:00
Peter Hutterer
0a82d2fa39 touchpad: if an external touchpad and keyboard share a VID/PID assume dwt
This requires to expand the blacklisting to be a bit more specific so we don't
initialize dwt config on devices that won't need it.

https://bugs.freedesktop.org/show_bug.cgi?id=99140

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-20 10:21:43 +10:00
Peter Hutterer
5d2501aa7d Drop HAVE_CONFIG_H ifdef
We have one. Yay. Lucky us. Go forth and celebrate.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-12-01 11:06:54 +10:00
Peter Hutterer
31542ffbfd test: add a device and test for udev-set calibration values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:38 +10:00
Peter Hutterer
b2a6a84da1 test: switch asserts to litest_assert
Gives us a stacktrace when it fails.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-28 11:56:36 +10:00
Peter Hutterer
c9d2d5e3de test: allow the first event to be a short one during scroll tests
The hysteresis cuts the first pointer motion by the hysteresis margin. On some
touchpads this causes the tests to fail when the motion history length is
reduced (future patch). Allow the first event to be smaller than the expected
minimum.

This doesn't trigger in current tests because the hysteresis is per-event and
by the time we get past the minimum 4 events to move the pointer, we're
already flying unaffected by the hysteresis.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-22 11:23:39 +10:00
Peter Hutterer
63409a6938 test: start with the first offset when moving touches
This doesn't have an effect in our current tests because the touchpad always
needs 4 motion events to get moving. But for the future, it simplifies the
case of "i want to move between x1/y1 and x2/y2", because it fills in only the
events in between rather than re-using the touch down coordinates and thus not
causing a motion on the first event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-22 11:23:39 +10:00
Peter Hutterer
f8c2eb0736 test: mark the various abort functions as noreturn
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-22 11:23:38 +10:00
Peter Hutterer
58c7a9cbf0 evdev: implement support for the MOUSE_WHEEL_CLICK_COUNT property
Not all mice have a click angle with integer degrees. The new
MOUSE_WHEEL_CLICK_COUNT property specifies how many clicks per full rotation,
the angle can be calculated from that.

See https://github.com/systemd/systemd/pull/4440 for more information

CLICK_COUNT overrides CLICK_ANGLE, so we check for the former first and then
fall back to the angle if need be. No changes to the user-facing API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-04 12:10:52 +10:00
Peter Hutterer
ef2f95dfee Mark some internal log functions as printf-style function
Fixes the respective clang warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-25 10:00:58 +10:00
Peter Hutterer
31fdb7e6b0 test: add litest_assert_touch_sequence helper
Touch sequences are interrupted by TOUCH_FRAME events which makes them
annoying to handle event-by-event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
df781aad2f test: add trackpoint palm detection tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-07 09:20:15 +10:00
Peter Hutterer
9550cd47b2 test: add a Wacom HID 4800 test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-02 09:10:54 +10:00
Peter Hutterer
ad2a51152f test: only abort when we fail to add any tests and we have no filters
This prevents any tests from being added but not run in the normal setup. But
as soon as filters are manually specified on the list proceed anyway.
Otherwise it's impossible to run specific sets of tests, e.g. things like
running all tests applicable to a specific device with
   --filter-device=foo

Now that all tests are in the same binary we are guaranteed that at least some
tests don't apply, so the above was guaranteed to abort.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-26 14:12:44 +10:00
Peter Hutterer
a43042425e test: add a helper function to compare the event type
New error message prints the human-readable event type, not just the enum
values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-26 14:12:44 +10:00
Peter Hutterer
6cde53fc1d test: if we're in a debugger, use single-fork mode only
Don't fork by default if we're in gdb.

Note that is_debugger_attached() is now inside #ifndef LITEST_NO_MAIN, gdb for
the litest selftest will now require a manual CK_FORK=no.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 11:32:03 +10:00
Peter Hutterer
681f967c8f test: if a filter is specified, don't parallelize jobs by default
Likely testing a specific set of tests, possibly in gdb. So don't parallelize.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 11:32:03 +10:00
Peter Hutterer
eb8e1d4a13 test: add a make-like job control to run tests in parallel
Add a make-like -j/--jobs option to split the number of parallel test
processes. Defaults to 8 if not specified, future patches will default this to
1 for special cases where filters are specified or gdb is detected.

Each subprocess overwrites argv[0] to be easier identifiable in the ps
output when we're trying to figure out which tests are still running.

A -j1 is equivalent to the previous functionality, i.e. we don't fork.

One quirk needed for check: any test case not part of a test runner will not
be freed and thus triggers valgrind. We do test filtering by splitting
up the tests across multiple forks (i.e. each process has several tests that
are in the list but not added to the runner). Thus we need to mark those we
expect check to free as used.
Then on cleanup we traverse the test list, add all the unused one to a
test runner and free that test runner (without actually running it). This
cleans up both the filtered tests in each subprocess and the whole test list
in the parent process which doesn't run a test itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 11:26:58 +10:00
Peter Hutterer
68841bfd52 Revert "test: create a lock file to avoid parallel udev reloads during device add"
Not needed anymore, we only have one process creating the udev rules.

This reverts commit 030ec053fb.
2016-08-02 10:19:38 +10:00
Peter Hutterer
51fb42cb60 test: restore the hwdb/udev rules on SIGINT
We can't call system() in the signal handler but we are allowed to fork. Do
that, update the hwdb and immediately exit the child again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
f9f4bb0266 test: make sure we remove all udev rules when we SIGINT the test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
a7f04c9a84 test: only init the device rules once
The udev hwdb takes about 200ms and we still trigger it on each device. The
udev rules don't actually change after compiling, so simply create them
once and remove them after the test run.

For multiple test binaries this needed to be synchronized (which is hard),
hence the previous merge into a single binary for all tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
35b28b1af3 test: merge all tests into a single binary
Call it a libinput-test-suite-runner, in subsequent patches we'll handle doing
parallel tests ourselves instead of relying on automake features.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
bc76bd6f77 test: store created udev rules in a list for easier deletion
Easier to clean up than knowing all the destination paths we'll install.
Only affects global udev rules so far.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-01 14:49:45 +10:00