--verbose only works when running a specific test, sometimes we need make
check to be more verbose. Set this by default for make check, the log becomes
a lot more expressive that way
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
libunwind gives us a file and an address and usually a function name. Beyond
that, it's mostly guessing.
Fork off addr2line to resolve the addresses that libunwind gives us, if we
succeed we get a backtrace like this:
Backtrace:
0: litest_fail_comparison_int() (./test/litest.c:268)
1: disable_button_scrolling() (./test/pointer.c:115)
2: middlebutton_doubleclick() (./test/pointer.c:991)
3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f6c12d8c025]
4: litest_run() (./test/litest.c:689)
5: main() (./test/pointer.c:1280)
6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f6c11a73790]
7: ./test/test-pointer (_start+0x29) [0x403d99]
8: ? (?+0x29) [0x29]
Note: I intentionally swapped function/file name in the output to make it
easier to spot which one is fully resolved and which one is the basic
libunwind output.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The check unit test framework isn't particularly suited to having ck_assert*
calls in helper functions. A failed assertion in a helper function or the
litest framework merely gives us a the failed line in litest.c.
which doesn't tell us which test actually failed.
Add a backtracing facility with litest_backtrace(). And since this requires
wrapping all ck_assert macros with litest_assert() this patch ended up
replacing/duplicating a bunch of ck_assert_* bits. So rather than
ck_assert_int_eq() we now use litest_assert_int_eq(), etc. in the litest
framework itself.
The int comparison macros are more type-safe than ck_assert()'s macros which
just cast all the ints to intmax_t.
Backtrace is spewed to stderr, which is good enough for debugging. Example
backtrace:
FAILED COMPARISON: status != expected
Resolved to: 0 != 0
in disable_button_scrolling() (pointer.c:115)
Backtrace:
0: ./test/test-pointer (litest_fail_comparison_int+0xab) [0x40973b]
1: ./test/test-pointer (disable_button_scrolling+0x174) [0x40421b]
2: ./test/test-pointer (middlebutton_middleclick+0x40) [0x40829c]
3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f0e8a277025]
4: ./test/test-pointer (litest_run+0x107) [0x40a42b]
5: ./test/test-pointer (main+0x2fa) [0x4090e7]
6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f0e88f5e790]
7: ./test/test-pointer (_start+0x29) [0x403ce9]
8: ? (?+0x29) [0x29]
litest_backtrace() itself is copied from xserver/os/backtrace.c which git
blame attributes to Marcin.
CC: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
No effect with the current macros since they'll cast to int for us, but this
will change with the litest_assert macros.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Unfortunately, typeof(enum something) != typeof(ENUM_VALUE) and produces a
-Wsign-compare warning
Preemptively fix this, it'll show up in the upcoming litest_asssert macros
otherwise.
This fix only applies to helper functions, tests themselves wont (yet) be
switched to the new macros and don't need fixing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
unsigned vs signed in both cases, but the ck_assert macros hide that
(everything is cast to intmax_t). The upcoming litest_assert wrappers expose
these warnings, so fix them ahead of time.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
litest_add_ranged* takes a range parameter that serves as the lower/upper
boundary for a loop. This enables tests to be run multiple times, avoiding the
timeouts we triggered by having the loops inside (e.g. see 2bf8d035c and
6dd02468).
This just wraps the underlying check framework, the ranged variable is
available as "_i" in the test.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
When the device supports true hovering, it reports this
information through ABS_MT_DISTANCE.
When this axis is available, we should rely on it to
(un)hover the touches as BTN_TOUCH is most of the time
unreliable (generated by the mouse emulation in the kernel).
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Prep work for the upcoming patch to extend the timeout for tap-and-drag. And
switch the tests that rely on it over to the new function.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If we have a middle button but no wheels, enable on-button scrolling for the
middle button by default. This applies e.g. to the Logitech trackball added as
new test device here.
This makes the separate check for POINTINGSTICK obsolete but I'd rather leave
this in to be more explicit about it.
https://bugs.freedesktop.org/show_bug.cgi?id=90208
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Added in d2842893a8 but never added to the list
of devices so none of the tests ran against it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
This is sort-of legitimate, so simply disable the axes and continue.
Any real axis we require to have a real range.
https://bugs.freedesktop.org/show_bug.cgi?id=90090
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Makes it easier from a caller to check for common things without all the other
boilerplate code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This is just the required framework, it's not hooked up to anything just yet.
Hooking it up comes as separate commit to better detail why/when a device
supports emulation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This currently requires a specific udev rule to tag the device, once the
matching bits are upstream we can drop this.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This device has a couple of axes (fake MT) and a wheel. The device itself
exports 4 nodes, this device is the second node, the most problematic one.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
The helper function now prints an error message if the event type passed is
not allowed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Currently all the touchpad 2fg tests move the 2 fingers 1 at a time,
causing a finger motion which looks more like a pinch zoom in followed by
a zoom out than an actual 2fg scroll gesture. Add a helper function which
can move 2 fingers at the same time (more or less), and use this where
relevant.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The previous setting of 10 wasn't 10 mm, it was used against the deltas
normalized to a 1000DPI mouse, i.e. closer to 4mm. It was also also per-event,
so a slow movement or a high-frequency touchpad can struggle to meet the
threshold.
Change the trigger to be ~5 mm from the initial touch down, accumulated until
we either meet the threshold or the timeout expires. The first scroll event
includes the delta since the touch down rather than the most recent delta.
This removes the delay otherwise seen in scrolling and makes the scroll motion
match the finger motion. This accumulated delta only applies when exceeding
the motion threshold, when the timeout triggers the switch to scrolling the
first delta posted is the current delta.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Works as a touchpad but has no buttons.
Minor change to one of the touchpad tests: because the touch area is so big
the slow-scrolling trigger needs to be adjusted.
And because the device is an external device, the "disable on external mouse"
test needs to be adjusted.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Does what it says on the box. or at least in the manual inside the box.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
Handle everything which is not handled by the tap, (soft)button or edge-scroll
code/statemachines in a unified way. Everything is treated as a X-finger
gesture now, and the action to take on finger movement is decided by
the gesture.finger_count setting. Pointer control now simply is seen as a
1 finger gesture, and 2fg scrolling as a 2fg gesture.
This removed the need for special-casing things like switching back to
pointer mode when lifting a finger in 2fg scrolling mode, and also lays the
groundwork for adding 3+ fg gesture support.
Note that 1 test-case needs to be updated to wait for the finger mode
switching when switching mode while a gesture has already been started.
This is actually an improvement as this stops sending spurious pointer
motion events at the end of 2fg scrolling when not lifting both fingers at
exactly the same time.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
seat_button_count
seat_key_count ... uninitialized variable
t = zalloc
s = zalloc ... dereferencing potential NULL-pointer
d->ntouches_down... side-effect in assertion
Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
There isn't much purpose in having proximity in and out as different events,
combining them into one single event is more consistent with the rest of the
API, and means less code for clients to have to work with.
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Added: udev-tag detection for the tablet.
libwacom assigns ID_INPUT_TABLET to all known devices but also
ID_INPUT_TOUCHPAD to all known devices with a touch interface. That's a bug
and should be fixed there but we can work around it by checking both and
making sure only one is set.
Conflicts:
src/evdev.c
test/misc.c
Don't rely on a magic version tag, instead let a device define a udev rule and
drop that into the udev runtime directory before the device is created.
There are a couple of caveats with this approach: first, since this changes
system-wide state it may cause issues on the device the test suite is run on.
This can be avoided if the udev rules have filter patterns that ensure only
test devices are affected.
Second, the check test suite aborts but it doesn't run the teardown() function
if a test fails. So far this wasn't a problem since uinput devices disappear
whenever we exit. The rules files will hang around though, so an unchecked
fixture was added to delete all litest-foo.rules files before and after a test
case starts. Unchecked fixtures are run regardless of the exit status of the
test but run in the same address space - i.e. no ck_assert() usage.
Also unchecked fixtures are only run once per test-case, not once per test
function. For us, that means they're only run once per device (we use the
devices as test case), i.e. if a test fails and the udev rule isn't tidied up,
the next test may be unpredictable. This shouldn't matter too much though.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Notable: sends BTN_0/1/2 instead of the trackpoint
This device currently has the INPUT_PROP_TOPBUTTONPAD property set, kernel
patches [1] and [2] are pending to remove this. This test device already lacks
the property.
[1] https://patchwork.kernel.org/patch/5730371/
[2] https://patchwork.kernel.org/patch/5730451/
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This device sends touch information before BTN_TOUCH
https://bugs.freedesktop.org/show_bug.cgi?id=87197
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
An upcoming synaptics semi-mt device needs the same code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Sending separate axis events instead of one unified events is limiting,
especially when simultaneously scrolling in both directions and the caller
tries to implement kinetic scrolling.
Take a page from the tablet-support branch and instead implement the axis
event as a generic event that can contain multiple axes simultaneously.
Right now we only have two (scroll) axes and we could easily just check both
for non-zero values. If we want to allow further axes in the future, we need
a check whether an axis is set in an event, that's what
libinput_event_pointer_has_axis to scroll events() is for.
We also need the mask to notify of a scroll stop event, which could otherwise
be confused as a vertical-only or horizontal-only event.
This is an API and ABI break.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
In a few tests we care about that a specific set of events are in the queue
but not about the details of the events (usually checked elsewhere). Instead
of manual loops, provide a helper function that also checks that there is at
least one of those events in the queue.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>