From: keescook at chromium.org (Kees Cook) Subject: [PATCH 4/6] selftests/runner: Add plan line and fix result line syntax Date: Tue, 9 Apr 2019 16:55:54 -0700 [thread overview] Message-ID: <20190409235556.3967-5-keescook@chromium.org> (raw) In-Reply-To: <20190409235556.3967-1-keescook@chromium.org> The TAP version 13 spec requires a "plan" line, which has been missing. Since we always know how many tests we're going to run, emit the count on the plan line. This also fixes the result lines to remove the "1.." prefix which is against spec, and to mark skips with the correct "# SKIP" suffix. Signed-off-by: Kees Cook <keescook at chromium.org> --- tools/testing/selftests/kselftest/runner.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh index 51139f42a6ca..7f8d6b127693 100644 --- a/tools/testing/selftests/kselftest/runner.sh +++ b/tools/testing/selftests/kselftest/runner.sh @@ -18,15 +18,15 @@ run_one() echo "========================================" if [ ! -x "$TEST" ]; then echo "$TEST_HDR_MSG: Warning: file $TEST is not executable, correct this." - echo "not ok 1..$test_num $TEST_HDR_MSG [FAIL]" + echo "not ok $test_num $TEST_HDR_MSG" else cd `dirname $TEST` > /dev/null (./$BASENAME_TEST >> "$logfile" 2>&1 && - echo "ok 1..$test_num $TEST_HDR_MSG [PASS]") || + echo "ok $test_num $TEST_HDR_MSG") || (if [ $? -eq $skip_rc ]; then \ - echo "not ok 1..$test_num $TEST_HDR_MSG [SKIP]" + echo "not ok $test_num $TEST_HDR_MSG # SKIP" else - echo "not ok 1..$test_num $TEST_HDR_MSG [FAIL]" + echo "not ok $test_num $TEST_HDR_MSG" fi) cd - >/dev/null fi @@ -37,6 +37,8 @@ run_many() echo "TAP version 13" DIR=$(basename "$PWD") test_num=0 + total=$(echo "$@" | wc -w) + echo "1..$total" for TEST in "$@"; do test_num=$(( test_num + 1 )) run_one "$DIR" "$TEST" "$test_num" -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: keescook@chromium.org (Kees Cook) Subject: [PATCH 4/6] selftests/runner: Add plan line and fix result line syntax Date: Tue, 9 Apr 2019 16:55:54 -0700 [thread overview] Message-ID: <20190409235556.3967-5-keescook@chromium.org> (raw) Message-ID: <20190409235554.cwLRmoOnUk70EufPZgT9rscwwd0Vua1x8X209RTww68@z> (raw) In-Reply-To: <20190409235556.3967-1-keescook@chromium.org> The TAP version 13 spec requires a "plan" line, which has been missing. Since we always know how many tests we're going to run, emit the count on the plan line. This also fixes the result lines to remove the "1.." prefix which is against spec, and to mark skips with the correct "# SKIP" suffix. Signed-off-by: Kees Cook <keescook at chromium.org> --- tools/testing/selftests/kselftest/runner.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh index 51139f42a6ca..7f8d6b127693 100644 --- a/tools/testing/selftests/kselftest/runner.sh +++ b/tools/testing/selftests/kselftest/runner.sh @@ -18,15 +18,15 @@ run_one() echo "========================================" if [ ! -x "$TEST" ]; then echo "$TEST_HDR_MSG: Warning: file $TEST is not executable, correct this." - echo "not ok 1..$test_num $TEST_HDR_MSG [FAIL]" + echo "not ok $test_num $TEST_HDR_MSG" else cd `dirname $TEST` > /dev/null (./$BASENAME_TEST >> "$logfile" 2>&1 && - echo "ok 1..$test_num $TEST_HDR_MSG [PASS]") || + echo "ok $test_num $TEST_HDR_MSG") || (if [ $? -eq $skip_rc ]; then \ - echo "not ok 1..$test_num $TEST_HDR_MSG [SKIP]" + echo "not ok $test_num $TEST_HDR_MSG # SKIP" else - echo "not ok 1..$test_num $TEST_HDR_MSG [FAIL]" + echo "not ok $test_num $TEST_HDR_MSG" fi) cd - >/dev/null fi @@ -37,6 +37,8 @@ run_many() echo "TAP version 13" DIR=$(basename "$PWD") test_num=0 + total=$(echo "$@" | wc -w) + echo "1..$total" for TEST in "$@"; do test_num=$(( test_num + 1 )) run_one "$DIR" "$TEST" "$test_num" -- 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 ` [PATCH 2/6] selftests: Use runner.sh for emit targets keescook 2019-04-09 23:55 ` 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 ` keescook [this message] 2019-04-09 23:55 ` [PATCH 4/6] selftests/runner: Add plan line and fix result line syntax 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-5-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.