From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 4A310C4320A for ; Sat, 28 Aug 2021 06:26:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 294C360C51 for ; Sat, 28 Aug 2021 06:26:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233337AbhH1G1N (ORCPT ); Sat, 28 Aug 2021 02:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbhH1G1M (ORCPT ); Sat, 28 Aug 2021 02:27:12 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3103EC0613D9 for ; Fri, 27 Aug 2021 23:26:22 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id 7so7640182pfl.10 for ; Fri, 27 Aug 2021 23:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ocepw5MIgKbkJ5+rqX6FwxezeVzORVwOUOKuDBN56vw=; b=Eti7UOt9z/9+9aczhhg1I99bmTfukQ6VNqBOWSvLTrewuKrRU2dKnbRh+FTibAUNV3 4W2l+qdc8Z+Fk4S04yPbo0VIb+hBmRmLfEoRQSMbAJ9cHa3csTwpmCdtnvh0sh+ynn1L YEhn2weu73nCoVyJHYi2GpxfTlauGhnz6kqg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ocepw5MIgKbkJ5+rqX6FwxezeVzORVwOUOKuDBN56vw=; b=MIVbEHJM1T2tJJIFeZ7c3PGVJYZSYflDMb5nEMjiVBhF6if5KEib1pAlQotx0ceGVH 2tccnT05EX1vCNolfQQa2upudbmfHGQ+0OACM9C0xBYWAWeQKVQZA7ybZDI0PM/QwaWF nu5HGDECRz8Iwlpk9uGBKCHvJUkdQmYxcC3MtzooKhW/je3PvmVReYC3xYya5ESJdA3p /m4v4+E5mfF6EFjE3Yhaw3nVMVdGGCyHBU47j2cL+VGcvFGNIkdNT/z6+oOnqBcqwEbY kh9Mrpet8w7q/vwdSZ+7bnt18OkppjaFndH1/i4Zdz7pzzGiSlQeA7jhu4XcYmmpKU9P /Q9w== X-Gm-Message-State: AOAM533Bew3C/QXSbjYH+F+wo52XV5NvhWxoryZ6zGku5cenKJbd2DU4 23Sfz/OI3KLmWdS6J75l7Gccew== X-Google-Smtp-Source: ABdhPJydtxI5ls6lxDQqjPVlGkBHr/rhjjX+WD3NtQjQRgT6be0vPrIAHbG9cqZCpfFJk7OYLrrnEA== X-Received: by 2002:aa7:9096:0:b0:3e1:72fd:a614 with SMTP id i22-20020aa79096000000b003e172fda614mr12493910pfa.56.1630131981675; Fri, 27 Aug 2021 23:26:21 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 192sm8424667pfz.140.2021.08.27.23.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 23:26:20 -0700 (PDT) Date: Fri, 27 Aug 2021 23:26:18 -0700 From: Kees Cook To: Rae Moar Cc: brendanhiggins@google.com, davidgow@google.com, dlatypov@google.com, shuah@kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] selftests: tool: Add subtest header line and change indentation format in TAP results Message-ID: <202108272314.403830F980@keescook> References: <20210827225812.3247919-1-rmoar@google.com> <20210827225812.3247919-2-rmoar@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210827225812.3247919-2-rmoar@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 10:58:11PM +0000, Rae Moar wrote: > 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 Some of the existing TAP parsers expect leading spaces to be parsed as YAML (from the _preceeding_ test result). "#" is understood to be diagnostics about the currently running test. Since there's no "---" nor "..." here, and the other parsers were pretty busted to try to parse YAML without those, I can be convinced that diagnostics can be marked with a leading " ", but if that's true, why not just drop all "#" usage? Then we'd have: 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 > @@ -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) | What's the benefit here? All I see is that now the test and the runner are once again mixing the responsibility of generating the test output. The subtest should be able to run strictly independently. > 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 "#" NAK: this is ensuring a newline before the "not ok" line on a timeout, where the test output may have been interrupted before printing a newline. (i.e. unflushed progress report style output) > echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds" > else > echo "not ok $test_num $TEST_HDR_MSG # exit=$rc" -Kees -- Kees Cook