Commit 8dc769d6 authored by Enjia Mai's avatar Enjia Mai Committed by Carles Cufi
Browse files

tests: boards: native_posix: move the test cpu_wait to new ztest API



Migrate the testsuite tests/boards/native_posix/cpu_wait to the
new ztest API.

Signed-off-by: default avatarEnjia Mai <enjia.mai@intel.com>
parent b5679278
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_TICKLESS_KERNEL=n
CONFIG_ZTEST_THREAD_PRIORITY=1
+4 −13
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
 * In this basic case, only one k_busy_wait() or posix_cpu_hold executes
 * at a time
 */
static void test_cpu_hold_basic(void)
ZTEST(native_cpu_hold, test_cpu_hold_basic)
{
	uint32_t wait_times[] =  {1, 30, 0, 121, 10000};
	uint64_t time2, time1 = posix_get_hw_cycle();
@@ -105,7 +105,7 @@ static void thread_entry(void *p1, void *p2, void *p3)
 * probably give problems if the tick time is not a relatively even number
 * of microseconds
 */
static void test_cpu_hold_with_another_thread(void)
ZTEST(native_cpu_hold, test_cpu_hold_with_another_thread)
{
	uint64_t time2, time1;

@@ -211,7 +211,7 @@ static void np_timer_isr_test_replacement(const void *arg)
 * The kernel is configured as NOT-tickless, and the default tick period is
 * 10ms
 */
static void test_cpu_hold_with_interrupts(void)
ZTEST(native_cpu_hold, test_cpu_hold_with_interrupts)
{
#if defined(CONFIG_BOARD_NATIVE_POSIX)
	/* So far we only have a test for native_posix.
@@ -289,13 +289,4 @@ static void test_cpu_hold_with_interrupts(void)
#endif /* defined(CONFIG_BOARD_NATIVE_POSIX) */
}

void test_main(void)
{
	ztest_test_suite(native_cpu_hold,
		ztest_unit_test(test_cpu_hold_basic),
		ztest_unit_test(test_cpu_hold_with_another_thread),
		ztest_unit_test(test_cpu_hold_with_interrupts)
	);

	ztest_run_test_suite(native_cpu_hold);
}
ZTEST_SUITE(native_cpu_hold, NULL, NULL, NULL, NULL, NULL);