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 <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-12-02 09:27:22 +10:00
parent 61b2ec3159
commit 26c305d044

View file

@ -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