Commit graph

461 commits

Author SHA1 Message Date
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
Peter Hutterer
e06701201f test: add a Cintiq 13 HDT test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-12 15:14:30 +10:00
Peter Hutterer
3c113111fa Remove LIBINPUT_EVENT_TABLET_PAD_MODE event
Unimplemented and it wasn't supposed to be in the series.

https://lists.freedesktop.org/archives/wayland-devel/2016-June/029376.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-07-11 11:00:51 +10:00
Peter Hutterer
601cdeeb95 test: up the timeout to 30s
10s is not enough when running the test suite in parallel as any test may have
to wait longer than that to get access to the udev lock. Especially for
tests with multiple timeouts it was too easy to trigger timeouts.

Up the timeout to 30s, this seems reliable enough now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-07-05 11:28:43 +10:00
Peter Hutterer
030ec053fb test: create a lock file to avoid parallel udev reloads during device add
litest_add_device and litest_delete_device trigger a udev rule reload. This
messes with some test devices and when we run multiple tests in parallel we
get weird errors like "keyboard $BLAH failed the touchpad sanity test".

Still not 100% reliable to run tests in parallel, but it's vastly improved
now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-07-05 11:28:43 +10:00
Peter Hutterer
b5ea413724 test: fix a memleak when creating udev devices
If the first device we got didn't have the expected syspath we'd leak the
device and cause the valgrind tests to fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-05 11:14:39 +10:00
Peter Hutterer
30bc86f47e test: add pad mode group tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-24 13:29:18 +10:00
Peter Hutterer
d520c5bb84 test: add an Wacom EKR test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-24 13:29:18 +10:00
Peter Hutterer
6583f4bb53 pad: Add a new API for modes and mode groups
Move mode control to libinput. This reduces some flexibility on what we can do
with modes but makes it a lot easier for anyone to implement modes correctly
and have the LEDs apply appropriately, etc. Let's go with the option to make
the 95% use-case easy. Note: whether the mode is actually used is up to the
caller, e.g.  under Windows and OS X the mode only applies to the
rings/strips, not the buttons.

A tablet pad has 1 or more mode groups, all buttons/ring/strips are assigned
to a mode group. That group has a numeric mode index and is hooked to the
LEDs. libinput will switch the LEDs accordingly.

The mode group is a separate object. This allows for better APIs when it comes
to:
* checking whether a button/ring/strip is part of a mode group
* checking whether a button will trigger a mode transition

and in the future potentially:
* checking which mode transition will happen
* setting which button should change the mode transition
* changing what type of mode transition should happen.
* moving a button from one mode group to the other

This patch adds the basic scaffolding, without any real implementation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Proofread-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-22 11:57:07 +10:00
Peter Hutterer
28f75d9f9d Merge branch 'wip/touchpad-drop-hysteresis' 2016-06-20 09:26:44 +10:00
Peter Hutterer
89747d7143 Revert "touchpad: reset the motion history on significant negative pressure changes"
We will reinstate the hysteresis for all devices making the negative
pressure check unncessary.

This reverts commit ef48c07a96.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:23:51 +10:00
Peter Hutterer
9bb0cfd878 test: add an apple magicmouse device
This device has a touchpad on the mouse but it's labeled as mouse. For litest
we only label it as LITEST_MOUSE feature and test the touchpad directly on the
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:17:38 +10:00
Peter Hutterer
5f55d71774 test: when creating an abs test device, force the abs->value to the mimimum
Otherwise the abs->value could lie outside the [min, max] range of the axis.
This isn't much of an issue for actual axes but in the case of ABS_MT_SLOT
(value 47) it causes errors when libevdev sanitises the event into the allowed
slot range.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:17:38 +10:00
Peter Hutterer
41b9078eec test: skip manually setting uinput resolution if it's already set
If we have libevdev 1.5 or later, the resolution is already set, no need to
change it again. Let's rely on libevdev to do the right thing and simply skip
the rest if we have one correct nonzero resolution already set on the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-20 09:58:19 +10:00
Peter Hutterer
fb5a97211b test: add a keyboard test device with all codes enabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-17 07:58:15 +10:00
Peter Hutterer
064c72a52a Merge branch 'wip/tablet-pad-support' 2016-04-18 13:31:46 +10:00
Peter Hutterer
d82cfa1d53 test: tablet pad tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00
Peter Hutterer
b2a3706948 Add the LIBINPUT_DEVICE_CAP_TABLET_PAD capability and matching interface
This interface handles the buttons on the physical tablet itself, including
the touch ring and the strip.

A notable difference to other libinput interfaces here is that we do not use
linux/input.h event codes for buttons. Instead, the buttons are merely
numbered sequentially, starting at button 1. This means:
* the API is different, instead of get_button() we have get_button_number() to
  drive the point home
* there is no seat button count. pads are inherently different devices and
  compositors should treat them as such. The seat button count makes sense
  when you want to know how many devices have BTN_LEFT down, but it makes no
  sense for buttons where all the semantics are handled by the compositor
  anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00
Peter Hutterer
fcc9a2bf18 evdev: always defuzz absolute touchscreens
If a touchscreen has a fuzz value use it for motion hysteresis similar to how
we do it for a touchpad. This stops pointer wobbles as seen in
https://bugs.freedesktop.org/show_bug.cgi?id=94918

It's up to the system to override or set the kernel's fuzz value correctly,
i.e. a udev hwdb entry is required where the kernel driver does not set it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-04-18 08:40:42 +10:00
Peter Hutterer
abcb99a597 test: fix printf for unexpected tablet events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 11:11:19 +10:00
Peter Hutterer
c420747be4 test: reduce the default abs-max range to avoid ENOMEM
This path is hit when we set up an abs device without setting specific axis
ranges. Usually because we only care that the axis is there, not the values,
see the tests of invalid devices.

0xffff is fine as max for most axes but setting it for ABS_MT_SLOT can cause
allocation errors. Reduce to 100 because we don't care about the range anyway
and 100 is still big enough for basic tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 08:05:52 +10:00
Peter Hutterer
aa90121125 touchpad: reset the motion history on significant negative pressure changes
Resetting the motion history has the side-effect of swallowing movements, we
don't calculate deltas until we have 4 motion events. During a finger release,
we're likely to get a large pressure change between two events, resetting the
motion history prevents the cursor from jumping on release.

The value of 7 found by trial-and-error, tested on the T440 and T450 hardware.
The absolute value is highly variable but recordings show that the pressure
changes only by 1 or 2 units during normal interaction. Higher pressure
changes are during finger position changes but since those should not cause a
jump anyway, we tend to win there too.

Currently only enabled for negative pressure changes, let's see how we go with
that.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-30 14:07:26 +10:00
Peter Hutterer
197bad1676 test: add Wacom Cintiq 24HD Pen
One test now gets close enough to 100% of the axis value that
ck_assert_double_lt() is not fine-grained enough. Switch to a direct x < 100.0
check.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-11 16:02:22 +10:00
Peter Hutterer
61c4ed9d7a Indentation fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 13:54:04 +10:00
Peter Hutterer
0b0150e08d touchpad: if we have a serio keyboard, override any previous dwt pairing
If a USB keyboard like the YubiKey is found before the internal keyboard, it
will be paired with the touchpad when it is seen. The internal keyboard is
seen later bug ignored because we already have a keyboard paired with the
touchpad.

This is obviously wrong. For now, give priority to serio keyboards, and
override existing dwt pairings with the new keyboard.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-05 07:43:25 +10:00
Peter Hutterer
a84bf167a3 test: fix leaking libevdev fd
This was the reason for the valgrind test case failures whenever we
accumulated too many tests (see 9c2afae1 and 2a110104). The cause was simply
that we ran out of fds which caused libevdev to fail the scandir() searching
for the event node. That resulted in a NULL devnode and an abort in litest.

Close the fd before freeing the evdev device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-05 07:40:50 +10:00
Peter Hutterer
7b21026e3a test: fix printfs to say "TABLET TOOL" instead of "TABLET"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-04 08:00:06 +10:00
Peter Hutterer
e19d5d228c evdev: disable the mode button on the Cyborg RAT 5
This button sends a release N, press N+1 on each press, cycling through the
three event codes supported. This causes a stuck button since the current mode
is never released.

Long-term this better served by a set of switches that toggle accordingly, for
now disable the button codes.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-01 08:37:41 +10:00
Peter Hutterer
de3f1fa6fa Merge branch 'master' into tablet-support 2016-01-25 15:29:11 +10:00
Peter Hutterer
d19307f20d test: when moving 2 fingers, move them in the same frame
More accurate representation of what we actually want to do. Plus it avoids
weird test case failures in semi-mt where we always pick the t/l and b/r
touches for the bounding box. That is the proper behavior for semi-mt, but
it's not for the tests where we expect simultaneous finger movement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-22 11:37:51 +10:00
Peter Hutterer
91a568d1a1 Merge branch 'master' into tablet-support 2016-01-19 12:02:51 +10:00
Peter Hutterer
988cfda42c evdev: only reject devices with missing MT x/y if they're MT devices
A fake MT device may have ABS_MT_POSITION_X but not Y. In this case we don't
care, because we don't handle those axes anyway.

http://bugs.freedesktop.org/show_bug.cgi?id=93474

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-12 09:07:36 +10:00
Caibin Chen
b3f11180e3 touchpad: fix DWT pairing for Macbook Pro 2015
Label internal keyboards through the udev hwdb and only pair the internal
(usb) Apple touchpads with those keyboards labelled as such.

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

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-11 10:11:32 +10:00
Peter Hutterer
2f481ba4a2 tablet: handle custom proximity handling
For the puck/lens cursor tool we need to artificially reduce proximity
detection. These tools are usually used in a relative mode (i.e. like a mouse)
and thus require lifting and resetting the tool multiple times to move across
the screen. The tablets' distance detection goes too far, requiring the user
to lift the device several cm on every move. This is uncomfortable.

Introduce an artificial distance threshold for the devices with the default
value taken from the X.Org wacom driver. If a tool is in proximity but outside
of this range, fake proximity events accordingly.

If a button was pressed while we were out of range we discard that event and
send it later when we enter proximity again.

This is the simple implementation that only takes one proximity out value (the
one from the wacom driver) and applies it to all. Those devices that support a
button/lens tool and have a different default threshold are well out of date.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

[rebased, tests updated for new axis percentage behavior (8d76734f)]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:15:36 +10:00
Peter Hutterer
6261e4e61f Merge branch 'master' into tablet-support 2015-12-14 12:44:05 +10:00
Peter Hutterer
1a34401137 test: set default axis values for all tablet devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:27:59 +10:00
Peter Hutterer
a4ac2bebb3 test: extend sendfile from 4kB to 40kB
The file is already larger than 4k, so we ended up truncating the file for the
tests. This went unnoticed until recent additions that ended up truncating it
halfway through an assignment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:25:56 +10:00
Peter Hutterer
727d184230 test: change extra axes to take a percentage as well
And change them to doubles, we need more granularity when the range is only
0-100.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 07:44:57 +10:00
Peter Hutterer
7ea1c134e6 test: add the HUION PenTablet device
Tablet with pressure and proximity but no distance axis.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-11 10:53:06 +10:00
Peter Hutterer
8d76734fb6 test: change extra axes to take a percentage as well
More flexible than having values that are device-specific.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-10 19:02:45 +10:00
Peter Hutterer
6e614e7bee test: use the double comparison macros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d070463a72)
2015-12-10 17:02:02 +10:00
Peter Hutterer
eb9b05f407 Merge branch 'master' into tablet-support 2015-12-09 10:19:47 +10:00