linux-imx/lib/kunit/Makefile
Stephen Boyd 5ac7973032 platform: Add test managed platform_device/driver APIs
Introduce KUnit resource wrappers around platform_driver_register(),
platform_device_alloc(), and platform_device_add() so that test authors
can register platform drivers/devices from their tests and have the
drivers/devices automatically be unregistered when the test is done.

This makes test setup code simpler when a platform driver or platform
device is needed. Add a few test cases at the same time to make sure the
APIs work as intended.

Cc: Brendan Higgins <brendan.higgins@linux.dev>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-6-sboyd@kernel.org
2024-07-29 15:33:12 -07:00

723 B

obj-$(CONFIG_KUNIT) += kunit.o

kunit-objs += test.o
resource.o
user_alloc.o
static_stub.o
string-stream.o
assert.o
try-catch.o
executor.o
attributes.o
device.o
platform.o

ifeq ($(CONFIG_KUNIT_DEBUGFS),y) kunit-objs += debugfs.o endif

KUnit 'hooks' are built-in even when KUnit is built as a module.

obj-y += hooks.o

obj-$(CONFIG_KUNIT_TEST) += kunit-test.o obj-$(CONFIG_KUNIT_TEST) += platform-test.o

string-stream-test compiles built-in only.

ifeq ($(CONFIG_KUNIT_TEST),y) obj-$(CONFIG_KUNIT_TEST) += string-stream-test.o obj-$(CONFIG_KUNIT_TEST) += assert_test.o endif

obj-$(CONFIG_KUNIT_EXAMPLE_TEST) += kunit-example-test.o