diff --git a/test/ztest/virtualmemoryheaps/CMakeLists.txt b/test/ztest/virtualmemoryheaps/CMakeLists.txt new file mode 100644 index 000000000000..8aef82d44fee --- /dev/null +++ b/test/ztest/virtualmemoryheaps/CMakeLists.txt @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +project(virtualmemoryheaps) + +message(PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}") + +include_directories("${PROJECT_SOURCE_DIR}/../../../zephyr/include") +message(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!SANITY1545) +include_directories("${PROJECT_SOURCE_DIR}/../../../zephyr/include/sof/lib") +include_directories("${PROJECT_SOURCE_DIR}/../../../src/include") +include_directories("${PROJECT_SOURCE_DIR}/../../../posix/include") + + +find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +target_compile_definitions(testbinary PRIVATE -D CONFIG_ZTEST=1) + +target_sources(testbinary PRIVATE ../../../zephyr/lib/regions_mm.c main.c) + diff --git a/test/ztest/virtualmemoryheaps/main.c b/test/ztest/virtualmemoryheaps/main.c new file mode 100644 index 000000000000..c2373a9b2f9c --- /dev/null +++ b/test/ztest/virtualmemoryheaps/main.c @@ -0,0 +1,14 @@ +//#include "sof/lib/regions_mm.h" +#include +#include +#include "regions_mm.h" +#include "vmh_test_helper.h" + +ZTEST(vmh_heaps, test_basic_memory_heap) +{ + struct vmh_heap* test_heap = vmh_init_heap(NULL,0, 0, true); + + zexpect_true(test_heap); +} + +ZTEST_SUITE(vmh_heap, NULL, NULL, NULL, NULL, NULL); diff --git a/test/ztest/virtualmemoryheaps/prj.conf b/test/ztest/virtualmemoryheaps/prj.conf new file mode 100644 index 000000000000..9467c2926896 --- /dev/null +++ b/test/ztest/virtualmemoryheaps/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/test/ztest/virtualmemoryheaps/testcase.yaml b/test/ztest/virtualmemoryheaps/testcase.yaml new file mode 100644 index 000000000000..b36ee51c0c30 --- /dev/null +++ b/test/ztest/virtualmemoryheaps/testcase.yaml @@ -0,0 +1,17 @@ +common: + tags: vmh + +tests: +vmh_heap: + platform_allow: + intel_adsp_cavs25 intel_adsp_ace15_mtpm intel_adsp_ace20_lnl + nxp_adsp_imx8 nxp_adsp_imx8x nxp_adsp_imx8m + tags: vmh + integration_platforms: + - intel_adsp_cavs25 # TGL + - intel_adsp_ace15_mtpm # MTL + - intel_adsp_ace20_lnl + - nxp_adsp_imx8 + - nxp_adsp_imx8x + - nxp_adsp_imx8m + - nxp_adsp_imx8ulp diff --git a/test/ztest/virtualmemoryheaps/vmh_test_helper.h b/test/ztest/virtualmemoryheaps/vmh_test_helper.h new file mode 100644 index 000000000000..fa4302e4c264 --- /dev/null +++ b/test/ztest/virtualmemoryheaps/vmh_test_helper.h @@ -0,0 +1,6 @@ +#include + +void* rzalloc(int zone, int unused , int caps, size_t size) +{ + return malloc(size); +} \ No newline at end of file diff --git a/zephyr/include/sof/lib/regions_mm.h b/zephyr/include/sof/lib/regions_mm.h index 7e9d3a1a40a7..abb670771b6e 100644 --- a/zephyr/include/sof/lib/regions_mm.h +++ b/zephyr/include/sof/lib/regions_mm.h @@ -8,14 +8,19 @@ #ifndef ZEPHYR_LIB_REGIONS_MM_H_ #define ZEPHYR_LIB_REGIONS_MM_H_ +#if CONFIG_ZTEST +#include +#else #include #include #include #include -#include -#include -#include +#endif // ! CONFIG_ZTEST + #include +#include +#include +#include /* Dependency on ipc/topology.h created due to memory capability definitions * that are defined there diff --git a/zephyr/lib/regions_mm.c b/zephyr/lib/regions_mm.c index dbb1aa087b26..1131a714ced4 100644 --- a/zephyr/lib/regions_mm.c +++ b/zephyr/lib/regions_mm.c @@ -5,8 +5,6 @@ * Author: Jakub Dabek */ -#include - #include /* list of vmh_heap objects created */