Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5423119pxb; Mon, 7 Feb 2022 01:26:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXIv1GagxRIWDYQWkoFEaE3rpeSvognK5BRgk5QEek9He+l/b5MPUfM9EB1rQKWjm/MByl X-Received: by 2002:a17:902:8c84:: with SMTP id t4mr15499331plo.78.1644225982529; Mon, 07 Feb 2022 01:26:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644225982; cv=none; d=google.com; s=arc-20160816; b=USCr/dkhG8NjmTLa9flmG6slnt8Xe96QdqC3rLJGJU1B8zJWN9pJEPIKmAd8BiIdIx ER6esKeoxz5p+QlJB2G189ctl+6oIRtQFg6Gzo4f8CDoyLBhK5GtJAGfNa9pS9d9W3wz Is18HlzA5SViOHQxrlYcsLwVpxFeCiG2uaLY4kHPhdfHE4VjyPlrpyPNLSwbCvhhdMmi NhM6+uXmLCQZM+Kh4xCElbR9abCs9lsP4jH5VlFqkL/umiW0eMKNP5F7fxw0e2MN/d9F +JFnvo9piLTa9Lu/RUeLNOvzzr5Z0U3hplsp0P/DYMc4qzweJ7/akRpkZP40Jr4pg7L3 /huA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+kPloqKO1KO25u/0GdWv0wKux8vVdRY/SXvc99NBLRA=; b=TekQHBV39+Uy2yL98eRvwvDwigW5OM17z5Jo8mtuVvRGNGl6ZIMO4K9o14QpWsrXhq 8SW8ho1vhoMjDfPUhXLtkje61OWt8GgFLSCF0vG94XNG1Y60Jw2Vg24StmiutD1PVFLH gKN6S5PjfJQWfYWEht3IiSMZ/6FyfEYCf/0wE7B5zRa9a4aiOLeEAy/mWJuCc4J42wq9 IRUVtxRpfgmb4AlTUCUadWRsIUc5L9ONY5jiZcNo4zyGEC1AS3c77mz6QFsv0r1bTKJ3 ejMTbeMP2C2xMzmKbs+An8DSYi4W6ZgAKgnogTtzHi/OZtNH51e9+uQcy7wYNOeNCgxU K2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=FAnneMzn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g186si9260462pgc.790.2022.02.07.01.26.09; Mon, 07 Feb 2022 01:26:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=FAnneMzn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378659AbiBEAvd (ORCPT + 99 others); Fri, 4 Feb 2022 19:51:33 -0500 Received: from mail-wr1-f52.google.com ([209.85.221.52]:40472 "EHLO mail-wr1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350118AbiBEAvb (ORCPT ); Fri, 4 Feb 2022 19:51:31 -0500 Received: by mail-wr1-f52.google.com with SMTP id s18so14198023wrv.7 for ; Fri, 04 Feb 2022 16:51:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+kPloqKO1KO25u/0GdWv0wKux8vVdRY/SXvc99NBLRA=; b=FAnneMznrfb4GJPaMgaKUGveEE5vvi5nQtjVkQ3Fbdxs4mGdY/dV0xc0pdqX3xLwmQ pcfV3YKuQy6VGq+S2UN/zIaYb/1paxGGCMVHlc36QMMW91yqTqvhSK3Xo30rt3Z18SBV NmAMzQZFI5yePNcewowgTjU5uwLhQQoVrnwNqiKbyymqXtVy2ZSavFCeo9tZnieBBmnQ i8B1Bm7K+VMXzr0P7V+Vys3cSVvpHhu6mBLusA0cQTapY46JRL7+zjoxa8n9ngyCRSun Mcg6FRdVMJaUGF5uVB3+X2LUdszVnnOpONIXw3j6pagRedCXqVHRyh/aH8uDVMDX3fZS n/Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+kPloqKO1KO25u/0GdWv0wKux8vVdRY/SXvc99NBLRA=; b=DN0k1n7/EtRpkohtHreiXRG9MjNfnMjLUivFH/IIWowafwmoz+on6YkPShWi465Y1G LhWGA0fnorX1UlgBMZa9BjclKXGFJALNIOHpTvYi1LgmXCUdfMmKEFDhGTHkSZzqwea9 yNysgMYp7znW1iBgb7YOebiALFMQEDNtXjBA+t0PtqPtvoKFhwO6yS4VR13eGe2bL9HO DbRf/46QjRUgn83XFfliVCFDHIlONqgviJennqrZJ6GPLfzmb9u1iWdczQVvzHgbjszj nQDALD28FlDq0I/+FVuESqDDDLOrNRjwXPxO+XeduvrVLyZQuWpYcTGCEFg2O8YxD5hf YYsw== X-Gm-Message-State: AOAM530e9aspsLzJYowrPIHiDJtWawI20V35TSP3u5R8MTHmz7phQFaT Y+e57Yui5GkHditLeQT/pNQWCv1CI2cTzs2sZb9Nwg== X-Received: by 2002:a05:6000:1a50:: with SMTP id t16mr1081375wry.571.1644022257448; Fri, 04 Feb 2022 16:50:57 -0800 (PST) MIME-Version: 1.0 References: <20220204203248.2981902-1-frowand.list@gmail.com> In-Reply-To: From: David Gow Date: Sat, 5 Feb 2022 08:50:45 +0800 Message-ID: Subject: Re: [PATCH 1/1] Documentation: dev-tools: clarify KTAP specification wording To: Frank Rowand Cc: Jonathan Corbet , Shuah Khan , Kees Cook , Rae Moar , "Bird, Tim" , Brendan Higgins , Rae Moar , Guillaume Tucker , Daniel Latypov , kernelci@groups.io, KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 5, 2022 at 8:18 AM Frank Rowand wrote: > > On 2/4/22 5:13 PM, David Gow wrote: > > On Sat, Feb 5, 2022 at 4:32 AM wrote: > >> > >> From: Frank Rowand > >> > >> Clarify some confusing phrasing. > > > > Thanks for this! A few comments below: > > > >> > >> Signed-off-by: Frank Rowand > >> --- > >> > >> One item that may result in bikeshedding is that I added the spec > >> version to the title line. > > > > This is fine by me. > > > >> > >> Documentation/dev-tools/ktap.rst | 12 ++++++------ > >> 1 file changed, 6 insertions(+), 6 deletions(-) > >> > >> diff --git a/Documentation/dev-tools/ktap.rst b/Documentation/dev-tools/ktap.rst > >> index 878530cb9c27..3b7a26816930 100644 > >> --- a/Documentation/dev-tools/ktap.rst > >> +++ b/Documentation/dev-tools/ktap.rst > >> @@ -1,8 +1,8 @@ > >> .. SPDX-License-Identifier: GPL-2.0 > >> > >> -======================================== > >> -The Kernel Test Anything Protocol (KTAP) > >> -======================================== > >> +=================================================== > >> +The Kernel Test Anything Protocol (KTAP), version 1 > >> +=================================================== > >> > >> TAP, or the Test Anything Protocol is a format for specifying test results used > >> by a number of projects. It's website and specification are found at this `link > >> @@ -186,7 +186,7 @@ starting with another KTAP version line and test plan, and end with the overall > >> result. If one of the subtests fail, for example, the parent test should also > >> fail. > >> > >> -Additionally, all result lines in a subtest should be indented. One level of > >> +Additionally, all lines in a subtest should be indented. One level of > > > > The original reason for this is to accommodate "unknown" lines which > > were not generated by the test itself (e.g, a KASAN report or BUG or > > something). These are awkward, as sometimes they're a useful thing to > > have as part of the test result, and sometimes they're unrelated spam. > > (Additionally, I think kselftest will indent these, as it indents the > > full results in a separate pass afterwards, but KUnit won't, as the > > level of nesting is done during printing.) > > > > Personally, I'd rather leave this as is, or perhaps call out "unknown" > > lines explicitly, e.g: > > Additionally, all lines in a subtest (except for 'unknown' lines) > > should be indented... > > Only listing result lines as being indented is not consistent with > the "Example KTAP output" section. The example shows: > > Version line - indented > Plan line - indented > Test case result lines - indented > Diagnostic lines - indented > Unknown lines - not shown in the example > > So there seem to be at least 4 types of lines that are indented for a > nested test. Agreed. > > The TAP standard (I'll use version 14 for my examples) does not allow > unknown lines (TAP 14 calls them "Anything else"). It says "is > incorrect", and "When the `pragma +strict` is enabled, incorrect test > lines SHOULD result in the test set being a failure, ...". TAP 14 > calls for the opposite behavior if `pragma -strict` is set. Are you reading the same version 14 spec as me? https://github.com/TestAnything/Specification/blob/tap-14-specification/specification.md I can find these lines in the version 13 spec, but not TAP14, which doesn't mention "Anything else" lines at all... Not that it matters... I'll just follow along with version 13. > > TAP 14 goes on to say "`Test::Harness` silently ignores incorrect lines, > but will become more stringent in the futures. > > It seems to me that KTAP "Unknown lines" are fundamentally different > than TAP 14 "Anything else" lines. Tests that generate KTAP output > may print their results to the system console (or log), in which > case kernel messages (or for the system log the messages may even > come from non-kernel sources) either directly triggered by a test or > from a task that is totally unrelated to the test may exist in the KTAP > data stream. So I would agree that "Unknown lines" are not indented. > Even if the "Unknown line" is directly triggered by the test. I do think that KTAP "unknown lines" and TAP "anything else" lines cover similar ground, the big difference being that in KTAP they're explicitly permitted, rather than "incorrect". I guess how similar they are is as much a matter of perspective as anything... I'd agree that "unknown lines" don't _need_ to be indented, but I wouldn't call it an error to indent them if that's something a test harness does. > > But I think the KTAP specification should say that "Diagnostic lines" > are emitted by the test (or the test harness), and thus must be > indented when related to a nested test. > > And as you suggest, "Unknown lines" should be explicitly called out > as not being part of "lines in a subtest", thus do not need to be > indented. > > Does that sound good? > Agreed on both counts. Sounds great, thanks! Cheers, -- David > > > > Thoughts? > > > >> indentation is two spaces: " ". The indentation should begin at the version > >> line and should end before the parent test's result line. > >> > >> @@ -225,8 +225,8 @@ Major differences between TAP and KTAP > >> -------------------------------------- > >> > >> Note the major differences between the TAP and KTAP specification: > >> -- yaml and json are not recommended in diagnostic messages > >> -- TODO directive not recognized > >> +- yaml and json are not recommended in KTAP diagnostic messages > >> +- TODO directive not recognized in KTAP > >> - KTAP allows for an arbitrary number of tests to be nested > >> > > > > Looks good here, cheers. > > > > > >> The TAP14 specification does permit nested tests, but instead of using another > >> -- > >> Frank Rowand > >> >