summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2024-10-23util: add the backtrace printing function as separate utilPeter Hutterer1-43/+5
Might as well make this easier to re-use since it doesn't do anything specific to litest. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1066>
2024-10-18test: split the touchpad tests into a palm and a dwt test collectionPeter Hutterer1-87/+95
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-18test: split the tablet left-handed tests out into a separate collectionPeter Hutterer1-12/+17
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-18test: split out the touchpad tap tests into multiple collectionsPeter Hutterer1-27/+44
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-18test: make the TEST_COLLECTION() macro re-usable in the same filePeter Hutterer1-5/+5
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-18test: detach the suite handling from the file namesPeter Hutterer1-44/+14
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-18test: match the tablet's pad test collection with the file namePeter Hutterer1-1/+1
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-16test: use a litest helper instead of return code comparisonPeter Hutterer1-6/+6
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: rename a variable to indicate suites, not testsPeter Hutterer1-6/+6
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: rename all_tests to all_test_suitesPeter Hutterer1-7/+7
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-16test: check for verbosity immediately in main()Peter Hutterer1-3/+3
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: check for empty tests immediately, not later when we're runningPeter Hutterer1-6/+6
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: init the global devices/test lists immediatelyPeter Hutterer1-4/+2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: add restore_tty helper and use itPeter Hutterer1-12/+18
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: init the device list via argumentPeter Hutterer1-6/+5
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: add a helper for deleting a created filePeter Hutterer1-7/+18
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: switch a bunch of tests from abort() to one with a messagePeter Hutterer1-41/+41
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16test: fix litest_abort_msg() not starting a new linePeter Hutterer1-12/+14
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-15test: switch the tests to use enum comparisonsPeter Hutterer16-396/+396
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: add macros to compare enum valuesPeter Hutterer1-0/+16
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-15test: switch a bunch of integer comparisons to right sizesPeter Hutterer10-46/+49
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: switch ck_assert over to litest_assertPeter Hutterer21-1792/+1728
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-15test: add litest string comparison macrosPeter Hutterer3-0/+86
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: replace manual "almost equal" with the new double epsilonPeter Hutterer1-12/+8
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: fix some checks using ints to compare doublesPeter Hutterer3-14/+14
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-15test: fix a touch test comparing ints to doublesPeter Hutterer1-2/+4
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-15test: add a macro to compare two doubles with a specific epsilonPeter Hutterer2-10/+147
Same as ck_assert_double_tol Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: initialize a variable to make scan-build happyPeter Hutterer1-1/+1
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-15test: add litest_assert_event_type_not_one_ofPeter Hutterer3-2/+41
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: replace ck_abort with litest_abort_msg()Peter Hutterer6-17/+17
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-15test: fix missing END_TEST for strv_for_each_testPeter Hutterer1-0/+1
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: fix double parsing testPeter Hutterer1-1/+1
We should check that we actually have a double here... Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: fix a data type in the utils testPeter Hutterer1-1/+1
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: add a missing va_endPeter Hutterer1-0/+1
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15test: fix uinput creation for the slotted devices with too many slotsPeter Hutterer5-6/+29
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-14test: make litest-test-suite --list YAML-compatiblePeter Hutterer1-4/+8
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14test: move the test devices into the test_device_sectionPeter Hutterer2-3/+3
Better naming this way Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14test: switch unused argc/argv to the list of testsPeter Hutterer1-7/+7
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-09-30Fix a few potential NULL dereferencesPeter Hutterer1-1/+3
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1052>
2024-09-19test: fix macro grouping in the litest.h headerPeter Hutterer1-11/+11
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19test: use litest_assert_event_type instead of direct type checkPeter Hutterer9-74/+33
This provides better debugging logs and is slightly less code in the checks too. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19test: use litest_wait_for_event instead of a NONE event checkPeter Hutterer2-4/+2
Technically we're not really waiting here since we expect the event to already be there but for these tests the distinction doesn't matter. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19test: fix use of wrong enum for setting clickfinger mapsPeter Hutterer1-2/+2
Hidden by ck_asset_int_eq type-casing everything to intmax_t Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19test: use litest_assert_empty_queue instead of a manual none checkPeter Hutterer1-4/+2
This provides better debugging printfs and is the now-recommended way to check this. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19test: add litest_dispatch() for better test debuggingPeter Hutterer20-1186/+1219
Wraps libinput_dispatch() with a location which will make things a bit easier to track. Output (in --verbose) is something like: gestures_swipe_3fg_unaccel_fn():1346 - dispatching Which makes it easier to associate the various calls to libinput dispatch with the other output from libinput. This patch switches all uses of libinput_dispatch() in test cases over but not the litest functions that may call dispatch too. Remains to be seen if that is necessary. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-19test: abort on libinput bugs againPeter Hutterer1-2/+2
This was always intended but a bug prevented the actual abort. strstr returns NULL when we cannot find the substring so we always triggered the first noop condition on bugs. Fixes: bd7b91065b13 ("evdev: warn if our event processing lags by 10ms or more") Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-19test: improve event debugging a bitPeter Hutterer2-17/+86
Add a litest_checkpoint macro and convert a few of the litest_assert macros to make use of that - this gives us a printf of the call site in case it fails. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12test: highlight the gesture state machine log messages in yellowPeter Hutterer1-0/+2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12test: make litest_wait_for_event_of_type auto-terminatingPeter Hutterer7-31/+20
Wrap this in a macro so we cannot forget to pass -1 Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12test: make litest_drain_events_of_type auto-terminatingPeter Hutterer5-12/+14
Wrap this in a macro so we cannot forget to pass -1 Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>