tests: drivers: move the regulator test to new ztest API

Migrate the testsuite tests/drivers/regulator/fixed to the
new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
This commit is contained in:
Enjia Mai 2022-08-24 23:27:21 +08:00 committed by Anas Nashif
parent 035dffcfcf
commit 69b740d61d
2 changed files with 7 additions and 6 deletions

View File

@ -3,3 +3,4 @@ CONFIG_REGULATOR=y
CONFIG_LOG=y
CONFIG_REGULATOR_LOG_LEVEL_DBG=y
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y

View File

@ -178,7 +178,7 @@ static void test_preconditions(void)
pc_errstr[precheck]);
}
static void test_basic(void)
ZTEST(regulator, test_basic)
{
zassert_equal(precheck, PC_OK,
"precheck failed: %s",
@ -274,7 +274,7 @@ static void test_basic(void)
"bad 2x on 2x off state: %d", rs);
}
void test_main(void)
void *regulator_setup(void)
{
const char * const compats[] = DT_PROP(REGULATOR_NODE, compatible);
@ -285,8 +285,8 @@ void test_main(void)
TC_PRINT("startup-delay: %u us\n", STARTUP_DELAY_US);
TC_PRINT("off-on-delay: %u us\n", OFF_ON_DELAY_US);
ztest_test_suite(regulator_test,
ztest_unit_test(test_preconditions),
ztest_unit_test(test_basic));
ztest_run_test_suite(regulator_test);
test_preconditions();
return NULL;
}
ZTEST_SUITE(regulator, NULL, regulator_setup, NULL, NULL, NULL);