Message ID | 20241210191353.533801-4-briannorris@chromium.org |
---|---|
State | New |
Headers | show |
Series | drivers: base: Don't match device with NULL of_node/fwnode/etc + tests | expand |
Hi, On Tue, Dec 10, 2024 at 11:13:32AM -0800, Brian Norris wrote: > This is a reasonably-helpful base for generic platform_device tests, and > I'd like to add more tests that aren't specifically about "devm" > functions. Drop the devm namings for the suite, for clarity. > > Signed-off-by: Brian Norris <briannorris@chromium.org> > --- > > drivers/base/test/platform-device-test.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/base/test/platform-device-test.c b/drivers/base/test/platform-device-test.c > index ea05b8785743..fd871bb9e143 100644 > --- a/drivers/base/test/platform-device-test.c > +++ b/drivers/base/test/platform-device-test.c > @@ -15,7 +15,7 @@ struct test_priv { > struct device *dev; > }; > > -static int platform_device_devm_init(struct kunit *test) > +static int platform_device_init(struct kunit *test) > { > struct test_priv *priv; > > @@ -203,7 +203,7 @@ static void probed_platform_device_devm_register_get_unregister_with_devm_test(s > platform_driver_unregister(&fake_driver); > } > > -static struct kunit_case platform_device_devm_tests[] = { > +static struct kunit_case platform_device_tests[] = { > KUNIT_CASE(platform_device_devm_register_unregister_test), > KUNIT_CASE(platform_device_devm_register_get_unregister_with_devm_test), > KUNIT_CASE(probed_platform_device_devm_register_unregister_test), > @@ -211,13 +211,13 @@ static struct kunit_case platform_device_devm_tests[] = { > {} > }; > > -static struct kunit_suite platform_device_devm_test_suite = { > - .name = "platform-device-devm", > - .init = platform_device_devm_init, > - .test_cases = platform_device_devm_tests, > +static struct kunit_suite platform_device_test_suite = { > + .name = "platform-device", > + .init = platform_device_init, > + .test_cases = platform_device_tests, > }; The rest of the patches look ok to me, but it still seems like it tests something different (ie, devm actions) so I don't see why we should group them in the same test suite. Maxime
Hi Maxime, On Wed, Dec 11, 2024 at 06:05:49PM +0100, Maxime Ripard wrote: > On Tue, Dec 10, 2024 at 11:13:32AM -0800, Brian Norris wrote: > > This is a reasonably-helpful base for generic platform_device tests, and > > I'd like to add more tests that aren't specifically about "devm" > > functions. Drop the devm namings for the suite, for clarity. > > > > Signed-off-by: Brian Norris <briannorris@chromium.org> > > --- > > > > drivers/base/test/platform-device-test.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/base/test/platform-device-test.c b/drivers/base/test/platform-device-test.c > > index ea05b8785743..fd871bb9e143 100644 > > --- a/drivers/base/test/platform-device-test.c > > +++ b/drivers/base/test/platform-device-test.c > > @@ -211,13 +211,13 @@ static struct kunit_case platform_device_devm_tests[] = { > > {} > > }; > > > > -static struct kunit_suite platform_device_devm_test_suite = { > > - .name = "platform-device-devm", > > - .init = platform_device_devm_init, > > - .test_cases = platform_device_devm_tests, > > +static struct kunit_suite platform_device_test_suite = { > > + .name = "platform-device", > > + .init = platform_device_init, > > + .test_cases = platform_device_tests, > > }; > > The rest of the patches look ok to me, but it still seems like it tests > something different (ie, devm actions) so I don't see why we should > group them in the same test suite. My goal was to avoid adding a new test file for every sub-topic of "test platform devices". Would adding a second suite in this file make more sense, then? If so, I'll just drop this patch, and do that when adding the test. (I'm not that familiar with kunit conventions yet.) Brian
diff --git a/drivers/base/test/platform-device-test.c b/drivers/base/test/platform-device-test.c index ea05b8785743..fd871bb9e143 100644 --- a/drivers/base/test/platform-device-test.c +++ b/drivers/base/test/platform-device-test.c @@ -15,7 +15,7 @@ struct test_priv { struct device *dev; }; -static int platform_device_devm_init(struct kunit *test) +static int platform_device_init(struct kunit *test) { struct test_priv *priv; @@ -203,7 +203,7 @@ static void probed_platform_device_devm_register_get_unregister_with_devm_test(s platform_driver_unregister(&fake_driver); } -static struct kunit_case platform_device_devm_tests[] = { +static struct kunit_case platform_device_tests[] = { KUNIT_CASE(platform_device_devm_register_unregister_test), KUNIT_CASE(platform_device_devm_register_get_unregister_with_devm_test), KUNIT_CASE(probed_platform_device_devm_register_unregister_test), @@ -211,13 +211,13 @@ static struct kunit_case platform_device_devm_tests[] = { {} }; -static struct kunit_suite platform_device_devm_test_suite = { - .name = "platform-device-devm", - .init = platform_device_devm_init, - .test_cases = platform_device_devm_tests, +static struct kunit_suite platform_device_test_suite = { + .name = "platform-device", + .init = platform_device_init, + .test_cases = platform_device_tests, }; -kunit_test_suite(platform_device_devm_test_suite); +kunit_test_suite(platform_device_test_suite); MODULE_DESCRIPTION("Test module for platform devices"); MODULE_AUTHOR("Maxime Ripard <mripard@kernel.org>");
This is a reasonably-helpful base for generic platform_device tests, and I'd like to add more tests that aren't specifically about "devm" functions. Drop the devm namings for the suite, for clarity. Signed-off-by: Brian Norris <briannorris@chromium.org> --- drivers/base/test/platform-device-test.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)