linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Handling for TAP header level
@ 2017-11-03 22:51 Shuah Khan
  2017-11-03 22:51 ` [PATCH 1/2] selftests: kselftest framework: add handling " Shuah Khan
  2017-11-03 22:51 ` [PATCH 2/2] selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers Shuah Khan
  0 siblings, 2 replies; 3+ messages in thread
From: Shuah Khan @ 2017-11-03 22:51 UTC (permalink / raw)
  To: shuah; +Cc: Shuah Khan, linux-kselftest, linux-kernel

This first patch in this series adds environment variable KSFT_TAP_LEVEL
to avoid printing nested TAP headers for each test. lib.mk run_tests
target prints TAP header before invoking the test program or test script.
Tests need a way to suppress TAP headers if it is already printed out.

This new environment variable adds a way for ksft_print_header()
print TAP header only when KSFT_TAP_LEVEL isn't set.

The second patch in this series changes lib.mk run_tests target to set
KSFT_TAP_LEVEL before running tests.

Shuah Khan (2):
  selftests: kselftest framework: add handling for TAP header level
  selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers

 tools/testing/selftests/kselftest.h | 3 ++-
 tools/testing/selftests/lib.mk      | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.11.0

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

* [PATCH 1/2] selftests: kselftest framework: add handling for TAP header level
  2017-11-03 22:51 [PATCH 0/2] Handling for TAP header level Shuah Khan
@ 2017-11-03 22:51 ` Shuah Khan
  2017-11-03 22:51 ` [PATCH 2/2] selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers Shuah Khan
  1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2017-11-03 22:51 UTC (permalink / raw)
  To: shuah; +Cc: Shuah Khan, linux-kselftest, linux-kernel

Introduce environment variable KSFT_TAP_LEVEL to avoid printing
nested TAP headers for each test. lib.mk run_tests target prints
TAP header before invoking the test program or test script. Tests
need a way to suppress TAP headers if it is already printed out.

This new environment variable adds a way for ksft_print_header()
print TAP header only when KSFT_TAP_LEVEL isn't set.

lib.mk run_tests and test program should print TAP header and set
KSFT_TAP_LEVEL to avoid a second TAP header to be printed.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/kselftest.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 1ae565ed9bf0..d6732ba312ef 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -57,7 +57,8 @@ static inline int ksft_get_error_cnt(void) { return ksft_cnt.ksft_error; }
 
 static inline void ksft_print_header(void)
 {
-	printf("TAP version 13\n");
+	if (!(getenv("KSFT_TAP_LEVEL"))
+		printf("TAP version 13\n");
 }
 
 static inline void ksft_print_cnts(void)
-- 
2.11.0

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

* [PATCH 2/2] selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers
  2017-11-03 22:51 [PATCH 0/2] Handling for TAP header level Shuah Khan
  2017-11-03 22:51 ` [PATCH 1/2] selftests: kselftest framework: add handling " Shuah Khan
@ 2017-11-03 22:51 ` Shuah Khan
  1 sibling, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2017-11-03 22:51 UTC (permalink / raw)
  To: shuah; +Cc: Shuah Khan, linux-kselftest, linux-kernel

Set KSFT_TAP_LEVEL before running tests to prevent nested TAP header
printing from tests.

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

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 5bef05d6ba39..a9e1f81ae177 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -20,6 +20,7 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 
 .ONESHELL:
 define RUN_TESTS
+	@export KSFT_TAP_LEVEL=`echo 1`:
 	@test_num=`echo 0`;
 	@echo "TAP version 13";
 	@for TEST in $(1); do				\
-- 
2.11.0

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 22:51 [PATCH 0/2] Handling for TAP header level Shuah Khan
2017-11-03 22:51 ` [PATCH 1/2] selftests: kselftest framework: add handling " Shuah Khan
2017-11-03 22:51 ` [PATCH 2/2] selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).