Commit graph

5115 commits

Author SHA1 Message Date
Peter Hutterer
f5cc45e409 tools: add rel dial support to libinput-list-devices
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>
2024-10-22 11:54:45 +10:00
Peter Hutterer
b34010bf4e test: split the touchpad tests into a palm and a dwt test collection
dwt and palm tests have a lot of timeouts to wait for so let's split
those out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
9e00d09b30 test: split the tablet left-handed tests out into a separate collection
These aren't complicated but there's a lot of them so let's run them
separately to make the overall tablet test shorter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
532932d8aa CI: move the "device" test suite to the "misc" set of suites
That one is still with the gestures but only takes 1-2 minutes, the
gestures takes 13 minutes. Let's move it to misc which currently has an
overall runtime of only 2 min anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
a67dbefc0f test: split out the touchpad tap tests into multiple collections
These take a long time and have a reasonable high chance of failure due
to the timing constraints. Let's split them up so they don't hog the
runners for that long and in case they fail, we only need to re-run a
short test.

Before: one test running approx 21 min, now 3 tests running approx 7 +
11 + 4 min.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
8cbf535ee5 meson: break out the test suites into manual list
If we start having multiple TEST_COLLECTION() in the same file we can
no longer use the file name - so a manually maintained list it is.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
3390f2e647 test: make the TEST_COLLECTION() macro re-usable in the same file
Concat the line number to the generated variable names, this way we can
have more than one TEST_COLLECTION() in the same file.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
0135b0b41c test: detach the suite handling from the file names
Instead of extracting the suite name from the test's file name use the
current suite that is being parsed. This way we pave the way for
multiple suites in the same file.

This uses a global because otherwise we'd have to redo all the
litest_add() functions but it does the job here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
dba296d290 test: match the tablet's pad test collection with the file name
This is currently a requirement, so let's match this before we run
into issues here re-structuring stuff.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
5f744c8928 tablet: fix a memory leak caused by an early return
Previously we'd return early, failing to libwacom_destroy() the device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1064>
2024-10-18 09:48:05 +10:00
Peter Hutterer
1c80605d56 CI: set the LITEST_JOBS in the template, not the script
Fixes: 70c57e9644 ("CI: drop the job count for the valgrind test suite to 2")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1063>
2024-10-17 15:14:02 +10:00
Peter Hutterer
fb4c5dd7c6 test: use a litest helper instead of return code comparison
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
d010c6a170 test: rename a variable to indicate suites, not tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
cd957b4e79 test: rename all_tests to all_test_suites
This is a a list of struct suite with the various tests inside that
suite.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
cb0575b473 test: check for verbosity immediately in main()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
75ce537342 test: check for empty tests immediately, not later when we're running
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
6d26d83f00 test: init the global devices/test lists immediately
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
50f6e4f195 test: add restore_tty helper and use it
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
1a1a8f5378 test: init the device list via argument
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
f7cc8e05f7 test: add a helper for deleting a created file
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
57a3313d33 test: switch a bunch of tests from abort() to one with a message
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
ecb2664e05 test: fix litest_abort_msg() not starting a new line
Most callers of litest_abort_msg() don't add '\n' so the output was
mangled.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
d010c879ef doc: correct that the test suite is indeed run in the CI
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
bd62da11e4 test: switch the tests to use enum comparisons
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
151c2feae6 test: add macros to compare enum values
This requires switching a lot of int_eq/int_ne over to enum_eq/enum_ne
because the compiler doesn't infer the right type from a harcoded enum
value - it just defaults to int.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
5f4f72dca4 test: switch a bunch of integer comparisons to right sizes
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
f89fd6d924 test: switch ck_assert over to litest_assert
This is the first step in switching away from the check framework.
Our litest macros already do almost exactly the same anyway so most of
this is a simple sed with a few compiler fixes where things mismatch
(nonnull -> notnull) and (_tol -> _epsilon).

This now generates a whole bunch of integer mismatch warnings: check
casts everything to intmax_t whereas we use typeof, so lots of warnings
especially for enums.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
0bc2bf60d2 test: add litest string comparison macros
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
9a5f888795 test: replace manual "almost equal" with the new double epsilon
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
237b15b401 test: fix some checks using ints to compare doubles
Theoretically we should be using ck_assert_double_eq here for
consistency but this patch  is part of a series eventually
replacing those calls, so let's jump to litest_assert_double
directly to avoid further rebase conflicts.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
825e521d9b test: fix a touch test comparing ints to doubles
We were checking doubles for integers but better to check that we're
close to the maximum range without actually being over.

This worked because check typecasts to uint_max_t but let's be explicit
here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
6e7dd8c111 test: add a macro to compare two doubles with a specific epsilon
Same as ck_assert_double_tol

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
84f96de974 test: initialize a variable to make scan-build happy
Assuming safe_atoi works as expected, `fuzz` cannot be
uninitialized by the time we get here. But let's init it anyway to make
scan-build happy.

[202/249] Compiling C object libinput-test-suite.p/test_test-touch.c.o
../../../test/test-touch.c:964:2: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
  964 |         litest_assert_int_eq(fuzz, 10); /* device-specific */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that this error message is the result of a follow-up commit,
this commit is shuffled before so we have bisectable build.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
3ed70e864f test: add litest_assert_event_type_not_one_of
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
67061c1af0 test: replace ck_abort with litest_abort_msg()
Weirdly, that also required initializing two variables to NULL to stop a
compiler warning.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
99961d4bd1 test: fix missing END_TEST for strv_for_each_test
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
88feb3f25c test: fix double parsing test
We should check that we actually have a double here...

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
8696e80136 test: fix a data type in the utils test
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
7316a627d6 test: add a missing va_end
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
aecfcf3d1b test: fix uinput creation for the slotted devices with too many slots
Kernel commit 206f533a0a7c
       "Input: uinput - reject requests with unreasonable number of slots"
limits the number of slots to 99 - let's manually adjust that so we can
keep creating uinput devices.

Since these are just a test device and we don't use the slots here
anyway (they're all fake MT devices) we can manually work around this.
The real devices won't be affected by this since this is a limitation
in uinput, not the input subsystem.

Also move the comment one line up in the ms-surface device, the previous
comment referred to the wrong event code.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1061>
2024-10-15 09:56:19 +10:00
Peter Hutterer
c123a76b0d test: make litest-test-suite --list YAML-compatible
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14 08:56:07 +00:00
Peter Hutterer
5b5776b148 test: move the test devices into the test_device_section
Better naming this way

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14 08:56:07 +00:00
Peter Hutterer
3577369805 test: switch unused argc/argv to the list of tests
This means we don't rely on the "all_tests" global here though it also
means we need to move the cleanup into the caller.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14 08:56:07 +00:00
Muhammad Talal Anwar
b89b0ccafb quirks: add Logitech ERGO M575(S)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1058>
2024-10-07 21:06:05 +00:00
Peter Hutterer
2b77bdab5c gestures: change a boolean to an enum for more expressive code
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
0fd074c974 gestures: add debugging for state transitions
Our state machine allows falling through multiple transitions, so let's
make it possible to debug this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
68a2ff0d49 gestures: get rid of tp_gestures_start
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
89596e61f8 gestures: rename gesture_notify_hold to gesture_notify_hold_begin()
HOLD gestures only have begin/end so let's rename this so it's
immediately obvious which one we're sending.

notify_swipe/pinch pass the event type in so it's clear that it's a
BEGIN vs an UPDATE.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
8899800de8 gestures: rename most events to FOO_START
These events aren't used to signal scroll/swipe/pinch/..., merely to
signal the start of that gesture. So let's rename it to make the code
clearer (e.g. why do we log a bug when for a FOO event when we're in
state FOO?).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
e88007d4ae gestures: push tp_gesture_start() for hold gestures into the state handling
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00