kernel: heap: move heap testcase to new ztest
Move heap testcases to new ztest. Signed-off-by: NingX Zhao <ningx.zhao@intel.com>
This commit is contained in:
parent
557fdaf2e3
commit
5f681dea38
3 changed files with 9 additions and 26 deletions
|
@ -1,2 +1,3 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_ZTEST_NEW_API=y
|
||||
CONFIG_IRQ_OFFLOAD=y
|
||||
|
|
|
@ -5,13 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
extern void test_k_heap_min_size(void);
|
||||
extern void test_k_heap_alloc(void);
|
||||
extern void test_k_heap_alloc_fail(void);
|
||||
extern void test_k_heap_free(void);
|
||||
extern void test_kheap_alloc_in_isr_nowait(void);
|
||||
extern void test_k_heap_alloc_pending(void);
|
||||
extern void test_k_heap_alloc_pending_null(void);
|
||||
|
||||
/**
|
||||
* @brief k heap api tests
|
||||
|
@ -23,15 +16,4 @@ extern void test_k_heap_alloc_pending_null(void);
|
|||
* @}
|
||||
*/
|
||||
/*test case main entry*/
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(k_heap_api,
|
||||
ztest_unit_test(test_k_heap_min_size),
|
||||
ztest_unit_test(test_k_heap_alloc),
|
||||
ztest_unit_test(test_k_heap_alloc_fail),
|
||||
ztest_unit_test(test_k_heap_free),
|
||||
ztest_unit_test(test_kheap_alloc_in_isr_nowait),
|
||||
ztest_unit_test(test_k_heap_alloc_pending),
|
||||
ztest_unit_test(test_k_heap_alloc_pending_null));
|
||||
ztest_run_test_suite(k_heap_api);
|
||||
}
|
||||
ZTEST_SUITE(k_heap_api, NULL, NULL, NULL, NULL, NULL);
|
||||
|
|
|
@ -76,7 +76,7 @@ volatile uint32_t heap_guard1;
|
|||
* works to allocate that byte at runtime and that it doesn't overflow
|
||||
* its memory bounds.
|
||||
*/
|
||||
void test_k_heap_min_size(void)
|
||||
ZTEST(k_heap_api, test_k_heap_min_size)
|
||||
{
|
||||
const uint32_t guard_bits = 0x5a5a5a5a;
|
||||
|
||||
|
@ -110,7 +110,7 @@ void test_k_heap_min_size(void)
|
|||
*
|
||||
* @see k_heap_malloc(), k_heap_Free()
|
||||
*/
|
||||
void test_k_heap_alloc(void)
|
||||
ZTEST(k_heap_api, test_k_heap_alloc)
|
||||
{
|
||||
k_timeout_t timeout = Z_TIMEOUT_US(TIMEOUT);
|
||||
char *p = (char *)k_heap_alloc(&k_heap_test, ALLOC_SIZE_1, timeout);
|
||||
|
@ -134,7 +134,7 @@ void test_k_heap_alloc(void)
|
|||
*
|
||||
* @see k_heap_malloc(), k_heap_Free()
|
||||
*/
|
||||
void test_k_heap_alloc_fail(void)
|
||||
ZTEST(k_heap_api, test_k_heap_alloc_fail)
|
||||
{
|
||||
|
||||
k_timeout_t timeout = Z_TIMEOUT_US(TIMEOUT);
|
||||
|
@ -161,7 +161,7 @@ void test_k_heap_alloc_fail(void)
|
|||
*
|
||||
* @see k_heap_alloc, k_heap_free()
|
||||
*/
|
||||
void test_k_heap_free(void)
|
||||
ZTEST(k_heap_api, test_k_heap_free)
|
||||
{
|
||||
k_timeout_t timeout = Z_TIMEOUT_US(TIMEOUT);
|
||||
char *p = (char *)k_heap_alloc(&k_heap_test, ALLOC_SIZE_1, timeout);
|
||||
|
@ -184,7 +184,7 @@ void test_k_heap_free(void)
|
|||
*
|
||||
* @ingroup kernel_heap_tests
|
||||
*/
|
||||
void test_kheap_alloc_in_isr_nowait(void)
|
||||
ZTEST(k_heap_api, test_kheap_alloc_in_isr_nowait)
|
||||
{
|
||||
irq_offload((irq_offload_routine_t)tIsr_kheap_alloc_nowait, NULL);
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ void test_kheap_alloc_in_isr_nowait(void)
|
|||
*
|
||||
* @ingroup kernel_heap_tests
|
||||
*/
|
||||
void test_k_heap_alloc_pending(void)
|
||||
ZTEST(k_heap_api, test_k_heap_alloc_pending)
|
||||
{
|
||||
/*
|
||||
* Allocate first to make sure subsequent allocations
|
||||
|
@ -235,7 +235,7 @@ void test_k_heap_alloc_pending(void)
|
|||
*
|
||||
* @ingroup kernel_heap_tests
|
||||
*/
|
||||
void test_k_heap_alloc_pending_null(void)
|
||||
ZTEST(k_heap_api, test_k_heap_alloc_pending_null)
|
||||
{
|
||||
/*
|
||||
* Allocate first to make sure subsequent allocations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue