]> git.proxmox.com Git - mirror_edk2.git/commit
UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test
authorZhiguang Liu <zhiguang.liu@intel.com>
Mon, 27 Jun 2022 08:58:48 +0000 (16:58 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 16 Aug 2022 02:44:08 +0000 (02:44 +0000)
commit2812668bfc121ee792cf3302195176ef4a2ad0bc
tree93704c1fab34322f4337bbc6c32fd0c9b5003ca1
parent809b5a3d2a3b7732459dd63c9382fe6ec42d1856
UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test

Add host based unit tests for the CpuPageTableLib services.

Unit test focuses on PageTableMap function, containing two kinds of test
cases: manual test case and random test case.
Manual test case creates some corner case to test function PageTableMap.
Random test case generates multiple random memory entries (with random
attribute) as the input of function PageTableMap to get the output
pagetable. Output pagetable will be validated and be parsed to get output
memory entries, and then the input and output memory entries will be
compared to verify the functionality.

The unit test is not perfect yet. There are options for random test, and
some of them control the test coverage, and some option are not ready.
Will enhance in the future.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTest.h [new file with mode: 0644]
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c [new file with mode: 0644]
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.inf [new file with mode: 0644]
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomNumber.c [new file with mode: 0644]
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c [new file with mode: 0644]
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.h [new file with mode: 0644]
UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c [new file with mode: 0644]
UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc
UefiCpuPkg/UefiCpuPkg.ci.yaml