Re: [PATCH 2/2] Revert "selftests: Remove KSFT_TAP_LEVEL"

From: Kees Cook
Date: Sat Aug 28 2021 - 02:29:53 EST


On Fri, Aug 27, 2021 at 10:58:12PM +0000, Rae Moar wrote:
> This reverts commit f41c322f17ec4aa809222dc352439d80862c175b:
> https://lore.kernel.org/linux-kselftest/20190424231236.aWGsEs-_2b6p3DpN3b_4U1xGERmHSv45uBzgjf6RIRk@z/
>
> This patch removes nested TAP headers in kselftets TAP results and is part
> of a series to alter the format of kselftest TAP results to improve
> compatibility with proposed KTAP specification
> (https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@xxxxxxxxxxxxxx/).

That would have been nice to have been CCed on. :)

-Kees

>
> Signed-off-by: Rae Moar <rmoar@xxxxxxxxxx>
> Change-Id: I24e74cacfc49a90a068eb30ee1448c097de5297d
> ---
> tools/testing/selftests/Makefile | 6 ++++++
> tools/testing/selftests/kselftest/runner.sh | 1 +
> 2 files changed, 7 insertions(+)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index fb010a35d61a..3bbfb83e2252 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -122,6 +122,12 @@ 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 9b04aeb26d3a..40ce901cb38d 100644
> --- a/tools/testing/selftests/kselftest/runner.sh
> +++ b/tools/testing/selftests/kselftest/runner.sh
> @@ -2,6 +2,7 @@
> # 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 timeout_rc=124
> export logfile=/dev/stdout
> --
> 2.33.0.259.gc128427fd7-goog
>

--
Kees Cook