Feature Overview
UefiTestingPkg provides various conformance tests for the UEFI environment. These are at least mostly generic and may be used on any UEFI implementation, including such not based on Project Mu. However, its source code has dependencies on Project Mu packages and thus cannot easily be built without a separate development environment.
For this reason, binary releases would greatly improve the usability of UefiTestingPkg outside of Project Mu platforms. Unfortunately, UefiTestingPkg.dsc is explicitly not designed to produce usable binaries as of now:
|
## NOTE: Some of these library configurations are just for CI builds. |
|
# If you would like to build these tests to run on your platform, |
|
# you should substitute your LibraryClasses configuration. |
Many of the dummy library classes are effectively generic. These include:
- MemoryAllocationLib
- DebugPrintErrorLevelLib
- PcdLib
One more library class could be, but currently sometimes may not be [1]:
The one library class that cannot really be generic as of now is DebugLib. While this should usually not pose a problem, the default instance for the UnitTestResultReportLib library class actually is UnitTestResultReportLibDebugLib:
|
UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.inf |
This means that there is no trivial way to build universal binary releases.
[1] In case a non-Null DebugLib is required, ArmVirtPkg has an ArmVirtDxeHobLib that does not depend on DebugLib. The reason is the risk for circular dependencies, such as the ArmVirt serial code that depends on HobLib:
https://github.com/microsoft/mu_silicon_arm_tiano/blob/922860bc4cb762e229b441de8a4ed2b127070168/ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf#L25
There is nothing ARM-specific about this approach and it might as well be DxeHobLibNoDebug variant (which actually could share its core code with the regular DxeHobLib).
Solution Overview
As I don't have a good overview of everyone's workloads and use cases, I can't propose a solution myself. Potential approaches I can think of are:
-
Using UnitTestResultReportLibConOut for binary builds. This would trivially be universal and require only a small patch to UefiTestingPkg.dsc. However, I'm not sure parsing outputs to ConOut is common practice and well-supported. I'm not aware something like this exists, but it may require something to re-route ConOut outputs to a variety of targets, such as a serial port (which we currently use for our CI, as it can easily be routed to stdout via QEMU).
-
Rather than hooking ConOut, a test result protocol can be defined by the platform ahead of launching the test application to route the test result to any arbitrary target. This would require a new instance of UnitTestResultReportLib and a driver to expose said protocol.
-
The protocol could be more "generic" in the sense that it may be used for other kinds of output. For OpenCorePkg, we have a centralized logging protocol that is also utilized by DebugLib:
https://github.com/acidanthera/OpenCorePkg/blob/2e93c954023df44d7d68c4d896c32a5d07439b3c/Include/Acidanthera/Library/OcLogAggregatorLib.h
This leaves the OpenCore application in charge of the logging targets and the OpenCore drivers consuming its logging protocol. We use this approach to decide where to route logging output based on a user configuration file, which may include multiple targets at once. Naturally, a new DebugLib instance would need to be introduced. However, in this scenario, UnitTestResultReportLibDebugLib could be re-used as-is.
Alternatives Considered
No response
Urgency
Low
Are you going to implement the feature request?
Someone else needs to implement the feature
Do you need maintainer feedback?
Maintainer feedback requested
Anything else?
No response