From d542f65955dc6427cca6540da9bf41bfb23f7598 Mon Sep 17 00:00:00 2001 From: Joey Vagedes Date: Wed, 8 Nov 2023 16:23:57 +0000 Subject: [PATCH] Use CI_PACKAGE_NAME --- .../HostUnitTestCompilerPlugin.py | 1 + .../HostBasedUnitTestRunner/HostBasedUnitTestRunner.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pytool/Plugin/HostUnitTestCompilerPlugin/HostUnitTestCompilerPlugin.py b/.pytool/Plugin/HostUnitTestCompilerPlugin/HostUnitTestCompilerPlugin.py index a99ce4ee14b..ec2063a0b46 100644 --- a/.pytool/Plugin/HostUnitTestCompilerPlugin/HostUnitTestCompilerPlugin.py +++ b/.pytool/Plugin/HostUnitTestCompilerPlugin/HostUnitTestCompilerPlugin.py @@ -87,6 +87,7 @@ def __GetHostUnitTestArch(self, environment): def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None): self._env = environment environment.SetValue("CI_BUILD_TYPE", "host_unit_test", "Set in HostUnitTestCompilerPlugin") + environment.SetValue("CI_PACKAGE_NAME", packagename, "Set in HostUnitTestCompilerPlugin") # Parse the config for required DscPath element if "DscPath" not in pkgconfig: diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py index 0b59442ec44..1f5664dd236 100644 --- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py @@ -174,7 +174,7 @@ def gen_code_coverage_gcc(self, thebuilder): # Filter out auto-generated and test code # MU_CHANGE begin - reformat coverage data - file_out = thebuilder.env.GetValue("PLATFORM_NAME", "") + "_coverage.xml" + file_out = thebuilder.env.GetValue("CI_PACKAGE_NAME", "") + "_coverage.xml" ret = RunCmd("lcov_cobertura",f"{buildOutputBase}/total-coverage.info --excludes ^.*UnitTest\|^.*MU\|^.*Mock\|^.*DEBUG -o {buildOutputBase}/{file_out}") # MU_CHANGE end - reformat coverage data if ret != 0: @@ -222,7 +222,7 @@ def gen_code_coverage_msvc(self, thebuilder): # Generate and XML file if requested.by each package # MU_CHANGE begin - reformat coverage data - file_out = thebuilder.env.GetValue("PLATFORM_NAME", "") + "_coverage.xml" + file_out = thebuilder.env.GetValue("CI_PACKAGE_NAME", "") + "_coverage.xml" ret = RunCmd("OpenCppCoverage", f"--export_type cobertura:{os.path.join(buildOutputBase, file_out)} {coverageFile}", workingdir=f"{workspace}Build/") # MU_CHANGE end - reformat coverage data if ret != 0: @@ -247,7 +247,7 @@ def organize_coverage(self, thebuilder) -> int: """Organize the generated coverage file by INF.""" db = self.parse_workspace(thebuilder) buildOutputBase = thebuilder.env.GetValue("BUILD_OUTPUT_BASE") - file_out = thebuilder.env.GetValue("PLATFORM_NAME", "") + "_coverage.xml" + file_out = thebuilder.env.GetValue("CI_PACKAGE_NAME", "") + "_coverage.xml" cov_file = os.path.join(buildOutputBase, file_out) return RunCmd("stuart_report", f"--database {db} coverage {cov_file} -o {cov_file} --by-package")