Skip to content

Commit

Permalink
Add CC_EXCLUDE support to exclude filetypes from reorganized reports.…
Browse files Browse the repository at this point in the history
… Defaults to exclude Null. Updated documentation
  • Loading branch information
apop5 committed Nov 15, 2024
1 parent 6189d11 commit 91f14ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import xml.etree.ElementTree
from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
from edk2toolext import edk2_logging
import edk2toollib.windows.locate_tools as locate_tools
from edk2toolext.environment import shell_environment
from edk2toollib.utility_functions import RunCmd
from edk2toollib.utility_functions import GetHostInfo
Expand Down Expand Up @@ -293,13 +292,14 @@ def organize_coverage(self, thebuilder) -> int:
package = thebuilder.env.GetValue("CI_PACKAGE_NAME", "")
file_out = package + "_coverage.xml"
cov_file = os.path.join(buildOutputBase, file_out)
exclude = thebuilder.env.GetValue("CC_EXCLUDE", "*NULL*,*Null*,*null*")

params = f"--database {db_path} coverage {cov_file} -o {cov_file} --by-package -ws {workspace}"

params += f" -p {package}" * int(package != "")
params += " --full" * int(thebuilder.env.GetValue("CC_FULL", "FALSE") == "TRUE")
params += " --flatten" * int(thebuilder.env.GetValue("CC_FLATTEN", "FALSE") == "TRUE")

params += f" --exclude {exclude}" * int(exclude != "")
return RunCmd("stuart_report", params)

def parse_workspace(self, thebuilder) -> str:
Expand Down
4 changes: 3 additions & 1 deletion UnitTestFrameworkPkg/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -1516,8 +1516,10 @@ or FALSE e.g. `CC_REORGANIZE=TRUE`:
1. `CC_FULL`: Generates zero'd out coverage data for untested source files in the package.
Default: `FALSE`
1. `CC_FLATTEN`: Groups all source files together, rather than by INF. Default: `FALSE`
1. `CC_EXCLUDE`: Comma separated list of fnmatch expressions to exclude from results.
Default: \*NULL\*,\*Null\*,\*null\*

** NOTE: `CC_FULL` and `CC_FLATTEN` values only matter if `CC_REORGANIZE=TRUE`, as they only
** NOTE: `CC_FULL` and `CC_FLATTEN` and `CC_EXCLUDE` values only matter if `CC_REORGANIZE=TRUE`, as they only
effect how the coverage report is reorganized.

**TIP: `CC_FLATTEN=TRUE/FALSE` will produce different coverage percentage results as `TRUE` de-duplicates source files
Expand Down

0 comments on commit 91f14ee

Please sign in to comment.