Introducing host based unit tests on AArch64 systems#12070
Introducing host based unit tests on AArch64 systems#12070kuqin12 wants to merge 14 commits intotianocore:masterfrom
Conversation
|
This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions. |
|
PR can not be merged due to conflict. Please rebase and resubmit |
|
Not stale |
1f0fc95 to
08ddeaa
Compare
5d5cc39 to
3eb6d07
Compare
pierregondois
left a comment
There was a problem hiding this comment.
Hello Kun,
Just a few comments, otherwise I tried the branch locally and it seems to work well.
|
|
||
| [Sources.AARCH64] | ||
| AArch64/InternalSwitchStack.c | ||
| AArch64/Unaligned.c |
There was a problem hiding this comment.
NIT:
It seems that this patch does 2 things:
- Add preprocessor for AArch64 instances
- Cleanup some unnecessary files
Maybe this patch should be split in 2 and also remove the following unused sections:
- [Sources.RISCV64]
- [Sources.EBC]
NIT2:
The following function are not supported by the UnitTestHost BaseLib implementation:
- AArch64/ArmReadCntPctReg.S
- AArch64/ArmReadIdAA64Isar0Reg.S
It doesn't seem it is required right now and it will still be possible to add it later if needed, so just making a note of it.
NIT3:
Also, the VALID_ARCHITECTURES might be updated to add AARCH64
There was a problem hiding this comment.
Thanks for your comments and testing this.
I have updated this patch per your feedback. Specifically, I split the majority of the inf change into a separate commit and also removed the EBC and RISCV sections.
It was a good callout, but I did not add the CntPctReg and IdAA64Isar0Reg support in this patch set. I would like to add the timer related changes in a separate PR to resolve the lack of timer support on host-based tests. But please let me know if you have other thoughts.
| /** | ||
| Sample unit test that performs a divide by 0 | ||
| **/ | ||
| TEST (SanitizerTests, DivideByZeroDeathTest) { |
There was a problem hiding this comment.
It seems that the same division by 0 test exists in:
UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTestGenerateException/ampleGoogleTestGenerateException.cpp
The test should generate an exception, but instead it should fail as the result is 0 (checked against MAX_UINTN). Maybe the test should be IA32/X64 only.
There was a problem hiding this comment.
I left this feedback out for this round of push. The test is intended to generate an exception, but divide by 0 will not trip on any exception on AArch64 platforms. Should we switch to read from a null pointer instead in this case? @mdkinney any thoughts?
On the other hand, this test is not included in the unit test dsc file, so we do not have obvious way to mark this test as x86 specific, other than the inf's supported architecture, which is already configured as such.
There was a problem hiding this comment.
I left this feedback out for this round of push. The test is intended to generate an exception, but divide by 0 will not trip on any exception on AArch64 platforms. Should we switch to read from a null pointer instead in this case? @mdkinney any thoughts?
On the other hand, this test is not included in the unit test dsc file, so we do not have obvious way to mark this test as x86 specific, other than the inf's supported architecture, which is already configured as such.
Most of this file can work for all archs. Just this one test should be broken out into an x86 only cpp file and INF updated with main cpp file for all archs and the one special cpp file for IA32/X64 only.
This change updates the iasl binary to the 20230628 release. The updated release also adds support for execution on ARM host machines. Signed-off-by: Kun Qin <[email protected]>
This change adds a few preprocessors to build AArch64 host based unit tests properly. An AArch64 specific instance of `gUnitTestHostBaseLib` is created to abstract the reference of arch specific special instructions. Signed-off-by: Kun Qin <[email protected]>
The existing UnitTestHostBaseLib has some source entries that are either redundant or for unsupported architectures. This change consolidated the redundant entries and removed the entries for unsupported architectures. Signed-off-by: Kun Qin <[email protected]>
…rch64 AArch64 does not have divide-by-zero exception. This change modifies the corresponding test to work with AArch64. Signed-off-by: Kun Qin <[email protected]>
This change adds the support of float operations for AArch64 host based unit tests by overriding the compiler flags. Signed-off-by: Kun Qin <[email protected]>
This change adds the GCC compiler flag for AArch64 targets. Signed-off-by: Kun Qin <[email protected]>
Current FunctionMockLib is relying on the subhoob module to support the backend operation by bitbanging the binary post-disassembly. However subhook module is a x64 centric module and does not support AArch64 usage. This change removes the mock function support for AArch64. The functionality will need other solutions to be properly supported. Signed-off-by: Kun Qin <[email protected]>
This change adds the AArch64 target for host based unit tests. Signed-off-by: Kun Qin <[email protected]>
This change adds the AArch64 target for host based unit tests. Signed-off-by: Kun Qin <[email protected]>
This change adds the AArch64 target for host based unit tests. Signed-off-by: Kun Qin <[email protected]>
This change adds the AArch64 target for host based unit tests. Signed-off-by: Kun Qin <[email protected]>
The current instance does not support host based test on AArch64 host system due to its dependency on hardware UART library. This change created a new instance that does not initialize the serial port for host based test applications. Signed-off-by: Kun Qin <[email protected]>
This change adds the AArch64 target for host based unit tests. Signed-off-by: Kun Qin <[email protected]>
This change adds the AArch64 target for host based unit tests. Signed-off-by: Kun Qin <[email protected]>
Description
This change adds the support for building and running host based unit tests on AArch64 Linux systems.
The change currently only supports the operations using GCC as the compiler. Support for CLANG is pending.
Known issues:
Subhook does not support AArch64 binaries, thus function pointer patching are not supported when building on AArch64 platforms.
RngLibfor AArch64 target will check on to determine the availability of RDRAND instruction, which may or may not be supported depending on . It is suggested to use the timer based RngLib for host tests.We might need a legit
TimerLibfor host based unit test to resolve the issue above.The packages that depends on RngLib are not onboarded to support AArch64 host tests. Including
CryptoPkg,SecurityPkg, andUefiCpuPkg.Breaking change?
Impacts security?
Includes tests?
How This Was Tested
This was tested on a AArch64 host system running Ubuntu 24.04.
Integration Instructions
N/A