Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1440746rwb; Fri, 28 Jul 2023 09:23:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlFetjgTQxg3ZjLvNPiez9wYZnwqoqoWOGzPL2lK8mHYvo63xcb2ivORdOZXeuqiL03LdNAw X-Received: by 2002:a05:6a21:47c8:b0:134:24bf:51b with SMTP id as8-20020a056a2147c800b0013424bf051bmr1839044pzc.30.1690561430517; Fri, 28 Jul 2023 09:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690561430; cv=none; d=google.com; s=arc-20160816; b=YdVylngzJ98sbeKhZgPIYOrHc8RN4z5w4osypvE2qGWX8kAzk1iHMUBYfUHSMPSfR3 xBO3nYOdunZP6Dwgai7lsgLvFdbcBfEav0OPcJlggpLrOsWmQUdhhouxjZUa3YsyMKtl ih1EabnWpqjJoPbSVNHAsIFtYIodCA403A1sVC+G3+/27LQkQU9wbdHfbmYwdHhYSLES o1x6A6Mp+WDuOO9MqXz3rGOgHwH+aiGVT45Nh2Mt3FOAApF2446gHQ9kIfhqoJIFztye LAfenpG30JaFny6lRCvZkqly9uG7irvQ5NaoqhDY5VhtO3e35tdeK/OJeQo54e/yK6jR O46Q== 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=j6L+uVtzJZqXE2DwNxEp+xVr3d5QX+4t1Wa1bWrjFSE=; b=vNpsjtbuaSEAWroU3auGFQe43btOwFUWyrEzO4PN5ew7ggfgQZBNhBoVFNUEJn7xn1 mBmPSneGGoJ55zZUgaPMNkFtkazAW+gJRao5aDht6cMMqIJvb0zYvk1ygmwbNdko6teN kEtZZouexKviqLhmaUdg3Z0/t5X8nbe+DPjmstinNoF+14iz4jfhcEnmP4sMvAH4uo+/ nVNPTfiozasLOzVOw8KmnlEYzrr45WIxeVEfmTGifKYENFmgV+gyagqlxZh4LbzJJmEO VA1CJ7tGZhBJWgF94zvulKP2v7wB8tszwoVj9w/Jwmy2j3u4o65IvcXanFgvw39np07y lA8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tsoj3rOw; 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 h2-20020a635302000000b0055c872695a3si3155956pgb.447.2023.07.28.09.23.30; Fri, 28 Jul 2023 09:23:50 -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=Tsoj3rOw; 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 S237441AbjG1Ppf (ORCPT + 99 others); Fri, 28 Jul 2023 11:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236933AbjG1Ppc (ORCPT ); Fri, 28 Jul 2023 11:45:32 -0400 Received: from mgamail.intel.com (unknown [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74613212B; Fri, 28 Jul 2023 08:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690559131; x=1722095131; 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=Tsoj3rOw/uHMzjrKviGMAIs7AmcdV2ajQOvw3iAtuwzR7Yv2uVHWC62f XoYV++sPYQhx2kpO/KKfoILs2VlEl7oczdWUxVA6vKsKMHCFXd0Rnd5Bl fQUQ5tEL2WcOryBhaQZJjwvWQu9kEtmWY+l5RbCLS71krNpegvAUU5Twc eJztowFBfwfUyncwrcXqCpXw2U3piQXzgS8TJAdXM8J/jNHyv3EIO8ojY 0AqyumMwsDAGHH6Wsi2Mbi0V1MJEi5FlEkCGor21MpZBhsUWTUuW2VSRh aAwbLdjWYFahuUsTAY/HiM9rP2F170GvdGouMzGkF4cOhBm+V9pO6r1xV g==; X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="371323344" X-IronPort-AV: E=Sophos;i="6.01,237,1684825200"; d="scan'208";a="371323344" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2023 08:45:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="817557440" X-IronPort-AV: E=Sophos;i="6.01,237,1684825200"; d="scan'208";a="817557440" Received: from jkrzyszt-mobl2.ger.corp.intel.com (HELO jkrzyszt-mobl2.lan) ([10.213.24.93]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2023 08:45:28 -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 1/3] kunit: Report the count of test suites in a module Date: Fri, 28 Jul 2023 17:44:21 +0200 Message-ID: <20230728154419.1810177-6-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230728154419.1810177-5-janusz.krzysztofik@linux.intel.com> References: <20230728154419.1810177-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 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