Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703301

Re: [PATCH] selftests: use $SHELL to exec selftests

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH] selftests: use $SHELL to exec selftests
Date 2017-08-03 19:30 +0200
Message-ID <uas6C-3bf-21@gated-at.bofh.it> (permalink)
References <uarNg-32O-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Aug 3, 2017 at 9:59 AM, Luis R. Rodriguez <mcgrof@kernel.org> wrote:
> Executing selftests is fragile as if someone forgot to set a secript
> as executable the test will fail. Setting scripts as executable is
> desirable to enable folks to execute tests as independent units,
> however, we can avoid the fragile errors of forgetting to set the
> script as executable by just invoking the $SHELL for running each
> script.
>
> Suggsted-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
>
> Shuah, while the last two patches could be queued in for 4.13-final,
> this one I think is more appropriate for v4.14-rc1 only.
>
>  tools/testing/selftests/lib.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 959273c3a52e..2d6abb8037be 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -14,7 +14,7 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
>  define RUN_TESTS
>         @for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
>                 BASENAME_TEST=`basename $$TEST`;        \
> -               cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
> +               cd `dirname $$TEST`; ($$SHELL ./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
>         done;
>  endef

Is BASENAME_TEST always a script? Can't it be a built binary too?

-Kees

-- 
Kees Cook
Pixel Security

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] selftests: use $SHELL to exec selftests "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-08-03 19:10 +0200
  Re: [PATCH] selftests: use $SHELL to exec selftests Kees Cook <keescook@chromium.org> - 2017-08-03 19:30 +0200
    Re: [PATCH] selftests: use $SHELL to exec selftests "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-08-03 22:30 +0200

csiph-web