drivers: base: Add basic devm tests for root devices
authorMaxime Ripard <mripard@kernel.org>
Thu, 20 Jul 2023 12:45:07 +0000 (14:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Aug 2023 11:06:15 +0000 (13:06 +0200)
commit06188bc80ccbec0dc2f9e451b53b2e48321acbd3
treec3ceb08701db0bffa8dde526b50d68aac0d38ab6
parent0559f63057f927d298d68294d6ff77ce09b99255
drivers: base: Add basic devm tests for root devices

The root devices show some odd behaviours compared to regular "bus" devices
that have been probed through the usual mechanism, so let's create kunit
tests to exercise those paths and odd cases.

It's not clear whether root devices are even allowed to use device
managed resources, but the fact that it works in some cases but not
others like shown in that test suite shouldn't happen either way: we
want to make it consistent and documented.

These tests will (after the following patches) ensure that consistency
and effectively document that it's allowed.

If it ever turns out to be a bad idea, we can always roll back and
modify the tests then.

Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20230720-kunit-devm-inconsistencies-test-v3-1-6aa7e074f373@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/test/.kunitconfig [new file with mode: 0644]
drivers/base/test/Kconfig
drivers/base/test/Makefile
drivers/base/test/root-device-test.c [new file with mode: 0644]