tests: drivers: counter: fix skip tests check
When running this test with multiple counter instances enabled that support different capabilities, if one of the instances does not support the test required capabilities, the test will be immediately skipped not giving the chance to run to the subsequent instances. Fix this by marking the test as skipped, only of all counter instances under test were skipped. Fixes #74358 Signed-off-by: Manuel Argüelles <marguelles.dev@gmail.com>
This commit is contained in:
parent
e491f220d8
commit
123f99c87b
1 changed files with 6 additions and 1 deletions
|
|
@ -183,6 +183,8 @@ static void counter_tear_down_instance(const struct device *dev)
|
|||
static void test_all_instances(counter_test_func_t func,
|
||||
counter_capability_func_t capability_check)
|
||||
{
|
||||
int devices_skipped = 0;
|
||||
|
||||
zassert_true(ARRAY_SIZE(devices) > 0, "No device found");
|
||||
for (int i = 0; i < ARRAY_SIZE(devices); i++) {
|
||||
counter_setup_instance(devices[i]);
|
||||
|
|
@ -192,12 +194,15 @@ static void test_all_instances(counter_test_func_t func,
|
|||
func(devices[i]);
|
||||
} else {
|
||||
TC_PRINT("Skipped for %s\n", devices[i]->name);
|
||||
ztest_test_skip();
|
||||
devices_skipped++;
|
||||
}
|
||||
counter_tear_down_instance(devices[i]);
|
||||
/* Allow logs to be printed. */
|
||||
k_sleep(K_MSEC(100));
|
||||
}
|
||||
if (devices_skipped == ARRAY_SIZE(devices)) {
|
||||
ztest_test_skip();
|
||||
}
|
||||
}
|
||||
|
||||
static bool set_top_value_capable(const struct device *dev)
|
||||
|
|
|
|||
Loading…
Reference in a new issue