ztest: fix ztest_1cpu_user_unit_test()
The start/stop functions do a whole pile of supervisor- only stuff; resolve this by making them ztest-specific system calls. Fixes: #20927 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
9849c7d3e7
commit
c1863875b7
3 changed files with 25 additions and 4 deletions
|
@ -557,6 +557,10 @@ if(CONFIG_APPLICATION_DEFINED_SYSCALL)
|
||||||
set(SYSCALL_INCLUDE_DIRECTORY --include ${APPLICATION_SOURCE_DIR})
|
set(SYSCALL_INCLUDE_DIRECTORY --include ${APPLICATION_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ZTEST)
|
||||||
|
set(SYSCALL_ZTEST_DIRECTORY --include ${ZEPHYR_BASE}/subsys/testsuite/ztest/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
${syscalls_json}
|
${syscalls_json}
|
||||||
|
@ -565,6 +569,7 @@ add_custom_command(
|
||||||
${ZEPHYR_BASE}/scripts/parse_syscalls.py
|
${ZEPHYR_BASE}/scripts/parse_syscalls.py
|
||||||
--include ${ZEPHYR_BASE}/include # Read files from this dir
|
--include ${ZEPHYR_BASE}/include # Read files from this dir
|
||||||
${SYSCALL_INCLUDE_DIRECTORY}
|
${SYSCALL_INCLUDE_DIRECTORY}
|
||||||
|
${SYSCALL_ZTEST_DIRECTORY}
|
||||||
--json-file ${syscalls_json} # Write this file
|
--json-file ${syscalls_json} # Write this file
|
||||||
DEPENDS ${syscalls_subdirs_trigger} ${PARSE_SYSCALLS_HEADER_DEPENDS}
|
DEPENDS ${syscalls_subdirs_trigger} ${PARSE_SYSCALLS_HEADER_DEPENDS}
|
||||||
)
|
)
|
||||||
|
|
|
@ -130,8 +130,8 @@ static inline void unit_test_noop(void)
|
||||||
#define ztest_user_unit_test(fn) \
|
#define ztest_user_unit_test(fn) \
|
||||||
ztest_user_unit_test_setup_teardown(fn, unit_test_noop, unit_test_noop)
|
ztest_user_unit_test_setup_teardown(fn, unit_test_noop, unit_test_noop)
|
||||||
|
|
||||||
extern void z_test_1cpu_start(void);
|
__syscall void z_test_1cpu_start(void);
|
||||||
extern void z_test_1cpu_stop(void);
|
__syscall void z_test_1cpu_stop(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Define a SMP-unsafe test function
|
* @brief Define a SMP-unsafe test function
|
||||||
|
@ -206,6 +206,9 @@ extern struct k_mem_domain ztest_mem_domain;
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
#ifndef ZTEST_UNITTEST
|
||||||
|
#include <syscalls/ztest_test.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ static void cpu_hold(void *arg1, void *arg2, void *arg3)
|
||||||
arch_irq_unlock(key);
|
arch_irq_unlock(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_test_1cpu_start(void)
|
void z_impl_z_test_1cpu_start(void)
|
||||||
{
|
{
|
||||||
cpuhold_active = 1;
|
cpuhold_active = 1;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void z_test_1cpu_start(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_test_1cpu_stop(void)
|
void z_impl_z_test_1cpu_stop(void)
|
||||||
{
|
{
|
||||||
cpuhold_active = 0;
|
cpuhold_active = 0;
|
||||||
|
|
||||||
|
@ -125,6 +125,19 @@ void z_test_1cpu_stop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_USERSPACE
|
||||||
|
void z_vrfy_z_test_1cpu_start(void)
|
||||||
|
{
|
||||||
|
z_impl_z_test_1cpu_start();
|
||||||
|
}
|
||||||
|
#include <syscalls/z_test_1cpu_start_mrsh.c>
|
||||||
|
|
||||||
|
void z_vrfy_z_test_1cpu_stop(void)
|
||||||
|
{
|
||||||
|
z_impl_z_test_1cpu_stop();
|
||||||
|
}
|
||||||
|
#include <syscalls/z_test_1cpu_stop_mrsh.c>
|
||||||
|
#endif /* CONFIG_USERSPACE */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void run_test_functions(struct unit_test *test)
|
static void run_test_functions(struct unit_test *test)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue