From patchwork Fri Aug 27 22:58:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rae Moar X-Patchwork-Id: 12462955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 087AFC432BE for ; Fri, 27 Aug 2021 22:58:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBF7060698 for ; Fri, 27 Aug 2021 22:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232427AbhH0W7N (ORCPT ); Fri, 27 Aug 2021 18:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232426AbhH0W7N (ORCPT ); Fri, 27 Aug 2021 18:59:13 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8ABEC0613D9 for ; Fri, 27 Aug 2021 15:58:23 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id k21-20020a056a001695b0290329e718b5a3so13307pfc.15 for ; Fri, 27 Aug 2021 15:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=5kt2Hs53YExhNYpfPSX+vfaUKXrkgz5zWfnPb9H9C5o=; b=CwVuEzd0fS3U5i7hEYs6kt8YGwK1Q+B0CA8MKQ0HFuUN7KjKITVZBmOAj9+61B/xUL H5eS7kjXwCW2Opax4eWgDUdycDVagLubSWmiM2uugcT5KVFWpajGG8X15tmzZe3VoaXG +236OKR3PaEC7xQONOBiLikYG6tNnLB2eA05KVSwgFn2uOYSOvyKMWfSoElbzwSHWeLO AMAUbEirs+E7hRG5UhbEizrS27gT89Dv0LCRFDz5Pr/VSfOURlAlsPHH7NhqBm26EGRD elIhr8IQWl3ZOni+DMR8RNbD+H/fFGRSGsTX79XayMd42lQGs3GKxcDCTXWzXGdbmLvs lWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=5kt2Hs53YExhNYpfPSX+vfaUKXrkgz5zWfnPb9H9C5o=; b=orVtRAZYSX3FHr7AVbaa4p8E4pH4S6T+A58rqsO5pmxf/zcQgwahO2ciEklHXf1p2F E5k/xvfJVEnUArqn6J6ELAd8b9M4oHC8ndNaZA1KuTtzuwOwbskQQCtgfaql8m5P7swT gCfOjb1tRk0fRsEYBqGPg+18WDJdw3zuG13tfF+qQG6SfbS5x3DvEZxizr1Wh/22Izcn lu3qraX7Y2Auzu+gp2y38yGJCSPI1GJqeffw9WzGntvnbnJnFqeRZDrQolQXwgd3vAxC P+Y+k6+3PjGqR2OMRY3GuC+SsV5kg/V6GZ8IwugfASTpVIdRIOZqzLPozfQVB1WjWd7I SCPQ== X-Gm-Message-State: AOAM532GOiFVWzyn6sFHg6gDWvssG3/tMehr3Y/s1GCJLkoCwy+9S+VI YPWiNxw24k2WurPKfWJdPCD3wAvwpQ== X-Google-Smtp-Source: ABdhPJwuGZHQKI3Z4ubJeC6jgqz/RDnR26QtINCQ0T5nhoUDIbS6Tb/DK4aJEaBXwMqbuAjIIzLy/idWhQ== X-Received: from sunrae.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2814]) (user=rmoar job=sendgmr) by 2002:a17:90b:1182:: with SMTP id gk2mr285811pjb.109.1630105102801; Fri, 27 Aug 2021 15:58:22 -0700 (PDT) Date: Fri, 27 Aug 2021 22:58:11 +0000 In-Reply-To: <20210827225812.3247919-1-rmoar@google.com> Message-Id: <20210827225812.3247919-2-rmoar@google.com> Mime-Version: 1.0 References: <20210827225812.3247919-1-rmoar@google.com> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog Subject: [PATCH 1/2] selftests: tool: Add subtest header line and change indentation format in TAP results From: Rae Moar To: brendanhiggins@google.com, davidgow@google.com, dlatypov@google.com, keescook@chromium.org, shuah@kernel.org Cc: kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Rae Moar Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This patch 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@mail.gmail.com/). Two changes: - Change from "# " to " " for indentation of nested tests - Add subtest header line at start of tests with subtests. Line format is "# Subtest: [name of test]". An example of the new format: Old format: TAP version 13 1..1 # TAP version 13 # 1..1 # # Starting 1 tests from 1 test cases. # # RUN global.get_syscall_info ... # # OK global.get_syscall_info # ok 1 global.get_syscall_info # # PASSED: 1 / 1 tests passed. # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 1 selftests: ptrace: get_syscall_info New format: TAP version 13 1..1 # Subtest: selftests: ptrace: get_syscall_info TAP version 13 1..1 # Starting 1 tests from 1 test cases. # RUN global.get_syscall_info ... # OK global.get_syscall_info ok 1 global.get_syscall_info # PASSED: 1 / 1 tests passed. # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 1 selftests: ptrace: get_syscall_info Signed-off-by: Rae Moar Change-Id: I139774745310ad2cd6dc5d7740254e48d8226241 --- tools/testing/selftests/kselftest/prefix.pl | 2 +- tools/testing/selftests/kselftest/runner.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kselftest/prefix.pl b/tools/testing/selftests/kselftest/prefix.pl index 12a7f4ca2684..e59374b62603 100755 --- a/tools/testing/selftests/kselftest/prefix.pl +++ b/tools/testing/selftests/kselftest/prefix.pl @@ -16,7 +16,7 @@ while (1) { my $bytes = sysread(STDIN, $char, 1); exit 0 if ($bytes == 0); if ($needed) { - print "# "; + print " "; $needed = 0; } print $char; diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh index cc9c846585f0..9b04aeb26d3a 100644 --- a/tools/testing/selftests/kselftest/runner.sh +++ b/tools/testing/selftests/kselftest/runner.sh @@ -23,7 +23,7 @@ fi tap_prefix() { if [ ! -x /usr/bin/perl ]; then - sed -e 's/^/# /' + sed -e 's/^/ /' else "$BASE_DIR"/kselftest/prefix.pl fi @@ -75,7 +75,8 @@ run_one() echo "not ok $test_num $TEST_HDR_MSG" else cd `dirname $TEST` > /dev/null - ((((( tap_timeout ./$BASENAME_TEST 2>&1; echo $? >&3) | + (echo " # Subtest: selftests: $DIR: $BASENAME_TEST" && + (((( tap_timeout ./$BASENAME_TEST 2>&1; echo $? >&3) | tap_prefix >&4) 3>&1) | (read xs; exit $xs)) 4>>"$logfile" && echo "ok $test_num $TEST_HDR_MSG") || @@ -83,7 +84,6 @@ run_one() if [ $rc -eq $skip_rc ]; then \ echo "ok $test_num $TEST_HDR_MSG # SKIP" elif [ $rc -eq $timeout_rc ]; then \ - echo "#" echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds" else echo "not ok $test_num $TEST_HDR_MSG # exit=$rc" From patchwork Fri Aug 27 22:58:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rae Moar X-Patchwork-Id: 12462957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A3BC4320E for ; Fri, 27 Aug 2021 22:58:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25CC860FC4 for ; Fri, 27 Aug 2021 22:58:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232396AbhH0W7T (ORCPT ); Fri, 27 Aug 2021 18:59:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232474AbhH0W7S (ORCPT ); Fri, 27 Aug 2021 18:59:18 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B60C0617AD for ; Fri, 27 Aug 2021 15:58:28 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id q13-20020a25820d000000b0059a84a55d89so8090066ybk.23 for ; Fri, 27 Aug 2021 15:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=1vVn3tT4i3E1FmbURQDOaSj4WaBWIdDZC/BLf0YptVo=; b=amWWbC4Vd2VlctVqbhne1QKiw4B3hrhIb4FhT4FizxwTOMAgV7eULVijyk+3PVUZl3 geP+wc1VfDExeq9hMedHt+dEh8yCqxDeOaW+DXQZrfa2fD8iAA5ShrKgwVHVfiphOFb+ EVX35GpTlIEEXY1HpFuFxtjIu1U8RKscpyj/neSEFUl6c6hk1Y09chRFSMFTMfZA33n1 Skvd0ELdhLLh3HdLm1LIPVcowumewcyvU+a0IwiifnBmwV8ZVLpMh2w52HxVrXmdihuv GFaZm9dRvZJLcYOK24g/OXezZs1BUTjAzokqRGTgfZiAQdg7l/dDR1iLW4liR30WRvc+ sqYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=1vVn3tT4i3E1FmbURQDOaSj4WaBWIdDZC/BLf0YptVo=; b=XEgfH70k12ixsWwKbGyOF5fF//QjFNU7iNp9jgYT2j2icI6gEFDjxP3gnuF2//lQqw JNCaO8dvM8XdKIJHyIJG8EnXca8FszeMmXLvAEio0mak7FVNHlAku4WwfQ+FtrbVRi/H F1RIe0T3kstRpuoa3e51ujj6IPk5dXMhz1WE7wgxPd6NNTBuy9hS7VSdpUerMs8QRqJN 8Ik2Xfpdf0tSUDhlt6Lf54HwTrALSgu5tg9ZPwkRyOxJ7KcGqn9KBB0+zE31cIlfE75c uhTllqH0p6gAOnJhb/vt+Izr8/4/SY++3QkZ7ZJDBy6vHa2eS9x68QGT18p/188RlasM POng== X-Gm-Message-State: AOAM531DVwYFa8DlE0VKN+bdBDG/QIKFfcSw6h1gzMvNVYIYwsKTXbcT HTjLm//d74xmflvi/UyFJIE6O7TDNw== X-Google-Smtp-Source: ABdhPJxYJKi9TruSA6ySOacyal37q2p6g1uxh23QfUPvKU++OzDjQwdfE9PbLpLJFBQ5IRxHcLJ5qGpmJA== X-Received: from sunrae.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2814]) (user=rmoar job=sendgmr) by 2002:a25:b810:: with SMTP id v16mr8723586ybj.357.1630105108003; Fri, 27 Aug 2021 15:58:28 -0700 (PDT) Date: Fri, 27 Aug 2021 22:58:12 +0000 In-Reply-To: <20210827225812.3247919-1-rmoar@google.com> Message-Id: <20210827225812.3247919-3-rmoar@google.com> Mime-Version: 1.0 References: <20210827225812.3247919-1-rmoar@google.com> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog Subject: [PATCH 2/2] Revert "selftests: Remove KSFT_TAP_LEVEL" From: Rae Moar To: brendanhiggins@google.com, davidgow@google.com, dlatypov@google.com, keescook@chromium.org, shuah@kernel.org Cc: kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Rae Moar Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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@mail.gmail.com/). Signed-off-by: Rae Moar 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