[PATCH v2 2/3] selftests/powerpc: Create a new SKIP_IF macro

Thiago Jung Bauermann bauerman at linux.ibm.com
Thu Nov 1 02:44:04 AEDT 2018


Breno Leitao <leitao at debian.org> writes:

> This patch creates a new macro that skips a test and prints a message to
> stderr. This is useful to give an idea why the tests is being skipped,
> other than just skipping the test blindly.
>
> Signed-off-by: Breno Leitao <leitao at debian.org>

Reviewed-by: Thiago Jung Bauermann <bauerman at linux.ibm.com>

> ---
>  tools/testing/selftests/powerpc/include/utils.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h
> index da1b963cdb32..486c1782c23e 100644
> --- a/tools/testing/selftests/powerpc/include/utils.h
> +++ b/tools/testing/selftests/powerpc/include/utils.h
> @@ -72,6 +72,16 @@ do {								\
>  	}							\
>  } while (0)
>  
> +#define SKIP_IF_MSG(x, msg)					\
> +do {								\
> +	if ((x)) {						\
> +		fprintf(stderr,					\
> +		"[SKIP] Test skipped on line %d: %s\n",		\
> +		 __LINE__, msg);				\
> +		return MAGIC_SKIP_RETURN_VALUE;			\
> +	}							\
> +} while (0)
> +
>  #define _str(s) #s
>  #define str(s) _str(s)


-- 
Thiago Jung Bauermann
IBM Linux Technology Center



More information about the Linuxppc-dev mailing list