@@ -366,6 +366,32 @@ void test_device_order(void)
366366 testing_device_order = false;
367367}
368368
369+ /**
370+ * @brief Test the device busy APIs.
371+ */
372+ void test_busy (void )
373+ {
374+ bool busy ;
375+
376+ busy = pm_device_is_any_busy ();
377+ zassert_false (busy , NULL );
378+
379+ pm_device_busy_set (device_dummy );
380+
381+ busy = pm_device_is_any_busy ();
382+ zassert_true (busy , NULL );
383+
384+ busy = pm_device_is_busy (device_dummy );
385+ zassert_true (busy , NULL );
386+
387+ pm_device_busy_clear (device_dummy );
388+
389+ busy = pm_device_is_any_busy ();
390+ zassert_false (busy , NULL );
391+
392+ busy = pm_device_is_busy (device_dummy );
393+ zassert_false (busy , NULL );
394+ }
369395
370396void test_main (void )
371397{
@@ -376,7 +402,8 @@ void test_main(void)
376402 ztest_1cpu_unit_test (test_power_idle ),
377403 ztest_1cpu_unit_test (test_power_state_trans ),
378404 ztest_1cpu_unit_test (test_device_order ),
379- ztest_1cpu_unit_test (test_power_state_notification ));
405+ ztest_1cpu_unit_test (test_power_state_notification ),
406+ ztest_1cpu_unit_test (test_busy ));
380407 ztest_run_test_suite (power_management_test );
381408 pm_notifier_unregister (& notifier );
382409}
0 commit comments