From nobody Sun May 19 12:26:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104638+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104638+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1683766405; cv=none; d=zohomail.com; s=zohoarc; b=TWh+Uw+oHHEgvtPilCABZzkwWhmhzZwf8gkWX2+jf0av9WYjzP6FWjQcKs1ITEVZuRuiG9F3hhJlXATbQPU/89qsfW2a0laL9oiDSUBuaZmP/8+qh1qhbiNeztJymSEhb5WfkbGil6cC4ElhYhs36Qwy4rKFdWI0oQRfDaKVD9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683766405; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=U6YdwF3udqr2BY5yUokQzyscHwkcHvreB1Q0Hqm/SQ0=; b=ljhlCLdgWad/zLlCblTyZktBkVswIS4c+rUPdxei3LXmEF+lsHsnKjOev6ElNf9gj4SaWuwuk9LyI5QndxNt36/C2+tMXzPeXTEiTOHFdVKWHYToTqSXP6Oh9oLgTmTsGxyCdD4vWBbJYU/4qzsK6sLXGLfIi+tUx2zlTH09hZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104638+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683766405625903.8665311927491; Wed, 10 May 2023 17:53:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4H7BYY1788612xN125A5Hacz; Wed, 10 May 2023 17:53:25 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.34629.1683766403622375645 for ; Wed, 10 May 2023 17:53:24 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="349196889" X-IronPort-AV: E=Sophos;i="5.99,265,1677571200"; d="scan'208";a="349196889" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2023 17:51:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="702503660" X-IronPort-AV: E=Sophos;i="5.99,265,1677571200"; d="scan'208";a="702503660" X-Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by fmsmga007.fm.intel.com with ESMTP; 10 May 2023 17:51:45 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: gua.guo@intel.com, Michael D Kinney , Sean Brogan , Michael Kubacki , Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v5 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure Date: Thu, 11 May 2023 08:51:36 +0800 Message-Id: <20230511005136.1465-2-gua.guo@intel.com> In-Reply-To: <20230511005136.1465-1-gua.guo@intel.com> References: <20230511005136.1465-1-gua.guo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gua.guo@intel.com X-Gm-Message-State: Z0517cfMSoiNvJIaIgg4MPwqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683766405; bh=/euPpnrD+a55zBUmZli7X/s9nBxzGvoMYwS2EBvnJ/o=; h=Cc:Date:From:Reply-To:Subject:To; b=xBktXWcX+eTT+3kBtle9mtxa0Ch/7GeTZwsL44OyBhNUoj3e0jlQ3NVCUAqQzkKtE28 kUXuG8WCOIJo4i5D0HyzU9k6tg/v5fvl1AjFFoHIo5+QHFzvUFMQK+XASfVHqH3FMdJ4U heUZNa3SF9Wb+qfzq8LujtMkuoW34IHAmpY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683766407088100005 Content-Type: text/plain; charset="utf-8" From: Gua Guo Windows command prompt have 8191 characters limitation, enhance it to make command too long can be resloved. Provide an example, if have too many cov files, it causes to run single command over the 8191 characters limitation. > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir=3D{workspace}Build > --input_coverage=3DAAA.cov > ... > --input_coverage=3DNNN.cov The solution is passing many coverage files in single command line to breaking it up into many command lines with one coverage file per command line in order to prevent single line is over to 8191 characters. - Command Line 1 > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir=3D{workspace}Build > --input_coverage=3DAAA.cov > --input_coverage=3Dcoverage.cov ... - Command Line N > OpenCppCoverage > --export_type. binary:coverage.cov > --working_dir=3D{workspace}Build > --input_coverage=3DNNN.cov > --input_coverage=3Dcoverage.cov Cc: Michael D Kinney Cc: Sean Brogan Cc: Michael Kubacki Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Gua Guo Reviewed-by: Michael Kubacki --- .../HostBasedUnitTestRunner.py | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunn= er.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py index d993de9412..2e5c462cd2 100644 --- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py @@ -205,28 +205,64 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin): testList =3D glob.glob(os.path.join(buildOutputBase, "**","*Test*.= exe"), recursive=3DTrue) workspace =3D thebuilder.env.GetValue("WORKSPACE") workspace =3D (workspace + os.sep) if workspace[-1] !=3D os.sep el= se workspace + workspaceBuild =3D os.path.join(workspace, 'Build') # Generate coverage file coverageFile =3D "" for testFile in testList: ret =3D RunCmd("OpenCppCoverage", f"--source {workspace} --exp= ort_type binary:{testFile}.cov -- {testFile}") - coverageFile +=3D " --input_coverage=3D" + testFile + ".cov" + if ret !=3D 0: + logging.error("UnitTest Coverage: Failed to collect covera= ge data.") + return 1 + + coverageFile =3D f" --input_coverage=3D{testFile}.cov" + totalCoverageFile =3D os.path.join(buildOutputBase, 'coverage.= cov') + if os.path.isfile(totalCoverageFile): + coverageFile +=3D f" --input_coverage=3D{totalCoverageFile= }" + ret =3D RunCmd( + "OpenCppCoverage", + f"--export_type binary:{totalCoverageFile} " + + f"--working_dir=3D{workspaceBuild} " + + f"{coverageFile}" + ) if ret !=3D 0: logging.error("UnitTest Coverage: Failed to collect covera= ge data.") return 1 =20 # Generate and XML file if requested.by each package - ret =3D RunCmd("OpenCppCoverage", f"--export_type cobertura:{os.pa= th.join(buildOutputBase, 'coverage.xml')} --working_dir=3D{workspace}Build = {coverageFile}") + ret =3D RunCmd( + "OpenCppCoverage", + f"--export_type cobertura:{os.path.join(buildOutputBase, 'cove= rage.xml')} " + + f"--working_dir=3D{workspaceBuild} " + + f"--input_coverage=3D{totalCoverageFile} " + ) if ret !=3D 0: logging.error("UnitTest Coverage: Failed to generate cobertura= format xml in single package.") return 1 =20 # Generate total report XML file for all package - testCoverageList =3D glob.glob(os.path.join(workspace, "Build", "*= *","*Test*.exe.cov"), recursive=3DTrue) + testCoverageList =3D glob.glob(os.path.join(workspace, "Build", "*= *", "*Test*.exe.cov"), recursive=3DTrue) coverageFile =3D "" + totalCoverageFile =3D os.path.join(workspaceBuild, 'coverage.cov') for testCoverage in testCoverageList: - coverageFile +=3D " --input_coverage=3D" + testCoverage + coverageFile =3D f" --input_coverage=3D{testCoverage}" + if os.path.isfile(totalCoverageFile): + coverageFile +=3D f" --input_coverage=3D{totalCoverageFile= }" + ret =3D RunCmd( + "OpenCppCoverage", + f"--export_type binary:{totalCoverageFile} " + + f"--working_dir=3D{workspaceBuild} " + + f"{coverageFile}" + ) + if ret !=3D 0: + logging.error("UnitTest Coverage: Failed to collect covera= ge data.") + return 1 =20 - ret =3D RunCmd("OpenCppCoverage", f"--export_type cobertura:{works= pace}Build/coverage.xml --working_dir=3D{workspace}Build {coverageFile}") + ret =3D RunCmd( + "OpenCppCoverage", + f"--export_type cobertura:{os.path.join(workspaceBuild, 'cover= age.xml')} " + + f"--working_dir=3D{workspaceBuild} " + + f"--input_coverage=3D{totalCoverageFile}" + ) if ret !=3D 0: logging.error("UnitTest Coverage: Failed to generate cobertura= format xml.") return 1 --=20 2.39.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104638): https://edk2.groups.io/g/devel/message/104638 Mute This Topic: https://groups.io/mt/98818783/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-