Skip to content

Commit

Permalink
tests: stm32_common_devices: move to new ztest API
Browse files Browse the repository at this point in the history
test cases in
tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices
are moved to new ztest API

Signed-off-by: Meng xianglin <[email protected]>
  • Loading branch information
mengxianglinx authored and fabiobaltieri committed Sep 5, 2022
1 parent bfd5118 commit 4e2da2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LOG_MODULE_REGISTER(test);
#define DT_NO_CLOCK 0xFFFFU

/* Not device related, but keep it to ensure core clock config is correct */
static void test_sysclk_freq(void)
ZTEST(stm32_common_devices_clocks, test_sysclk_freq)
{
uint32_t soc_sys_clk_freq;

Expand All @@ -39,7 +39,7 @@ static void test_sysclk_freq(void)
#define STM32_I2C_DOMAIN_CLOCK_SUPPORT 0
#endif

static void test_i2c_clk_config(void)
ZTEST(stm32_common_devices_clocks, test_i2c_clk_config)
{
static const struct stm32_pclken pclken[] = STM32_DT_CLOCKS(DT_NODELABEL(i2c1));

Expand Down Expand Up @@ -119,8 +119,6 @@ static void test_i2c_clk_config(void)
/* Test clock_off(srce) */
/* Not supported today */
}
#else
static void test_i2c_clk_config(void) {}
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptim1), okay)
Expand All @@ -134,7 +132,7 @@ static void test_i2c_clk_config(void) {}
#define STM32_LPTIM_OPT_CLOCK_SUPPORT 0
#endif

static void test_lptim_clk_config(void)
ZTEST(stm32_common_devices_clocks, test_lptim_clk_config)
{
static const struct stm32_pclken pclken[] = STM32_DT_CLOCKS(DT_NODELABEL(lptim1));

Expand Down Expand Up @@ -214,8 +212,6 @@ static void test_lptim_clk_config(void)
/* Test clock_off(domain clk) */
/* Not supported today */
}
#else
static void test_lptim_clk_config(void) {}
#endif

#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay)
Expand Down Expand Up @@ -255,7 +251,7 @@ static void test_lptim_clk_config(void) {}
#define ADC_SOURCE_PLL (-1)
#endif

static void test_adc_clk_config(void)
ZTEST(stm32_common_devices_clocks, test_adc_clk_config)
{
static const struct stm32_pclken pclken[] = STM32_DT_CLOCKS(DT_NODELABEL(adc1));

Expand Down Expand Up @@ -326,17 +322,5 @@ static void test_adc_clk_config(void)
/* Test clock_off(domain clk) */
/* Not supported today */
}
#else
static void test_adc_clk_config(void) {}
#endif

void test_main(void)
{
ztest_test_suite(test_stm32_common_devices_clocks,
ztest_unit_test(test_sysclk_freq),
ztest_unit_test(test_i2c_clk_config),
ztest_unit_test(test_lptim_clk_config),
ztest_unit_test(test_adc_clk_config)
);
ztest_run_test_suite(test_stm32_common_devices_clocks);
}
ZTEST_SUITE(stm32_common_devices_clocks, NULL, NULL, NULL, NULL, NULL);

0 comments on commit 4e2da2e

Please sign in to comment.