From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.891.1683577135427613511 for ; Mon, 08 May 2023 13:18:55 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=T4MIYfA6; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: gua.guo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683577135; x=1715113135; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=R9WRjSG/ilqhmrd0oRnIyKolXtX0PNPfv/FerbNveCA=; b=T4MIYfA68NfbvlCjc3FaCuNHyiHOQXHukfBSdFeYWPtwn5KHqGEs4VYi OjyFj23Y7DbNQC0xppZyyXpiQW75pqW8Bz0jOPN0vjlzttq8nKa6s3ybs 8mqyjHd9res98QM1W8tWm4RlXsX3OtB8sTS0G0z1bLErFtCPBtuEjianC jz4Zko1mMxw8LyWEDZhx7HeS9B43mgPIXjVMQhRQLVIo1HgYOh9yQqvt9 1BGfFV/slwn4l7T/v43mzDjp0QgiUuik8OPMjPAa5B9chpNK0DipURxDC GEEG1RpLvjJEi/Ld9s5iQbhDNHbseOXVHz5YjyDVDfqEYXMoc/oc+RYOE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="329371803" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="329371803" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 13:18:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="822818459" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="822818459" Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga004.jf.intel.com with ESMTP; 08 May 2023 13:18:52 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: Gua Guo , Michael D Kinney , Sean Brogan , Michael Kubacki Subject: [PATCH v3] BaseTools/Plugin: Too many execute filess cause "cmd too long" failure Date: Tue, 9 May 2023 04:18:49 +0800 Message-Id: <20230508201849.36-1-gua.guo@intel.com> X-Mailer: git-send-email 2.39.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Signed-off-by: Gua Guo --- .../HostBasedUnitTestRunner.py | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunn= er.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py index d993de9412..05bb6da50a 100644 --- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py @@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin): coverageFile =3D ""=0D for testFile in testList:=0D ret =3D RunCmd("OpenCppCoverage", f"--source {workspace} --exp= ort_type binary:{testFile}.cov -- {testFile}")=0D - coverageFile +=3D " --input_coverage=3D" + testFile + ".cov"=0D + if ret !=3D 0:=0D + logging.error("UnitTest Coverage: Failed to collect covera= ge data.")=0D + return 1=0D +=0D + coverageFile =3D f" --input_coverage=3D{testFile}.cov"=0D + if (os.path.isfile(f"{os.path.join(buildOutputBase, 'coverage.= cov')}")):=0D + coverageFile +=3D f" --input_coverage=3D{os.path.join(buil= dOutputBase, 'coverage.cov')}"=0D + ret =3D RunCmd("OpenCppCoverage", f"--export_type binary:{os.p= ath.join(buildOutputBase, 'coverage.cov')} --working_dir=3D{workspace}Build= {coverageFile}")=0D if ret !=3D 0:=0D logging.error("UnitTest Coverage: Failed to collect covera= ge data.")=0D return 1=0D =0D # Generate and XML file if requested.by each package=0D - ret =3D RunCmd("OpenCppCoverage", f"--export_type cobertura:{os.pa= th.join(buildOutputBase, 'coverage.xml')} --working_dir=3D{workspace}Build = {coverageFile}")=0D + ret =3D RunCmd(=0D + "OpenCppCoverage",=0D + f"--export_type cobertura:{os.path.join(buildOutputBase, 'cove= rage.xml')} " +=0D + f"--working_dir=3D{workspace}Build " +=0D + f"--input_coverage=3D{os.path.join(buildOutputBase, 'coverage.= cov')}"=0D + )=0D if ret !=3D 0:=0D logging.error("UnitTest Coverage: Failed to generate cobertura= format xml in single package.")=0D return 1=0D @@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin): testCoverageList =3D glob.glob(os.path.join(workspace, "Build", "*= *","*Test*.exe.cov"), recursive=3DTrue)=0D coverageFile =3D ""=0D for testCoverage in testCoverageList:=0D - coverageFile +=3D " --input_coverage=3D" + testCoverage=0D + coverageFile =3D f" --input_coverage=3D{testCoverage}"=0D + if (os.path.isfile(f"{workspace}Build/coverage.cov")):=0D + coverageFile +=3D f" --input_coverage=3D{workspace}Build/c= overage.cov"=0D + ret =3D RunCmd("OpenCppCoverage", f"--export_type binary:{work= space}Build/coverage.cov --working_dir=3D{workspace}Build {coverageFile}")= =0D + if ret !=3D 0:=0D + logging.error("UnitTest Coverage: Failed to collect covera= ge data.")=0D + return 1=0D =0D - ret =3D RunCmd("OpenCppCoverage", f"--export_type cobertura:{works= pace}Build/coverage.xml --working_dir=3D{workspace}Build {coverageFile}")=0D + ret =3D RunCmd(=0D + "OpenCppCoverage",=0D + f"--export_type cobertura:{workspace}Build/coverage.xml " +=0D + f"--working_dir=3D{workspace}Build " +=0D + f"--input_coverage=3D{workspace}Build/coverage.cov"=0D + )=0D if ret !=3D 0:=0D logging.error("UnitTest Coverage: Failed to generate cobertura= format xml.")=0D return 1=0D --=20 2.39.2.windows.1