Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4076364rwb; Mon, 31 Jul 2023 00:21:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+uiBQyj6P6pIBwZBJ1oLLhLvTsDA8FNDB+wF6VGsVFVAezhlbuFBaE6jldbXIlpU3ABB9 X-Received: by 2002:a05:6a21:7895:b0:132:1e76:6f02 with SMTP id bf21-20020a056a21789500b001321e766f02mr9797285pzc.34.1690788069183; Mon, 31 Jul 2023 00:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690788069; cv=none; d=google.com; s=arc-20160816; b=rBM2IRNZkEhNg1wwgqWb0zPDSb7Jn6Y7gWVm/9Ksdb/D63nNTnZ4JLzz4cEudL8HKr rJBExd7uCwsTTbKKQPRfMQFguzwkxtfQRN5LozOISqogqMsoWfMd4FOyMKLfDLEGnsbZ k+XFW77f77pC+AcR/WU+BBAod26miqcf8SULmuadRewaWrjKkTmE/xNyRrRMDq1Xlq0G qXeBzPcIoMvluN2twt9KTh0mzONLt5w8oYPvJcJ6eHR+sU/S+xLYKPF1bwSWSEwwEMK7 mCv4uBqTAc6VJEsFH6tRpV93xIjhdjLCMgjfvCALmO/5feDbJrcXFvsD4aXTE20N6yuV flkA== 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=J7jwRl8sxlkuz1Y6aiN29Tx7OSI+1iIAU0/PGKUBBYcgiQUcRWndx6/SyGM7QAFyG5 etzXHHCuGnG4Hg6PArko+09mszJrHahdutO2wFtI3aEp9FyO3fp332arjRwKDph45GJF LEHhpszZQiWZ61rIWxspE83/5REYehvxX2lxzfQ8wzJtvCPaW/Z155zQM6EJ0aaOGo/A EFArbyQfNauzXcaZHoDPyKLuT4ZWRylH2xYqhy2FQcMnfdifNKQZhiLC9uaEHeCxwhrS RMX7Tz/TJSqAuFW4V5Hslrkh7TOAIte+MYyVOb3e5Weheip/UensNtWdA+FcnyYTJ0CK AHFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="WVzV/ctB"; 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 d20-20020a056a0024d400b0067ff1a1ccbcsi7218620pfv.63.2023.07.31.00.20.57; Mon, 31 Jul 2023 00:21:09 -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="WVzV/ctB"; 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 S230182AbjGaGRe (ORCPT + 99 others); Mon, 31 Jul 2023 02:17:34 -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: 8bit 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, RCVD_IN_MSPIKE_H2,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