Commit d650b4e8 authored by Andrew Boie's avatar Andrew Boie Committed by Anas Nashif
Browse files

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: default avatarAndrew Boie <andrew.p.boie@intel.com>
parent 9bfc8d82
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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
+10 −17
Original line number Diff line number Diff line
@@ -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
	/* 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_add_partition(&k_mem_domain_default,
				   &ztest_mem_partition);
#ifdef Z_MALLOC_PARTITION_EXISTS
		/* Required for access to malloc arena */
		&z_malloc_partition,
	/* Allow access to malloc() memory */
	k_mem_domain_add_partition(&k_mem_domain_default,
				   &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.
	 */
	k_mem_domain_init(&ztest_mem_domain, ARRAY_SIZE(parts), parts);
	k_mem_domain_add_thread(&ztest_mem_domain, k_current_get());
#endif /* CONFIG_USERSPACE */

	z_init_mock();
+1 −1
Original line number Diff line number Diff line
@@ -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));
+0 −2
Original line number Diff line number Diff line
@@ -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),
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading