tests: ztress: convert to new ztest API

Move to new ztest API.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-05-26 03:32:58 -04:00
commit 1cb5933553
2 changed files with 7 additions and 18 deletions

View file

@ -1,4 +1,5 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_ZTRESS=y
CONFIG_ZTRESS_MAX_THREADS=3
CONFIG_TEST_EXTRA_STACK_SIZE=2048

View file

@ -23,7 +23,7 @@ bool ztress_handler_busy(void *user_data, uint32_t cnt, bool last, int prio)
return true;
}
static void test_timeout(void)
ZTEST(ztress, test_timeout)
{
int64_t d;
uint32_t repeat = 1000000;
@ -64,7 +64,7 @@ static void timeout_abort(struct k_timer *timer)
ztress_abort();
}
static void test_abort(void)
ZTEST(ztress, test_abort)
{
struct k_timer timer;
uint32_t repeat = 10000000;
@ -79,7 +79,7 @@ static void test_abort(void)
zassert_true(ztress_exec_count(1) < repeat);
}
static void test_repeat_completion(void)
ZTEST(ztress, test_repeat_completion)
{
uint32_t repeat = 10;
@ -105,7 +105,7 @@ static void test_repeat_completion(void)
}
}
static void test_no_context_requirements(void)
ZTEST(ztress, test_no_context_requirements)
{
uint32_t repeat = 10;
@ -130,7 +130,7 @@ static void test_no_context_requirements(void)
zassert_true(exec_cnt >= repeat && exec_cnt < repeat + 10);
}
static void test_too_many_threads(void)
ZTEST(ztress, test_too_many_threads)
{
uint32_t repeat = 10;
k_timeout_t t = Z_TIMEOUT_TICKS(20);
@ -151,16 +151,4 @@ static void test_too_many_threads(void)
zassert_equal(err, -EINVAL, "ztress_execute: unexpected err=%d (expected -EINVAL)", err);
}
void test_main(void)
{
ztest_test_suite(ztress_tests,
ztest_unit_test(test_timeout),
ztest_unit_test(test_abort),
ztest_unit_test(test_repeat_completion),
ztest_unit_test(test_no_context_requirements),
ztest_unit_test(test_too_many_threads)
);
ztest_run_test_suite(ztress_tests);
}
ZTEST_SUITE(ztress, NULL, NULL, NULL, NULL, NULL);