diff options
Diffstat (limited to '.pytool/Plugin')
-rw-r--r-- | .pytool/Plugin/CompilerPlugin/CompilerPlugin.py | 7 | ||||
-rw-r--r-- | .pytool/Plugin/DependencyCheck/DependencyCheck.py | 4 | ||||
-rw-r--r-- | .pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py | 53 | ||||
-rw-r--r-- | .pytool/Plugin/DscCompleteCheck/Readme.md | 3 | ||||
-rw-r--r-- | .pytool/Plugin/SpellCheck/SpellCheck.py | 3 | ||||
-rw-r--r-- | .pytool/Plugin/SpellCheck/cspell.base.yaml | 467 | ||||
-rw-r--r-- | .pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py | 16 |
7 files changed, 289 insertions, 264 deletions
diff --git a/.pytool/Plugin/CompilerPlugin/CompilerPlugin.py b/.pytool/Plugin/CompilerPlugin/CompilerPlugin.py index 3cf3888828..01101b2f4a 100644 --- a/.pytool/Plugin/CompilerPlugin/CompilerPlugin.py +++ b/.pytool/Plugin/CompilerPlugin/CompilerPlugin.py @@ -74,9 +74,10 @@ class CompilerPlugin(ICiBuildPlugin): self._env.SetValue("ACTIVE_PLATFORM", AP_Path, "Set in Compiler Plugin")
# Parse DSC to check for SUPPORTED_ARCHITECTURES
+ build_target = self._env.GetValue("TARGET")
+ input_vars = self._env.GetAllBuildKeyValues(build_target)
dp = DscParser()
- dp.SetBaseAbsPath(Edk2pathObj.WorkspacePath)
- dp.SetPackagePaths(Edk2pathObj.PackagePathList)
+ dp.SetEdk2Path(Edk2pathObj).SetInputVars(input_vars)
dp.ParseFile(AP_Path)
if "SUPPORTED_ARCHITECTURES" in dp.LocalVars:
SUPPORTED_ARCHITECTURES = dp.LocalVars["SUPPORTED_ARCHITECTURES"].split('|')
@@ -85,7 +86,7 @@ class CompilerPlugin(ICiBuildPlugin): # Skip if there is no intersection between SUPPORTED_ARCHITECTURES and TARGET_ARCHITECTURES
if len(set(SUPPORTED_ARCHITECTURES) & set(TARGET_ARCHITECTURES)) == 0:
tc.SetSkipped()
- tc.LogStdError("No supported architecutres to build")
+ tc.LogStdError("No supported architectures to build")
return -1
uefiBuilder = UefiBuilder()
diff --git a/.pytool/Plugin/DependencyCheck/DependencyCheck.py b/.pytool/Plugin/DependencyCheck/DependencyCheck.py index 07c5682d95..30b0c0254f 100644 --- a/.pytool/Plugin/DependencyCheck/DependencyCheck.py +++ b/.pytool/Plugin/DependencyCheck/DependencyCheck.py @@ -108,8 +108,8 @@ class DependencyCheck(ICiBuildPlugin): if mod_specific_key in pkgconfig and p in pkgconfig[mod_specific_key]:
continue
- logging.error("Dependency Check: Invalid Dependency INF: {0} depends on pkg {1}".format(file, p))
- tc.LogStdError("Dependency Check: Invalid Dependency INF: {0} depends on pkg {1}".format(file, p))
+ logging.error(f"Dependency Check: {file} depends on pkg {p} but pkg is not listed in AcceptableDependencies")
+ tc.LogStdError(f"Dependency Check: {file} depends on pkg {p} but pkg is not listed in AcceptableDependencies")
overall_status += 1
# If XML object exists, add results
diff --git a/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py b/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py index 351137c5e4..14f99330f6 100644 --- a/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py +++ b/.pytool/Plugin/DscCompleteCheck/DscCompleteCheck.py @@ -6,9 +6,12 @@ import logging
import os
from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toollib.uefi.edk2.path_utilities import Edk2Path
from edk2toollib.uefi.edk2.parsers.dsc_parser import DscParser
from edk2toollib.uefi.edk2.parsers.inf_parser import InfParser
from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.gitignore_parser import parse_gitignore_lines
+from pathlib import Path
class DscCompleteCheck(ICiBuildPlugin):
@@ -71,38 +74,39 @@ class DscCompleteCheck(ICiBuildPlugin): # Get INF Files
INFFiles = self.WalkDirectoryForExtension([".inf"], abs_pkg_path)
- INFFiles = [Edk2pathObj.GetEdk2RelativePathFromAbsolutePath(
- x) for x in INFFiles] # make edk2relative path so can compare with DSC
# remove ignores
-
+ ignored_paths = []
if "IgnoreInf" in pkgconfig:
- for a in pkgconfig["IgnoreInf"]:
- a = a.replace(os.sep, "/")
+ ignore_filter = parse_gitignore_lines(
+ pkgconfig["IgnoreInf"],
+ "DSC Complete Check Config",
+ os.path.dirname(abs_pkg_path))
+
+ # INFFiles must be a list of absolute paths
+ ignored_paths = list(filter(ignore_filter, INFFiles))
+ for a in ignored_paths:
try:
tc.LogStdOut("Ignoring INF {0}".format(a))
INFFiles.remove(a)
- except:
+ except Exception:
tc.LogStdError(
"DscCompleteCheck.IgnoreInf -> {0} not found in filesystem. Invalid ignore file".format(a))
logging.info(
"DscCompleteCheck.IgnoreInf -> {0} not found in filesystem. Invalid ignore file".format(a))
+ # make edk2relative path so can compare with DSC
+ INFFiles = [Edk2pathObj.GetEdk2RelativePathFromAbsolutePath(x) for x in INFFiles]
+
# DSC Parser
- dp = DscParser()
- dp.SetBaseAbsPath(Edk2pathObj.WorkspacePath)
- dp.SetPackagePaths(Edk2pathObj.PackagePathList)
+ dp = DscParser().SetEdk2Path(Edk2pathObj)
dp.SetInputVars(environment.GetAllBuildKeyValues())
dp.ParseFile(wsr_dsc_path)
# Check if INF in component section
for INF in INFFiles:
- if not any(INF.strip() in x for x in dp.ThreeMods) and \
- not any(INF.strip() in x for x in dp.SixMods) and \
- not any(INF.strip() in x for x in dp.OtherMods):
-
- infp = InfParser().SetBaseAbsPath(Edk2pathObj.WorkspacePath)
- infp.SetPackagePaths(Edk2pathObj.PackagePathList)
+ if not DscCompleteCheck._module_in_dsc(INF, dp, Edk2pathObj):
+ infp = InfParser().SetEdk2Path(Edk2pathObj)
infp.ParseFile(INF)
if("MODULE_TYPE" not in infp.Dict):
tc.LogStdOut(
@@ -131,3 +135,22 @@ class DscCompleteCheck(ICiBuildPlugin): else:
tc.SetSuccess()
return overall_status
+
+ @staticmethod
+ def _module_in_dsc(inf: str, dsc: DscParser, Edk2pathObj: Edk2Path) -> bool:
+
+ """Checks if the given module (inf) is in the given dsc.
+ Args:
+ inf (str): The inf file to check for
+ dsc (DscParser): The parsed dsc file.
+ Edk2pathObj (Edk2Path): The path object capturing the workspace and package paths.
+ Returns:
+ bool: if the module is in the dsc.
+ """
+ for module_type in (dsc.ThreeMods, dsc.SixMods, dsc.OtherMods):
+ for module in module_type:
+ if Path(module).is_absolute():
+ module = Edk2pathObj.GetEdk2RelativePathFromAbsolutePath(module)
+ if inf in module:
+ return True
+ return False
diff --git a/.pytool/Plugin/DscCompleteCheck/Readme.md b/.pytool/Plugin/DscCompleteCheck/Readme.md index 8aaa4f76ee..9f7291b747 100644 --- a/.pytool/Plugin/DscCompleteCheck/Readme.md +++ b/.pytool/Plugin/DscCompleteCheck/Readme.md @@ -29,4 +29,5 @@ Path to DSC to consider platform dsc ### IgnoreInf
-Ignore error if Inf file is not listed in DSC file
+A list of paths in git ignore syntax to ignore in the check. These can include directory and file paths. The path is
+relative to the directory that contains the package.
diff --git a/.pytool/Plugin/SpellCheck/SpellCheck.py b/.pytool/Plugin/SpellCheck/SpellCheck.py index 8347fa9900..d5408479e7 100644 --- a/.pytool/Plugin/SpellCheck/SpellCheck.py +++ b/.pytool/Plugin/SpellCheck/SpellCheck.py @@ -186,13 +186,14 @@ class SpellCheck(ICiBuildPlugin): # Helper - Log the syntax needed to add these words to dictionary
if len(EasyFix) > 0:
EasyFix = sorted(set(a.lower() for a in EasyFix))
+ logging.error(f'SpellCheck found {len(EasyFix)} failing words. See CI log for details.')
tc.LogStdOut("\n Easy fix:")
OneString = "If these are not errors add this to your ci.yaml file.\n"
OneString += '"SpellCheck": {\n "ExtendWords": ['
for a in EasyFix:
tc.LogStdOut(f'\n"{a}",')
OneString += f'\n "{a}",'
- logging.info(OneString.rstrip(",") + '\n ]\n}')
+ logging.critical(OneString.rstrip(",") + '\n ]\n}')
# add result to test case
overall_status = len(Errors)
diff --git a/.pytool/Plugin/SpellCheck/cspell.base.yaml b/.pytool/Plugin/SpellCheck/cspell.base.yaml index 92e65ec6f6..d701c0650e 100644 --- a/.pytool/Plugin/SpellCheck/cspell.base.yaml +++ b/.pytool/Plugin/SpellCheck/cspell.base.yaml @@ -28,269 +28,270 @@ "muchange"
],
"words": [
- "MTRRs",
- "Microarchitecture",
- "Goldmont",
- "cpuid",
- "mwait",
- "cstate",
- "smram",
- "scrtm",
- "smbus",
- "selftest",
- "socket",
- "MMRAM",
- "qword",
- "ENDBR",
- "SMBASE",
- "FXSAVE",
- "FXRSTOR",
- "RDRAND",
- "IOAPIC",
- "ATAPI",
- "movsb",
- "iretw",
- "XENSTORE",
- "cdrom",
- "oprom",
- "oproms",
- "varstore",
- "EKU",
+ "ACPICA",
+ "ACPINVS",
+ "armltd",
"ascii",
- "nmake",
- "NVDIMM",
- "nasmb",
- "Mtftp",
- "Hypercall",
- "hypercalls",
- "IOMMU",
- "QEMU",
- "qemus",
- "OVMF",
- "tiano",
- "tianocore",
- "edkii",
- "coreboot",
- "uefipayload",
+ "ASMLINK",
+ "ATAPI",
+ "autodetect",
+ "autogen",
+ "autoreload",
+ "basetools",
+ "blockio",
+ "bootability",
+ "bootable",
+ "bootflow",
"bootloader",
"bootloaders",
- "mdepkg",
- "skuid",
- "dxefv",
- "toolchain",
- "libraryclass",
- "preboot",
- "pythonpath",
- "cygpath",
- "nuget",
- "basetools",
- "prepi",
- "OPTEE",
- "stringid",
- "peims",
- "memmap",
- "guids",
- "uuids",
- "smbios",
+ "bootup",
+ "bringup",
+ "brotli",
+ "bugbug",
+ "bytecodes",
+ "bytelist",
+ "bytestream",
+ "cacheability",
+ "cachetype",
+ "cdrom",
"certdb",
"certdbv",
- "EfiSigList",
- "depex",
- "IHANDLE",
- "Virtio",
- "Mbytes",
"Citrix",
- "initrd",
- "semihost",
- "Semihosting",
- "Trustzone",
- "Fastboot",
- "framebuffer",
- "genfw",
- "TTYTERM",
- "miniport",
- "LFENCE",
- "PCANSI",
- "submodule",
- "submodules",
- "brotli",
- "PCCTS",
- "softfloat",
- "whitepaper",
- "ACPICA",
- "plugfest",
- "bringup",
- "formset", #VFR
- "ideqvallist",
- "numberof",
- "oneof",
- "endformset",
- "endnumeric",
- "endoneof",
- "disableif",
- "guidid",
+ "CLANGPDB",
"classguid",
+ "cmocka",
+ "conout",
+ "Consplitter", # common module in UEFI
+ "coreboot",
+ "countof",
+ "cpuid",
+ "creatorid",
+ "cstate",
+ "cygpath",
+ "datacache",
+ "deadloop",
+ "depex",
+ "depexes",
+ "deregistering",
+ "devicepath",
+ "devicetree",
+ "devpath",
+ "disableif",
+ "Disasm",
+ "drhds",
+ "dxefv",
+ "dxeipl",
+ "dynamicex",
+ "edkii",
+ "edksetup",
+ "EfiSigList",
"efivarstore",
- "formsetguid",
- "formid",
- "suppressif",
- "grayoutif",
- "ideqval",
- "endform",
+ "EKU",
+ "ENDBR",
"endcheckbox",
- "questionid",
- "questionref",
"enddate",
- "endstring",
- "guidop",
+ "endform",
+ "endformset",
"endguidop",
- "langdef",
- "dynamicex",
- "tokenspace",
- "tokenguid",
- "pcd's", #seems like cspell bug
- "peim's",
- "autogen",
- "Disasm",
- "Torito",
- "SRIOV",
- "MRIOV",
- "UARTs",
- "Consplitter", # common module in UEFI
- "FIFOs",
- "ACPINVS",
+ "endiannness",
+ "endnumeric",
"Endof", # due to of not being uppercase
- "bootability",
- "Sdhci",
+ "endoneof",
+ "endstring",
+ "Fastboot",
+ "FIFOs",
+ "formid",
+ "formsetguid",
+ "formset", #VFR
+ "framebuffer",
+ "fvmain",
+ "fwvol",
+ "FXRSTOR",
+ "FXSAVE",
+ "genfw",
+ "Goldmont",
+ "grayoutif",
+ "guidid",
+ "guidop",
+ "guids",
+ "harddisk",
+ "hisilicon",
+ "hoblist",
+ "hwerrrec",
+ "Hypercall",
+ "hypercalls",
+ "ideqval",
+ "ideqvallist",
+ "IHANDLE",
+ "imagehandle",
+ "initrd",
"inmodule",
- "RISCV",
- "edksetup",
+ "IOAPIC",
+ "IOMMU",
+ "iretw",
"iscsi",
- "nvdata",
- "pytools",
- "NTDDI",
- "Wnonportable",
- "CLANGPDB",
- "nologo",
+ "langcode",
+ "langcodes",
+ "langdef",
+ "lastattemptstatus",
+ "lastattemptversion",
+ "LFENCE",
+ "libraryclass",
+ "littleendian",
"lldmap",
- "ASMLINK",
- "NODEFAULTLIB",
- "vcruntimed",
- "ucrtd",
+ "lockv",
+ "LOONGARCH",
+ "Loongson",
+ "lowestsupportedversion",
+ "mainpage",
+ "Mbytes",
+ "mdepkg",
+ "memmap",
+ "Microarchitecture",
+ "miniport",
+ "mismanipulation",
+ "MMRAM",
+ "movsb",
+ "MPIDR",
+ "MRIOV",
"msvcrtd",
- "XIPFLAGS",
- "bootflow",
- "bootup",
- "cacheability",
- "cachetype",
- "conout",
- "deadloop",
- "devicepath",
- "hisilicon",
- "littleendian",
+ "Mtftp",
+ "mtrrcap",
+ "MTRRs",
+ "multiboot",
+ "mwait",
+ "nasmb",
+ "nmake",
+ "NODEFAULTLIB",
+ "nofailure",
+ "nologo",
"nonsecure",
+ "NTDDI",
+ "ntxml",
+ "ntxmlcomparestrings",
+ "ntxmlfetchcharacterdecoder",
+ "ntxmlrawnextcharacter",
+ "ntxmlspecialstringcompare",
+ "ntxmltransformcharacter",
+ "nuget",
+ "numberof",
+ "nvdata",
+ "NVDIMM",
+ "okcancel",
+ "oneof",
+ "oprom",
+ "oproms",
+ "OPTEE",
+ "osruntime",
+ "OVMF",
"pagetable",
+ "PCANSI",
+ "PCCTS",
+ "pcd's", #seems like cspell bug
+ "pcencoder",
+ "pclutf",
+ "pcunicode",
+ "pcvoid",
+ "pcxml",
+ "pcxmldoc",
+ "pcxmlstructure",
+ "pecoff",
+ "peim's",
+ "peims",
+ "plugfest",
"postmem",
+ "preboot",
+ "prefetchable",
"premem",
+ "prepi",
+ "pxmldoc",
+ "pxmlstructure",
+ "pythonpath",
+ "pytool",
+ "pytools",
+ "QEMU",
+ "qemus",
+ "qrencoder",
+ "qrencoding",
+ "qrlevel",
+ "questionid",
+ "questionref",
+ "qword",
+ "ramdisk",
+ "RDRAND",
+ "readytoboot",
"reglist",
+ "reprompt",
+ "RISCV",
+ "rmrrs",
+ "rtlxmlcallback",
+ "schedulable",
+ "scrtm",
+ "Sdhci",
+ "selawik",
+ "selftest",
"semihalf",
- "subvendor",
+ "semihost",
+ "Semihosting",
+ "setjump",
+ "shiftn",
+ "skuid",
+ "SMBASE",
+ "smbios",
+ "smbus",
+ "smram",
+ "socket",
+ "softfloat",
+ "SRIOV",
+ "StandaloneMMCore",
+ "stringid",
"subhierarchy",
+ "submodule",
+ "submodules",
+ "subvendor",
+ "suppressif",
+ "swmdialogs",
+ "systemtable",
"targetlist",
+ "testcase",
+ "testsuites",
+ "tiano",
+ "tianocore",
"tmpname",
- "watchdogtimer",
- "writeback",
- "langcode",
- "langcodes",
- "autoreload",
- "bootable",
- "endiannness",
- "fvmain",
- "prefetchable",
- "multiboot",
- "ramdisk",
- "unbootable",
- "setjump",
- "bytecodes",
- "bytelist",
- "bytestream",
- "countof",
- "deregistering",
- "devicetree",
- "mainpage",
- "mismanipulation",
- "pytool",
- "wbinvd",
- "armltd",
- "datacache",
- "lastattemptstatus",
- "lastattemptversion",
- "lowestsupportedversion",
- "updateable",
- "pecoff",
- "autodetect",
- "harddisk",
"toctou",
- "bugbug",
- "depexes",
- "fwvol",
- "hoblist",
- "imagehandle",
- "schedulable",
- "StandaloneMMCore",
- "systemtable",
+ "tokenguid",
+ "tokenspace",
+ "toolchain",
+ "Torito",
+ "Trustzone",
+ "TTYTERM",
+ "UARTs",
+ "ucrtd",
+ "uefipayload",
+ "uefishelldebug",
+ "unbootable",
"uncacheable",
- "devpath",
- "testsuites",
- "testcase",
- "pxmldoc",
- "pcxml",
- "pclutf",
- "pcunicode",
- "ntxmltransformcharacter",
- "ntxmlcomparestrings",
- "pcxmldoc",
- "ntxmlfetchcharacterdecoder",
- "ntxml",
- "ntxmlspecialstringcompare",
- "rtlxmlcallback",
- "xmlef",
- "osruntime",
- "readytoboot",
- "hwerrrec",
- "xformed",
- "xform",
+ "unconfigure",
"undock",
- "qrencoder",
- "selawik",
- "ntxmlrawnextcharacter",
"undocked",
- "reprompt",
- "yesno",
- "okcancel",
- "qrencoding",
- "qrlevel",
- "shiftn",
"unenroll",
- "pcxmlstructure",
- "pxmlstructure",
- "pcencoder",
- "pcvoid",
- "nofailure",
- "blockio",
- "lockv",
- "uefishelldebug",
- "mtrrcap",
- "drhds",
- "rmrrs",
- "creatorid",
- "dxeipl",
- "swmdialogs",
- "unrecovered",
- "cmocka",
"unenrolling",
- "unconfigure",
- "Loongson",
- "LOONGARCH"
+ "unrecovered",
+ "updateable",
+ "uuids",
+ "varstore",
+ "vcruntimed",
+ "Virtio",
+ "watchdogtimer",
+ "wbinvd",
+ "whitepaper",
+ "Wnonportable",
+ "writeback",
+ "XENSTORE",
+ "xform",
+ "xformed",
+ "XIPFLAGS",
+ "xmlef",
+ "yesno"
]
}
diff --git a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py index 73dc03c0dc..2bdc3e2925 100644 --- a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py +++ b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py @@ -563,26 +563,26 @@ class UncrustifyCheck(ICiBuildPlugin): self._formatted_file_error_count = len(formatted_files)
if self._formatted_file_error_count > 0:
- logging.error(
+ logging.warning(f'Uncrustify found {self._formatted_file_error_count} files with formatting errors')
+ self._tc.LogStdError(f"Uncrustify found {self._formatted_file_error_count} files with formatting errors:\n")
+ logging.critical(
"Visit the following instructions to learn "
"how to find the detailed formatting errors in Azure "
"DevOps CI: "
"https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting#how-to-find-uncrustify-formatting-errors-in-continuous-integration-ci")
- self._tc.LogStdError("Files with formatting errors:\n")
if self._output_file_diffs:
logging.info("Calculating file diffs. This might take a while...")
for formatted_file in formatted_files:
- pre_formatted_file = formatted_file[:-
- len(UncrustifyCheck.FORMATTED_FILE_EXTENSION)]
- logging.error(pre_formatted_file)
+ pre_formatted_file = formatted_file[:-len(UncrustifyCheck.FORMATTED_FILE_EXTENSION)]
+
+ self._tc.LogStdError(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")
+ logging.info(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}")
if (self._output_file_diffs or
self._file_template_contents is not None or
self._func_template_contents is not None):
- self._tc.LogStdError(
- f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n")
with open(formatted_file) as ff:
formatted_file_text = ff.read()
@@ -603,8 +603,6 @@ class UncrustifyCheck(ICiBuildPlugin): self._tc.LogStdError(line)
self._tc.LogStdError('\n')
- else:
- self._tc.LogStdError(pre_formatted_file)
def _remove_tree(self, dir_path: str, ignore_errors: bool = False) -> None:
"""
|