* [PATCH v1] BaseTools/Plugin: Too many execute file will be failure
@ 2023-05-08 10:49 Guo, Gua
2023-05-08 16:54 ` Michael D Kinney
0 siblings, 1 reply; 2+ messages in thread
From: Guo, Gua @ 2023-05-08 10:49 UTC (permalink / raw)
To: devel; +Cc: Gua Guo, Michael D Kinney, Sean Brogan, Michael Kubacki
From: Gua Guo <gua.guo@intel.com>
Windows command prompt have 8191 character limitation,
enhance it to make command too long can be resloved.
Change-Id: I7f1d8d46274f1c0104572d47253d499900effe76
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Signed-off-by: Gua Guo <gua.guo@intel.com>
---
.../HostBasedUnitTestRunner.py | 31 ++++++++++++++++---
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.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 = ""
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"
+ if (os.path.isfile(f"{os.path.join(buildOutputBase, 'coverage.cov')}")):
+ coverageFile += f" --input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ ret = RunCmd("OpenCppCoverage", f"--export_type binary:{os.path.join(buildOutputBase, 'coverage.cov')} --working_dir={workspace}Build {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={workspace}Build " +
+ f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ )
if ret != 0:
logging.error("UnitTest Coverage: Failed to generate cobertura format xml in single package.")
return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
testCoverageList = glob.glob(os.path.join(workspace, "Build", "**","*Test*.exe.cov"), recursive=True)
coverageFile = ""
for testCoverage in testCoverageList:
- coverageFile += " --input_coverage=" + testCoverage
+ coverageFile = f" --input_coverage={testCoverage}"
+ if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+ coverageFile += f" --input_coverage={workspace}Build/coverage.cov"
+ ret = RunCmd("OpenCppCoverage", f"--export_type binary:{workspace}Build/coverage.cov --working_dir={workspace}Build {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:{workspace}Build/coverage.xml " +
+ f"--working_dir={workspace}Build " +
+ f"--input_coverage={workspace}Build/coverage.cov"
+ )
if ret != 0:
logging.error("UnitTest Coverage: Failed to generate cobertura format xml.")
return 1
--
2.39.2.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] BaseTools/Plugin: Too many execute file will be failure
2023-05-08 10:49 [PATCH v1] BaseTools/Plugin: Too many execute file will be failure Guo, Gua
@ 2023-05-08 16:54 ` Michael D Kinney
0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2023-05-08 16:54 UTC (permalink / raw)
To: Guo, Gua, devel@edk2.groups.io
Cc: Sean Brogan, Michael Kubacki, Kinney, Michael D
Hi Gua,
Can you add summary of change made to the commit message?
I think it is changes passing many coverage files in single command line to breaking it up into many command lines with one coverage file per command line. Right?
Mike
> -----Original Message-----
> From: Guo, Gua <gua.guo@intel.com>
> Sent: Monday, May 8, 2023 3:49 AM
> To: devel@edk2.groups.io
> Cc: Guo, Gua <gua.guo@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>;
> Michael Kubacki <mikuback@linux.microsoft.com>
> Subject: [PATCH v1] BaseTools/Plugin: Too many execute file will be failure
>
> From: Gua Guo <gua.guo@intel.com>
>
> Windows command prompt have 8191 character limitation,
> enhance it to make command too long can be resloved.
>
> Change-Id: I7f1d8d46274f1c0104572d47253d499900effe76
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Signed-off-by: Gua Guo <gua.guo@intel.com>
> ---
> .../HostBasedUnitTestRunner.py | 31 ++++++++++++++++---
> 1 file changed, 27 insertions(+), 4 deletions(-)
>
> diff --git
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.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 = ""
>
> 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"
>
> + if (os.path.isfile(f"{os.path.join(buildOutputBase, 'coverage.cov')}")):
>
> + coverageFile += f" --input_coverage={os.path.join(buildOutputBase,
> 'coverage.cov')}"
>
> + ret = RunCmd("OpenCppCoverage", f"--export_type
> binary:{os.path.join(buildOutputBase, 'coverage.cov')} --
> working_dir={workspace}Build {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={workspace}Build " +
>
> + f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
>
> + )
>
> if ret != 0:
>
> logging.error("UnitTest Coverage: Failed to generate cobertura format
> xml in single package.")
>
> return 1
>
> @@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
> testCoverageList = glob.glob(os.path.join(workspace, "Build",
> "**","*Test*.exe.cov"), recursive=True)
>
> coverageFile = ""
>
> for testCoverage in testCoverageList:
>
> - coverageFile += " --input_coverage=" + testCoverage
>
> + coverageFile = f" --input_coverage={testCoverage}"
>
> + if (os.path.isfile(f"{workspace}Build/coverage.cov")):
>
> + coverageFile += f" --
> input_coverage={workspace}Build/coverage.cov"
>
> + ret = RunCmd("OpenCppCoverage", f"--export_type
> binary:{workspace}Build/coverage.cov --working_dir={workspace}Build
> {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:{workspace}Build/coverage.xml " +
>
> + f"--working_dir={workspace}Build " +
>
> + f"--input_coverage={workspace}Build/coverage.cov"
>
> + )
>
> if ret != 0:
>
> logging.error("UnitTest Coverage: Failed to generate cobertura format
> xml.")
>
> return 1
>
> --
> 2.39.2.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-08 16:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08 10:49 [PATCH v1] BaseTools/Plugin: Too many execute file will be failure Guo, Gua
2023-05-08 16:54 ` Michael D Kinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox