tests: remove obsolete usage of defrag

Also increase ISR stack to make it run on Quark D2000 CRB.

Jira: ZEP-2224
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-06-08 11:21:14 -04:00 committed by Anas Nashif
commit 6e78701392
3 changed files with 4 additions and 38 deletions

View file

@ -1,2 +1,4 @@
CONFIG_ZTEST=y CONFIG_ZTEST=y
CONFIG_IRQ_OFFLOAD=y CONFIG_IRQ_OFFLOAD=y
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_ISR_STACK_SIZE=512

View file

@ -11,7 +11,6 @@ extern void test_mpool_alloc_free_isr(void);
extern void test_mpool_kdefine_extern(void); extern void test_mpool_kdefine_extern(void);
extern void test_mpool_alloc_size(void); extern void test_mpool_alloc_size(void);
extern void test_mpool_alloc_timeout(void); extern void test_mpool_alloc_timeout(void);
extern void test_mpool_defrag(void);
/*test case main entry*/ /*test case main entry*/
void test_main(void *p1, void *p2, void *p3) void test_main(void *p1, void *p2, void *p3)
@ -21,7 +20,7 @@ void test_main(void *p1, void *p2, void *p3)
ztest_unit_test(test_mpool_alloc_free_isr), ztest_unit_test(test_mpool_alloc_free_isr),
ztest_unit_test(test_mpool_kdefine_extern), ztest_unit_test(test_mpool_kdefine_extern),
ztest_unit_test(test_mpool_alloc_size), ztest_unit_test(test_mpool_alloc_size),
ztest_unit_test(test_mpool_alloc_timeout), ztest_unit_test(test_mpool_alloc_timeout)
ztest_unit_test(test_mpool_defrag)); );
ztest_run_test_suite(test_mpool_api); ztest_run_test_suite(test_mpool_api);
} }

View file

@ -14,7 +14,6 @@
* -# K_MEM_POOL_DEFINE * -# K_MEM_POOL_DEFINE
* -# k_mem_pool_alloc * -# k_mem_pool_alloc
* -# k_mem_pool_free * -# k_mem_pool_free
* -# k_mem_pool_defrag
* @} * @}
*/ */
@ -152,37 +151,3 @@ void test_mpool_alloc_timeout(void)
} }
} }
void test_mpool_defrag(void)
{
struct k_mem_block block[BLK_NUM_MIN];
/*fragment the memory pool into small blocks*/
for (int i = 0; i < BLK_NUM_MIN; i++) {
zassert_true(k_mem_pool_alloc(&kmpool, &block[i], BLK_SIZE_MIN,
K_NO_WAIT) == 0, NULL);
}
/*free the small blocks in the 1st half of the pool*/
for (int i = 0; i < (BLK_NUM_MIN >> 1); i++) {
k_mem_pool_free(&block[i]);
}
/*request a big block, the pool has "adjacent free blocks" to merge*/
zassert_true(k_mem_pool_alloc(&kmpool, &block[0], BLK_SIZE_MAX,
K_FOREVER) == 0, NULL);
/*free the small blocks in the 2nd half of the pool*/
for (int i = (BLK_NUM_MIN >> 1); i < BLK_NUM_MIN; i++) {
k_mem_pool_free(&block[i]);
}
/**
* TESTPOINT: This routine instructs a memory pool to concatenate unused
* memory blocks into larger blocks wherever possible.
*/
/*do manual de-fragment*/
k_mem_pool_defrag(&kmpool);
/*request a big block, the pool is de-fragmented*/
zassert_true(k_mem_pool_alloc(&kmpool, &block[1], BLK_SIZE_MAX,
K_NO_WAIT) == 0, NULL);
/*free the big blocks*/
for (int i = 0; i < BLK_NUM_MAX; i++) {
k_mem_pool_free(&block[i]);
}
}