Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1945171pxb; Fri, 27 Aug 2021 23:28:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX7swLgjS+bn5HwZR8Ju1yGJh2ZcYcm+op2VLJ784xNVnljgLdh+TKEIXTuSBRP7YjMJ+Q X-Received: by 2002:a05:6402:1057:: with SMTP id e23mr13715106edu.352.1630132091938; Fri, 27 Aug 2021 23:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630132091; cv=none; d=google.com; s=arc-20160816; b=QBSM8Ox+4Stiq0lkZZQPdEV1j3B+7Cp8U43mE+F1/J98dd3Uc0N+oz5kWjJ3UcPdw3 eos0sSCFk4cNXq9NxLxxMLGPNqDQLzyw3qp5OwQNz+Ax+2FM05k44w96rLKltM1yZb1l 3NJwkkt7bfJVZckD/E2HpDa6ZQIcRBszLCgKf/HyP4XXiUW0QenN05+PjpeC5+wtVcl9 zyK9qnErnsRwaDnfHB9LlF8kEnD+609r0s4nAFyTNePTa+rwe6m2ayWTjFt8O8Hr3ddi 5rtg+fqMWo8caEvkrXArVukqmQuSYvSy5D6LU7lnTr7R2XidBXFSv80N2jDWGq/J3D8x Y8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ocepw5MIgKbkJ5+rqX6FwxezeVzORVwOUOKuDBN56vw=; b=LN3odk72qUq7ovZEjS6sNk+VsKIrWBgnVWsLaJ0/lqi4AKN/9XK8sDBJ3WJheggev4 tyQ0G99azTd9Jxhc9CosOq91yOwKFnSRk+8/+OBPQUHpPwFaekA+cy3YMBSTUw96KZvZ IEhQRelv2eTgZYh2dLbPJZVWfKbRB3t9xgEXAHM6T0Zbs8EZKte5Tjdm0iVmvIUgVYP5 KwBEbUNEebJPiali+ChxBWgv4Jbl6FUU/HobtBEjDdXPPaGG/F3pK59W0w/dehewz6AT tgnxr7epIRv6I6s1esAyFBLLPJJLlvFYwx3KRU1iwTCbzpQM3RPs4Rc3KOYMvt/u594M 7SqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Eti7UOt9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si7990257ejm.464.2021.08.27.23.27.43; Fri, 27 Aug 2021 23:28:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Eti7UOt9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232788AbhH1G1M (ORCPT + 99 others); Sat, 28 Aug 2021 02:27:12 -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-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