Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp851348pxu; Wed, 2 Dec 2020 05:13:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZTzVh6djIhx3X46WvhS8ES715VvbYEz/evxtlJO0NV7ibARRr4Omk38MiESpn/kRLhGbr X-Received: by 2002:a17:906:5912:: with SMTP id h18mr2192240ejq.261.1606914779809; Wed, 02 Dec 2020 05:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606914779; cv=none; d=google.com; s=arc-20160816; b=hUiVAHWIQkOkJVvbWRIaFRGCSMk6jCqcbszTodtbXTIzrUI5YjG6rKn3ysmyHdG3pI EyADUpcQB8j6XN+NTXBSvQM6jqH5c2KF1zdbpS7CahVRTE8UyWUfpiylwylvlDom2Uxx i+LXPGr5VQfHLFWxdEpc0dNIxs3iodFfifL6CpsOfgg7Ir4Hm1apc+WJz7rTi8gV53VY WtwM0yybkhxWENBylOB6PDQ8G3n9PfTYMEkFAZnTKfrboVHHHjOVTvwJGME2XRvdstGE XP49xuFYOi/JrrMIf4cW9c4T42V/lTgWk2w7vAJ0BFVrVCan+r2ppXMVMQd12JK/NnXV uR3w== 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=i4Suf39GCGNNHp9xQ0t7Zvgxat9mlBC6lgDT1pUfxf8=; b=0brfOOdzw0MaDBGHFdIFjqxRiAE+ZRq9QWkHKkyv41DVwRFtw6/W0XLU0ek/BHktyz 9URd46mCw9LGoSpv8j8yHqtC6WGfg4lC3iQPvaBhhYcfL6ecdGiYdBpQF1e5VVyUuo+e k56gnaqIL95TxVLwW3WCEgYGE40+w3rduQckN4dpX1vz2EGeeBZx5zdFIrk4hqD1kOjn 3WJiqcEtfMSHyT3fr0Lq20r3EmjdJUGID0f0cCu1OzovdO8/KXkFwDR0+37rEIBq67e6 4aqtAS1T3JJEfLAmyMS4A3+tyR6nGoqvIDAsjej9ZfSkKA8+zONLe/xM/9Xfd0PSLtVT mzKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FM8PTyPU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zc8si779905ejb.662.2020.12.02.05.12.35; Wed, 02 Dec 2020 05:12:59 -0800 (PST) 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=@google.com header.s=20161025 header.b=FM8PTyPU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730038AbgLBNLQ (ORCPT + 99 others); Wed, 2 Dec 2020 08:11:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbgLBNLP (ORCPT ); Wed, 2 Dec 2020 08:11:15 -0500 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B59EFC0613D4 for ; Wed, 2 Dec 2020 05:10:28 -0800 (PST) Received: by mail-lj1-x244.google.com with SMTP id t22so3643293ljk.0 for ; Wed, 02 Dec 2020 05:10:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i4Suf39GCGNNHp9xQ0t7Zvgxat9mlBC6lgDT1pUfxf8=; b=FM8PTyPU6TQTdnznfVQtjDlCFBomkBLOza9aIVUNFobA4LQplmlPkVf91dS+rRDR4g b0DRhOd8uTdbxwVj5LQDZJWGmFHP6gVqF8LzPbDTQlUPTjG5Ega8JUm46ZF8kTCRiTGy E3HBlchayQ+Y+NEq03G2hLtfgXfYIhZWZD7fGTymaQiOnblWT6/AkrIlTUkv8Ukm9Sqn SrPa3h7I7+i+2mWLWFP1PqW8Fmk8EumQcSbFvXWdT2lYsZsYf246ARFDmelfpz1M0aZT GGlAhNPeiLBtONohGTwREA1bVCy0leHymUQyhcdmcVH9mJ5dZXrqoYAgi9+9sd6Ik7E/ wsjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i4Suf39GCGNNHp9xQ0t7Zvgxat9mlBC6lgDT1pUfxf8=; b=XGTOZ6ntDOYgSpBypo8f1/qBp5pwNZk0NG5cV0bP2cYbt44zZBrvwm5xyiXmvz9biD ztMaDZUU7drdHv7i0wiv4Wtux+5CK6li9z8WzPhphwQQY0pkBgBzzJUBzrT3EYwReUS1 zHLV/cepS28oPirIvj+tviqj17vQDIkuY6Abk2hz+bKCRzyObJfC7OyjcS4YhbcwPHte SWe6Fp9JB07yv00sUxFVWGk52yU+d2mDRxnGysTp+CNnlHtbS/G5XjxxijCerYogA1bv 9KQirKswFXsyEJtN3gvmNZEcmxQeihiY1cmsqtZhqEpmchNxHrDSNu3W1/veWOfakAcv S1RQ== X-Gm-Message-State: AOAM531aIk9lp9xW7bo+mEzr2RQCx3H8eh4mlSOjqdQj4lw55XiAkV0o nIHIg3vQArZHsQDnLHYbY00UexLGVd3ANf7VsCN7xw== X-Received: by 2002:a2e:9118:: with SMTP id m24mr1133847ljg.363.1606914626899; Wed, 02 Dec 2020 05:10:26 -0800 (PST) MIME-Version: 1.0 References: <20201201071632.68471-1-98.arpi@gmail.com> <20201202094408.GW4077@smile.fi.intel.com> In-Reply-To: From: David Gow Date: Wed, 2 Dec 2020 21:10:14 +0800 Message-ID: Subject: Re: [PATCH v3] lib: Convert test_hexdump.c to KUnit To: Andy Shevchenko Cc: Arpitha Raghunandan <98.arpi@gmail.com>, Brendan Higgins , Shuah Khan , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List , linux-kernel-mentees@lists.linuxfoundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 2, 2020 at 8:21 PM Andy Shevchenko wrote: > > On Wed, Dec 2, 2020 at 1:57 PM David Gow wrote: > > On Wed, Dec 2, 2020 at 6:06 PM Andy Shevchenko > > wrote: > > > On Wed, Dec 02, 2020 at 09:51:19AM +0530, Arpitha Raghunandan wrote: > > ... > > > > What I;m talking about is the output. How it will be implemented (using the > > > same variable or differently) is up to you. So the point is I want to see the > > > statistics of success/total at the end. > > > > > > I think this should be done in KUNIT rather than in the individual test cases. > > > > I tend to agree here that this really is something for KUnit. At the > > moment, the tools/testing/kunit/kunit.py script will parse the kernel > > log and generate these sorts of statistics. I know that needing to run > > it through a script might seem like a step backwards, but there's no > > formal place for statistics in the KTAP specification[1] being worked > > on to standardise kselftest/kunit output formats. > > Then it sucks. Fix specification (in a long term) and does it have a > comment style of messages that we can have this statistics printed > (but maybe not parsed)? I should clarify: there's nothing in the spec which explicitly defines a place for such statistics (nor anything which requires them). There are "diagnostic" lines which are not parsed, and so it'd be possible to output statistics there. KUnit itself doesn't at present, but allows individual tests to log diagnostic lines which could be such statistics, particularly in cases like this where the full structure of the tests aren't quite exposed to the framework. > > Note that there are > > other parsers for TAP-like formats which are being used with KUnit > > results, so systems like LAVA could also sum up these statistics. It's > > also possible, as Arpitha alluded to, to have the test dump them out > > as a comment. > > Fine to me. > > > This won't actually work for this test as-is, though, as the KUnit > > version is running as a single giant test case (so KUnit believes that > > 1/1 tests have passed, rather than having any more-detailed > > statistics). It looks like there are a few ways to split it up a bit > > which would make it neater (a test each for the for() loops in > > test_hexdump_init() seems sensible to me), but at the moment, there's > > not really a way of programmatically generating test cases which KUnit > > then counts > > Fix it, please. We rely on this statistics pretty much. The hope is that the Parameterised Test feature will make this possible (though, as mentioned, there are a few other issues around then making those statistics available, but we should be able to work through those). It may be a silly question, but what is it that makes these statistics useful in this test? Maybe I'm misunderstanding something, but I'd've thought that the important things were whether or not _all_ tests had passed, and -- if not --- _which_ ones had failed. Is the count of failing cases within a test like this really that useful for debugging, or is it more for comparing against different versions? Either way, we'll try to make sure they're available. > > The "Parameterised Tests"[2] work Arpitha has been working on ought to > > go some way to helping here, though it won't solve this completely in > > this initial version. The problem there is that parameterised tests > > are not reported individually in a way the kunit.py parser can report > > cleanly, yet, so it'll still only be counted as one test until that's > > changed (though, at least, that shouldn't require any test-specific > > work). > > > > My suggestion for the ultimate state of the test would be: > > - Split up the test into separate KUnit tests for the different > > "categories" of tests: (e.g., test_hexdump_set, > > test_hexdump_overflow_set_ascii, etc) > > - Replace the for loops in test_hexdump_init() with parameters, so > > that KUnit is aware of the original runs. > > - Once KUnit and the tooling supports it, these will be reported as > > subtests. (In the meantime, the results will be listed individually, > > commented out) > > I'm fine as long as we have this information printed to the user. Okay -- Arpitha: does this seem like a sensible approach to you? If printing it to the kernel log is really essential, I'll have a look into how we can do that in KUnit. > > Of course, it'll take a while before all of those KUnit pieces are in > > place. I personally think that a good compromise would be to just do > > the first of these for now, which would make kunit_tool give at least > > a 4/4 rather than 1/1 result. Then, once the parameterised testing > > work is merged (and perhaps the tooling fixes are finished), the tests > > could be updated to take advantage of that. > > How can we guarantee it will be not forgotten? Thinking about it further, if we can get the parameterised testing stuff in 5.11 as planned, then any tooling/output fixes done later would automatically apply. Maybe rather than doing an intermediate version with just the first splitting up of tests, we try it with the current parameterised test patches, and we can possibly prototype some kernel-side statistics reporting which should work. To be honest, though, the subtest support on the kunit_tool side is likely to take quite a while, so it would be nice to have something (like statistics in the kernel log) which ameliorate the problem in the meantime. I'll have a bit of a play around with the test output and parsing code this week and see if there's a simple change that can get us most of the way there. I think something should be possible if the test uses the Parameterised testing feature. Cheers, -- David