Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dabekjakub committed Dec 18, 2023
1 parent f93f7d4 commit f254c7c
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 5 deletions.
21 changes: 21 additions & 0 deletions test/ztest/virtualmemoryheaps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

14 changes: 14 additions & 0 deletions test/ztest/virtualmemoryheaps/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//#include "sof/lib/regions_mm.h"
#include <zephyr/fff.h>
#include <zephyr/ztest.h>
#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);
1 change: 1 addition & 0 deletions test/ztest/virtualmemoryheaps/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZTEST=y
17 changes: 17 additions & 0 deletions test/ztest/virtualmemoryheaps/testcase.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions test/ztest/virtualmemoryheaps/vmh_test_helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <stdlib.h>

void* rzalloc(int zone, int unused , int caps, size_t size)
{
return malloc(size);
}
14 changes: 11 additions & 3 deletions zephyr/include/sof/lib/regions_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@
#ifndef ZEPHYR_LIB_REGIONS_MM_H_
#define ZEPHYR_LIB_REGIONS_MM_H_

#if CONFIG_ZTEST
#include <zephyr/ztest.h>
#else
#include <adsp_memory.h>
#include <adsp_memory_regions.h>
#include <ipc/topology.h>
#include <rtos/alloc.h>
#include <sof/list.h>
#include <zephyr/drivers/mm/system_mm.h>
#include <zephyr/init.h>
#endif // ! CONFIG_ZTEST

#include <zephyr/sys/mem_blocks.h>
#include <zephyr/init.h>
#include <zephyr/drivers/mm/system_mm.h>
#include <sof/list.h>

#if CONFIG_ZTEST
void* rzalloc(int zone, int unused, int caps, size_t size);
#endif
/* Dependency on ipc/topology.h created due to memory capability definitions
* that are defined there
*/
Expand Down
2 changes: 0 additions & 2 deletions zephyr/lib/regions_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* Author: Jakub Dabek <[email protected]>
*/

#include <zephyr/init.h>

#include <sof/lib/regions_mm.h>

/* list of vmh_heap objects created */
Expand Down

0 comments on commit f254c7c

Please sign in to comment.