Commit graph

602 commits

Author SHA1 Message Date
Peter Hutterer
3d8daf99e5 test: remove hwdb leftovers
We don't write hwdb entries anymore, so let's drop any reference to it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 06:53:51 +00:00
Peter Hutterer
f612c1ef0c tablet: add tilt-based touch arbitration for screen tablets
If the tilt angle on tip down is not 0 set the touch arbitration to a
rectangle around the assumed position of the hand. This assumed position is
right of the tip for a rightwards tilt and left of the tip for a leftwards
tilt (i.e. left-handed mode). The rectangle is 200x200mm with a 20x50mm
NW of the tip or NE for left-handed. In other words, if the period below is
the tip, the rectangle looks like this:

    +-----------+                          +-----------+
    | . 	| <- for rightwards tilt   |         . |
    |           |                          |           |
    |           |                          |           |
    |           |    for leftwards tilt -> |           |
    +-----------+                          +-----------+

Touches within that rectangle are canceled, new touches are ignored. As the
tip moves around the rectangle is updated but touches are only cancelled on
the original tip down. While the tip is down, new touches are ignored in the
exclusion area but pre-existing touches are not cancelled.

This is currently only implemented in the fallback interface, i.e. it will
only work for Cintiqs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
afbb90daeb test: add an additional final libinput_dispatch()
After the test device was removed, run one more libinput_dispatch(). This may
catch some errors that happen due to the device removal that were ignored for
now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
8987773440 test: store the device type in the test device struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:01:31 +10:00
Peter Hutterer
655f565fba touchpad: if two fingers are within the lower thumb area, they're not thumbs
The shape of the average hand implies that two fingers down within the lower
thumb area (the bottom few mm of the touchpad) cannot be thumbs without
significant contortion. So let's not mark them as thumb.

Fixes #126

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-03 14:52:36 +10:00
Peter Hutterer
e09c822fd1 udev: re-instate the model-quirks callout
This was removed accidentally as part of a9ef4ba1f3 and then completely dropped in
870ddce9e4 when the hwdb was deprecated completely. The model quirks call
is also the one that reads and sets the LIBINPUT_FUZZ property, effectively
making that code a noop.

Fixes #138

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-10 15:57:27 +10:00
Peter Hutterer
65f890a352 test: abort when we detect a touch jump during the tests
We never want to accidentally trigger this one. Where we trigger them on
purpose, we can swap the log handler out first.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
7768d7d981 test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.

Cocinelle spatch files were variants of:
	@@
	expression A, B, C, D, E, F, G, H, I, J, K;
	@@

	- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
	+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)

The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
20a9c38db0 test: force 10ms intervals for touch moves, unless specified otherwise
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
040892572f test: re-use code in litest_touch_move_to()
We can use the _extended version here. And it turns out the behavior was
slightly different, with the _extended version doing one step too few.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:01 +10:00
Peter Hutterer
fffae6fb27 test: when testing for a touch sequence, assert it's the same slot's sequence
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-14 08:54:09 +10:00
Peter Hutterer
c8e0e94c00 test: replace hand-rolled backtrace function with gstack
Let's use something that specializes in that task and does a better job of it
than whatever we'll come up with. Due to how it's implemented the stacktrace
will always show waitpid() as frame 0 now but we can live with that.

gstack prints to stdout but litest_log() uses stderr, so we cannot just call
system(), we have do do the pipe/fork/exec/waitpid/read dance.
We could use that to filter the #0 frame showing waidpid() from gstack but
meh.

This drops the libunwind and addr2line dependency and replaces it with gstack
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:43:45 +10:00
Peter Hutterer
335554a80e test: remove the deviceless test runner, make it a commandline arg instead
No need to rebuild everything with an ifdef, we can just use meson to pass an
argument to the test itself and filter based on that. This drops about 100
ninja targets.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:08:32 +10:00
Peter Hutterer
0d27a3399d test: switch two ints to bools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:08:32 +10:00
Peter Hutterer
3b6cb471d3 test: remove an obsolete comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 10:39:58 +10:00
Peter Hutterer
abab7f1609 test: handle ABS_MT_TOOL_TYPE from the litest devices
We want to autoreplace this value where possible but not scale it to min/max,
this is effectively an enum. The same is true for slot/tracking id, so let's
add it here too.

Because it's an enum and 99% of the cases require MT_TOOL_FINGER, we always
fall back to that instead of using the axis_defaults that we use for other
axes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-03 13:29:20 +10:00
Peter Hutterer
2855e26d6f test: add test helpers for touch sequence parts
The necessary helpers to test for a touch event + one touch frame and the
extra case for the TOUCH_CANCEL in is_touch_event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-03 13:29:20 +10:00
Peter Hutterer
5f589c8582 test: release a few leaking udev devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-26 11:51:21 +10:00
Greg V
d23074cec9 test: ptrace compatibility with *BSD 2018-07-16 13:48:54 +03:00
Greg V
8cc4de5fc9 test: use simple portable sendfile
There's no need for high performance in these little tests, so instead of
supporting various platform-specific sendfile() implementations, just use a local read-write function.
2018-07-16 13:48:54 +03:00
Greg V
63a2180b40 test: support disabling tty on FreeBSD
Instead of K_OFF, use K_RAW plus termios raw mode.
(Same approach as in the Weston patches)
2018-07-16 13:48:51 +03:00
Peter Hutterer
e6cad92005 Rename data/ to quirks/
A better, less ambiguous name than just "datadir"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-13 13:30:54 +10:00
Peter Hutterer
76233364b1 test: parse arguments before any other stuff
If the args are bad, we don't need to check for root and whatnot.

Only exception here is the debugger check because it changes defaults that we
may want to override with commandline arguments later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-26 13:51:23 +10:00
Peter Hutterer
5ca1862bde test: add a libinput-test runner for 'deviceless' tests
These are tests that don't need *any* uinput devices at all. Mark them
accordingly and create a new binary that only runs those tests. This way we
can run some of the test suite even in containers where we're restricted.

Better have 10% tested than none, I guess.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-26 11:18:31 +10:00
Peter Hutterer
07a0d04fd3 test: switch the global device list to a struct list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-25 11:14:48 +10:00
Peter Hutterer
3f72d6df2e test: if we never installed any udev files, we don't need to reload
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-25 11:08:37 +10:00
Peter Hutterer
0a9c28c8c0 test: skip the test-suite runner based on SKIP_LIBINPUT_TEST_SUITE_RUNNER
The current /dev/input/* check isn't reliable enough. So rather than adding
extra heuristics prone to fail add an environment variable that says "do not
run the test suite runner". All other tests are run since they do not
require/modify any specific system setup.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/62

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-21 15:46:04 +10:00
Peter Hutterer
4de756766c test: remove a compiler warning
Leftover from a previous iteration of this code - having a static but
unnecessarily large size for dirname results in:

../test/litest.c:1251:38: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
   snprintf(dest, sizeof(dest), "%s/%s", dirname, filename);
                                      ^
../test/litest.c:1251:3: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096
   snprintf(dest, sizeof(dest), "%s/%s", dirname, filename);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-19 13:13:24 +10:00
Peter Hutterer
7266ed600a test: pass the open mode to open(O_CREAT)
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-18 13:41:18 +10:00
Peter Hutterer
870ddce9e4 Drop the udev hwdb model quirks
Replaced with the quirks files in merge commit
000ac14c27

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-18 11:04:43 +10:00
Peter Hutterer
a50e13d50f test: init the quirks once per test suite run
So we have them available per litest device and can check in tests for certain
quirks to be present.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:37:17 +10:00
Peter Hutterer
5e4dee22fd test: install per-test device quirks files
These will replace the custom udev rules we currently have in place.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 14:33:35 +10:00
Peter Hutterer
c81809d0aa test: remove created directories too
If we created it, remove it again. No change because we're not adding any of
the directories yet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 13:47:33 +10:00
Peter Hutterer
4738c5cde5 test: make litest_copy_file copy normal files too
Make the tempfile creation dependent on whether the required template is
present. Currently unused, this is just prep work for future patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-08 13:47:33 +10:00
Peter Hutterer
d5c705a539 tablet: increase the proximity timeout during test runs
This is causing too many false positives and they're not easy to filter out.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 09:42:06 +10:00
Peter Hutterer
25d309bde7 test: print the device name for a wrong event
So we can rule out any between device race conditions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-20 14:25:57 +10:00
Peter Hutterer
dec1b4f93c test: print the full event in case of a mismatch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-20 14:25:54 +10:00
Peter Hutterer
2857cfe87d test: use a udev monitor to wait for a device to disappear
Reduces potential race conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-18 14:36:31 +10:00
Peter Hutterer
fb8a5b040a test: replace a strcmp with streq
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-18 14:36:31 +10:00
Peter Hutterer
1531c9dc88 test: call K_OFF when run on the vt
Slight disadvantage: this breaks Ctrl+C to cancel the test suite. Still
potentially better than injecting random events into your vt.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-04-06 10:35:36 +10:00
Peter Hutterer
1e9925735a test: reliably sort the udev rules
This guarantees the device rules have a static order between test runs.
Previously and in some cases, the temporary file name could affect the order
of the udev rules - let's not do that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-23 10:17:52 +10:00
Peter Hutterer
ce80e40006 test: move all the _setup() functions into a special section
This way we can loop through them instead of having to add them manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-23 10:17:52 +10:00
Peter Hutterer
ab59264bb3 test: fix vert axis printing on error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-21 10:18:45 +10:00
Peter Hutterer
2a378beab0 touchpad: delay arbitration by 90ms after touch toggle
When drawing on a tablet, the hand usually rests on the device, causing touch
events. The kernel arbitrates for us in most cases, so we get a touch up
and no events while the stylus is in proximity. When lifting the hand off in a
natural position, the hand still touches the device when the pen goes out of
proximity. This is 'immediately' followed by the hand lifting off the device.

When kernel pen/touch arbitration is active, the pen proximity out causes a
touch begin for the hand still on the pad. This is followed by a touch up when
the hand lifts which happens to look exactly like a tap-to-click.

Fix this by delaying the 'arbitration is now off' toggle, causing any touch
that starts immediately after proximity out to be detected as palm and
ignored for its lifetime.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21 15:58:35 +10:00
Peter Hutterer
dd096a50fe touchpad: add a touch index for debugging
Makes debugging a bit easier when you know *which* touch was marked as palm,
etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-20 15:45:01 +10:00
Peter Hutterer
d4b76be18b evdev: log all evdev_msg_* on one line
So we don't have to have newline handling in the callers. This effectively
reverts 6ab2999be9 "test: detect linebreaks in log messages".

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 19:29:26 +10:00
Peter Hutterer
394f343e70 test: don't abort for timer offset errors during valgrind runs
Too easy to trigger with the short button debouncing offsets

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-01 16:52:02 +10:00
Peter Hutterer
7175cafe78 test: inhibit nasty keys and switches during test runs
Having the system suspend or shutdown halfway through a test run is a tad
annoying. So let's talk to logind and tell it to inhibit the various keys
we're testing.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-01 16:52:02 +10:00
Peter Hutterer
613ecda1cb test: collect test case failures and print them on each fd
When running the test suite in full fork mode, the error messages are in the
quite verbose output and searching for them is annoying. Work around this by
opening a pipe to each subprocess and writing the failed test cases to that
pipe. When all tests have finished, print the messages to stdout. This way the
failures are always the last thing printed by the test suite.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-09 13:47:42 +10:00
Greg V
8adfac3975 Include stdarg.h where variadic functions are used
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-01 09:31:42 +10:00