From patchwork Tue Apr 9 23:55:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10892867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B47FF1708 for ; Tue, 9 Apr 2019 23:56:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92EC728387 for ; Tue, 9 Apr 2019 23:56:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 874C62883B; Tue, 9 Apr 2019 23:56:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6421228387 for ; Tue, 9 Apr 2019 23:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbfDIX4H (ORCPT ); Tue, 9 Apr 2019 19:56:07 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41204 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726592AbfDIX4H (ORCPT ); Tue, 9 Apr 2019 19:56:07 -0400 Received: by mail-pg1-f193.google.com with SMTP id f6so339000pgs.8 for ; Tue, 09 Apr 2019 16:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ht0iEC0j4OarhyDSbuUqVPCj03juNb5j0gNHH6SpSmw=; b=Qmd+M1wwbFny3gtH46RqfXESkiPDZMJY5q4jvOKtfl7YV7+OYia7h5SbljyK1U3FKE Y7Xz50Pv3ZBZNQihrQpSF0wWR/PgYu/yp+c0SVMHGMs7tiGk9JVCLd/O1Oibf32GMI5N dIfvuhDOsZtTY8MwdP6dbOYa5DisMpej5Yd8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ht0iEC0j4OarhyDSbuUqVPCj03juNb5j0gNHH6SpSmw=; b=ScOpeHnL9kU1t4iM8ASB6v+SNx9b5T70nBklcERNT75/Qhe8OnauzLUl20TeUtA2z4 lX/yOh0vGjvQaF5nEtHUcH5GkNnNPwkOxvWZUq4CMlZAGF9re87qOjJu2AI5KM2GJvC5 DqVpAv5vjE5cu+RPhuR5Ip00yBKgqo+LBh/d8/jKKhiy6iCzA9id6tRP4KgZ8OBcsS5q GbITQhMnXavl4lBeNRtE/Ao/6qGSdybuYnjL3kVdHNgTuxNxThEaqWnI2d1kx8xeE9Aw pW6xIjhRl2/kPi7zZE4RquNDFTUsBfUs1q2u5sOCVZEpGqhIlqnUvmwSMmwVkKkrlYzi FZcA== X-Gm-Message-State: APjAAAWC5Ei4gyx3KfI60LuSk0TOrwrBUFpZxVDLX3e3ftZw2X2w2w5b 2AHxNAoMJql/Nk7+ud9L5N9nN6SAgFg= X-Google-Smtp-Source: APXvYqxChk/l3QtKS/+6xBsqBYNdC8ORu+ssMhl+OcCmMs+yPx6HXaDsgJ0VPZ8ueTuCOrUIMcBfmQ== X-Received: by 2002:a63:b305:: with SMTP id i5mr35881672pgf.274.1554854166784; Tue, 09 Apr 2019 16:56:06 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id j67sm56729208pfc.72.2019.04.09.16.56.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 16:56:05 -0700 (PDT) From: Kees Cook To: Shuah Khan Cc: Kees Cook , linux-kselftest@vger.kernel.org Subject: [PATCH 4/6] selftests/runner: Add plan line and fix result line syntax Date: Tue, 9 Apr 2019 16:55:54 -0700 Message-Id: <20190409235556.3967-5-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190409235556.3967-1-keescook@chromium.org> References: <20190409235556.3967-1-keescook@chromium.org> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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"