vmh_tests: remove current vmh test implementation

Remove current tests for vmh api. To be replaced by
new implementation.
Old implementation is not parametrized and only checks one scenario:
create heap and allocate on it.
New implementation will cover multiple heap creation, multiple allocations,
checking allocated memory for physical page allocation among other
scenarios.
Remove whole implementation since there is no code reuse.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
This commit is contained in:
Jakub Dabek 2024-01-23 11:27:15 +01:00 committed by Michal Wasko
parent f5a11dc454
commit fe92f03c59
1 changed files with 1 additions and 74 deletions

View File

@ -17,81 +17,8 @@
LOG_MODULE_DECLARE(sof_boot_test, CONFIG_SOF_LOG_LEVEL);
#define ALLOC_SIZE1 1616
#define ALLOC_SIZE2 26
static int vmh_test_single(bool span)
{
struct vmh_heap *h = vmh_init_heap(NULL, MEM_REG_ATTR_CORE_HEAP, 0, span);
if (!h)
return -EINVAL;
char *buf = vmh_alloc(h, ALLOC_SIZE1);
int ret1;
if (buf) {
buf[0] = 0;
buf[ALLOC_SIZE1 - 1] = 15;
ret1 = vmh_free(h, buf);
if (ret1 < 0)
goto out;
} else if (span) {
ret1 = -ENOMEM;
LOG_ERR("Failed to allocate %u in contiguous mode", ALLOC_SIZE1);
goto out;
} else {
LOG_WRN("Ignoring failure to allocate %u in non-contiguous mode",
ALLOC_SIZE1);
}
buf = vmh_alloc(h, ALLOC_SIZE2);
if (!buf) {
ret1 = -ENOMEM;
LOG_ERR("Failed to allocate %u", ALLOC_SIZE2);
goto out;
}
buf[0] = 0;
buf[ALLOC_SIZE2 - 1] = 15;
ret1 = vmh_free(h, buf);
if (ret1 < 0)
LOG_ERR("Free error %d", ret1);
out:
int ret2 = vmh_free_heap(h);
if (ret2 < 0)
LOG_ERR("Free heap error %d", ret2);
if (!ret1)
ret1 = ret2;
return ret1;
}
static int vmh_test(void)
{
int ret = vmh_test_single(false);
if (ret < 0) {
LOG_ERR("Non-contiguous test error %d", ret);
return ret;
}
ret = vmh_test_single(true);
if (ret < 0)
LOG_ERR("Contiguous test error %d", ret);
return ret;
}
ZTEST(sof_boot, virtual_memory_heap)
{
int ret = vmh_test();
TEST_CHECK_RET(ret, "virtual_memory_heap");
TEST_CHECK_RET(true, "virtual_memory_heap");
}