All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests: warn if failure is due to lack of executable bit
@ 2017-08-03 20:24 Luis R. Rodriguez
  2017-08-08 17:50 ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2017-08-03 20:24 UTC (permalink / raw)
  To: shuah, linux-kselftest
  Cc: akpm, keescook, pmladek, dan.carpenter, colin.king, dcb314,
	linux-kernel, Luis R. Rodriguez

Executing selftests is fragile as if someone forgot to set a secript
as executable the test will fail, and you won't know for sure if the
failure was caused by the lack of proper permissions or something else.

Setting scripts as executable is required, this also enable folks to
execute selftests as independent units.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 tools/testing/selftests/lib.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 959273c3a52e..e71f8e4633b1 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -14,7 +14,12 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 define RUN_TESTS
 	@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
 		BASENAME_TEST=`basename $$TEST`;	\
-		cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
+		if [ ! -x $$BASENAME_TEST ]; then	\
+			echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
+			echo "selftests: $$BASENAME_TEST [FAIL]"; \
+		else					\
+			cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
+		fi;					\
 	done;
 endef
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] selftests: warn if failure is due to lack of executable bit
  2017-08-03 20:24 [PATCH v2] selftests: warn if failure is due to lack of executable bit Luis R. Rodriguez
@ 2017-08-08 17:50 ` Luis R. Rodriguez
  2017-08-09 20:47   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2017-08-08 17:50 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: shuah, linux-kselftest, akpm, keescook, pmladek, dan.carpenter,
	colin.king, dcb314, linux-kernel, Michael Ellerman

On Thu, Aug 03, 2017 at 01:24:36PM -0700, Luis R. Rodriguez wrote:
> Executing selftests is fragile as if someone forgot to set a secript
> as executable the test will fail, and you won't know for sure if the
> failure was caused by the lack of proper permissions or something else.
> 
> Setting scripts as executable is required, this also enable folks to
> execute selftests as independent units.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
>  tools/testing/selftests/lib.mk | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 959273c3a52e..e71f8e4633b1 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -14,7 +14,12 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
>  define RUN_TESTS
>  	@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
>  		BASENAME_TEST=`basename $$TEST`;	\
> -		cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
> +		if [ ! -x $$BASENAME_TEST ]; then	\
> +			echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
> +			echo "selftests: $$BASENAME_TEST [FAIL]"; \
> +		else					\
> +			cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
> +		fi;					\
>  	done;
>  endef
>  

*poke*

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] selftests: warn if failure is due to lack of executable bit
  2017-08-08 17:50 ` Luis R. Rodriguez
@ 2017-08-09 20:47   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2017-08-09 20:47 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linux-kselftest, akpm, keescook, pmladek, dan.carpenter,
	colin.king, dcb314, linux-kernel, Michael Ellerman, Shuah Khan,
	shuah Khan

On 08/08/2017 11:50 AM, Luis R. Rodriguez wrote:
> On Thu, Aug 03, 2017 at 01:24:36PM -0700, Luis R. Rodriguez wrote:
>> Executing selftests is fragile as if someone forgot to set a secript
>> as executable the test will fail, and you won't know for sure if the
>> failure was caused by the lack of proper permissions or something else.
>>
>> Setting scripts as executable is required, this also enable folks to
>> execute selftests as independent units.
>>
>> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
>> ---
>>  tools/testing/selftests/lib.mk | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
>> index 959273c3a52e..e71f8e4633b1 100644
>> --- a/tools/testing/selftests/lib.mk
>> +++ b/tools/testing/selftests/lib.mk
>> @@ -14,7 +14,12 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
>>  define RUN_TESTS
>>  	@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
>>  		BASENAME_TEST=`basename $$TEST`;	\
>> -		cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
>> +		if [ ! -x $$BASENAME_TEST ]; then	\
>> +			echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
>> +			echo "selftests: $$BASENAME_TEST [FAIL]"; \
>> +		else					\
>> +			cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
>> +		fi;					\
>>  	done;
>>  endef
>>  
> 
> *poke*
> 
>   Luis
> 
> 

Applied to linux-kselftest next for 4.14-rc1.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-09 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 20:24 [PATCH v2] selftests: warn if failure is due to lack of executable bit Luis R. Rodriguez
2017-08-08 17:50 ` Luis R. Rodriguez
2017-08-09 20:47   ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.