ztest: remove ztest_mem_domain
Just add ztest's partition to the default domain, as well as the malloc partition if it exists. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
9bfc8d82d0
commit
d650b4e800
7 changed files with 21 additions and 31 deletions
|
@ -169,7 +169,6 @@ __syscall void z_test_1cpu_stop(void);
|
|||
#define ZTEST_BMEM K_APP_BMEM(ztest_mem_partition)
|
||||
#define ZTEST_SECTION K_APP_DMEM_SECTION(ztest_mem_partition)
|
||||
extern struct k_mem_partition ztest_mem_partition;
|
||||
extern struct k_mem_domain ztest_mem_domain;
|
||||
#else
|
||||
#define ZTEST_DMEM
|
||||
#define ZTEST_BMEM
|
||||
|
|
|
@ -399,7 +399,6 @@ void end_report(void)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
struct k_mem_domain ztest_mem_domain;
|
||||
K_APPMEM_PARTITION_DEFINE(ztest_mem_partition);
|
||||
#endif
|
||||
|
||||
|
@ -416,24 +415,18 @@ int main(void)
|
|||
void main(void)
|
||||
{
|
||||
#ifdef CONFIG_USERSPACE
|
||||
struct k_mem_partition *parts[] = {
|
||||
#ifdef Z_LIBC_PARTITION_EXISTS
|
||||
/* C library globals, stack canary storage, etc */
|
||||
&z_libc_partition,
|
||||
#endif
|
||||
#ifdef Z_MALLOC_PARTITION_EXISTS
|
||||
/* Required for access to malloc arena */
|
||||
&z_malloc_partition,
|
||||
#endif
|
||||
&ztest_mem_partition
|
||||
};
|
||||
|
||||
/* Ztests just have one memory domain with one partition.
|
||||
* Any variables that user code may reference need to go in them,
|
||||
* using the ZTEST_DMEM and ZTEST_BMEM macros.
|
||||
/* Partition containing globals tagged with ZTEST_DMEM and ZTEST_BMEM
|
||||
* macros. Any variables that user code may reference need to be
|
||||
* placed in this partition if no other memory domain configuration
|
||||
* is made.
|
||||
*/
|
||||
k_mem_domain_init(&ztest_mem_domain, ARRAY_SIZE(parts), parts);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, k_current_get());
|
||||
k_mem_domain_add_partition(&k_mem_domain_default,
|
||||
&ztest_mem_partition);
|
||||
#ifdef Z_MALLOC_PARTITION_EXISTS
|
||||
/* Allow access to malloc() memory */
|
||||
k_mem_domain_add_partition(&k_mem_domain_default,
|
||||
&z_malloc_partition);
|
||||
#endif
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
z_init_mock();
|
||||
|
|
|
@ -13,7 +13,7 @@ extern void test_mbedtls(void);
|
|||
void test_main(void)
|
||||
{
|
||||
#ifdef CONFIG_USERSPACE
|
||||
k_mem_domain_add_partition(&ztest_mem_domain, &k_mbedtls_partition);
|
||||
k_mem_domain_add_partition(&k_mem_domain_default, &k_mbedtls_partition);
|
||||
#endif
|
||||
ztest_test_suite(test_mbedtls_fn,
|
||||
ztest_user_unit_test(test_mbedtls));
|
||||
|
|
|
@ -25,7 +25,6 @@ extern void test_mem_domain_add_partitions_simple(void);
|
|||
extern void test_mem_domain_remove_partitions_simple(void);
|
||||
extern void test_mem_domain_remove_partitions(void);
|
||||
extern void test_mem_domain_remove_thread(void);
|
||||
extern void test_mem_domain_destroy(void);
|
||||
extern void test_kobject_access_grant(void);
|
||||
extern void test_syscall_invalid_kobject(void);
|
||||
extern void test_thread_without_kobject_permission(void);
|
||||
|
@ -68,7 +67,6 @@ void test_main(void)
|
|||
ztest_unit_test(test_mem_domain_remove_partitions_simple),
|
||||
ztest_unit_test(test_mem_domain_remove_partitions),
|
||||
ztest_unit_test(test_mem_domain_remove_thread),
|
||||
ztest_unit_test(test_mem_domain_destroy),
|
||||
ztest_unit_test(test_mark_thread_exit_uninitialized),
|
||||
ztest_unit_test(test_kobject_access_grant),
|
||||
ztest_unit_test(test_syscall_invalid_kobject),
|
||||
|
|
|
@ -559,7 +559,7 @@ void test_mem_domain_remove_thread(void *p1, void *p2, void *p3)
|
|||
|
||||
|
||||
k_mem_domain_remove_thread(k_current_get());
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, k_current_get());
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, k_current_get());
|
||||
|
||||
k_thread_user_mode_enter(mem_domain_for_user_tc7,
|
||||
NULL, NULL, NULL);
|
||||
|
|
|
@ -424,12 +424,12 @@ void test_main(void)
|
|||
k_thread_access_grant(k_current_get(),
|
||||
&thread_12_thread_data, &thread_12_stack_area);
|
||||
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, THREAD_05);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, THREAD_06);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, THREAD_07);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, THREAD_08);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, THREAD_09);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, THREAD_11);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, THREAD_05);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, THREAD_06);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, THREAD_07);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, THREAD_08);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, THREAD_09);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, THREAD_11);
|
||||
#endif
|
||||
rv = sys_mutex_lock(¬_my_mutex, K_NO_WAIT);
|
||||
if (rv != 0) {
|
||||
|
|
|
@ -209,8 +209,8 @@ void test_main(void)
|
|||
k_thread_access_grant(k_current_get(), &thread_preempt, &stack_preempt,
|
||||
&start_sema, &end_sema);
|
||||
#ifdef CONFIG_USERSPACE
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, T_KDEFINE_COOP_THREAD);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, T_KDEFINE_PREEMPT_THREAD);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, T_KDEFINE_COOP_THREAD);
|
||||
k_mem_domain_add_thread(&k_mem_domain_default, T_KDEFINE_PREEMPT_THREAD);
|
||||
#endif
|
||||
|
||||
ztest_test_suite(thread_init,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue