tests: drivers: counter: counter_basic_api: Fix teardown function
Teardown may fail due to not supported setting of top_value. Modified to accept not supported case. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
0ec6f4e257
commit
7e7a4426d8
1 changed files with 7 additions and 1 deletions
|
@ -95,7 +95,13 @@ static void counter_tear_down_instance(const char *dev_name)
|
|||
|
||||
top_cfg.ticks = counter_get_max_top_value(dev);
|
||||
err = counter_set_top_value(dev, &top_cfg);
|
||||
zassert_equal(0, err,
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue