selftests: Makefile set KSFT_TAP_LEVEL to prevent nested TAP headers
authorShuah Khan <shuahkh@osg.samsung.com>
Thu, 22 Feb 2018 00:25:55 +0000 (17:25 -0700)
committerShuah Khan <shuahkh@osg.samsung.com>
Tue, 6 Mar 2018 02:10:47 +0000 (19:10 -0700)
Export KSFT_TAP_LEVEL and add TAP Header echo to the run_kselftest.sh
script from emit_tests target handling.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/Makefile

index 7442dfb73b7f3149d00a0ec92e4e7a19dd50542c..a41b4be28b9fcb672137f25925ec90a8c113ab24 100644 (file)
@@ -66,6 +66,12 @@ ifndef BUILD
   BUILD := $(shell pwd)
 endif
 
+# KSFT_TAP_LEVEL is used from KSFT framework to prevent nested TAP header
+# printing from tests. Applicable to run_tests case where run_tests adds
+# TAP header prior running tests and when a test program invokes another
+# with system() call. Export it here to cover override RUN_TESTS defines.
+export KSFT_TAP_LEVEL=`echo 1`
+
 export BUILD
 all:
        @for TARGET in $(TARGETS); do           \
@@ -125,10 +131,12 @@ ifdef INSTALL_PATH
        echo "else" >> $(ALL_SCRIPT)
        echo "  OUTPUT=/dev/stdout" >> $(ALL_SCRIPT)
        echo "fi" >> $(ALL_SCRIPT)
+       echo "export KSFT_TAP_LEVEL=`echo 1`" >> $(ALL_SCRIPT)
 
        for TARGET in $(TARGETS); do \
                BUILD_TARGET=$$BUILD/$$TARGET;  \
-               echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
+               echo "echo ; echo TAP version 13" >> $(ALL_SCRIPT);     \
+               echo "echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
                echo "echo ========================================" >> $(ALL_SCRIPT); \
                echo "cd $$TARGET" >> $(ALL_SCRIPT); \
                make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \