回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure
gaoliming via groups.io
gaoliming=byosoft.com.cn at groups.io
Thu May 11 01:43:08 UTC 2023
Gua:
This is like a bug fix. I am OK to merge it for this stable tag.
Thanks
Liming
> -----邮件原件-----
> 发件人: devel at edk2.groups.io <devel at edk2.groups.io> 代表 Guo, Gua
> 发送时间: 2023年5月11日 6:01
> 收件人: Michael Kubacki <mikuback at linux.microsoft.com>;
> devel at edk2.groups.io; Kinney, Michael D <michael.d.kinney at intel.com>
> 抄送: Sean Brogan <sean.brogan at microsoft.com>
> 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
>
> @Kinney, Michael D
>
> Could we merge the bug patch before code freeze ? The patch can help unlock
> command too long issue on Windows command prompt.
>
> Thanks,
> Gua
>
> -----Original Message-----
> From: Michael Kubacki <mikuback at linux.microsoft.com>
> Sent: Thursday, May 11, 2023 5:41 AM
> To: devel at edk2.groups.io; Guo, Gua <gua.guo at intel.com>
> Cc: Kinney, Michael D <michael.d.kinney at intel.com>; Sean Brogan
> <sean.brogan at microsoft.com>
> Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
>
> Reviewed-by: Michael Kubacki <michael.kubacki at microsoft.com>
>
> On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > From: Gua Guo <gua.guo at intel.com>
> >
> > 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={workspace}Build
> >> --input_coverage=AAA.cov
> >> ...
> >> --input_coverage=NNN.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={workspace}Build
> >> --input_coverage=AAA.cov
> >> --input_coverage=coverage.cov
> > ...
> >
> > - Command Line N
> >> OpenCppCoverage
> >> --export_type binary:coverage.cov
> >> --working_dir={workspace}Build
> >> --input_coverage=NNN.cov
> >> --input_coverage=coverage.cov
> >
> > Cc: Michael D Kinney <michael.d.kinney at intel.com>
> > Cc: Sean Brogan <sean.brogan at microsoft.com>
> > Cc: Michael Kubacki <mikuback at linux.microsoft.com>
> > Signed-off-by: Gua Guo <gua.guo at intel.com>
> > ---
> > .../HostBasedUnitTestRunner.py | 46
> +++++++++++++++++--
> > 1 file changed, 41 insertions(+), 5 deletions(-)
> >
> > diff --git
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.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 = glob.glob(os.path.join(buildOutputBase,
> > "**","*Test*.exe"), recursive=True)
> >
> > workspace = thebuilder.env.GetValue("WORKSPACE")
> >
> > workspace = (workspace + os.sep) if workspace[-1] != os.sep
> > else workspace
> >
> > + workspaceBuild = os.path.join(workspace, 'Build')
> >
> > # Generate coverage file
> >
> > coverageFile = ""
> >
> > for testFile in testList:
> >
> > ret = RunCmd("OpenCppCoverage", f"--source
> {workspace}
> > --export_type binary:{testFile}.cov -- {testFile}")
> >
> > - coverageFile += " --input_coverage=" + testFile + ".cov"
> >
> > + if ret != 0:
> >
> > + logging.error("UnitTest Coverage: Failed to collect
> > + coverage data.")
> >
> > + return 1
> >
> > +
> >
> > + coverageFile = f" --input_coverage={testFile}.cov"
> >
> > + totalCoverageFile = os.path.join(buildOutputBase,
> > + 'coverage.cov')
> >
> > + if os.path.isfile(totalCoverageFile):
> >
> > + coverageFile += f"
> --input_coverage={totalCoverageFile}"
> >
> > + ret = RunCmd(
> >
> > + "OpenCppCoverage",
> >
> > + f"--export_type binary:{totalCoverageFile} " +
> >
> > + f"--working_dir={workspaceBuild} " +
> >
> > + f"{coverageFile}"
> >
> > + )
> >
> > if ret != 0:
> >
> > logging.error("UnitTest Coverage: Failed to collect
> > coverage data.")
> >
> > return 1
> >
> >
> >
> > # Generate and XML file if requested.by each package
> >
> > - ret = RunCmd("OpenCppCoverage", f"--export_type
> cobertura:{os.path.join(buildOutputBase, 'coverage.xml')}
> --working_dir={workspace}Build {coverageFile}")
> >
> > + ret = RunCmd(
> >
> > + "OpenCppCoverage",
> >
> > + f"--export_type cobertura:{os.path.join(buildOutputBase,
> > + 'coverage.xml')} " +
> >
> > + f"--working_dir={workspaceBuild} " +
> >
> > + f"--input_coverage={totalCoverageFile} "
> >
> > + )
> >
> > if ret != 0:
> >
> > logging.error("UnitTest Coverage: Failed to generate
> > cobertura format xml in single package.")
> >
> > return 1
> >
> >
> >
> > # Generate total report XML file for all package
> >
> > - testCoverageList = glob.glob(os.path.join(workspace, "Build",
> "**","*Test*.exe.cov"), recursive=True)
> >
> > + testCoverageList = glob.glob(os.path.join(workspace, "Build",
> > + "**", "*Test*.exe.cov"), recursive=True)
> >
> > coverageFile = ""
> >
> > + totalCoverageFile = os.path.join(workspaceBuild,
> > + 'coverage.cov')
> >
> > for testCoverage in testCoverageList:
> >
> > - coverageFile += " --input_coverage=" + testCoverage
> >
> > + coverageFile = f" --input_coverage={testCoverage}"
> >
> > + if os.path.isfile(totalCoverageFile):
> >
> > + coverageFile += f"
> --input_coverage={totalCoverageFile}"
> >
> > + ret = RunCmd(
> >
> > + "OpenCppCoverage",
> >
> > + f"--export_type binary:{totalCoverageFile} " +
> >
> > + f"--working_dir={workspaceBuild} " +
> >
> > + f"{coverageFile}"
> >
> > + )
> >
> > + if ret != 0:
> >
> > + logging.error("UnitTest Coverage: Failed to collect
> > + coverage data.")
> >
> > + return 1
> >
> >
> >
> > - ret = RunCmd("OpenCppCoverage", f"--export_type
> cobertura:{workspace}Build/coverage.xml --working_dir={workspace}Build
> {coverageFile}")
> >
> > + ret = RunCmd(
> >
> > + "OpenCppCoverage",
> >
> > + f"--export_type cobertura:{os.path.join(workspaceBuild,
> > + 'coverage.xml')} " +
> >
> > + f"--working_dir={workspaceBuild} " +
> >
> > + f"--input_coverage={totalCoverageFile}"
> >
> > + )
> >
> > if ret != 0:
> >
> > logging.error("UnitTest Coverage: Failed to generate
> > cobertura format xml.")
> >
> > return 1
> >
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104647): https://edk2.groups.io/g/devel/message/104647
Mute This Topic: https://groups.io/mt/98819510/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list