From nobody Sun May 19 04:35:08 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+104483+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+104483+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1683695706; cv=none; d=zohomail.com; s=zohoarc; b=ckubVS7jeKLVsBx1Nci+f61Q0k5heFT5GkKeN3YCjVKNG2H17itKnaCSgkd5YxXyryN833Mp0m5ES5KE6mXQxOsuEY1GAT6jO4CFzht0cfaLAY4Vd82EoyogQP9ZHvgWBQfA6s9lyxuzULIyxFOUpHebQSyhmcXfJJQ1J9TgG9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683695706; 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=9jlswwvtqJLD2Q2D1xa22Q1aQo19y5gTA6Mb/Tjm2l8=; b=MwgRsRHpZ6201PaLkRtQvf6diDkr7lge1NhqTVQjCUOv9tTYSBGep9Pko27IN7OFbUD2kcge3493hIijPYjCJ6fkoeJGRufv37BBhLg6cf/FhgnEUGM7D1pxaHQHWKQnrBQyGcRXvTgV9nDStMCF56gCXqP0mRmJBzdDSq7qmE8= 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+104483+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 1683695706716972.1670468283569; Tue, 9 May 2023 22:15:06 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id v0ZvYY1788612x4Qyy0Zk7UR; Tue, 09 May 2023 22:15:06 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.9406.1683695701564861887 for ; Tue, 09 May 2023 22:15:05 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="329746748" X-IronPort-AV: E=Sophos;i="5.99,263,1677571200"; d="scan'208";a="329746748" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 22:15:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="699157345" X-IronPort-AV: E=Sophos;i="5.99,263,1677571200"; d="scan'208";a="699157345" X-Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga002.jf.intel.com with ESMTP; 09 May 2023 22:15:04 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: gua.guo@intel.com, Michael D Kinney , Sean Brogan , Michael Kubacki Subject: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure Date: Wed, 10 May 2023 13:14:57 +0800 Message-Id: <20230510051457.1063-2-gua.guo@intel.com> In-Reply-To: <20230510051457.1063-1-gua.guo@intel.com> References: <20230510051457.1063-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: LoPCp6KBMWdjajJpd3LnwPyix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683695706; bh=EJI6G4TklXKzSoZ/vojiLydXytmOSebwcT80Z4OEn0s=; h=Cc:Date:From:Reply-To:Subject:To; b=YB5SAcNZ39FmGVbUnpHBm1xeeBJwtJ2hN2ht+nuCw2u0U7jGw9BJpkViRgTNOxGKmoP 8+Rc8UV6Y1ouqFliC1uNWd4zQNnTFEsLNh4tkzXoC7Vw4JZjp+Y1lhLX+2HwLAbIp8aXA QpQVaEwwgmZxHiy7XaapKHIbH8+clwaAf/U= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683695708407100011 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 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 (#104483): https://edk2.groups.io/g/devel/message/104483 Mute This Topic: https://groups.io/mt/98800296/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-