From nobody Mon Feb 9 15:08:23 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4820CC04E69 for ; Mon, 31 Jul 2023 06:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230184AbjGaGRf (ORCPT ); Mon, 31 Jul 2023 02:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbjGaGRb (ORCPT ); Mon, 31 Jul 2023 02:17:31 -0400 Received: from mgamail.intel.com (unknown [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D49A10D9; Sun, 30 Jul 2023 23:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690784228; x=1722320228; 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=WVzV/ctBBy1eg+jScgSxdJIUbRKJR5ToTQ6JZW033vz6RAvoEeQp5oCK 2tfN7ut+zhl6Vwun7wtrFwVLIqQtt+LWht+EojVapxFb/YAhXwfNx+9nm 9a5k07nrj9wX42Qz14EtmIKTY9poPhb3nhaRD7sAPaZ1EU6yNYBROPbGL 8lkx7/ax77gLpFwUoTY6pbJebPPa9MrTLmV4qT4VJ6a4tOtpwwIDnNT69 PBDXmAh36FtVvHVDEyxHSfwYIgUhcg4Hni/ncacIngZCepBv6lYYh0a4w vGxGa8yhao9Ab4WR6xUkq51JuK2mQaC2MELUqD/iTrhN6rZFaZrT3RNIo A==; X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="435231342" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="435231342" 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 Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, Mauro Carvalho Chehab , igt-dev@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] kunit: Report the count of test suites in a module 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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); } =20 --=20 2.41.0