Commit graph

475 commits

Author SHA1 Message Date
Peter Hutterer
7147d5a211 test: don't treat a signal exit as success
WEXITSTATUS() "should be employed only if WIFEXITED returned true", see
wait(2). If a test failed with an abort, WIFEXITED is false and WEXITSTATUS
is... undefined? and apparently zero, so test case failures would cause a
false postive test result.

This doesn't affect a normal test run because check handles the aborts
correctly, but the valgrind invocation with CK_FORK ended up being handle by
litest. So with the result that any abort during valgrind was a silent success
and if there was a memleak in the same process that exited with a signal, the
memleak would be ignored too.

Fixes #267

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28 10:32:08 +10:00
Peter Hutterer
9b414faea2 test: allow for a LITEST_JOBS environment variable
valgrind struggles with too many parallel jobs, too easy to hit timeouts.
Let's reduce this for the valgrind runs.

Meson doesn't let us pass arguments through depending on the setup, so let's
make this an environment value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28 10:23:25 +10:00
Peter Hutterer
d2cce8298d test: always set CK_FORK=no under valgrind
Set this in the code rather than the environment variable to make it easier to
run valgrind manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 21:02:33 +10:00
Peter Hutterer
1e73cccfd9 test: make the test case failure output easier to select
Split the suite and test case name up so it's easier to select with a
double-click in the terminal. Because usually those tests need to be re-run
individually and making that easier is a good thing.

Previously:
:: Failure: ../test/test-tablet.c:4434:touch_arbitration:wacom-cintiq-13hdt-pen-tablet

Now:
:: Failure: ../test/test-tablet.c:4434: touch_arbitration(wacom-cintiq-13hdt-pen-tablet)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-09 13:57:45 +10:00
Peter Hutterer
cac9d53789 test: drop the SKIP_LIBINPUT_TEST_RUNNER environment variable
We have the meson test suites now that we can use to filter which tests to
run, let's use those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-07 04:48:00 +00:00
Peter Hutterer
32cd8ae011 test: skip the backtrace under valgrind
gstack can't resolve the backtrace under valgrind anyway, so let's just skip
it altogether.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-07 04:48:00 +00:00
Peter Hutterer
01efe9de4f test: replace the USING_VALGRIND env with the valgrind.h header
This header is intended to be included in the project, so let's do that and
have proper runtime detection of the valgrind environment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-07 04:48:00 +00:00
Peter Hutterer
dd96d6b900 Revert "Reduce button scroll timeout to 38ms"
This introduces a regression, see #265. Reverting until a better solution can
be found.

This reverts commit 5dae7aac38.
2019-05-02 10:53:54 +10:00
Jason Gerecke
657842093c test: abort when no default value is available for an axis
And fix the cases where the default value isn't filled in correctly

Issue found because of the following ubsan error:
../src/evdev-tablet.c:182:19: runtime error: signed integer overflow: 0 - -214783648 cannot be represented in type 'int'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-11 17:50:09 +10:00
Peter Hutterer
bdd6f3d40b test: actually filter events when writing to udev
Don't write events to the uinput device if we disabled that specific event
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-09 13:41:03 +10:00
Peter Hutterer
26702e4d73 Fix three coverity complaints
Two resource leaks, one uninitialized variable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-25 15:15:13 +10:00
Peter Hutterer
11adaadd51 test: let the device custom create method return a bool
This is so we can tell litest to create the device anyway, useful for when all
we have to do in the custom create is allocate some memory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-22 16:23:17 +10:00
Peter Hutterer
566d73aa3d test: don't install our normal rules file in installed mode
When running the test-suite, don't install our rules for device groups and
model quirks - they're expected to be present already.

Plus, since we copy them from the meson build dir, we don't have
those files available anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-22 03:21:22 +00:00
Peter Hutterer
be7045cdc7 test: make the test suite runner available as installed binary
Available as 'libinput test-suite'. This also renames the bit in the build
directory now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 12:04:22 +10:00
Peter Hutterer
2df11f8708 test: add an option to skip installing our quirks into the test system
This allows us to run the test suite runner against the installed system
rather than always using the build tree quirks.

The actual option will be removed in a future commit, it is just here for
commit consistency and testing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
4e0a362803 test: split up the quirks installations
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
27188228fd test: install the test device udev rule from a string
It's a one-liner, we don't need this as a separate file. Plus, this makes the
test suite runner less dependent on the build directory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
fefddeda4d test: add --help to the test suite runner
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:00 +10:00
Peter Hutterer
5a05e41940 test: clip the exit code to 255
If more than 255 tests fail, we're returning an exit code outside of the POSIX
standard. This only takes effect for -j1, where we fork off we only ever have
a failed value of 1 anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 15:10:15 +10:00
Peter Hutterer
87abdf1f63 test: minor warning message change
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 15:10:15 +10:00
Henré Botha
5dae7aac38 Reduce button scroll timeout to 38ms
When using button scrolling, a hardcoded delay of 200 milliseconds between
button down and scroll events being emitted makes fast scrolling gestures feel
clunky and sometimes fail entirely. This feature comes from
xf86-input-mouse, was copied into xf86-input-evdev and reimplemented in
libinput.

This was, as far as can be determined, to allow right clicks without
triggering scrolling. libinput now also has distance triggers (2bbf4a0117)
and sends button events if no movement has happened for long clicks,
regardless of the delay.

The 200ms delay is thus not really necessary anymore, let's drop it to 38ms
which is just above the 3-event threshold for 8/10/12ms intervals which is
most devices.

Fixes #237

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 10:37:05 +10:00
Peter Hutterer
19aac0e4be test: add another helper to discard specific events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
9abc55e484 test: make litest robust for ABS_MT_POSITION_X-only devices
The Dell Canvas Totem only has the MT axes but not the single touch ones. Make
sure we copy the axis extents correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
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