diff mbox series

[v2,7/8] selftests: Remove KSFT_TAP_LEVEL

Message ID 20190424231237.14776-8-keescook@chromium.org (mailing list archive)
State Mainlined
Commit f41c322f17ec4aa809222dc352439d80862c175b
Headers show
Series selftests: Move test output to diagnostic lines | expand

Commit Message

Kees Cook April 24, 2019, 11:12 p.m. UTC
Since sub-testing can now be detected by indentation level, this removes
KSFT_TAP_LEVEL so that subtests report their TAP header for later parsing.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 tools/testing/selftests/Makefile            | 6 ------
 tools/testing/selftests/kselftest/runner.sh | 1 -
 2 files changed, 7 deletions(-)

Comments

Shuah April 25, 2019, 4:36 p.m. UTC | #1
On 4/24/19 5:12 PM, Kees Cook wrote:
> Since sub-testing can now be detected by indentation level, this removes
> KSFT_TAP_LEVEL so that subtests report their TAP header for later parsing.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>   tools/testing/selftests/Makefile            | 6 ------
>   tools/testing/selftests/kselftest/runner.sh | 1 -
>   2 files changed, 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 64699f59b95f..9f05448e5e4b 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -86,12 +86,6 @@ else
>   	endif
>   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`
> -
>   # Prepare for headers install
>   top_srcdir ?= ../../..
>   include $(top_srcdir)/scripts/subarch.include
> diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
> index b9f74e5a2ee5..eff3ee303d0d 100644
> --- a/tools/testing/selftests/kselftest/runner.sh
> +++ b/tools/testing/selftests/kselftest/runner.sh
> @@ -2,7 +2,6 @@
>   # SPDX-License-Identifier: GPL-2.0
>   #
>   # Runs a set of tests in a given subdirectory.
> -export KSFT_TAP_LEVEL=1
>   export skip_rc=4
>   export logfile=/dev/stdout
>   export per_test_logging=
> 

Does this take into ksft_print_header() getenv logic to avoid printing
TAP headers from tests when they fork? e.g timers tests do that a lot.

thanks,
-- Shuah
Kees Cook April 25, 2019, 4:56 p.m. UTC | #2
On Thu, Apr 25, 2019 at 9:36 AM shuah <shuah@kernel.org> wrote:
>
> On 4/24/19 5:12 PM, Kees Cook wrote:
> > Since sub-testing can now be detected by indentation level, this removes
> > KSFT_TAP_LEVEL so that subtests report their TAP header for later parsing.
>
> Does this take into ksft_print_header() getenv logic to avoid printing
> TAP headers from tests when they fork? e.g timers tests do that a lot.

I didn't change the ksft_print_header() code, in case you want it back
in the future. But nothing sets that variable any more in my series:

$ git grep KSFT_TAP_LEVEL
tools/testing/selftests/kselftest.h:    if (!(getenv("KSFT_TAP_LEVEL")))

I don't see the timers tests using print_header() at all, actually...

$ cd tools/testing/kselftest/timers
$ git grep print_header | wc -l
0
Shuah April 25, 2019, 5:06 p.m. UTC | #3
On 4/25/19 10:56 AM, Kees Cook wrote:
> On Thu, Apr 25, 2019 at 9:36 AM shuah <shuah@kernel.org> wrote:
>>
>> On 4/24/19 5:12 PM, Kees Cook wrote:
>>> Since sub-testing can now be detected by indentation level, this removes
>>> KSFT_TAP_LEVEL so that subtests report their TAP header for later parsing.
>>
>> Does this take into ksft_print_header() getenv logic to avoid printing
>> TAP headers from tests when they fork? e.g timers tests do that a lot.
> 
> I didn't change the ksft_print_header() code, in case you want it back
> in the future. But nothing sets that variable any more in my series:
> 

Right. I want to see the impact of not setting this. I added this for
two reasons, one is to prevent nesting which goes away with your
refactor. I know there is another reason which I can't recall.


> $ git grep KSFT_TAP_LEVEL
> tools/testing/selftests/kselftest.h:    if (!(getenv("KSFT_TAP_LEVEL")))
> 
> I don't see the timers tests using print_header() at all, actually...
> 
> $ cd tools/testing/kselftest/timers
> $ git grep print_header | wc -l
> 0
> 

I don't see it in there either. I must be thinking about another test.

btw I like the changes. I just want to make sure it gets some road
testing first. :)

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 64699f59b95f..9f05448e5e4b 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -86,12 +86,6 @@  else
 	endif
 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`
-
 # Prepare for headers install
 top_srcdir ?= ../../..
 include $(top_srcdir)/scripts/subarch.include
diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
index b9f74e5a2ee5..eff3ee303d0d 100644
--- a/tools/testing/selftests/kselftest/runner.sh
+++ b/tools/testing/selftests/kselftest/runner.sh
@@ -2,7 +2,6 @@ 
 # SPDX-License-Identifier: GPL-2.0
 #
 # Runs a set of tests in a given subdirectory.
-export KSFT_TAP_LEVEL=1
 export skip_rc=4
 export logfile=/dev/stdout
 export per_test_logging=