Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
1d57eda909 test: remove a duplicate check
We already checked that pointer a few lines earlier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11 15:49:02 +10:00
Peter Hutterer
9484d13773 test: swap a few litest_assert() calls for their more precise cousins
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11 15:49:02 +10:00
Peter Hutterer
43156b4f77 test: add the 24HDT pad to the custom device group
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11 15:49:02 +10:00
Peter Hutterer
8a15c404f9 test: abort if our device didn't initialize
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11 15:49:02 +10:00
Peter Hutterer
164a6a8159 test: fix an intermitted failing test
The touchpad_2fg_scroll_initially_diagonal test would semi-reliably fail under
valgrind but succeed otherwise. Cause was that on some devices, the initial
diagonal movement wasn't diagonal enough and closer to a horizontal movement.
This was fine on normal runs, but under valgrind we'd hit the "active
threshold" time limit and lock to horizontal scrolling, ditching the remaining
events and failing the test.

Fix this by calculating the scroll vector based on the device's width/height
ratio and go "more diagonal" on the initial vector.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11 15:49:02 +10:00
Peter Hutterer
bf4277623f Add a new dispatch interface for the Dell Canvas Totem
This device looks similar to a MT device on the kernel side, but it's not a
MT device and it's not quite a tablet either. It uses slots to track up to 4
totems off the same device and the only hint that it's not a MT device is that
it sends ABS_MT_TOOL_TYPE / MT_TOOL_DIAL.

udev thinks it's a touchscreen and a tablet but we currently init those
devices as touchscreen (because all wacom tablet touch devices are udev
tablets+tochscreens). So we need a quirk to hook onto this device.

And we use a completely separate dispatch implementation, because adding the
behavior to the tablet interface requires so many exceptions that it's easier
to just add a separate dispatch interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 01:03:21 +00:00
Peter Hutterer
52e86f4b2a test: force the litest feature enum to be 8 bytes or more
We've used up all bits, so let's extend the enum. (1 << 31) triggers an
assertion because we check for > LITEST_DEVICELESS. So we can't use that bit
without other changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 01:03:21 +00:00
Peter Hutterer
c9a936f1bb test: drop two unreachable statements
This was a copy-paste error in the form of

	while(event) {
	   ...}
	} while(event);

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-03 10:10:40 +10:00
Peter Hutterer
8dfe8c68eb quirks: add trackpoint integration attribute
Some versions [1] of the Lenovo ThinkPad Compact USB Keyboard with TrackPoint USB
have the pointing stick on an event node that has keys but is not a regular
keyboard. Thus the stick falls through the cracks and gets disabled on tablet
mode switch. Instead of adding more hacks let's do this properly: tag the
pointing stick as external and have the code in place to deal with that.

[1] This may be caused by recent kernel changes

Fixes #291

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28 13:23:49 +10:00
Peter Hutterer
3dc27d5d38 test: add a missing blank line 2019-05-28 13:23:49 +10:00
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
fe8a0eee3f test: make all tap tests use the "tap" group prefix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 21:02:33 +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
64df646658 test: split a test up into events vs processing
Running under valgrind, this test often fails when the machine is under load.
Split it up so the events are all processed in one go, reducing the chance of
getting a timeout while processing a previous event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 21:02:33 +10:00
Peter Hutterer
0a4d59d88d test: add test cases for tablet/touchpad left-handed rotation locks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 13:53:35 +10:00
Peter Hutterer
4f63345b60 tablet: don't disable the proximity quirk on good sequences
There are tablets out there that *sometimes* send the right event sequence,
but are generally broken. So let's not disable that quirk even if we do get a
right sequence.

Affected devices: Lenovo Flex 5
Fixes #248
Fixes #290

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 10:16:35 +10:00
Peter Hutterer
8b3aca4ceb test: fix a typo in the test device name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 09:52:04 +10:00
Peter Hutterer
08da56dc81 test: assign ID_INPUT_TABLET to the bamboo/intuos5 touchpad parts
We rely on libwacom to set this, but it doesn't do so by default for uinput
devices. Let's set this here so the parts are correctly detected as tablet
touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27 09:52:04 +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
632b0f741b test: fix the wacom bamboo touch device
Missing buttons caused it to fail sanity checks in some cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-08 14:09:28 +10:00
Peter Hutterer
803a99ac05 test: fix a bunch of tests expecting BTN_TOOL_TRIPLETAP
A device may have 1 or 2 slots without setting BTN_TOOL_TRIPLETAP, those
devices will fail those tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-08 14:09:28 +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
2185a9d6bd test: return 77 for skip when we're not running a test
This isn't technically needed since those tests aren't in the valgrind test
suite anymore. But let's have it here anyway.

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
Peter Hutterer
c35e0e734f test: update valgrind suppressions for a glib leak
Fixed upstream, but it's not in F30 yet so the valgrind tests fail there.
https://gitlab.gnome.org/GNOME/glib/merge_requests/338

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-01 12:03:38 +10:00
Peter Hutterer
6229df184e touchpad: rotate the touch part of tablets
Tablets in left-handed mode are rotated, so we need to rotate the touchpad
part of them too. This doesn't affect all tablets though, some of them are
symmetrical and the left-handed mode merely changes the button order around
(some of the earlier Bamboos). So we rely on libwacom to tell us which device
must be rotated.

The rotation itself is done on the input coordinate itself as we get it. This
way any software buttons, palm zones, etc. are automatically handled by rest
of the code.

Fixes #274

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-30 16:28:29 +10:00
Peter Hutterer
3542855902 test: use identifiable shortnames for the Intuos5 devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-30 15:34:44 +10:00
Peter Hutterer
9deb57e9b5 tablet: move tablet tool change processing to tablet_flush
Unlike virtually everything else, the tablet tool was processed at the time
the event was read rather than when the subsequent EV_SYN came in. This causes
difficulties with tablets that send the wrong BTN_TOOL_PEN events.

Moving the tool change processing to tablet_flush() makes the injection of the
BTN_TOOL_PEN event a lot easier, simply flipping the matching bit does the
job. It also makes it easier to ignore duplicate tool updates like we've seen
in #259.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-30 12:31:51 +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
Jason Gerecke
09e97a5231 test: Clean up memory leaks
A few leaks in the test code were found when running linput-test-suite
with the -fsanitize=address option enabled. Clean up these leaks so that
we can more clearly see real issues.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-11 17:50:09 +10:00
Peter Hutterer
8040c459c9 test: add proximity timeout delay to a tablet test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-11 14:59:20 +10:00
Peter Hutterer
f45a8c9ed7 tablet: tighten the test for tablet button releases on proximity out
Make sure we check the expected sequence more stringent and change the x/y
coordinates on prox in so the kernel doesn't filter them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-09 13:42:13 +10:00
Peter Hutterer
2cdda41a3b test: reduce some touch sequences to avoid tablet timeouts
We need to keep those sequences to fall below the tablet proximity timeout.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-09 13:42:13 +10:00
Peter Hutterer
b8d2fd162a test: fix the hid4800 device's prox out serial number
The test device sent a serial of 0. That would end up creating a new tool in
libinput which is wrong. Let's hope this was just an error in creating the
test device, if the device really sends that sequence, we're in trouble.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-09 13:42:13 +10:00
Peter Hutterer
1a1b6070c4 test: filter BTN_TOOL_PEN correctly for the mouse tool tests
With the previous code we'd set both tools simultaneously which isn't allowed.
It only worked because the second tool set was the one we cared about.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-09 13:41:37 +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
9bba14990a tablet: always enable the proximity out quirk
Don't require a quirk update, just enable this by default for all tablets. If
we get a proximity out event at the right time, the quirk is disabled for that
tablet for the rest of its lifetime. And it's virtually impossible to have a
false positive here anyway - you cannot hold the pen still enough to not
trigger events for 50ms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-08 11:19:19 +10:00
Peter Hutterer
ca1a75a961 tablet: log a bug when a tablet switches between tools directly
We expect the kernel to transition properly for us, e.g. BTN_TOOL_PEN goes to
0, BTN_TOOL_ERASER goes to 1. Two cases have surfaced recently where this
doesn't happen and debugging this takes time - so let's warn about it to make
it obvious.

Example 1: https://github.com/linuxwacom/libwacom/issues/70
Example 2: https://gitlab.freedesktop.org/libinput/libinput/issues/259

This is just a warning, nothing more. We should just handle that case
accordingly but that requires more effort.

Fixes #260

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-04 05:51:34 +00:00
Peter Hutterer
67ddce09bb test: drop some unnecessary extern declarations
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-02 10:48:20 +10:00
Peter Hutterer
31d1aa7f28 test: add another valgrind suppression for Python
This triggers on Fedora 30, even though skip skip the tools options test when
running under valgrind.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-28 16:14:08 +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
2edc7e37ac test: mark the protocol A device as touch device
Now that we're emulating everything correctly, let's mark it as proper touch
device.

Two test cases need to be excluded:
- double-down triggers an assert in the test device because this isn't
  possible this way with protocol A devices
- the axisrange warning test can't be triggered, mtdev clips those axes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-22 16:23:17 +10:00
Peter Hutterer
44702e947c test: switch the protocol A test device to be an actual protocol A device
This device mostly behaved like a normal touch device except for
SYN_MT_REPORT. Switch it to behave like a real protocol A device and adjust
the test accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-22 16:23:17 +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
Paolo Giangrandi
a88d73cef4 touchpad: multitap state transitions use the same timing used for taps
Multitap sequences (more than 2 taps) had a 180ms timer set only on press,
not on release.
New taps within those 180ms could either trigger multitap+drag or another
multitap (for N+1 taps), resetting the timer on press once again.
If no new tap appears within those 180ms, the sequence was considered
complete.

This behavior differed from regular taps: for the very first tap of a
sequence the timer was set both on touch and on release.

The multitap timing caused misdetection of triple-tap-and-drag sequences as
the timer was hit frequently. Some of those were correctly detected, others
as tripletap only.

Changing the timer to be set on press **and** release gives us a more lenient
timeout. 180ms for tap-and-drag and 180ms for the next tap down after
release. This was also the behavior for the xorg synaptics driver.

Note that quadruple-tap-and-drag didn't suffer from this because the timeout
resulted in double-tap + double-tap-and-drag. Which has the same
user-visible effect.
2019-03-18 02:45:00 -06: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