[PATCH libinput 1/3] test: abort if we have a test that doesn't run for any devices

Hans de Goede hdegoede at redhat.com
Thu Dec 3 00:52:38 PST 2015


Hi,

On 02-12-15 22:43, Peter Hutterer wrote:
> 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 at who-t.net>

Series looks good to me and is:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans



> ---
>   test/litest.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/test/litest.c b/test/litest.c
> index 65be6b5..e235bc9 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
>


More information about the wayland-devel mailing list