Skip to content
  • Peter Hutterer's avatar
    test: add per-device udev rule support · 4ec2947c
    Peter Hutterer authored
    
    
    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: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    4ec2947c