Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6387849rwb; Tue, 22 Nov 2022 12:37:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf40HPnWBnWaBRiLAhnSNzDZb9pHmum8ZDmDztKIG0QT9ZGWedzlNGTtB6SKXiEpydjvu6nU X-Received: by 2002:a17:902:e494:b0:189:19db:56f2 with SMTP id i20-20020a170902e49400b0018919db56f2mr6594843ple.7.1669149479740; Tue, 22 Nov 2022 12:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669149479; cv=none; d=google.com; s=arc-20160816; b=aeoj3jZwYPs+9z6jmQUhKNZN5Dt1cl3qf5EJzUpg9Oh+6o9sIMG4+cBFdCZCFIT6R/ JKC40iXksi3lR+LUK16+0f8LSoTFmNMEq5i3btpV5L+MSMxT5y8se89j3SfM73qF34wu 8shyhl7pnDQ/1V+o/ggWYaSZ/8fFEwmc1FYzfZ9FHdZm3dRPhP6Nu1S9Nh6cPQNmXmhQ UcOf2fD+tQ2Vk1SoT/xYaD43a5SZ3EdhAfFDxSEc3yRDD6w+8M3cFOh2flRRBpoVuMYg JrSEFVscVfcXQ4LeLEGLPY+y8NvKzQzoF48fJaVXn2udEFo/vbBrtBVIyqOUgG5oLwTz DrBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=JJeM2QZ9j6Bl1KYDD45QbX15tSP8xUPz8dxNHtRGie0=; b=OxLtdC0mSYyJLz47j/v9cyJjNV+GwloEUl8HdOMer00qMrcSL2dKAaHxawFH5tydkd Qk0DlbzUzRur/yQnJQD3Wq/lansLraTuFosBTOjB7fxvW9R6BRCCPWwbTSqII9EAHaZz ANw5uCtU3GOyjkZXeCaiRQeqFewLSWHjDXF5ViRQahgNVJabGbZ920Y5cP/5YuC0eD9J v/mfVkYk/8Y7AIYIUROS+RnQkMGgLtChvMsfu3Uv/b17lYZdxbmD8ZIwgmd47LYcaQGp 9EJ3sD77HsfT13nFIgKddHFa8aF8beG99H9+L1ak6sf+cLZsNCwKfQ9sW/9qNO1QKNcm qglQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SJhuMMaS; 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 p6-20020a654906000000b00458ae7b0a24si15399995pgs.208.2022.11.22.12.37.46; Tue, 22 Nov 2022 12:37:59 -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=SJhuMMaS; 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 S234113AbiKVUTo (ORCPT + 90 others); Tue, 22 Nov 2022 15:19:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233701AbiKVUTm (ORCPT ); Tue, 22 Nov 2022 15:19:42 -0500 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764DE27FE4 for ; Tue, 22 Nov 2022 12:19:41 -0800 (PST) Received: by mail-oi1-x229.google.com with SMTP id q83so17003537oib.10 for ; Tue, 22 Nov 2022 12:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JJeM2QZ9j6Bl1KYDD45QbX15tSP8xUPz8dxNHtRGie0=; b=SJhuMMaSp6msJ0PsB556c5ah3uZu7a10YngHgwsZfuGDB8+IF/LJYOqzGIhX52Sqnh acj5Uc5MxbBqHpuvgO/xmEsUWBOXnTL9JOwQmaT4jWTgAYV8Zf/vt4UFcQx7lPJOyCex y81jzFq1ki8KZ+JPC9h/sjVY4plAq19ncn+IccWU0PzEpSNsk1FXhp44fZvll2ffWsRz Vz1ZzxFiAIOh97C7LqM0knQbx+mo59/ByP/U7J5Q2HXKa8BzC9Mtu6NlEgAUR2+Tj2l9 OL2xSSxY6WsL0FGRgRLj6ByyizeMe1cqwJmp6pttKjVEFi5kchTfcPhiv3Vbu5CdOMOb azww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJeM2QZ9j6Bl1KYDD45QbX15tSP8xUPz8dxNHtRGie0=; b=TFReexyD+nyj57o21+0EQyLYn6w2i7abcWwlTMFt3JMb56wvfLoGos5HHgNnhU75Rh JNGL0FfczNqNBfKwgyIUMO5djkib0NYWXYd9EbyF29PFY1rBzYMM5BlbqQiovDSUiRav fp2KOFBohiNVIE+xwwJCrBkKCwrXfs1YYFQegJJ3TOtnDGQilbmz9fy5KIwaweCwkhpz glsToPvCNudoydUxV0yaBeshM7c4QdutgPJ9BDQPuZ5BYrwJgpifU5ftq41SHQs6tifg BrsS72GQNMjY5nrX4rZocFOODdB6aSxxGJLiAMnMhfOVqbF1ro/pE9fhqUZnur468UA/ A0og== X-Gm-Message-State: ANoB5pnbnkvySEI/MSMH3UqPo55YpPafgUZGO48R7t9l0mYul7dcxMcl C+wMys1oNxUO+dhRiBp6BY9FKkWpElkyq4ZJx/dW2g== X-Received: by 2002:a54:441a:0:b0:35a:4390:1b8b with SMTP id k26-20020a54441a000000b0035a43901b8bmr2549926oiw.122.1669148380657; Tue, 22 Nov 2022 12:19:40 -0800 (PST) MIME-Version: 1.0 References: <20221121184743.1123556-1-rmoar@google.com> <20221121184743.1123556-2-rmoar@google.com> In-Reply-To: From: Rae Moar Date: Tue, 22 Nov 2022 15:19:28 -0500 Message-ID: Subject: Re: [PATCH v2 2/2] kunit: improve KTAP compliance of KUnit test output To: Daniel Latypov , Anders Roxell Cc: brendanhiggins@google.com, davidgow@google.com, skhan@linuxfoundation.org, mauro.chehab@linux.intel.com, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, isabbasso@riseup.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 22, 2022 at 12:14 PM Daniel Latypov wrote= : > > On Tue, Nov 22, 2022 at 1:17 AM Anders Roxell = wrote: > > > > On Mon, 21 Nov 2022 at 19:48, Rae Moar wrote: > > > > > > Change KUnit test output to better comply with KTAP v1 specifications > > > found here: https://kernel.org/doc/html/latest/dev-tools/ktap.html. > > > 1) Use "KTAP version 1" instead of "TAP version 14" as test output he= ader > > > 2) Remove '-' between test number and test name on test result lines > > > 2) Add KTAP version lines to each subtest header as well > > > > > > Note that the new KUnit output still includes the =E2=80=9C# Subtest= =E2=80=9D line now > > > located after the KTAP version line. This does not completely match t= he > > > KTAP v1 spec but since it is classified as a diagnostic line, it is n= ot > > > expected to be disruptive or break any existing parsers. This > > > =E2=80=9C# Subtest=E2=80=9D line comes from the TAP 14 spec > > > (https://testanything.org/tap-version-14-specification.html) > > > and it is used to define the test name before the results. > > > > > > Original output: > > > > > > TAP version 14 > > > 1..1 > > > # Subtest: kunit-test-suite > > > 1..3 > > > ok 1 - kunit_test_1 > > > ok 2 - kunit_test_2 > > > ok 3 - kunit_test_3 > > > # kunit-test-suite: pass:3 fail:0 skip:0 total:3 > > > # Totals: pass:3 fail:0 skip:0 total:3 > > > ok 1 - kunit-test-suite > > > > > > New output: > > > > > > KTAP version 1 > > > 1..1 > > > KTAP version 1 > > > # Subtest: kunit-test-suite > > > 1..3 > > > ok 1 kunit_test_1 > > > ok 2 kunit_test_2 > > > ok 3 kunit_test_3 > > > # kunit-test-suite: pass:3 fail:0 skip:0 total:3 > > > # Totals: pass:3 fail:0 skip:0 total:3 > > > ok 1 kunit-test-suite > > > > > > Signed-off-by: Rae Moar > > > Reviewed-by: Daniel Latypov > > > Reviewed-by: David Gow > > > > I tried this patch, see the full boot log [1] and I can still see some > > tests that output the "old" format with 'ok 1 - kunit_test_1', for exa= mple > > > > ok 1 - 1901-12-13 Lower bound of 32bit < 0 timestamp, no extra bits > > > > Isn't this something that should be converted too? Hello! Sorry for missing that. You are definitely right. Those results shou= ld be converted as well. > > Yes, thanks for catching that. > That's what I get from only looking over the diff this time since I > thought I remembered the code... > > We also want this diff to fix a) debugfs, b) subtests. > > diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c > index 1048ef1b8d6e..de0ee2e03ed6 100644 > --- a/lib/kunit/debugfs.c > +++ b/lib/kunit/debugfs.c > @@ -63,7 +63,7 @@ static int debugfs_print_results(struct seq_file > *seq, void *v) > kunit_suite_for_each_test_case(suite, test_case) > debugfs_print_result(seq, suite, test_case); > > - seq_printf(seq, "%s %d - %s\n", > + seq_printf(seq, "%s %d %s\n", > kunit_status_to_ok_not_ok(success), 1, suite->name); > return 0; > } > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > index 19344cb501c5..c9d57a1d9524 100644 > --- a/lib/kunit/test.c > +++ b/lib/kunit/test.c > @@ -556,7 +556,7 @@ int kunit_run_tests(struct kunit_suite *suite) > > kunit_log(KERN_INFO, &test, > KUNIT_SUBTEST_INDENT > KUNIT_SUBTEST_INDENT > - "%s %d - %s", > + "%s %d %s", > > kunit_status_to_ok_not_ok(test.status), > test.param_index + 1, param_des= c); > > Daniel Thanks Daniel! I think that should do the trick with the addition of adding the "KTAP version 1" line, which you can do with the following diff: diff --git a/lib/kunit/test.c b/lib/kunit/test.c index c9d57a1d9524..1c9d8d962d67 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -543,6 +543,8 @@ int kunit_run_tests(struct kunit_suite *suite) /* Get initial param. */ param_desc[0] =3D '\0'; test.param_value =3D test_case->generate_params(NULL, param_desc); + kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT + "KTAP version 1\n"); kunit_log(KERN_INFO, &test, KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT "# Subtest: %s", test_case->name); Going to run through some more examples to make sure this version works otherwise I will make a v3 with the addition of fixing any merge conflicts. Rae