Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4502172rwb; Mon, 31 Jul 2023 07:51:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFIZ2g9RSN2LgQnjgAwreyMzjvrE/VskfiqLbwPokYo7VCYGNgTT2wTBR2ull4EdML9py0K X-Received: by 2002:a17:907:168a:b0:974:fb94:8067 with SMTP id hc10-20020a170907168a00b00974fb948067mr46732ejc.23.1690815078960; Mon, 31 Jul 2023 07:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690815078; cv=none; d=google.com; s=arc-20160816; b=0/UQWqLpWbUx7q7ri5nVm/RxzLkVtk5Fzs38zQ2rTq44C52CnTpv3vEoIigzsrYw+L ptdAJ1FuYhqwLSqpJ7hmAtFehGvvVMrcq3I7gdqmdwbbhj3MRPoZwuEMCmQnpRccoiIB Q5z0bI237z9lP5kLcl+YYK0Am4O6Nttih2OkBo45mlDjqYNfdD4il4ZsVEYRM8hSXj5Q KK3E15q6mlN6rYM7ImT1orhAl5yqCiSV+yNUc7B//MhG7W/bBrylFIcgCwNW+1waI70Z z20pCbHazH8v8rPpeaNHKSY6Nk0YsCTK54+LCKM5jC9AMNXx8aGibepVNXeuNSOV6sHn OODA== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=molosIvnLrvnltEaGVKzvi1qIz4BKcQV3nndhcgulbY=; fh=2DascdEigk5YKkI7xsPhzXnEwnq6+gHGf5jSQyJPeBg=; b=Hk6D9uoSYh9OeqMTgvT2HDrAzVV0MipujYZzqqHZahzKr4P168TfwgG0OidulSG/I+ B9Vk1jdofsYuMCOt6NTaUjVxMpOGVHPjEOeoN/tEpp8X0aPvNb9ro+s7syqOD0lp1OeQ vVUscCFagINoZoPkmLGJtM8EU4etISzG4XAlW1PVqoPYu9YdI9WQEdUgtfEwqklxCsH/ TOQmhMcUThj5o/kodSpCXN8956PA2W1RHrUoiSpuYuJQ3PYJHrR48HmfevQvwxlQNFZ9 MR7NNHiZCwNl7Gstkou1xRE2F5+rTn0H1GJOwKOpzVx9CSpmL+43zOjp0W4t5Czuj+rg wB7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D7RoLEGS; 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 pg22-20020a170907205600b00991f1e4b03dsi2594893ejb.406.2023.07.31.07.50.52; Mon, 31 Jul 2023 07:51:18 -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=D7RoLEGS; 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 S230462AbjGaONH (ORCPT + 99 others); Mon, 31 Jul 2023 10:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbjGaOMr (ORCPT ); Mon, 31 Jul 2023 10:12:47 -0400 Received: from mgamail.intel.com (unknown [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F8AD8; Mon, 31 Jul 2023 07:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690812764; x=1722348764; 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=D7RoLEGSSRXBJYSsWpoOe1BhF5oPVLCNW1iv8RkHovivM1L2XEWwT7J1 d67jcxsUMgYYZjJarVfsgD0cgFeA5VpPnNMSIfn16IGQd/SaCORIiWkAP ketO89XEp/tZy+ACCLfvti754Nt1YTVgS7C/rGcqNjhxXjMRjerTPPtlL dAJA6VK9Oi21pV671DsNsPAXJhAF7yAZge8pp+kJlp17Dc1OhlFA+3AsI JEqdGvdRBsc7JBJgvIG3AJ43A8gP8lFnHMcEH6Gpe+EKZxTggnf3QVyZp Kfla1iFrZfVbxNhtFEKTMWptSKG1fz7MyoNFrXrYK8wmzf9NB6QDkcGom A==; X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="455403626" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="455403626" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 07:12:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="728324347" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="728324347" Received: from jkrzyszt-mobl2.ger.corp.intel.com (HELO jkrzyszt-mobl2.intranet) ([10.213.1.128]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 07:12:41 -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, Janusz Krzysztofik Subject: [PATCH v3 1/3] kunit: Report the count of test suites in a module Date: Mon, 31 Jul 2023 16:10:23 +0200 Message-ID: <20230731141021.2854827-6-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731141021.2854827-5-janusz.krzysztofik@linux.intel.com> References: <20230731141021.2854827-5-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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