VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/.pytool/Readme.md

Last change on this file was 105670, checked in by vboxsync, 5 weeks ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
File size: 13.0 KB
Line 
1# Edk2 Continuous Integration
2
3This file focuses on information for those working with the `.pytools` directory
4directly or interested in lower-level details about how CI works.
5
6If you just want to get started building code, visit
7[Build Instructions](https://github.com/tianocore/tianocore.github.io/wiki/Build-Instruction)
8on the TianoCore wiki.
9
10## Basic Status
11
12| Package | Windows VS2019 (IA32/X64)| Ubuntu GCC (IA32/X64/ARM/AARCH64) | Known Issues |
13| :---- | :----- | :---- | :--- |
14| ArmPkg | | :heavy_check_mark: |
15| ArmPlatformPkg | | :heavy_check_mark: |
16| ArmVirtPkg | SEE PACKAGE README | SEE PACKAGE README |
17| CryptoPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
18| DynamicTablesPkg | :heavy_check_mark: | :heavy_check_mark: |
19| EmbeddedPkg |
20| EmulatorPkg | SEE PACKAGE README | SEE PACKAGE README | Spell checking in audit mode
21| FatPkg | :heavy_check_mark: | :heavy_check_mark: |
22| FmpDevicePkg | :heavy_check_mark: | :heavy_check_mark: |
23| IntelFsp2Pkg |
24| IntelFsp2WrapperPkg |
25| MdeModulePkg | :heavy_check_mark: | :heavy_check_mark: | DxeIpl dependency on ArmPkg, Depends on StandaloneMmPkg, Spell checking in audit mode
26| MdePkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
27| NetworkPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
28| OvmfPkg | SEE PACKAGE README | SEE PACKAGE README | Spell checking in audit mode
29| PcAtChipsetPkg | :heavy_check_mark: | :heavy_check_mark: |
30| SecurityPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode
31| ShellPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode, 3 modules are not being built by DSC
32| SignedCapsulePkg |
33| SourceLevelDebugPkg |
34| StandaloneMmPkg | :heavy_check_mark: | :heavy_check_mark: |
35| UefiCpuPkg | :heavy_check_mark: | :heavy_check_mark: | Spell checking in audit mode, 2 binary modules not being built by DSC
36| UefiPayloadPkg |
37| UnitTestFrameworkPkg | :heavy_check_mark: | :heavy_check_mark: |
38
39For more detailed status look at the test results of the latest CI run on the
40repo readme.
41
42## Background
43
44This Continuous integration and testing infrastructure leverages the TianoCore EDKII Tools PIP modules:
45[library](https://pypi.org/project/edk2-pytool-library/) and
46[extensions](https://pypi.org/project/edk2-pytool-extensions/) (with repos
47located [here](https://github.com/tianocore/edk2-pytool-library) and
48[here](https://github.com/tianocore/edk2-pytool-extensions)).
49
50The primary execution flows can be found in the
51`.azurepipelines/Windows-VS2019.yml` and `.azurepipelines/Ubuntu-GCC5.yml`
52files. These YAML files are consumed by the Azure Dev Ops Build Pipeline and
53dictate what server resources should be used, how they should be configured, and
54what processes should be run on them. An overview of this schema can be found
55[here](https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema).
56
57Inspection of these files reveals the EDKII Tools commands that make up the
58primary processes for the CI build: 'stuart_setup', 'stuart_update', and
59'stuart_ci_build'. These commands come from the EDKII Tools PIP modules and are
60configured as described below. More documentation on the tools can be
61found [here](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/using.md)
62and [here](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/features/feature_invocables.md).
63
64## Configuration
65
66Configuration of the CI process consists of (in order of precedence):
67
68* command-line arguments passed in via the Pipeline YAML
69* a per-package configuration file (e.g. `<package-name>.ci.yaml`) that is
70 detected by the CI system in EDKII Tools.
71* a global configuration Python module (e.g. `CISetting.py`) passed in via the
72 command-line
73
74The global configuration file is described in
75[this readme](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/usability/using_settings_manager.md)
76from the EDKII Tools documentation. This configuration is written as a Python
77module so that decisions can be made dynamically based on command line
78parameters and codebase state.
79
80The per-package configuration file can override most settings in the global
81configuration file, but is not dynamic. This file can be used to skip or
82customize tests that may be incompatible with a specific package. Each test generally requires
83per package configuration which comes from this file.
84
85## Running CI locally
86
87The EDKII Tools environment (and by extension the ci) is designed to support
88easily and consistently running locally and in a cloud ci environment. To do
89that a few steps should be followed. Details of EDKII Tools can be found in the
90[docs folder here](https://github.com/tianocore/edk2-pytool-extensions/tree/master/docs)
91
92### Running CI
93
94Quick notes:
95
96* By default all CI plugins are opted in.
97 * Setting the plugin to `skip` as an argument will skip running the plugin.
98 Examples:
99 * `CompilerPlugin=skip` skip the build test
100 * `GuidCheck=skip` skip the Guid check
101 * `SpellCheck=skip` skip the spell checker
102 * etc.
103* Detailed reports and logs per package are captured in the `Build` directory.
104
105## Current PyTool Test Capabilities
106
107All CI tests are instances of EDKII Tools plugins. Documentation on the plugin
108system can be found [here](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/usability/using_plugin_manager.md)
109and [here](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/features/feature_plugin_manager.md).
110Upon invocation, each plugin will be passed the path to the current package
111under test and a dictionary containing its targeted configuration, as assembled
112from the command line, per-package configuration, and global configuration.
113
114Note: CI plugins are considered unique from build plugins and helper plugins,
115even though some CI plugins may execute steps of a build.
116
117In the example, these plugins live alongside the code under test (in the
118`.pytool/Plugin` directory), but may be moved to the 'edk2-test' repo if that
119location makes more sense for the community.
120
121### Module Inclusion Test - DscCompleteCheck
122
123This scans all INF files from a package and confirms they are
124listed in the package level DSC file. The test considers it an error if any INF
125does not appear in the `Components` section of the package-level DSC (indicating
126that it would not be built if the package were built). This is critical because
127much of the CI infrastructure assumes that all modules will be listed in the DSC
128and compiled.
129
130This test will ignore INFs in the following cases:
131
1321. When `MODULE_TYPE` = `HOST_APPLICATION`
1332. When a Library instance **only** supports the `HOST_APPLICATION` environment
134
135### Host Module Inclusion Test - HostUnitTestDscCompleteCheck
136
137This test scans all INF files from a package for those related to host
138based unit tests and confirms they are listed in the unit test DSC file for the package.
139The test considers it an error if any INF meeting the requirements does not appear
140in the `Components` section of the unit test DSC. This is critical because
141much of the CI infrastructure assumes that modules will be listed in the DSC
142and compiled.
143
144This test will only require INFs in the following cases:
145
1461. When `MODULE_TYPE` = `HOST_APPLICATION`
1472. When a Library instance explicitly supports the `HOST_APPLICATION` environment
148
149### Code Compilation Test - CompilerPlugin
150
151Once the Module Inclusion Test has verified that all modules would be built if
152all package-level DSCs were built, the Code Compilation Test simply runs through
153and builds every package-level DSC on every toolchain and for every architecture
154that is supported. Any module that fails to build is considered an error.
155
156### Host Unit Test Compilation and Run Test - HostUnitTestCompilerPlugin
157
158A test that compiles the dsc for host based unit test apps.
159On Windows this will also enable a build plugin to execute that will run the unit tests and verify the results.
160
161These tools will be invoked on any CI
162pass that includes the NOOPT target. In order for these tools to do their job,
163the package and tests must be configured in a particular way...
164
165#### Including Host-Based Tests in the Package YAML
166
167For example, looking at the `MdeModulePkg.ci.yaml` config file, there are two
168config options that control HostBased test behavior:
169
170```json
171 ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
172 "HostUnitTestCompilerPlugin": {
173 "DscPath": "Test/MdeModulePkgHostTest.dsc"
174 },
175```
176
177This option tell the test builder to run. The test builder needs to know which
178modules in this package are host-based tests, so that DSC path is provided.
179
180#### Configuring the HostBased DSC
181
182The HostBased DSC for `MdeModulePkg` is located at
183`MdeModulePkg/Test/MdeModulePkgHostTest.dsc`.
184
185To add automated host-based unit test building to a new package, create a
186similar DSC. The new DSC should make sure to have the `NOOPT` BUILD_TARGET
187and should include the line:
188
189```
190!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
191```
192
193All of the modules that are included in the `Components` section of this
194DSC should be of type HOST_APPLICATION.
195
196### GUID Uniqueness Test - GuidCheck
197
198This test works on the collection of all packages rather than an individual
199package. It looks at all FILE_GUIDs and GUIDs declared in DEC files and ensures
200that they are unique for the codebase. This prevents, for example, accidental
201duplication of GUIDs when using an existing INF as a template for a new module.
202
203### Cross-Package Dependency Test - DependencyCheck
204
205This test compares the list of all packages used in INFs files for a given
206package against a list of "allowed dependencies" in plugin configuration for
207that package. Any module that depends on a disallowed package will cause a test
208failure.
209
210### Library Declaration Test - LibraryClassCheck
211
212This test scans at all library header files found in the `Library` folders in
213all of the package's declared include directories and ensures that all files
214have a matching LibraryClass declaration in the DEC file for the package. Any
215missing declarations will cause a failure.
216
217### Invalid Character Test - CharEncodingCheck
218
219This test scans all files in a package to make sure that there are no invalid
220Unicode characters that may cause build errors in some character
221sets/localizations.
222
223### Spell Checking - cspell
224
225This test runs a spell checker on all files within the package. This is done
226using the NodeJs cspell tool. For details check `.pytool/Plugin/SpellCheck`.
227For this plugin to run during ci you must install nodejs and cspell and have
228both available to the command line when running your CI.
229
230Install
231
232* Install nodejs from https://nodejs.org/en/
233* Install cspell
234 1. Open cmd prompt with access to node and npm
235 2. Run `npm install -g cspell`
236
237 More cspell info: https://github.com/streetsidesoftware/cspell
238
239### License Checking - LicenseCheck
240
241Scans all new added files in a package to make sure code is contributed under
242BSD-2-Clause-Patent.
243
244### Ecc tool - EccCheck
245
246Run the Ecc tool on the package. The Ecc tool is available in the BaseTools
247package. It checks that the code complies to the EDKII coding standard.
248
249### Coding Standard Compliance - UncrustifyCheck
250
251Runs the Uncrustify application to check for coding standard compliance issues.
252
253## PyTool Scopes
254
255Scopes are how the PyTool ext_dep, path_env, and plugins are activated. Meaning
256that if an invocable process has a scope active then those ext_dep and path_env
257will be active. To allow easy integration of PyTools capabilities there are a
258few standard scopes.
259
260| Scope | Invocable | Description |
261| :---- | :----- | :---- |
262| global | edk2_invocable++ - should be base_abstract_invocable | Running an invocables |
263| global-win | edk2_invocable++ | Running on Microsoft Windows |
264| global-nix | edk2_invocable++ | Running on Linux based OS |
265| edk2-build | | This indicates that an invocable is building EDK2 based UEFI code |
266| cibuild | set in .pytool/CISettings.py | Suggested target for edk2 continuous integration builds. Tools used for CiBuilds can use this scope. Example: asl compiler |
267| host-based-test | set in .pytool/CISettings.py | Turns on the host based tests and plugin |
268| host-test-win | set in .pytool/CISettings.py | Enables the host based test runner for Windows |
269
270## Future investments
271
272* PatchCheck tests as plugins
273* MacOS/xcode support
274* Clang/LLVM support
275* Visual Studio AARCH64 and ARM support
276* BaseTools C tools CI/PR and binary release process
277* BaseTools Python tools CI/PR process
278* Extensible private/closed source platform reporting
279* UEFI SCTs
280* Other automation
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette