diff options
Diffstat (limited to 'test/litest.h')
-rw-r--r-- | test/litest.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/litest.h b/test/litest.h index 0d133f35..d25a9a58 100644 --- a/test/litest.h +++ b/test/litest.h @@ -35,6 +35,30 @@ #include "libinput-util.h" +struct test_device { + const char *name; + struct litest_test_device *device; +} __attribute__((aligned(16))); + +#define TEST_DEVICE(name, ...) \ + static struct litest_test_device _device; \ + \ + static void _setup(void) { \ + struct litest_device *d = litest_create_device(_device.type); \ + litest_set_current_device(d); \ + } \ + \ + static const struct test_device _test_device \ + __attribute__ ((used)) \ + __attribute__ ((section ("test_section"))) = { \ + name, &_device \ + }; \ + static struct litest_test_device _device = { \ + .setup = _setup, \ + .shortname = name, \ + __VA_ARGS__ \ + }; + extern void litest_setup_tests_udev(void); extern void litest_setup_tests_path(void); extern void litest_setup_tests_pointer(void); |