Skip to content

Commit 21b785d

Browse files
bjarki-andreasenkartben
authored andcommitted
tests: pm: device_power_domain: test async put
Assert async put correctly releases device's power domain. Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
1 parent d0b9a4e commit 21b785d

File tree

1 file changed

+6
-2
lines changed
  • tests/subsys/pm/device_power_domains/src

1 file changed

+6
-2
lines changed

tests/subsys/pm/device_power_domains/src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,19 @@ ZTEST(device_power_domain, test_device_power_domain)
114114
/* Directly request the supported device multiple times */
115115
pm_device_runtime_get(dev);
116116
pm_device_runtime_get(dev);
117+
pm_device_runtime_get(dev);
117118
/* Directly release the supported device the first time, check all still powered */
118119
pm_device_runtime_put(dev);
119120
zassert_true(pm_device_is_powered(dev), "");
120121
pm_device_state_get(dev, &state);
121122
zassert_equal(PM_DEVICE_STATE_ACTIVE, state, "");
122123
pm_device_state_get(reg_1, &state);
123124
zassert_equal(PM_DEVICE_STATE_ACTIVE, state, "");
124-
/* Directly release the supported device the second time, check all off */
125-
pm_device_runtime_put(dev);
125+
/* Release the supported device the twice using async */
126+
zassert_ok(pm_device_runtime_put_async(dev, K_SECONDS(1)));
127+
zassert_ok(pm_device_runtime_put_async(dev, K_SECONDS(1)));
128+
k_sleep(K_SECONDS(2));
129+
/* Check all off */
126130
zassert_false(pm_device_is_powered(dev), "");
127131
pm_device_state_get(dev, &state);
128132
zassert_equal(PM_DEVICE_STATE_OFF, state, "");

0 commit comments

Comments
 (0)