diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-08-04 12:49:59 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-09-18 11:30:15 +1000 |
commit | 647b2ba18d0ebcacd70c3f808197b8c8d3c8ea07 (patch) | |
tree | b49dfc50082793c659144db930aeeba0ed58d04d /test | |
parent | e9239d81a95e7968a2a3bc929cde63a0cc64b8e3 (diff) | |
download | libinput-647b2ba18d0ebcacd70c3f808197b8c8d3c8ea07.tar.gz |
test: avoid erroneous devices to be passed into the test suites
The litest features overlap with the litest device specifiers, so it's easy to
pass in LITEST_MOUSE where LITEST_POINTER should be passed in, and vice versa.
Lacking proper type checking the best we can do here is simply move the
devices into the negative range and check for that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/litest.c | 5 | ||||
-rw-r--r-- | test/litest.h | 20 |
2 files changed, 15 insertions, 10 deletions
diff --git a/test/litest.c b/test/litest.c index f99d145a..e5e7316c 100644 --- a/test/litest.c +++ b/test/litest.c @@ -159,6 +159,9 @@ litest_add_tcase(struct suite *suite, void *func, { struct litest_test_device **dev = devices; + assert(required >= LITEST_DISABLE_DEVICE); + assert(excluded >= LITEST_DISABLE_DEVICE); + if (required == LITEST_DISABLE_DEVICE && excluded == LITEST_DISABLE_DEVICE) { litest_add_tcase_no_device(suite, func); @@ -223,6 +226,8 @@ litest_add_for_device(const char *name, struct suite *s; struct litest_test_device **dev = devices; + assert(type < LITEST_NO_DEVICE); + s = get_suite(name); while (*dev) { if ((*dev)->type == type) { diff --git a/test/litest.h b/test/litest.h index aefde3fe..cc55c8f0 100644 --- a/test/litest.h +++ b/test/litest.h @@ -35,16 +35,16 @@ enum litest_device_type { LITEST_NO_DEVICE = -1, - LITEST_SYNAPTICS_CLICKPAD, - LITEST_SYNAPTICS_TOUCHPAD, - LITEST_SYNAPTICS_TOPBUTTONPAD, - LITEST_BCM5974, - LITEST_KEYBOARD, - LITEST_TRACKPOINT, - LITEST_MOUSE, - LITEST_WACOM_TOUCH, - LITEST_ALPS_SEMI_MT, - LITEST_GENERIC_SINGLETOUCH, + LITEST_SYNAPTICS_CLICKPAD = -2, + LITEST_SYNAPTICS_TOUCHPAD = -3, + LITEST_SYNAPTICS_TOPBUTTONPAD = -4, + LITEST_BCM5974 = -5, + LITEST_KEYBOARD = -6, + LITEST_TRACKPOINT = -7, + LITEST_MOUSE = -8, + LITEST_WACOM_TOUCH = -9, + LITEST_ALPS_SEMI_MT = -10, + LITEST_GENERIC_SINGLETOUCH = -11, }; enum litest_device_feature { |