diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2015-02-02 10:47:52 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-02-03 10:34:26 +1000 |
commit | 4ec2947cc9fb804c9bc0262563e5b373affb4c42 (patch) | |
tree | 2bf597a73e38f1fa75962452d50d8cb776f6618f /test/litest-int.h | |
parent | 7d7ea4ec2ea87f73cefaab86e5e6ac17ff60e4c0 (diff) | |
download | libinput-4ec2947cc9fb804c9bc0262563e5b373affb4c42.tar.gz |
test: add per-device udev rule support
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>
Diffstat (limited to 'test/litest-int.h')
-rw-r--r-- | test/litest-int.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/litest-int.h b/test/litest-int.h index 95bc2483..12746f1b 100644 --- a/test/litest-int.h +++ b/test/litest-int.h @@ -69,6 +69,8 @@ struct litest_test_device { */ struct input_absinfo *absinfo; struct litest_device_interface *interface; + + const char *udev_rule; }; struct litest_device_interface { |