]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
PM: runtime: Add basic kunit tests for API contracts
authorBrian Norris <briannorris@chromium.org>
Thu, 25 Sep 2025 19:42:14 +0000 (12:42 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 27 Sep 2025 11:41:47 +0000 (13:41 +0200)
commit7f7acd193ba8aaa8ed07cfadc335bb17a991fd42
treec756cc9784465c0342af286c519005c4422aa9bf
parent927f3e85015285ff68789bd00aa66b071016b27f
PM: runtime: Add basic kunit tests for API contracts

In exploring the various return codes and failure modes of runtime PM
APIs, I found it helpful to verify and codify many of them in unit
tests, especially given that even the kerneldoc can be rather complex to
reason through, and it also has had subtle errors of its own.

Notably, I avoid testing the return codes for pm_runtime_put() and
pm_runtime_put_autosuspend(), since code that checks them is probably
wrong, and we're considering making them return 'void' altogether. I
still test the sync() variants, since those have a bit more meaning to
them.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/Kconfig
drivers/base/power/Makefile
drivers/base/power/runtime-test.c [new file with mode: 0644]