nitro_enclaves: Add KUnit tests for contiguous physical memory regions merging
authorLongpeng <longpeng2@huawei.com>
Sun, 7 Nov 2021 14:09:17 +0000 (22:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 15:11:09 +0000 (16:11 +0100)
commitfbf3443f77503f68f244cd7afa050c19ac78511c
treea754f5c8b64e79bdfc8a06ed7547c7ace88319ba
parent07503b3c1e13fdeb66d4531c5dcba335eed9602a
nitro_enclaves: Add KUnit tests for contiguous physical memory regions merging

Add KUnit tests for the contiguous physical memory regions merging
functionality from the Nitro Enclaves misc device logic.

We can build the test binary with the following configuration:
  CONFIG_KUNIT=y
  CONFIG_NITRO_ENCLAVES=m
  CONFIG_NITRO_ENCLAVES_MISC_DEV_TEST=y
and install the nitro_enclaves module to run the testcases.

We'll see the following message using dmesg if everything goes well:

[...]     # Subtest: ne_misc_dev_test
[...]     1..1
[...] (NULL device *): Physical mem region address is not 2 MiB aligned
[...] (NULL device *): Physical mem region size is not multiple of 2 MiB
[...] (NULL device *): Physical mem region address is not 2 MiB aligned
[...]     ok 1 - ne_misc_dev_test_merge_phys_contig_memory_regions
[...] ok 1 - ne_misc_dev_test

Reviewed-by: Andra Paraschiv <andraprs@amazon.com>
Signed-off-by: Longpeng <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20211107140918.2106-5-longpeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/virt/nitro_enclaves/ne_misc_dev_test.c