* [PATCH v4 0/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure @ 2023-05-10 5:14 Guo, Gua 2023-05-10 5:14 ` [PATCH v4 1/1] " Guo, Gua 0 siblings, 1 reply; 10+ messages in thread From: Guo, Gua @ 2023-05-10 5:14 UTC (permalink / raw) To: devel; +Cc: gua.guo From: Gua Guo <gua.guo@intel.com> V3: Michael Kubacki Open1: I understand it was common in some parts of the code base at one point to wrap all expressions in parentheses, but can it be avoided in newly added code? And the parentheses are unnecessary in this case and don't follow typical Python style. Solution: Fixed, I will record it in my personal guideline to prevent happen again in next time that I change python code on Edk2. Open2: Due to the number of references, it would be easier to follow if this path were assigned to a variable: os.path.join(buildOutputBase, 'coverage.cov') Solution: Fixed, Use variable to reduce repetitive data. Open3: Solution: my local test, performance time increase 1.4% each build. I'm not sure whether the data is reasonable or not. But if won't fix it, I think one day unittest implement more and more on Edk2 part. It will break azurepipe line build in the future. V2/V1: Mike Kinney: Open1: Make commit message more clearly. Solution: Change commit message to use real case to describe the issue I encounter. Gua Guo (1): BaseTools/Plugin: Too many execute files cause "cmd too long" failure .../HostBasedUnitTestRunner.py | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) -- 2.39.2.windows.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-10 5:14 [PATCH v4 0/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure Guo, Gua @ 2023-05-10 5:14 ` Guo, Gua 2023-05-10 21:40 ` [edk2-devel] " Michael Kubacki 0 siblings, 1 reply; 10+ messages in thread From: Guo, Gua @ 2023-05-10 5:14 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 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@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 | 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 -- 2.39.2.windows.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-10 5:14 ` [PATCH v4 1/1] " Guo, Gua @ 2023-05-10 21:40 ` Michael Kubacki 2023-05-10 22:00 ` Guo, Gua 0 siblings, 1 reply; 10+ messages in thread From: Michael Kubacki @ 2023-05-10 21:40 UTC (permalink / raw) To: devel, gua.guo; +Cc: Michael D Kinney, Sean Brogan Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> On 5/10/2023 1:14 AM, Guo, Gua wrote: > From: Gua Guo <gua.guo@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@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 | 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 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-10 21:40 ` [edk2-devel] " Michael Kubacki @ 2023-05-10 22:00 ` Guo, Gua 2023-05-11 1:43 ` 回复: " gaoliming 0 siblings, 1 reply; 10+ messages in thread From: Guo, Gua @ 2023-05-10 22:00 UTC (permalink / raw) To: Michael Kubacki, devel@edk2.groups.io, Kinney, Michael D; +Cc: Sean Brogan @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@linux.microsoft.com> Sent: Thursday, May 11, 2023 5:41 AM To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@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@microsoft.com> On 5/10/2023 1:14 AM, Guo, Gua wrote: > From: Gua Guo <gua.guo@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@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 | 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 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-10 22:00 ` Guo, Gua @ 2023-05-11 1:43 ` gaoliming 2023-05-11 1:52 ` Michael D Kinney 0 siblings, 1 reply; 10+ messages in thread From: gaoliming @ 2023-05-11 1:43 UTC (permalink / raw) To: devel, gua.guo, 'Michael Kubacki', 'Kinney, Michael D' Cc: 'Sean Brogan' Gua: This is like a bug fix. I am OK to merge it for this stable tag. Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > 发送时间: 2023年5月11日 6:01 > 收件人: Michael Kubacki <mikuback@linux.microsoft.com>; > devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com> > 抄送: Sean Brogan <sean.brogan@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@linux.microsoft.com> > Sent: Thursday, May 11, 2023 5:41 AM > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan > <sean.brogan@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@microsoft.com> > > On 5/10/2023 1:14 AM, Guo, Gua wrote: > > From: Gua Guo <gua.guo@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@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 | 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 > > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-11 1:43 ` 回复: " gaoliming @ 2023-05-11 1:52 ` Michael D Kinney 2023-05-11 1:59 ` Guo, Gua 0 siblings, 1 reply; 10+ messages in thread From: Michael D Kinney @ 2023-05-11 1:52 UTC (permalink / raw) To: devel@edk2.groups.io, Gao, Liming, Guo, Gua, 'Michael Kubacki' Cc: 'Sean Brogan', Kinney, Michael D Hi Liming, I agree it is bug fix. Can you do review and if pass help with push label? Thanks, Mike > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming > via groups.io > Sent: Wednesday, May 10, 2023 6:43 PM > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; 'Michael Kubacki' > <mikuback@linux.microsoft.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Cc: 'Sean Brogan' <sean.brogan@microsoft.com> > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > execute files cause "cmd too long" failure > > Gua: > > This is like a bug fix. I am OK to merge it for this stable tag. > > Thanks > Liming > > -----邮件原件----- > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > > 发送时间: 2023年5月11日 6:01 > > 收件人: Michael Kubacki <mikuback@linux.microsoft.com>; > > devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com> > > 抄送: Sean Brogan <sean.brogan@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@linux.microsoft.com> > > Sent: Thursday, May 11, 2023 5:41 AM > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan > > <sean.brogan@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@microsoft.com> > > > > On 5/10/2023 1:14 AM, Guo, Gua wrote: > > > From: Gua Guo <gua.guo@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@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 | 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 > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-11 1:52 ` Michael D Kinney @ 2023-05-11 1:59 ` Guo, Gua 2023-05-11 2:06 ` 回复: " gaoliming 0 siblings, 1 reply; 10+ messages in thread From: Guo, Gua @ 2023-05-11 1:59 UTC (permalink / raw) To: Kinney, Michael D, devel@edk2.groups.io, Gao, Liming, 'Michael Kubacki' Cc: 'Sean Brogan' @Gao, Liming Thank for the reply. It's PR for the patch. https://github.com/tianocore/edk2/pull/4357 Thanks Gua -----Original Message----- From: Kinney, Michael D <michael.d.kinney@intel.com> Sent: Thursday, May 11, 2023 9:53 AM To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Guo, Gua <gua.guo@intel.com>; 'Michael Kubacki' <mikuback@linux.microsoft.com> Cc: 'Sean Brogan' <sean.brogan@microsoft.com>; Kinney, Michael D <michael.d.kinney@intel.com> Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure Hi Liming, I agree it is bug fix. Can you do review and if pass help with push label? Thanks, Mike > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > gaoliming via groups.io > Sent: Wednesday, May 10, 2023 6:43 PM > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; 'Michael Kubacki' > <mikuback@linux.microsoft.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Cc: 'Sean Brogan' <sean.brogan@microsoft.com> > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > execute files cause "cmd too long" failure > > Gua: > > This is like a bug fix. I am OK to merge it for this stable tag. > > Thanks > Liming > > -----邮件原件----- > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > > 发送时间: 2023年5月11日 6:01 > > 收件人: Michael Kubacki <mikuback@linux.microsoft.com>; > > devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com> > > 抄送: Sean Brogan <sean.brogan@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@linux.microsoft.com> > > Sent: Thursday, May 11, 2023 5:41 AM > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan > > <sean.brogan@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@microsoft.com> > > > > On 5/10/2023 1:14 AM, Guo, Gua wrote: > > > From: Gua Guo <gua.guo@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@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 | 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 > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-11 1:59 ` Guo, Gua @ 2023-05-11 2:06 ` gaoliming 2023-05-11 2:12 ` Guo, Gua 0 siblings, 1 reply; 10+ messages in thread From: gaoliming @ 2023-05-11 2:06 UTC (permalink / raw) To: devel, gua.guo, 'Kinney, Michael D', 'Michael Kubacki' Cc: 'Sean Brogan' Gua: Seemly, this PR 4357 doesn't match the reviewed patch. I find the commit message is different. And, you also need to add reviewed-by from Michael. Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > 发送时间: 2023年5月11日 10:00 > 收件人: Kinney, Michael D <michael.d.kinney@intel.com>; > devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; 'Michael > Kubacki' <mikuback@linux.microsoft.com> > 抄送: 'Sean Brogan' <sean.brogan@microsoft.com> > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute > files cause "cmd too long" failure > > @Gao, Liming > > Thank for the reply. > It's PR for the patch. > https://github.com/tianocore/edk2/pull/4357 > > > Thanks > Gua > -----Original Message----- > From: Kinney, Michael D <michael.d.kinney@intel.com> > Sent: Thursday, May 11, 2023 9:53 AM > To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Guo, > Gua <gua.guo@intel.com>; 'Michael Kubacki' > <mikuback@linux.microsoft.com> > Cc: 'Sean Brogan' <sean.brogan@microsoft.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute > files cause "cmd too long" failure > > Hi Liming, > > I agree it is bug fix. Can you do review and if pass help with push label? > > Thanks, > > Mike > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > gaoliming via groups.io > > Sent: Wednesday, May 10, 2023 6:43 PM > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; 'Michael > Kubacki' > > <mikuback@linux.microsoft.com>; Kinney, Michael D > > <michael.d.kinney@intel.com> > > Cc: 'Sean Brogan' <sean.brogan@microsoft.com> > > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > > execute files cause "cmd too long" failure > > > > Gua: > > > > This is like a bug fix. I am OK to merge it for this stable tag. > > > > Thanks > > Liming > > > -----邮件原件----- > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > > > 发送时间: 2023年5月11日 6:01 > > > 收件人: Michael Kubacki <mikuback@linux.microsoft.com>; > > > devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com> > > > 抄送: Sean Brogan <sean.brogan@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@linux.microsoft.com> > > > Sent: Thursday, May 11, 2023 5:41 AM > > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan > > > <sean.brogan@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@microsoft.com> > > > > > > On 5/10/2023 1:14 AM, Guo, Gua wrote: > > > > From: Gua Guo <gua.guo@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@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 | 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-11 2:06 ` 回复: " gaoliming @ 2023-05-11 2:12 ` Guo, Gua 2023-05-11 2:55 ` 回复: " gaoliming 0 siblings, 1 reply; 10+ messages in thread From: Guo, Gua @ 2023-05-11 2:12 UTC (permalink / raw) To: devel@edk2.groups.io, Gao, Liming, Kinney, Michael D, 'Michael Kubacki' Cc: 'Sean Brogan' Hi Liming I've added both review-by now. One from Mike One from Michael. Thanks, Gua -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming via groups.io Sent: Thursday, May 11, 2023 10:07 AM To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; 'Michael Kubacki' <mikuback@linux.microsoft.com> Cc: 'Sean Brogan' <sean.brogan@microsoft.com> Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure Gua: Seemly, this PR 4357 doesn't match the reviewed patch. I find the commit message is different. And, you also need to add reviewed-by from Michael. Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > 发送时间: 2023年5月11日 10:00 > 收件人: Kinney, Michael D <michael.d.kinney@intel.com>; > devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; 'Michael > Kubacki' <mikuback@linux.microsoft.com> > 抄送: 'Sean Brogan' <sean.brogan@microsoft.com> > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute > files cause "cmd too long" failure > > @Gao, Liming > > Thank for the reply. > It's PR for the patch. > https://github.com/tianocore/edk2/pull/4357 > > > Thanks > Gua > -----Original Message----- > From: Kinney, Michael D <michael.d.kinney@intel.com> > Sent: Thursday, May 11, 2023 9:53 AM > To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Guo, > Gua <gua.guo@intel.com>; 'Michael Kubacki' > <mikuback@linux.microsoft.com> > Cc: 'Sean Brogan' <sean.brogan@microsoft.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute > files cause "cmd too long" failure > > Hi Liming, > > I agree it is bug fix. Can you do review and if pass help with push label? > > Thanks, > > Mike > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > gaoliming via groups.io > > Sent: Wednesday, May 10, 2023 6:43 PM > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; 'Michael > Kubacki' > > <mikuback@linux.microsoft.com>; Kinney, Michael D > > <michael.d.kinney@intel.com> > > Cc: 'Sean Brogan' <sean.brogan@microsoft.com> > > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > > execute files cause "cmd too long" failure > > > > Gua: > > > > This is like a bug fix. I am OK to merge it for this stable tag. > > > > Thanks > > Liming > > > -----邮件原件----- > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > > > 发送时间: 2023年5月11日 6:01 > > > 收件人: Michael Kubacki <mikuback@linux.microsoft.com>; > > > devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com> > > > 抄送: Sean Brogan <sean.brogan@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@linux.microsoft.com> > > > Sent: Thursday, May 11, 2023 5:41 AM > > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan > > > <sean.brogan@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@microsoft.com> > > > > > > On 5/10/2023 1:14 AM, Guo, Gua wrote: > > > > From: Gua Guo <gua.guo@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@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 | 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure 2023-05-11 2:12 ` Guo, Gua @ 2023-05-11 2:55 ` gaoliming 0 siblings, 0 replies; 10+ messages in thread From: gaoliming @ 2023-05-11 2:55 UTC (permalink / raw) To: 'Guo, Gua', devel, 'Kinney, Michael D', 'Michael Kubacki' Cc: 'Sean Brogan' I just add push label. Thanks Liming > -----邮件原件----- > 发件人: Guo, Gua <gua.guo@intel.com> > 发送时间: 2023年5月11日 10:13 > 收件人: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; > Kinney, Michael D <michael.d.kinney@intel.com>; 'Michael Kubacki' > <mikuback@linux.microsoft.com> > 抄送: 'Sean Brogan' <sean.brogan@microsoft.com> > 主题: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute > files cause "cmd too long" failure > > Hi Liming > > I've added both review-by now. > One from Mike > One from Michael. > > Thanks, > Gua > > > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming > via groups.io > Sent: Thursday, May 11, 2023 10:07 AM > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; Kinney, Michael D > <michael.d.kinney@intel.com>; 'Michael Kubacki' > <mikuback@linux.microsoft.com> > Cc: 'Sean Brogan' <sean.brogan@microsoft.com> > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > execute files cause "cmd too long" failure > > Gua: > Seemly, this PR 4357 doesn't match the reviewed patch. I find the commit > message is different. And, you also need to add reviewed-by from Michael. > > Thanks > Liming > > -----邮件原件----- > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua > > 发送时间: 2023年5月11日 10:00 > > 收件人: Kinney, Michael D <michael.d.kinney@intel.com>; > > devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; 'Michael > > Kubacki' <mikuback@linux.microsoft.com> > > 抄送: 'Sean Brogan' <sean.brogan@microsoft.com> > > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute > > files cause "cmd too long" failure > > > > @Gao, Liming > > > > Thank for the reply. > > It's PR for the patch. > > https://github.com/tianocore/edk2/pull/4357 > > > > > > Thanks > > Gua > > -----Original Message----- > > From: Kinney, Michael D <michael.d.kinney@intel.com> > > Sent: Thursday, May 11, 2023 9:53 AM > > To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Guo, > > Gua <gua.guo@intel.com>; 'Michael Kubacki' > > <mikuback@linux.microsoft.com> > > Cc: 'Sean Brogan' <sean.brogan@microsoft.com>; Kinney, Michael D > > <michael.d.kinney@intel.com> > > Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > execute > > files cause "cmd too long" failure > > > > Hi Liming, > > > > I agree it is bug fix. Can you do review and if pass help with push label? > > > > Thanks, > > > > Mike > > > > > -----Original Message----- > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > gaoliming via groups.io > > > Sent: Wednesday, May 10, 2023 6:43 PM > > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>; 'Michael > > Kubacki' > > > <mikuback@linux.microsoft.com>; Kinney, Michael D > > > <michael.d.kinney@intel.com> > > > Cc: 'Sean Brogan' <sean.brogan@microsoft.com> > > > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many > > > execute files cause "cmd too long" failure > > > > > > Gua: > > > > > > This is like a bug fix. I am OK to merge it for this stable tag. > > > > > > Thanks > > > Liming > > > > -----邮件原件----- > > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, > Gua > > > > 发送时间: 2023年5月11日 6:01 > > > > 收件人: Michael Kubacki <mikuback@linux.microsoft.com>; > > > > devel@edk2.groups.io; Kinney, Michael D > <michael.d.kinney@intel.com> > > > > 抄送: Sean Brogan <sean.brogan@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@linux.microsoft.com> > > > > Sent: Thursday, May 11, 2023 5:41 AM > > > > To: devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com> > > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan > > > > <sean.brogan@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@microsoft.com> > > > > > > > > On 5/10/2023 1:14 AM, Guo, Gua wrote: > > > > > From: Gua Guo <gua.guo@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@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 | 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-05-11 2:55 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-05-10 5:14 [PATCH v4 0/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure Guo, Gua 2023-05-10 5:14 ` [PATCH v4 1/1] " Guo, Gua 2023-05-10 21:40 ` [edk2-devel] " Michael Kubacki 2023-05-10 22:00 ` Guo, Gua 2023-05-11 1:43 ` 回复: " gaoliming 2023-05-11 1:52 ` Michael D Kinney 2023-05-11 1:59 ` Guo, Gua 2023-05-11 2:06 ` 回复: " gaoliming 2023-05-11 2:12 ` Guo, Gua 2023-05-11 2:55 ` 回复: " gaoliming
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox