From: keescook at chromium.org (Kees Cook) Subject: [PATCH 2/6] selftests: Use runner.sh for emit targets Date: Tue, 9 Apr 2019 16:55:52 -0700 [thread overview] Message-ID: <20190409235556.3967-3-keescook@chromium.org> (raw) In-Reply-To: <20190409235556.3967-1-keescook@chromium.org> This reuses the new runner.sh for the emit targets instead of manually running each test via run_kselftest.sh. Signed-off-by: Kees Cook <keescook at chromium.org> --- tools/testing/selftests/Makefile | 11 +++++------ tools/testing/selftests/lib.mk | 15 ++------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 971fc8428117..45327e921169 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -131,7 +131,8 @@ ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh install: ifdef INSTALL_PATH @# Ask all targets to install their files - mkdir -p $(INSTALL_PATH) + mkdir -p $(INSTALL_PATH)/kselftest + install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/ @for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ @@ -141,15 +142,13 @@ ifdef INSTALL_PATH echo "#!/bin/sh" > $(ALL_SCRIPT) echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT) echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT) + echo ". ./kselftest/runner.sh" >> $(ALL_SCRIPT) echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT) - echo " OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT) - echo " cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT) - echo "else" >> $(ALL_SCRIPT) - echo " OUTPUT=/dev/stdout" >> $(ALL_SCRIPT) + echo " logfile=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT) + echo " cat /dev/null > \$$logfile" >> $(ALL_SCRIPT) echo "fi" >> $(ALL_SCRIPT) echo "export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT) - echo "export skip=4" >> $(ALL_SCRIPT) for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 7da79fe0bb78..8a4fad5d3934 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -78,24 +78,13 @@ else $(error Error: set INSTALL_PATH to use install) endif -define EMIT_TESTS +emit_tests: @test_num=`echo 0`; \ for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \ BASENAME_TEST=`basename $$TEST`; \ test_num=`echo $$test_num+1 | bc`; \ - TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ - echo "echo $$TEST_HDR_MSG"; \ - if [ ! -x $$TEST ]; then \ - echo "echo \"$$TEST_HDR_MSG: Warning: file $$BASENAME_TEST is not executable, correct this.\""; \ - echo "echo \"not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]\""; \ - else - echo "(./$$BASENAME_TEST >> \$$OUTPUT 2>&1 && echo \"ok 1..$$test_num $$TEST_HDR_MSG [PASS]\") || (if [ \$$? -eq \$$skip ]; then echo \"not ok 1..$$test_num $$TEST_HDR_MSG [SKIP]\"; else echo \"not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]\"; fi;)"; \ - fi; \ + echo "run_one \"$$BASENAME_TEST\" \"$$test_num\""; \ done; -endef - -emit_tests: - $(EMIT_TESTS) # define if isn't already. It is undefined in make O= case. ifeq ($(RM),) -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: keescook@chromium.org (Kees Cook) Subject: [PATCH 2/6] selftests: Use runner.sh for emit targets Date: Tue, 9 Apr 2019 16:55:52 -0700 [thread overview] Message-ID: <20190409235556.3967-3-keescook@chromium.org> (raw) Message-ID: <20190409235552.N0piGKfwVvBG5O3LlH7K5KdLrHVLALqoCW9lsRo5XaE@z> (raw) In-Reply-To: <20190409235556.3967-1-keescook@chromium.org> This reuses the new runner.sh for the emit targets instead of manually running each test via run_kselftest.sh. Signed-off-by: Kees Cook <keescook at chromium.org> --- tools/testing/selftests/Makefile | 11 +++++------ tools/testing/selftests/lib.mk | 15 ++------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 971fc8428117..45327e921169 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -131,7 +131,8 @@ ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh install: ifdef INSTALL_PATH @# Ask all targets to install their files - mkdir -p $(INSTALL_PATH) + mkdir -p $(INSTALL_PATH)/kselftest + install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/ @for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ @@ -141,15 +142,13 @@ ifdef INSTALL_PATH echo "#!/bin/sh" > $(ALL_SCRIPT) echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT) echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT) + echo ". ./kselftest/runner.sh" >> $(ALL_SCRIPT) echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT) - echo " OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT) - echo " cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT) - echo "else" >> $(ALL_SCRIPT) - echo " OUTPUT=/dev/stdout" >> $(ALL_SCRIPT) + echo " logfile=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT) + echo " cat /dev/null > \$$logfile" >> $(ALL_SCRIPT) echo "fi" >> $(ALL_SCRIPT) echo "export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT) - echo "export skip=4" >> $(ALL_SCRIPT) for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 7da79fe0bb78..8a4fad5d3934 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -78,24 +78,13 @@ else $(error Error: set INSTALL_PATH to use install) endif -define EMIT_TESTS +emit_tests: @test_num=`echo 0`; \ for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \ BASENAME_TEST=`basename $$TEST`; \ test_num=`echo $$test_num+1 | bc`; \ - TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ - echo "echo $$TEST_HDR_MSG"; \ - if [ ! -x $$TEST ]; then \ - echo "echo \"$$TEST_HDR_MSG: Warning: file $$BASENAME_TEST is not executable, correct this.\""; \ - echo "echo \"not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]\""; \ - else - echo "(./$$BASENAME_TEST >> \$$OUTPUT 2>&1 && echo \"ok 1..$$test_num $$TEST_HDR_MSG [PASS]\") || (if [ \$$? -eq \$$skip ]; then echo \"not ok 1..$$test_num $$TEST_HDR_MSG [SKIP]\"; else echo \"not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]\"; fi;)"; \ - fi; \ + echo "run_one \"$$BASENAME_TEST\" \"$$test_num\""; \ done; -endef - -emit_tests: - $(EMIT_TESTS) # define if isn't already. It is undefined in make O= case. ifeq ($(RM),) -- 2.17.1
next prev parent reply other threads:[~2019-04-09 23:55 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-09 23:55 [PATCH 0/6] selftests: Move test output to diagnostic lines keescook 2019-04-09 23:55 ` Kees Cook 2019-04-09 23:55 ` [PATCH 1/6] selftests: Extract single-test shell logic from lib.mk keescook 2019-04-09 23:55 ` Kees Cook 2019-04-16 23:11 ` shuah 2019-04-16 23:11 ` shuah 2019-04-16 23:16 ` keescook 2019-04-16 23:16 ` Kees Cook 2019-04-16 23:21 ` shuah 2019-04-16 23:21 ` shuah 2019-04-23 22:31 ` keescook 2019-04-23 22:31 ` Kees Cook 2019-04-23 22:47 ` shuah 2019-04-23 22:47 ` shuah 2019-04-24 2:43 ` keescook 2019-04-24 2:43 ` Kees Cook 2019-04-24 2:46 ` shuah 2019-04-24 2:46 ` shuah 2019-04-09 23:55 ` keescook [this message] 2019-04-09 23:55 ` [PATCH 2/6] selftests: Use runner.sh for emit targets Kees Cook 2019-04-09 23:55 ` [PATCH 3/6] selftests: Extract logic for multiple test runs keescook 2019-04-09 23:55 ` Kees Cook 2019-04-09 23:55 ` [PATCH 4/6] selftests/runner: Add plan line and fix result line syntax keescook 2019-04-09 23:55 ` Kees Cook 2019-04-09 23:55 ` [PATCH 5/6] selftests/runner: Distinguish between missing and non-executable keescook 2019-04-09 23:55 ` Kees Cook 2019-04-09 23:55 ` [PATCH 6/6] selftests: Move test output to diagnostic lines keescook 2019-04-09 23:55 ` Kees Cook
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190409235556.3967-3-keescook@chromium.org \ --to=unknown@example.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.