From 26c305d04416ff30b0e88818f8f56c6f42146643 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 2 Dec 2015 09:27:22 +1000 Subject: [PATCH] test: abort if we have a test that doesn't run for any devices If the test is filtered out and we never run it generates a false positive. Though it isn't listed in the "Checks" summary this is a bit hard to tell when you're running >700 tests. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/litest.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/litest.c b/test/litest.c index 65be6b5a..e235bc93 100644 --- a/test/litest.c +++ b/test/litest.c @@ -590,6 +590,7 @@ litest_add_tcase(const char *suite_name, { struct litest_test_device **dev = devices; struct suite *suite; + bool added = false; assert(required >= LITEST_DISABLE_DEVICE); assert(excluded >= LITEST_DISABLE_DEVICE); @@ -607,6 +608,7 @@ litest_add_tcase(const char *suite_name, if (required == LITEST_DISABLE_DEVICE && excluded == LITEST_DISABLE_DEVICE) { litest_add_tcase_no_device(suite, func, range); + added = true; } else if (required != LITEST_ANY || excluded != LITEST_ANY) { for (; *dev; dev++) { if (filter_device && @@ -621,6 +623,7 @@ litest_add_tcase(const char *suite_name, func, *dev, range); + added = true; } } else { for (; *dev; dev++) { @@ -633,8 +636,14 @@ litest_add_tcase(const char *suite_name, func, *dev, range); + added = true; } } + + if (!added) { + fprintf(stderr, "Test '%s' does not match any devices. Aborting.\n", funcname); + abort(); + } } void