From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50D5DC001DC for ; Mon, 31 Jul 2023 06:16:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F414A10E1AB; Mon, 31 Jul 2023 06:16:50 +0000 (UTC) Received: from mgamail.intel.com (unknown [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id BAECE10E1AB; Mon, 31 Jul 2023 06:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690784208; x=1722320208; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xfWKTT2Wn3/IWe//m/LpBpFN0F6nm+3nkhbl/ibfElU=; b=bdgffTKaEHMPVam7NCZelkfhZDv6C8ODUlqRsQEa9etNsdVrOXEZ+HCO APgHyC86AViCt9ZpPmGyld2olq4hyB0bHsNMtcSj5+IbKgjYhsmnB8TDG nOLjlJJ51xnhg1a32G+cZIG1l7cZ/hL86RaekqpVPu05+ud+P3NprwuQS ESfrvmwrnGWo90u1Ww3TAeZbbuai1a/RxKmEZ/l6kl0Rz86k0bQI/jsyc iB01aiJWCNYphvwL3pvGwBXjVpv1EtQDEOgAUljXOcYF/EKlmkYdAz1Op RHoQutsWIJPNgsc/49qjlRyuCdn1cjXcyE8fd/btAsAiAX8XidAF6mIOB A==; X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="435231344" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="435231344" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 23:16:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="1058827669" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="1058827669" Received: from jkrzyszt-mobl2.ger.corp.intel.com (HELO jkrzyszt-mobl2.intranet) ([10.213.1.128]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 23:16:44 -0700 From: Janusz Krzysztofik To: Brendan Higgins , David Gow Date: Mon, 31 Jul 2023 07:45:54 +0200 Message-ID: <20230731054552.2145292-6-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731054552.2145292-5-janusz.krzysztofik@linux.intel.com> References: <20230731054552.2145292-5-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH v2 1/3] kunit: Report the count of test suites in a module X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, igt-dev@lists.freedesktop.org, linux-kselftest@vger.kernel.org, intel-xe@lists.freedesktop.org, kunit-dev@googlegroups.com Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" 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); } -- 2.41.0