[PATCH evemu 5/7] test: only test for event code if we have the type

Peter Hutterer peter.hutterer at who-t.net
Thu Nov 21 16:20:00 PST 2013


Fixed versions of libevdev won't enable event types that don't exist,
so we can't expect them to be enabled.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/test-evemu-create.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/test-evemu-create.c b/test/test-evemu-create.c
index 3df3194..27fb326 100644
--- a/test/test-evemu-create.c
+++ b/test/test-evemu-create.c
@@ -174,14 +174,20 @@ void check_evemu_read(int fd, const char *file, enum flags flags)
 
 	if (flags & BITS) {
 		int i, j;
-		for (i = 0; i < EV_CNT; i++)
+		for (i = 1; i < EV_CNT; i++) {
+			if (!evemu_has_bit(dev, i))
+				continue;
+
 			for (j = 0; j < max[i]; j++)
 				assert(evemu_has_event(dev, i, j));
+		}
 	}
 
 	if (flags & ABSINFO) {
 		int i;
 		for (i = 0; i < ABS_CNT; i++) {
+			if (!evemu_has_event(dev, EV_ABS, i))
+				continue;
 			assert(evemu_get_abs_minimum(dev, i) == i + 1);
 			assert(evemu_get_abs_maximum(dev, i) == i + 2);
 			assert(evemu_get_abs_fuzz(dev, i) == i + 3);
-- 
1.8.3.1



More information about the Input-tools mailing list