All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests: lib.mk: print individual test results to console by default
@ 2017-10-31  0:01 Shuah Khan
  2017-11-03  2:35 ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2017-10-31  0:01 UTC (permalink / raw)
  To: shuah; +Cc: Shuah Khan, mpe, linux-kselftest, linux-kernel

Change run_tests to print individual test results to console by default.
Introduce "summary" option to print individual test results to a file
/tmp/test_name and just print the summary to the console.

This change is necessary to support use-cases where test machines get
rebooted once tests are run and the console log should contain the full
results.

In the following example, individual test results with "summary=1" option
are written to /tmp/kcmp_test

make --silent TARGETS=kcmp kselftest

TAP version 13
selftests: kcmp_test
========================================
pid1:  30126 pid2:  30127 FD:  2 FILES:  2 VM:  1 FS:  2 SIGHAND:  2 IO:
0 SYSVSEM:  0 INV: -1
PASS: 0 returned as expected
PASS: 0 returned as expected
FAIL: 0 expected but -1 returned (Invalid argument)
Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
1..3
Bail out!
Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
1..3
Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
1..0
ok 1..1 selftests: kcmp_test [PASS]

make --silent TARGETS=kcmp summary=1 kselftest
TAP version 13
selftests: kcmp_test
========================================
ok 1..1 selftests: kcmp_test [PASS]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/lib.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index f65886af7c0c..5bef05d6ba39 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -31,7 +31,11 @@ define RUN_TESTS
 			echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
 			echo "not ok 1..$$test_num selftests: $$BASENAME_TEST [FAIL]"; \
 		else					\
-			cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
+		if [ "X$(summary)" != "X" ]; then		\
+				cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
+			else				\
+				cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
+			fi;				\
 		fi;					\
 	done;
 endef
-- 
2.11.0

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

* Re: [PATCH] selftests: lib.mk: print individual test results to console by default
  2017-10-31  0:01 [PATCH] selftests: lib.mk: print individual test results to console by default Shuah Khan
@ 2017-11-03  2:35 ` Michael Ellerman
  2017-11-03 14:10   ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2017-11-03  2:35 UTC (permalink / raw)
  To: Shuah Khan, shuah; +Cc: Shuah Khan, linux-kselftest, linux-kernel

Shuah Khan <shuahkh@osg.samsung.com> writes:

> Change run_tests to print individual test results to console by default.
> Introduce "summary" option to print individual test results to a file
> /tmp/test_name and just print the summary to the console.
>
> This change is necessary to support use-cases where test machines get
> rebooted once tests are run and the console log should contain the full
> results.
>
> In the following example, individual test results with "summary=1" option
> are written to /tmp/kcmp_test
>
> make --silent TARGETS=kcmp kselftest
>
> TAP version 13
> selftests: kcmp_test
> ========================================
> pid1:  30126 pid2:  30127 FD:  2 FILES:  2 VM:  1 FS:  2 SIGHAND:  2 IO:
> 0 SYSVSEM:  0 INV: -1
> PASS: 0 returned as expected
> PASS: 0 returned as expected
> FAIL: 0 expected but -1 returned (Invalid argument)
> Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
> 1..3
> Bail out!
> Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
> 1..3
> Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
> 1..0
> ok 1..1 selftests: kcmp_test [PASS]
>
> make --silent TARGETS=kcmp summary=1 kselftest
> TAP version 13
> selftests: kcmp_test
> ========================================
> ok 1..1 selftests: kcmp_test [PASS]
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  tools/testing/selftests/lib.mk | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

This looks good to me as a minimal fix, thanks.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

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

* Re: [PATCH] selftests: lib.mk: print individual test results to console by default
  2017-11-03  2:35 ` Michael Ellerman
@ 2017-11-03 14:10   ` Shuah Khan
  2017-11-06  0:22     ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2017-11-03 14:10 UTC (permalink / raw)
  To: Michael Ellerman, shuah; +Cc: linux-kselftest, linux-kernel, Shuah Khan

On 11/02/2017 08:35 PM, Michael Ellerman wrote:
> Shuah Khan <shuahkh@osg.samsung.com> writes:
> 
>> Change run_tests to print individual test results to console by default.
>> Introduce "summary" option to print individual test results to a file
>> /tmp/test_name and just print the summary to the console.
>>
>> This change is necessary to support use-cases where test machines get
>> rebooted once tests are run and the console log should contain the full
>> results.
>>
>> In the following example, individual test results with "summary=1" option
>> are written to /tmp/kcmp_test
>>
>> make --silent TARGETS=kcmp kselftest
>>
>> TAP version 13
>> selftests: kcmp_test
>> ========================================
>> pid1:  30126 pid2:  30127 FD:  2 FILES:  2 VM:  1 FS:  2 SIGHAND:  2 IO:
>> 0 SYSVSEM:  0 INV: -1
>> PASS: 0 returned as expected
>> PASS: 0 returned as expected
>> FAIL: 0 expected but -1 returned (Invalid argument)
>> Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
>> 1..3
>> Bail out!
>> Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
>> 1..3
>> Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
>> 1..0
>> ok 1..1 selftests: kcmp_test [PASS]
>>
>> make --silent TARGETS=kcmp summary=1 kselftest
>> TAP version 13
>> selftests: kcmp_test
>> ========================================
>> ok 1..1 selftests: kcmp_test [PASS]
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/testing/selftests/lib.mk | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> This looks good to me as a minimal fix, thanks.
> 
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> 
> cheers
> 

Thanks Michael, bummer I can't add your Ack, I sent pull request
to Linus yesterday so this fix makes it into the release.

-- Shuah

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

* Re: [PATCH] selftests: lib.mk: print individual test results to console by default
  2017-11-03 14:10   ` Shuah Khan
@ 2017-11-06  0:22     ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-11-06  0:22 UTC (permalink / raw)
  To: Shuah Khan, shuah; +Cc: linux-kselftest, linux-kernel, Shuah Khan

Shuah Khan <shuahkh@osg.samsung.com> writes:

> On 11/02/2017 08:35 PM, Michael Ellerman wrote:
>> Shuah Khan <shuahkh@osg.samsung.com> writes:
>> 
>>> Change run_tests to print individual test results to console by default.
>>> Introduce "summary" option to print individual test results to a file
>>> /tmp/test_name and just print the summary to the console.
>>>
>>> This change is necessary to support use-cases where test machines get
>>> rebooted once tests are run and the console log should contain the full
>>> results.
>>>
>>> In the following example, individual test results with "summary=1" option
>>> are written to /tmp/kcmp_test
>>>
>>> make --silent TARGETS=kcmp kselftest
>>>
>>> TAP version 13
>>> selftests: kcmp_test
>>> ========================================
>>> pid1:  30126 pid2:  30127 FD:  2 FILES:  2 VM:  1 FS:  2 SIGHAND:  2 IO:
>>> 0 SYSVSEM:  0 INV: -1
>>> PASS: 0 returned as expected
>>> PASS: 0 returned as expected
>>> FAIL: 0 expected but -1 returned (Invalid argument)
>>> Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
>>> 1..3
>>> Bail out!
>>> Pass 2 Fail 1 Xfail 0 Xpass 0 Skip 0 Error 0
>>> 1..3
>>> Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
>>> 1..0
>>> ok 1..1 selftests: kcmp_test [PASS]
>>>
>>> make --silent TARGETS=kcmp summary=1 kselftest
>>> TAP version 13
>>> selftests: kcmp_test
>>> ========================================
>>> ok 1..1 selftests: kcmp_test [PASS]
>>>
>>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>>> ---
>>>  tools/testing/selftests/lib.mk | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>> 
>> This looks good to me as a minimal fix, thanks.
>> 
>> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
>
> Thanks Michael, bummer I can't add your Ack, I sent pull request
> to Linus yesterday so this fix makes it into the release.

No worries about the ack. Thanks for getting it merged.

cheers

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

end of thread, other threads:[~2017-11-06  0:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31  0:01 [PATCH] selftests: lib.mk: print individual test results to console by default Shuah Khan
2017-11-03  2:35 ` Michael Ellerman
2017-11-03 14:10   ` Shuah Khan
2017-11-06  0:22     ` Michael Ellerman

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.