eec78d9f5d
* [utest/mm] add testcase for create/init format codes of create/init in components/mm * [libcpu/aarch64] fix user stack check routine * [kservice] export API for utest * [utest/mm] testcase for aspace_map format & modify the files under components/mm related with aspace_map * [lwp/user_mm] add user_map_varea for mmap feature * [mm] rename rt_mm_fault_try_fix to rt_aspace_fault_try_fix * [utest/mm] testcase for synchronization * [mm] modify unmap api to improve throughput * [utest/mm] testcases for cache and varea map * [format] remove extra space * [utest/mm] fix testcase problem in header * [lwp] extend map_user_varea with a flag * [utest/mm] testcase for lwp_map_user_varea * [libcpu/arm/cortex-a] fix kernel space layout * [utest/mm] adjust for armv7 arch
66 lines
1.6 KiB
C
66 lines
1.6 KiB
C
/*
|
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2023-03-20 WangXiaoyao Complete testcase for mm_aspace.c
|
|
*/
|
|
#ifndef __TEST_MM_COMMON_H__
|
|
#define __TEST_MM_COMMON_H__
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
#include <utest.h>
|
|
|
|
#include <board.h>
|
|
#include <rtthread.h>
|
|
#include <rthw.h>
|
|
#include <lwp_arch.h>
|
|
#include <mmu.h>
|
|
#include <tlb.h>
|
|
|
|
#include <ioremap.h>
|
|
#include <mm_aspace.h>
|
|
#include <mm_flag.h>
|
|
#include <mm_page.h>
|
|
#include <mm_private.h>
|
|
|
|
extern rt_base_t rt_heap_lock(void);
|
|
extern void rt_heap_unlock(rt_base_t level);
|
|
|
|
/**
|
|
* @brief During the operations, is heap still the same;
|
|
*/
|
|
#define CONSIST_HEAP(statement) do { \
|
|
rt_size_t total, used, max_used; \
|
|
rt_size_t totala, useda, max_useda; \
|
|
rt_ubase_t level = rt_heap_lock(); \
|
|
rt_memory_info(&total, &used, &max_used); \
|
|
statement; \
|
|
rt_memory_info(&totala, &useda, &max_useda); \
|
|
rt_heap_unlock(level); \
|
|
uassert_true(total == totala); \
|
|
uassert_true(used == useda); \
|
|
uassert_true(max_used == max_useda); \
|
|
} while (0)
|
|
|
|
rt_inline int memtest(volatile char *buf, int value, size_t buf_sz)
|
|
{
|
|
int ret = 0;
|
|
for (size_t i = 0; i < buf_sz; i++)
|
|
{
|
|
if (buf[i] != value)
|
|
{
|
|
ret = -1;
|
|
break;
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
#endif /* __TEST_MM_COMMON_H__ */
|