Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp803602pxu; Wed, 2 Dec 2020 04:00:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJweDddawXPY8PNazF6IoOUpPh1oCMp1HqlvGVw3HH8azhO/tNKwmbjX5ZEqIvullDNnwCNj X-Received: by 2002:a17:906:76c9:: with SMTP id q9mr632946ejn.484.1606910404510; Wed, 02 Dec 2020 04:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606910404; cv=none; d=google.com; s=arc-20160816; b=VP1pDxMyERYSAgKmwlOyvFmiWWMEi/9NM1NnfiRxupIE9AkCxZx/8nUN11KPmELUQb yHz/FMzL85s2Qo1gbOiE2P3Ly4veC/1bOXm7HJMnxbEfT2gM2sOM/ulCrqwkp+xznqTM jrJF/idB3syr/ZTPBytXjQWjZ+SCKSslwrMM6++kSzzeo+rILB6tesX0WvGDFGi5LBhA berDg5oCT6D7zJWkojkJJEnGXHmlqjKdgdLmVGDjQMhshxhJ9gXQcV+I/8upMYpc3KWl ZyfvWfMmplwh2R4GAZyrWBwRxxLrNl5sRcNPCFZ96TvMiTOYAMghA+A/EKZC5bfENlur pWRw== 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=cCeY5T30/ZjfSVbte8zrwF6m9bsYxmhw2op2/i/S+hk=; b=T4ekmtMIn5vki5Id7YADkvJA+q2Gg6+PSVz32vdAX7Wx39gl7neaD1e/Y6nRgU1Jt3 kO2f2AveFORGpBKljHHEIVSTi9k0+E90XTbsgQmf2CjOhTMZANul6qnLxNC+aSkn41sG f1/XMWuMb/+CIDRJ0Si+H7Ew2GX1jSG3L2xTPwObeBajkqD3s2zXvbAlWEy6xmJH5mut k5kg+jGiE/QVKSspf6DfBoQllvG52DxSvcE+4A0cHwrOb0twOqNC02BH7n464mt+CZvk cLwby4pnRUJNte0HMcj6hfhH3qakKFAERZ6nWeHBlN7jNbtwBSa3HYGm5GXm9B2YSxz9 S9rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Vww9jv/7"; 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 y4si684575ejq.528.2020.12.02.03.59.41; Wed, 02 Dec 2020 04:00:04 -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="Vww9jv/7"; 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 S2387547AbgLBL5o (ORCPT + 99 others); Wed, 2 Dec 2020 06:57:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729405AbgLBL5o (ORCPT ); Wed, 2 Dec 2020 06:57:44 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AEF9C0613D4 for ; Wed, 2 Dec 2020 03:57:04 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id d8so1561396ioc.13 for ; Wed, 02 Dec 2020 03:57:04 -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=cCeY5T30/ZjfSVbte8zrwF6m9bsYxmhw2op2/i/S+hk=; b=Vww9jv/7xYol0/yx+O5GXuPAjYE2ZK/2iu17yCICQIn377EmVBPj8bX5D9plVX/P83 rgNm91r0jdTwNPhnp8hedFn8xMrxOiSg/wqN0k7NPUUQzwNfgG6nn7KqGB6v4cs4GEhV xJRqXiPl3uvHdHab7AoVGaLmctWo3hLJ5UXNkmvYvC9QN9JC9qKKM8zZn8pr/8Kwrav3 1PkWHopunycNfFqxbgpViqHN4L2ik82TvdZiKsPFSmkbmR9in2KJmVt+GmJLrj+078QJ KYZP84XuQ/Uiold75a7RaZN9i47OWwNjXyzyKwYpjMwR+VgDXTiwu/GpCNdf1mHfq/yU A2GA== 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=cCeY5T30/ZjfSVbte8zrwF6m9bsYxmhw2op2/i/S+hk=; b=s1MWdcbaIjMXjlqt8dV5+4z4jABItcftFXOdwzmUf/2hoH4vxsy2Q+fiqzOicTRB5k IvKyxspbXlup8tKgmWcnfRAVlA0r95oicw8vzLRpuGRHP5flAvDN3sPxxSOJQn5fLkW9 SRHuwFgWyEsnw3pw1lcGj6zl5vxqlnO7CQ4Q/Blt2D0qk1yyh9L7guYXpDr1ARVklW3e wviCjKNLIo5XqY1hOC9XqigqH/HcKcXfhE0Z6mT+WYKpHWf9egcsQO6l6PzzZa655+a5 7ziSBQOBuYIHv2XyXQWs5trA0OHFPiJFHAu1DJS5znk+LyvJ1mbx4yjmm1pfJNi1Pgs8 gihQ== X-Gm-Message-State: AOAM532tYv8wsz1woeuhw2/oQB+nr+FKw4xjYbdKRixJawG81x20P74e dNMVq3qZFHog2rgsfgz79+nyU8kDINegdGCJbAvesg== X-Received: by 2002:a02:354a:: with SMTP id y10mr1818092jae.126.1606910223366; Wed, 02 Dec 2020 03:57:03 -0800 (PST) MIME-Version: 1.0 References: <20201201071632.68471-1-98.arpi@gmail.com> <20201202094408.GW4077@smile.fi.intel.com> In-Reply-To: <20201202094408.GW4077@smile.fi.intel.com> From: David Gow Date: Wed, 2 Dec 2020 19:56:51 +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 6:06 PM Andy Shevchenko wrote: > > On Wed, Dec 02, 2020 at 09:51:19AM +0530, Arpitha Raghunandan wrote: > > On 01/12/20 4:36 pm, Andy Shevchenko wrote: > > > On Tue, Dec 1, 2020 at 9:21 AM Arpitha Raghunandan <98.arpi@gmail.com> wrote: > > ... > > > >> I ran both the original and converted tests as is to produce the > > >> output for success of the test in the two cases. I also ran these > > >> tests with a small modification to show the difference in the output > > >> for failure of the test in both cases. The modification I made is: > > >> static const char * const test_data_4_le[] __initconst = { > > >> - "7bdb32be", "b293180a", "24c4ba70", "9b34837d", > > >> + "7bdb32be", "b293180a", "24c4ba70", "9b3483d", > > >> > > >> The difference in outputs can be seen here: > > >> https://gist.github.com/arpi-r/38f53a3c65692bf684a6bf3453884b6e > > > > > > Looks pretty much good, what I'm sad to see is the absence of the test > > > statistics. Any ideas if we can get it back? > > > > > > > I could again include variable total_tests as was in the original test. > > Would that be fine? > > 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. 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. 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 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) 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. Cheres, -- David [1]: https://lore.kernel.org/linux-kselftest/CY4PR13MB1175B804E31E502221BC8163FD830@CY4PR13MB1175.namprd13.prod.outlook.com/T/ [2]: https://lore.kernel.org/linux-kselftest/20201116054035.211498-1-98.arpi@gmail.com/