Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5848043rwb; Tue, 1 Aug 2023 08:41:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHR5y+hyf7LNI7Bu4pGRHngdKJpbiwMXyRaRdxrd5awvkla6hiHNymHRHF8QBQLIOfVXWlZ X-Received: by 2002:a17:902:e88e:b0:1b8:b459:f47a with SMTP id w14-20020a170902e88e00b001b8b459f47amr16069433plg.34.1690904461672; Tue, 01 Aug 2023 08:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690904461; cv=none; d=google.com; s=arc-20160816; b=b2v4l8tZyVaiS5uHOa8sG+Tony36PK0y6MqnHxrZ/436YAQVPCcqcG0G+Z2QgdM3Ql t9UIqVTBqANKUINCeP7bt7MxkMULmrKDNNDGbpAdm+fQk6MV5Qzh2h5d4v9s0jqQI5Q+ 9ky+4ARpTPNCCFTwZFieKXes89oSBSkNd9hNr+MG87DUDUOPnuoL6FMMTtAl15mD4MLB ukHXPO9MgCkUXmuHuMIdcMu99LSG0auubUbUXgCL42UDuE7WTT6s4fN7dR+CJrPNMPXm m75Mxh9cTDhYsFqjuo8lpBbJuI11ZmJ92d0TjhQAXabIUhOhLwbbs5bnnq8Z6JqH6uEG GJYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=LFZ83Bw32MtzypAl9+TiO+Y4hTMKea3XW7rOL+GcN+4=; fh=sJMzKF+5e0axZHYHjY8ztJNt7mlACw6aqKjty2sJg0s=; b=duXhxaxUfz+dc6ginu5vVjADG5QqBD//asHPE132OICDxLate1oo2mYclpuOa+mf61 IDNIdusK9WksZTKB3rFYwp+7w6zJ6snIkcbqVQBFyZcviXVHyY1YLkfllS3MCN9xstTl Ufb8YXujL63gFBlRZAZo6iptLzESaANxd/fjJmn6SePgiJ1pVVo1p6ZJ6jq2soTEC7k+ ZI3gNCstuEvRiVwHZdJlg3V/bUQPkkRj/fXjjz6UOQz7FXck7IUgpBmTLQcbOggaPWBy QNnPbGUqTTuHUGbe5xHD1XgLx5cBlBMgOelzMbBjaNVbaMaoXvgUKS3xl3KRVgHFKcw+ aHkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CrdxN4KY; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a170902ce8b00b001bbf89feae3si6043213plg.600.2023.08.01.08.40.41; Tue, 01 Aug 2023 08:41:01 -0700 (PDT) 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=@intel.com header.s=Intel header.b=CrdxN4KY; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232890AbjHAPOB (ORCPT + 99 others); Tue, 1 Aug 2023 11:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbjHAPN7 (ORCPT ); Tue, 1 Aug 2023 11:13:59 -0400 Received: from mgamail.intel.com (unknown [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F10AF116; Tue, 1 Aug 2023 08:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690902838; x=1722438838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D3Gr4CQz5RXEpExSMqhczLYsHj+yuAQsgSmsBQ4YJ6c=; b=CrdxN4KYzAalhwHv9BTvmUYmsCzX/AYiKre100TzFT35yX54fMOh8Wgp +/vDCNMKF+yYIrXui7Qq6vRGXNN0Z2R7c7/JrWa5/2s9nYQbAGWMhVJMH QpG0uWW3pyHKDrhCUbbJBhO1DTxNNQIY9Q9iOT0kaHemPm/cDVaBHUMdy SLPb/a4D1cLzH16P940eAgObD8Oz220H172P4vLPNx5wrtCyFbHJTxHTl nspwrEuFs1dA47DRFFGg7g+2PC6qjQuMwxa6Vni9/5hsm0YZMb7ANajiV iZnxVNDnNspEskMi0bTigye+K7DaZg/VwbEf1ygpizMI95H6e9PiG36CN w==; X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="349619784" X-IronPort-AV: E=Sophos;i="6.01,247,1684825200"; d="scan'208";a="349619784" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2023 08:13:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10789"; a="975350300" X-IronPort-AV: E=Sophos;i="6.01,247,1684825200"; d="scan'208";a="975350300" Received: from jkrzyszt-mobl2.ger.corp.intel.com ([10.213.27.8]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2023 08:13:56 -0700 From: Janusz Krzysztofik To: Mauro Carvalho Chehab Cc: Brendan Higgins , David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, igt-dev@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: Re: [PATCH v3 1/3] kunit: Report the count of test suites in a module Date: Tue, 01 Aug 2023 17:13:53 +0200 Message-ID: <5405097.29KlJPOoH8@jkrzyszt-mobl2.ger.corp.intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 In-Reply-To: <20230801151711.2765e2eb@coco.lan> References: <20230731141021.2854827-5-janusz.krzysztofik@linux.intel.com> <20230731141021.2854827-6-janusz.krzysztofik@linux.intel.com> <20230801151711.2765e2eb@coco.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Hi Mauro, Thanks for review. On Tuesday, 1 August 2023 15:17:11 CEST Mauro Carvalho Chehab wrote: > Em Mon, 31 Jul 2023 16:10:23 +0200 > Janusz Krzysztofik escreveu: > > > According to KTAP specification[1], results should always start from a > > header that provides a TAP protocol version, followed by a test plan with > > a count of items to be executed. That pattern should be followed at each > > nesting level. In the current implementation of the top-most, i.e., test > > suite level, those rules apply only for test suites built into the kernel, > > executed and reported on boot. Results submitted to dmesg from kunit test > > modules loaded later are missing those top-level headers. > > > > As a consequence, if a kunit test module provides more than one test suite > > then, without the top level test plan, external tools that are parsing > > dmesg for kunit test output are not able to tell how many test suites > > should be expected and whether to continue parsing after complete output > > from the first test suite is collected. > > > > Submit the top-level headers also from the kunit test module notifier > > initialization callback. > > > > [1] https://docs.kernel.org/dev-tools/ktap.html# > > > > Signed-off-by: Janusz Krzysztofik > > --- > > lib/kunit/test.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > > index 84e4666555c94..a29ca1acc4d81 100644 > > --- a/lib/kunit/test.c > > +++ b/lib/kunit/test.c > > @@ -729,6 +729,11 @@ EXPORT_SYMBOL_GPL(__kunit_test_suites_exit); > > #ifdef CONFIG_MODULES > > static void kunit_module_init(struct module *mod) > > { > > + if (mod->num_kunit_suites > 0) { > > + pr_info("KTAP version 1\n"); > > + pr_info("1..%d\n", mod->num_kunit_suites); > > + } > > + > > __kunit_test_suites_init(mod->kunit_suites, mod->num_kunit_suites); > > } > > IMO, the best would be instead to export kunit_exec_run_tests() and > use it here too. I was considering a similar approach, i.e., moving those two pr_info() lines from built-in only kunit_exec_run_tests() to __kunit_test_suites_init() which is common to both built-in and modular paths, but please note that with kunit built in, an empty test plan "1..0" is now reported on boot, while we don't want similar reports to appear on loading modules that don't provide any kunit tests. Then, inside either your exported kunit_exec_run_tests() or my __kunit_test_suites_init(), we would have to check somehow if it has been called from a module notifier initialization callback, and that seemed to me too much complicated and less clean than what I've proposed: keep using unmodified kunit_exec_run_tests() in built-in and updated kunit_module_init() in modular processing path. Dropping the empty "1..0" test plan from boot messages would mean an ABI change, I believe, which I'd rather avoid adding to the scope of this patch as not required. Thanks, Janusz > > Except for the nit, LGTM. > > > Thanks, > Mauro >