tests: drivers: counter: counter_basic_api: Fix single_shot_alarm
test_single_shot_alarm_instance may fail due to not supported setting of top_value in call to counter_set_top_value. Modified to accept not supported case. Fixes #21745 Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
1a01a10a87
commit
41a3ac6a35
1 changed files with 8 additions and 2 deletions
|
@ -348,8 +348,14 @@ void test_single_shot_alarm_instance(const char *dev_name, bool set_top)
|
|||
top_cfg.callback = NULL;
|
||||
top_cfg.user_data = NULL;
|
||||
err = counter_set_top_value(dev, &top_cfg);
|
||||
zassert_equal(0, err, "%s: Setting top value to default failed",
|
||||
dev_name);
|
||||
if (err == -ENOTSUP) {
|
||||
/* If resetting is not support, attempt without reset. */
|
||||
top_cfg.flags = COUNTER_TOP_CFG_DONT_RESET;
|
||||
err = counter_set_top_value(dev, &top_cfg);
|
||||
|
||||
}
|
||||
zassert_true((err == 0) || (err == -ENOTSUP),
|
||||
"%s: Setting top value to default failed", dev_name);
|
||||
|
||||
err = counter_stop(dev);
|
||||
zassert_equal(0, err, "%s: Counter failed to stop", dev_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue