Make the test suite runner installable
Outline
Right now, the libinput test suite runner is not installed. This makes sense for a unit test but the test suite runner is a bit more than that, it does test the kernel (through uinput) and udev (device discovery) as well, including in some cases some changes to udev rules for specific devices.
This makes the test suite runner slightly more useful than a plain unit-test but to test any specific system it currently needs to be built on that system. Having the runner installed means it can be packaged and run on any system that the package can be installed on. It also makes it more reproducible, the installed runner doesn't change (as opposed to building from git every time).
Current state
As of today's git master, libinput runs these via ninja test
:
-
libinput quirks validate --data-dir=<quirks source dir>
- this is available as
libinput quirks validate
on an installed machine anyway
- this is available as
-
libinput list devices
- most basic "does it work" test, can be emulated by running the installed tools
-
test-tool-option-parsing.py
- tests a number of commandline options to the tools. Not necessary as larger test suite
-
test-builddir-lookup
- tests the builddir replacement for the correct
libinput foo
invocations. This isn't needed as we default to the libexecdir anyway
- tests the builddir replacement for the correct
-
symbols-leak-test
- true unit test, not needed on an installed version
-
leftover-rules
- this would be required to avoid the test suite tripping up because previous runs didn't complete
-
test-litest-selftest
- a true unit test
-
libinput-test-suite-runner
- the main test this issue was filed for
-
libinput-test-deviceless
- a subset of the test suite runner for systems where uinput is not available. there is no reasons to run this on an installed machine as the tests are part of the main test suite runner. It's just the test suite runner with a custom cmdline argument anyway.
Proposal
Add a new libinput test-suite
command that invokes the test suite runner based on the installed bits (i.e. prefix, etc.)
That command should:
- create and/or check the udev directories to make sure no leftover files are present from a previous run
-
install an xorg.conf file to prevent the test devices be added to the system[edit: this file would have to be in place before X is started to take effect, so better left to the administrator] - disable/inhibit any lid switch/power button press effects in the system
- invoke the test-suite-runner
Most importantly: it would use the system-installed libinput.so
, not the one from the builddir.
Distribution
Make it part of ninja install
, albeit hidden behind a default-off meson option. The large majority of users won't need this.
Distributions can decide what to do with that, Fedora would likely have a libinput-tests
subpackage (there's precedence for this with the llvm-test
package)
TODO
-
The LIBINPUT_TEST_DEVICE_RULES_FILE
must be shipped or installed in some other way -
The test suite must not install custom quirks but use the system ones -
test-device specific quirks must be installed though
-
-
split out unit tests from integration tests (e.g. tests for libinput-util.h
functions don't need to run in this thing)