Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1092338pxb; Fri, 6 Nov 2020 00:12:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyJSpEdVP4KJVR2DCe5AR4zR4pYei7oOqe8gC0laC7y0Tq15DClYYYp89rU7QJx37KavX/ X-Received: by 2002:a17:906:2297:: with SMTP id p23mr903208eja.60.1604650354737; Fri, 06 Nov 2020 00:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604650354; cv=none; d=google.com; s=arc-20160816; b=exoUg5rVS7fKjWxpGmkYqO+2Id88EkbtCvHBfoEj3CXJxACZ2AUJnLpsBwS5hwrcyb btvYAti0AP7Ei5PwjDjyMrxr7FdNbvh2OwCmANqLwzQMYuNEX4+7w7rQvkTZZvefRqFM PbFWxSfaJrrlF02l8Rk5qSKnY4blArtis2DlYNEg9Shradxbi104U/SLfvCQYgZJLuP/ bCzyt2lNDU14Ikw6qarGz0nA2/LfqCs9OyAr9Rejv7ZTOWZXT5bMaHOKYG11HQ8nnLXp ATIAnY+ZDfkW0qunUq2kUcqTkW3f5JIa6/67RdE3cI1WCNmUADOu/rEXlxYIjiedm5A2 vA8A== 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=Qv+2fhKomPyM/Arm56dvQoUMdEAVFc/83vyB1HdFckk=; b=ulBWtqfQa0IZisf2cetbeDBmCNS3Riqs7ETP6kqfNvYP6isC7GJpbCQMjtQCT0vAjp obdVnPmgTNVu19mu0q75JfMVJCgMoQ3lbUDel7buaw+AZrsGwK4KuPLmKvGq92P1YnyQ JNSQOzdo+ttmrxTafvV4VADYRdSFyebiV+AZDrPvlia5ggt6On2AOhd8uKUv8AQY/Y1B 6J3qf/SViRV0Dsx3IMzB9XwRhqBdpDV457hO8IMheEmgTnaaPD4I6uNdqmb6O6YHwRDz mAg+bHaGmdl5RFCL2T0HIv5BoYrJKjeqxhrAuiStFbIH/da3pHrliatEtuQPyqNrJFDT O07A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="q/n2tTky"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 j11si460699edy.158.2020.11.06.00.12.03; Fri, 06 Nov 2020 00:12:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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="q/n2tTky"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 S1726447AbgKFILk (ORCPT + 99 others); Fri, 6 Nov 2020 03:11:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726621AbgKFILj (ORCPT ); Fri, 6 Nov 2020 03:11:39 -0500 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB72FC0613D3 for ; Fri, 6 Nov 2020 00:11:37 -0800 (PST) Received: by mail-ot1-x344.google.com with SMTP id l36so538243ota.4 for ; Fri, 06 Nov 2020 00:11:37 -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=Qv+2fhKomPyM/Arm56dvQoUMdEAVFc/83vyB1HdFckk=; b=q/n2tTky7OkAqP8C6pWfwUzofJAe1/aH2LP6nRy8e86QEOAggOB2RABoWjxSqYs44w qiIby2q8K4FhstReXQ6XkcFr9tWdN0X6NV50+6/UqHfxtceRcfWAvIrZZ2ETjDWbQBRC LwzbC79eYqSOJV8XQTOzXRspkiTzY5nfYqOuo+TnW2BMmy0eAbGAke985JGk3hdcYdEo 2UifHWiv+Z1Bj1bZqjfYYEbkXmLbhMTyGF6gmXReU2yayfvwesZ7H0R8ysw78y+UJisu oPWhbTXcAhmd6+XpKTS+IuhvQMAwO1Hl/dHQUiHZJiduF8KveOG+BkMNYS1MP76sb4CN k1jA== 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=Qv+2fhKomPyM/Arm56dvQoUMdEAVFc/83vyB1HdFckk=; b=VWjId99BaGpQvOZYwEEIvbvsCgaaNEJ+Ik5uAIxzC8HKgZmOEiLYn2RsoAq9CY5ig6 64HmtxmIUNlVhXUOKNHKhkUK8qV+5y5myuGjV43VQl9cH1BE2VImMS+Snalp67/sl7bB j9x0LSePYHFxlBcZ7u9Xaczl+5kkzO0TnQ8lrNVf+smeylO+xMshO1fBpnmLjjOKz7i6 so+/5psUS3lslmSQwoJw3U2N1Us2R6ZrP+tpCMShvVJGzd1IU+tYo5HyvMLBNHJDLKmu 5UAeW1XRaQPT1Z7b575DHZNgfVbroBojH2w0TExYmytQrchpm2b6W9I22865b1SZbPg0 eZjg== X-Gm-Message-State: AOAM532g+XvCRSCIjlVZs5QOh9ryXoWLD273rfDZpmxN3eDW6AaBBPxn 8eHtMRqrtvA+OVbUq4Rv0YqQwptMf2XtdoV6SldHdg== X-Received: by 2002:a9d:f44:: with SMTP id 62mr426221ott.17.1604650296929; Fri, 06 Nov 2020 00:11:36 -0800 (PST) MIME-Version: 1.0 References: <20201027174630.85213-1-98.arpi@gmail.com> <73c4e46c-10f1-9362-b4fb-94ea9d74e9b2@gmail.com> <77d6dc66-1086-a9ae-ccbc-bb062ff81437@gmail.com> <20201105195503.GA2399621@elver.google.com> In-Reply-To: From: Marco Elver Date: Fri, 6 Nov 2020 09:11:25 +0100 Message-ID: Subject: Re: [PATCH v4 1/2] kunit: Support for Parameterized Testing To: Arpitha Raghunandan <98.arpi@gmail.com> Cc: Brendan Higgins , skhan@linuxfoundation.org, Iurii Zaikin , "Theodore Ts'o" , Andreas Dilger , "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , LKML , linux-kernel-mentees@lists.linuxfoundation.org, linux-ext4@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, 6 Nov 2020 at 06:54, Arpitha Raghunandan <98.arpi@gmail.com> wrote: > > On 06/11/20 1:25 am, Marco Elver wrote: > > On Thu, Nov 05, 2020 at 04:02PM +0100, Marco Elver wrote: > >> On Thu, 5 Nov 2020 at 15:30, Arpitha Raghunandan <98.arpi@gmail.com> wrote: > > [...] > >>>>> I tried adding support to run each parameter as a distinct test case by > >>>>> making changes to kunit_run_case_catch_errors(). The issue here is that > >>>>> since the results are displayed in KTAP format, this change will result in > >>>>> each parameter being considered a subtest of another subtest (test case > >>>>> in KUnit). > >>>> > >>>> Do you have example output? That might help understand what's going on. > >>>> > >>> > >>> The change that I tried can be seen here (based on the v4 patch): > >>> https://gist.github.com/arpi-r/4822899087ca4cc34572ed9e45cc5fee. > >>> > >>> Using the kunit tool, I get this error: > >>> > >>> [19:20:41] [ERROR] expected 7 test suites, but got -1 > >>> [ERROR] no tests run! > >>> [19:20:41] ============================================================ > >>> [19:20:41] Testing complete. 0 tests run. 0 failed. 0 crashed. > >>> > >>> But this error is only because of how the tool displays the results. > >>> The test actually does run, as can be seen in the dmesg output: > >>> > >>> TAP version 14 > >>> 1..7 > >>> # Subtest: ext4_inode_test > >>> 1..1 > >>> ok 1 - inode_test_xtimestamp_decoding 1 > >>> ok 1 - inode_test_xtimestamp_decoding 2 > >>> ok 1 - inode_test_xtimestamp_decoding 3 > >>> ok 1 - inode_test_xtimestamp_decoding 4 > >>> ok 1 - inode_test_xtimestamp_decoding 5 > >>> ok 1 - inode_test_xtimestamp_decoding 6 > >>> ok 1 - inode_test_xtimestamp_decoding 7 > >>> ok 1 - inode_test_xtimestamp_decoding 8 > >>> ok 1 - inode_test_xtimestamp_decoding 9 > >>> ok 1 - inode_test_xtimestamp_decoding 10 > >>> ok 1 - inode_test_xtimestamp_decoding 11 > >>> ok 1 - inode_test_xtimestamp_decoding 12 > >>> ok 1 - inode_test_xtimestamp_decoding 13 > >>> ok 1 - inode_test_xtimestamp_decoding 14 > >>> ok 1 - inode_test_xtimestamp_decoding 15 > >>> ok 1 - inode_test_xtimestamp_decoding 16 > >>> ok 1 - ext4_inode_test > >>> (followed by other kunit test outputs) > >> > >> Hmm, interesting. Let me play with your patch a bit. > >> > >> One option is to just have the test case number increment as well, > >> i.e. have this: > >> | ok 1 - inode_test_xtimestamp_decoding#1 > >> | ok 2 - inode_test_xtimestamp_decoding#2 > >> | ok 3 - inode_test_xtimestamp_decoding#3 > >> | ok 4 - inode_test_xtimestamp_decoding#4 > >> | ok 5 - inode_test_xtimestamp_decoding#5 > >> ... > >> > >> Or is there something else I missed? > > > > Right, so TAP wants the exact number of tests it will run ahead of time. > > In which case we can still put the results of each parameterized test in > > a diagnostic. Please see my proposed patch below, which still does > > proper initialization/destruction of each parameter case as if it was > > its own test case. > > > > With it the output looks as follows: > > > > | TAP version 14 > > | 1..6 > > | # Subtest: ext4_inode_test > > | 1..1 > > | # ok param#0 - inode_test_xtimestamp_decoding > > | # ok param#1 - inode_test_xtimestamp_decoding > > | # ok param#2 - inode_test_xtimestamp_decoding > > | # ok param#3 - inode_test_xtimestamp_decoding > > | # ok param#4 - inode_test_xtimestamp_decoding > > | # ok param#5 - inode_test_xtimestamp_decoding > > | # ok param#6 - inode_test_xtimestamp_decoding > > | # ok param#7 - inode_test_xtimestamp_decoding > > | # ok param#8 - inode_test_xtimestamp_decoding > > | # ok param#9 - inode_test_xtimestamp_decoding > > | # ok param#10 - inode_test_xtimestamp_decoding > > | # ok param#11 - inode_test_xtimestamp_decoding > > | # ok param#12 - inode_test_xtimestamp_decoding > > | # ok param#13 - inode_test_xtimestamp_decoding > > | # ok param#14 - inode_test_xtimestamp_decoding > > | # ok param#15 - inode_test_xtimestamp_decoding > > | ok 1 - inode_test_xtimestamp_decoding > > | ok 1 - ext4_inode_test > > > > Would that be reasonable? If so, feel free to take the patch and > > test/adjust as required. > > > > I'm not sure on the best format -- is there is a recommended format for > > parameterized test result output? If not, I suppose we can put anything > > we like into the diagnostic. > > > > I think this format of output should be fine for parameterized tests. > But, this patch has the same issue as earlier. While, the tests run and > this is the output that can be seen using dmesg, it still causes an issue on > using the kunit tool. It gives a similar error: > > [11:07:38] [ERROR] expected 7 test suites, but got -1 > [11:07:38] [ERROR] expected_suite_index -1, but got 2 > [11:07:38] [ERROR] got unexpected test suite: kunit-try-catch-test > [ERROR] no tests run! > [11:07:38] ============================================================ > [11:07:38] Testing complete. 0 tests run. 0 failed. 0 crashed. > I'd suggest testing without these patches and diffing the output. AFAIK we're not adding any new non-# output, so it might be a pre-existing bug in some parsing code. Either that, or the parsing code does not respect the # correctly? Thanks, -- Marco