All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Brendan Higgins <brendanhiggins@google.com>,
	keescook@google.com, mcgrof@kernel.org, shuah@kernel.org,
	robh@kernel.org, kieran.bingham@ideasonboard.com
Cc: brakmo@fb.com, pmladek@suse.com, amir73il@gmail.com,
	dri-devel@lists.freedesktop.org, Alexander.Levin@microsoft.com,
	linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org,
	richard@nod.at, knut.omang@oracle.com, wfg@linux.intel.com,
	joel@jms.id.au, jdike@addtoit.com, dan.carpenter@oracle.com,
	devicetree@vger.kernel.org, Tim.Bird@sony.com,
	linux-um@lists.infradead.org, rostedt@goodmis.org,
	julia.lawall@lip6.fr, kunit-dev@googlegroups.com,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	daniel@ffwll.ch, mpe@ellerman.id.au, joe@perches.com,
	khilman@baylibre.com
Subject: Re: [RFC v4 17/17] of: unittest: split up some super large test cases
Date: Thu, 21 Mar 2019 18:16:02 -0700	[thread overview]
Message-ID: <09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com> (raw)
In-Reply-To: <20190214213729.21702-18-brendanhiggins@google.com>

On 2/14/19 1:37 PM, Brendan Higgins wrote:
> Split up the super large test cases of_unittest_find_node_by_name and
> of_unittest_dynamic into properly sized and defined test cases.

I also still object to this patch.

-Frank


> 
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> ---
>  drivers/of/base-test.c | 297 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 249 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/of/base-test.c b/drivers/of/base-test.c
> index 3d3f4f1b74800..7b44c967ed2fd 100644
> --- a/drivers/of/base-test.c
> +++ b/drivers/of/base-test.c
> @@ -8,10 +8,10 @@
>  
>  #include "test-common.h"
>  
> -static void of_unittest_find_node_by_name(struct kunit *test)
> +static void of_test_find_node_by_name_basic(struct kunit *test)
>  {
>  	struct device_node *np;
> -	const char *options, *name;
> +	const char *name;
>  
>  	np = of_find_node_by_path("/testcase-data");
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -20,11 +20,21 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find /testcase-data failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_trailing_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("/testcase-data/"), NULL,
>  			    "trailing '/' on /testcase-data/ should fail\n");
>  
> +}
> +
> +static void of_test_find_node_by_name_multiple_components(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
> +
>  	np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -33,6 +43,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find /testcase-data/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_with_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -41,10 +57,23 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find testcase-alias failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_with_alias_and_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works on aliases */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("testcase-alias/"), NULL,
> -			    "trailing '/' on testcase-alias/ should fail\n");
> +			   "trailing '/' on testcase-alias/ should fail\n");
> +}
> +
> +/*
> + * TODO(brendanhiggins@google.com): This looks like a duplicate of
> + * of_test_find_node_by_name_multiple_components
> + */
> +static void of_test_find_node_by_name_multiple_components_2(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -54,17 +83,33 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find testcase-alias/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_missing_path(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
>  		np = of_find_node_by_path("/testcase-data/missing-path"), NULL,
>  		"non-existent path returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test, np = of_find_node_by_path("missing-alias"), NULL,
>  		"non-existent alias returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias_with_relative_path(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
> @@ -72,12 +117,24 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"non-existent alias with relative path returned node %pOF\n",
>  		np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	KUNIT_EXPECT_STREQ_MSG(test, "testoption", options,
>  			       "option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_and_slash(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -90,11 +147,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/option", options,
>  			       "option path test, subcase #2 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, np,
>  					 "NULL option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
>  				       &options);
> @@ -102,6 +170,13 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "testaliasoption", options,
>  			       "option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias_and_slash(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
>  				       &options);
> @@ -109,11 +184,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/alias/option", options,
>  			       "option alias path test, subcase #1 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(
>  			test, np, "NULL option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("testcase-alias", &options);
> @@ -121,6 +207,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, options, NULL,
>  			    "option clearing test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing_root(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("/", &options);
> @@ -130,65 +222,147 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	of_node_put(np);
>  }
>  
> -static void of_unittest_dynamic(struct kunit *test)
> +static int of_test_find_node_by_name_init(struct kunit *test)
>  {
> +	/* adding data for unittest */
> +	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
> +
> +	if (!of_aliases)
> +		of_aliases = of_find_node_by_path("/aliases");
> +
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
> +			"/testcase-data/phandle-tests/consumer-a"));
> +
> +	return 0;
> +}
> +
> +static struct kunit_case of_test_find_node_by_name_cases[] = {
> +	KUNIT_CASE(of_test_find_node_by_name_basic),
> +	KUNIT_CASE(of_test_find_node_by_name_trailing_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components_2),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_path),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias_with_relative_path),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing_root),
> +	{},
> +};
> +
> +static struct kunit_module of_test_find_node_by_name_module = {
> +	.name = "of-test-find-node-by-name",
> +	.init = of_test_find_node_by_name_init,
> +	.test_cases = of_test_find_node_by_name_cases,
> +};
> +module_test(of_test_find_node_by_name_module);
> +
> +struct of_test_dynamic_context {
>  	struct device_node *np;
> -	struct property *prop;
> +	struct property *prop0;
> +	struct property *prop1;
> +};
>  
> -	np = of_find_node_by_path("/testcase-data");
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> +static void of_test_dynamic_basic(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
> -	/* Array of 4 properties for the purpose of testing */
> -	prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop);
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
> +
> +	/* Test that we can remove a property */
> +	KUNIT_EXPECT_EQ(test, of_remove_property(np, prop0), 0);
> +}
> +
> +static void of_test_dynamic_add_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
>  
>  	/* Add a new property - should pass*/
> -	prop->name = "new-property";
> -	prop->value = "new-property-data";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a new property failed\n");
>  
>  	/* Try to add an existing property - should fail */
> -	prop++;
> -	prop->name = "new-property";
> -	prop->value = "new-property-data-should-fail";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop), 0,
> +	prop1->name = "new-property";
> +	prop1->value = "new-property-data-should-fail";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop1), 0,
>  			    "Adding an existing property should have failed\n");
> +}
> +
> +static void of_test_dynamic_modify_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
> +
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
>  
>  	/* Try to modify an existing property - should pass */
> -	prop->value = "modify-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(
> -		test, of_update_property(np, prop), 0,
> -		"Updating an existing property should have passed\n");
> +	prop1->name = "new-property";
> +	prop1->value = "modify-property-data-should-pass";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop1), 0,
> +			    "Updating an existing property should have passed\n");
> +}
> +
> +static void of_test_dynamic_modify_non_existent_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Try to modify non-existent property - should pass*/
> -	prop++;
> -	prop->name = "modify-property";
> -	prop->value = "modify-missing-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop), 0,
> +	prop0->name = "modify-property";
> +	prop0->value = "modify-missing-property-data-should-pass";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop0), 0,
>  			    "Updating a missing property should have passed\n");
> +}
>  
> -	/* Remove property - should pass */
> -	KUNIT_EXPECT_EQ_MSG(test, of_remove_property(np, prop), 0,
> -			    "Removing a property should have passed\n");
> +static void of_test_dynamic_large_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Adding very large property - should pass */
> -	prop++;
> -	prop->name = "large-property-PAGE_SIZEx8";
> -	prop->length = PAGE_SIZE * 8;
> -	prop->value = kzalloc(prop->length, GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop->value);
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "large-property-PAGE_SIZEx8";
> +	prop0->length = PAGE_SIZE * 8;
> +	prop0->value = kunit_kzalloc(test, prop0->length, GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop0->value);
> +
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a large property should have passed\n");
>  }
>  
> -static int of_test_init(struct kunit *test)
> +static int of_test_dynamic_init(struct kunit *test)
>  {
> -	/* adding data for unittest */
> +	struct of_test_dynamic_context *ctx;
> +
>  	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
>  
>  	if (!of_aliases)
> @@ -197,18 +371,45 @@ static int of_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
>  			"/testcase-data/phandle-tests/consumer-a"));
>  
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	ctx->np = of_find_node_by_path("/testcase-data");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np);
> +
> +	ctx->prop0 = kunit_kzalloc(test, sizeof(*ctx->prop0), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop0);
> +
> +	ctx->prop1 = kunit_kzalloc(test, sizeof(*ctx->prop1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop1);
> +
>  	return 0;
>  }
>  
> -static struct kunit_case of_test_cases[] = {
> -	KUNIT_CASE(of_unittest_find_node_by_name),
> -	KUNIT_CASE(of_unittest_dynamic),
> +static void of_test_dynamic_exit(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +
> +	of_remove_property(np, ctx->prop0);
> +	of_remove_property(np, ctx->prop1);
> +	of_node_put(np);
> +}
> +
> +static struct kunit_case of_test_dynamic_cases[] = {
> +	KUNIT_CASE(of_test_dynamic_basic),
> +	KUNIT_CASE(of_test_dynamic_add_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_non_existent_property),
> +	KUNIT_CASE(of_test_dynamic_large_property),
>  	{},
>  };
>  
> -static struct kunit_module of_test_module = {
> -	.name = "of-base-test",
> -	.init = of_test_init,
> -	.test_cases = of_test_cases,
> +static struct kunit_module of_test_dynamic_module = {
> +	.name = "of-dynamic-test",
> +	.init = of_test_dynamic_init,
> +	.exit = of_test_dynamic_exit,
> +	.test_cases = of_test_dynamic_cases,
>  };
> -module_test(of_test_module);
> +module_test(of_test_dynamic_module);
> 

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Frank Rowand <frowand.list@gmail.com>
To: Brendan Higgins <brendanhiggins@google.com>,
	keescook@google.com, mcgrof@kernel.org, shuah@kernel.org,
	robh@kernel.org, kieran.bingham@ideasonboard.com
Cc: gregkh@linuxfoundation.org, joel@jms.id.au, mpe@ellerman.id.au,
	joe@perches.com, brakmo@fb.com, rostedt@goodmis.org,
	Tim.Bird@sony.com, khilman@baylibre.com, julia.lawall@lip6.fr,
	linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org, jdike@addtoit.com, richard@nod.at,
	linux-um@lists.infradead.org, daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, dan.j.williams@intel.com,
	linux-nvdimm@lists.01.org, knut.omang@oracle.com,
	devicetree@vger.kernel.org, pmladek@suse.com,
	Alexander.Levin@microsoft.com, amir73il@gmail.com,
	dan.carpenter@oracle.com, wfg@linux.intel.com
Subject: Re: [RFC v4 17/17] of: unittest: split up some super large test cases
Date: Thu, 21 Mar 2019 18:16:02 -0700	[thread overview]
Message-ID: <09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com> (raw)
In-Reply-To: <20190214213729.21702-18-brendanhiggins@google.com>

On 2/14/19 1:37 PM, Brendan Higgins wrote:
> Split up the super large test cases of_unittest_find_node_by_name and
> of_unittest_dynamic into properly sized and defined test cases.

I also still object to this patch.

-Frank


> 
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> ---
>  drivers/of/base-test.c | 297 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 249 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/of/base-test.c b/drivers/of/base-test.c
> index 3d3f4f1b74800..7b44c967ed2fd 100644
> --- a/drivers/of/base-test.c
> +++ b/drivers/of/base-test.c
> @@ -8,10 +8,10 @@
>  
>  #include "test-common.h"
>  
> -static void of_unittest_find_node_by_name(struct kunit *test)
> +static void of_test_find_node_by_name_basic(struct kunit *test)
>  {
>  	struct device_node *np;
> -	const char *options, *name;
> +	const char *name;
>  
>  	np = of_find_node_by_path("/testcase-data");
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -20,11 +20,21 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find /testcase-data failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_trailing_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("/testcase-data/"), NULL,
>  			    "trailing '/' on /testcase-data/ should fail\n");
>  
> +}
> +
> +static void of_test_find_node_by_name_multiple_components(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
> +
>  	np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -33,6 +43,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find /testcase-data/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_with_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -41,10 +57,23 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find testcase-alias failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_with_alias_and_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works on aliases */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("testcase-alias/"), NULL,
> -			    "trailing '/' on testcase-alias/ should fail\n");
> +			   "trailing '/' on testcase-alias/ should fail\n");
> +}
> +
> +/*
> + * TODO(brendanhiggins@google.com): This looks like a duplicate of
> + * of_test_find_node_by_name_multiple_components
> + */
> +static void of_test_find_node_by_name_multiple_components_2(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -54,17 +83,33 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find testcase-alias/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_missing_path(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
>  		np = of_find_node_by_path("/testcase-data/missing-path"), NULL,
>  		"non-existent path returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test, np = of_find_node_by_path("missing-alias"), NULL,
>  		"non-existent alias returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias_with_relative_path(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
> @@ -72,12 +117,24 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"non-existent alias with relative path returned node %pOF\n",
>  		np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	KUNIT_EXPECT_STREQ_MSG(test, "testoption", options,
>  			       "option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_and_slash(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -90,11 +147,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/option", options,
>  			       "option path test, subcase #2 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, np,
>  					 "NULL option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
>  				       &options);
> @@ -102,6 +170,13 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "testaliasoption", options,
>  			       "option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias_and_slash(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
>  				       &options);
> @@ -109,11 +184,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/alias/option", options,
>  			       "option alias path test, subcase #1 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(
>  			test, np, "NULL option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("testcase-alias", &options);
> @@ -121,6 +207,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, options, NULL,
>  			    "option clearing test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing_root(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("/", &options);
> @@ -130,65 +222,147 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	of_node_put(np);
>  }
>  
> -static void of_unittest_dynamic(struct kunit *test)
> +static int of_test_find_node_by_name_init(struct kunit *test)
>  {
> +	/* adding data for unittest */
> +	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
> +
> +	if (!of_aliases)
> +		of_aliases = of_find_node_by_path("/aliases");
> +
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
> +			"/testcase-data/phandle-tests/consumer-a"));
> +
> +	return 0;
> +}
> +
> +static struct kunit_case of_test_find_node_by_name_cases[] = {
> +	KUNIT_CASE(of_test_find_node_by_name_basic),
> +	KUNIT_CASE(of_test_find_node_by_name_trailing_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components_2),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_path),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias_with_relative_path),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing_root),
> +	{},
> +};
> +
> +static struct kunit_module of_test_find_node_by_name_module = {
> +	.name = "of-test-find-node-by-name",
> +	.init = of_test_find_node_by_name_init,
> +	.test_cases = of_test_find_node_by_name_cases,
> +};
> +module_test(of_test_find_node_by_name_module);
> +
> +struct of_test_dynamic_context {
>  	struct device_node *np;
> -	struct property *prop;
> +	struct property *prop0;
> +	struct property *prop1;
> +};
>  
> -	np = of_find_node_by_path("/testcase-data");
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> +static void of_test_dynamic_basic(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
> -	/* Array of 4 properties for the purpose of testing */
> -	prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop);
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
> +
> +	/* Test that we can remove a property */
> +	KUNIT_EXPECT_EQ(test, of_remove_property(np, prop0), 0);
> +}
> +
> +static void of_test_dynamic_add_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
>  
>  	/* Add a new property - should pass*/
> -	prop->name = "new-property";
> -	prop->value = "new-property-data";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a new property failed\n");
>  
>  	/* Try to add an existing property - should fail */
> -	prop++;
> -	prop->name = "new-property";
> -	prop->value = "new-property-data-should-fail";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop), 0,
> +	prop1->name = "new-property";
> +	prop1->value = "new-property-data-should-fail";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop1), 0,
>  			    "Adding an existing property should have failed\n");
> +}
> +
> +static void of_test_dynamic_modify_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
> +
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
>  
>  	/* Try to modify an existing property - should pass */
> -	prop->value = "modify-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(
> -		test, of_update_property(np, prop), 0,
> -		"Updating an existing property should have passed\n");
> +	prop1->name = "new-property";
> +	prop1->value = "modify-property-data-should-pass";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop1), 0,
> +			    "Updating an existing property should have passed\n");
> +}
> +
> +static void of_test_dynamic_modify_non_existent_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Try to modify non-existent property - should pass*/
> -	prop++;
> -	prop->name = "modify-property";
> -	prop->value = "modify-missing-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop), 0,
> +	prop0->name = "modify-property";
> +	prop0->value = "modify-missing-property-data-should-pass";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop0), 0,
>  			    "Updating a missing property should have passed\n");
> +}
>  
> -	/* Remove property - should pass */
> -	KUNIT_EXPECT_EQ_MSG(test, of_remove_property(np, prop), 0,
> -			    "Removing a property should have passed\n");
> +static void of_test_dynamic_large_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Adding very large property - should pass */
> -	prop++;
> -	prop->name = "large-property-PAGE_SIZEx8";
> -	prop->length = PAGE_SIZE * 8;
> -	prop->value = kzalloc(prop->length, GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop->value);
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "large-property-PAGE_SIZEx8";
> +	prop0->length = PAGE_SIZE * 8;
> +	prop0->value = kunit_kzalloc(test, prop0->length, GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop0->value);
> +
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a large property should have passed\n");
>  }
>  
> -static int of_test_init(struct kunit *test)
> +static int of_test_dynamic_init(struct kunit *test)
>  {
> -	/* adding data for unittest */
> +	struct of_test_dynamic_context *ctx;
> +
>  	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
>  
>  	if (!of_aliases)
> @@ -197,18 +371,45 @@ static int of_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
>  			"/testcase-data/phandle-tests/consumer-a"));
>  
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	ctx->np = of_find_node_by_path("/testcase-data");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np);
> +
> +	ctx->prop0 = kunit_kzalloc(test, sizeof(*ctx->prop0), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop0);
> +
> +	ctx->prop1 = kunit_kzalloc(test, sizeof(*ctx->prop1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop1);
> +
>  	return 0;
>  }
>  
> -static struct kunit_case of_test_cases[] = {
> -	KUNIT_CASE(of_unittest_find_node_by_name),
> -	KUNIT_CASE(of_unittest_dynamic),
> +static void of_test_dynamic_exit(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +
> +	of_remove_property(np, ctx->prop0);
> +	of_remove_property(np, ctx->prop1);
> +	of_node_put(np);
> +}
> +
> +static struct kunit_case of_test_dynamic_cases[] = {
> +	KUNIT_CASE(of_test_dynamic_basic),
> +	KUNIT_CASE(of_test_dynamic_add_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_non_existent_property),
> +	KUNIT_CASE(of_test_dynamic_large_property),
>  	{},
>  };
>  
> -static struct kunit_module of_test_module = {
> -	.name = "of-base-test",
> -	.init = of_test_init,
> -	.test_cases = of_test_cases,
> +static struct kunit_module of_test_dynamic_module = {
> +	.name = "of-dynamic-test",
> +	.init = of_test_dynamic_init,
> +	.exit = of_test_dynamic_exit,
> +	.test_cases = of_test_dynamic_cases,
>  };
> -module_test(of_test_module);
> +module_test(of_test_dynamic_module);
> 


WARNING: multiple messages have this Message-ID (diff)
From: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Brendan Higgins
	<brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	keescook-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	shuah-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	kieran.bingham-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org
Cc: brakmo-b10kYP2dOMg@public.gmane.org,
	pmladek-IBi9RG/b67k@public.gmane.org,
	amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Alexander.Levin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org,
	linux-kselftest-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	richard-/L3Ra7n9ekc@public.gmane.org,
	knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org,
	jdike-OPE4K8JWMJJBDgjK7y7TUQ@public.gmane.org,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Tim.Bird-7U/KSKJipcs@public.gmane.org,
	linux-um-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org,
	julia.lawall-L2FTfq7BK8M@public.gmane.org,
	kunit-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	daniel-/w4YWyX8dFk@public.gmane.org,
	mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org,
	joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org,
	khilman-rdvid1DuHRBWk0Htik3J/w@public.gmane.org
Subject: Re: [RFC v4 17/17] of: unittest: split up some super large test cases
Date: Thu, 21 Mar 2019 18:16:02 -0700	[thread overview]
Message-ID: <09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com> (raw)
In-Reply-To: <20190214213729.21702-18-brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>

On 2/14/19 1:37 PM, Brendan Higgins wrote:
> Split up the super large test cases of_unittest_find_node_by_name and
> of_unittest_dynamic into properly sized and defined test cases.

I also still object to this patch.

-Frank


> 
> Signed-off-by: Brendan Higgins <brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/of/base-test.c | 297 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 249 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/of/base-test.c b/drivers/of/base-test.c
> index 3d3f4f1b74800..7b44c967ed2fd 100644
> --- a/drivers/of/base-test.c
> +++ b/drivers/of/base-test.c
> @@ -8,10 +8,10 @@
>  
>  #include "test-common.h"
>  
> -static void of_unittest_find_node_by_name(struct kunit *test)
> +static void of_test_find_node_by_name_basic(struct kunit *test)
>  {
>  	struct device_node *np;
> -	const char *options, *name;
> +	const char *name;
>  
>  	np = of_find_node_by_path("/testcase-data");
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -20,11 +20,21 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find /testcase-data failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_trailing_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("/testcase-data/"), NULL,
>  			    "trailing '/' on /testcase-data/ should fail\n");
>  
> +}
> +
> +static void of_test_find_node_by_name_multiple_components(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
> +
>  	np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -33,6 +43,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find /testcase-data/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_with_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -41,10 +57,23 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find testcase-alias failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_with_alias_and_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works on aliases */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("testcase-alias/"), NULL,
> -			    "trailing '/' on testcase-alias/ should fail\n");
> +			   "trailing '/' on testcase-alias/ should fail\n");
> +}
> +
> +/*
> + * TODO(brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org): This looks like a duplicate of
> + * of_test_find_node_by_name_multiple_components
> + */
> +static void of_test_find_node_by_name_multiple_components_2(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -54,17 +83,33 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find testcase-alias/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_missing_path(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
>  		np = of_find_node_by_path("/testcase-data/missing-path"), NULL,
>  		"non-existent path returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test, np = of_find_node_by_path("missing-alias"), NULL,
>  		"non-existent alias returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias_with_relative_path(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
> @@ -72,12 +117,24 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"non-existent alias with relative path returned node %pOF\n",
>  		np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	KUNIT_EXPECT_STREQ_MSG(test, "testoption", options,
>  			       "option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_and_slash(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -90,11 +147,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/option", options,
>  			       "option path test, subcase #2 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, np,
>  					 "NULL option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
>  				       &options);
> @@ -102,6 +170,13 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "testaliasoption", options,
>  			       "option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias_and_slash(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
>  				       &options);
> @@ -109,11 +184,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/alias/option", options,
>  			       "option alias path test, subcase #1 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(
>  			test, np, "NULL option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("testcase-alias", &options);
> @@ -121,6 +207,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, options, NULL,
>  			    "option clearing test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing_root(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("/", &options);
> @@ -130,65 +222,147 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	of_node_put(np);
>  }
>  
> -static void of_unittest_dynamic(struct kunit *test)
> +static int of_test_find_node_by_name_init(struct kunit *test)
>  {
> +	/* adding data for unittest */
> +	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
> +
> +	if (!of_aliases)
> +		of_aliases = of_find_node_by_path("/aliases");
> +
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
> +			"/testcase-data/phandle-tests/consumer-a"));
> +
> +	return 0;
> +}
> +
> +static struct kunit_case of_test_find_node_by_name_cases[] = {
> +	KUNIT_CASE(of_test_find_node_by_name_basic),
> +	KUNIT_CASE(of_test_find_node_by_name_trailing_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components_2),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_path),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias_with_relative_path),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing_root),
> +	{},
> +};
> +
> +static struct kunit_module of_test_find_node_by_name_module = {
> +	.name = "of-test-find-node-by-name",
> +	.init = of_test_find_node_by_name_init,
> +	.test_cases = of_test_find_node_by_name_cases,
> +};
> +module_test(of_test_find_node_by_name_module);
> +
> +struct of_test_dynamic_context {
>  	struct device_node *np;
> -	struct property *prop;
> +	struct property *prop0;
> +	struct property *prop1;
> +};
>  
> -	np = of_find_node_by_path("/testcase-data");
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> +static void of_test_dynamic_basic(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
> -	/* Array of 4 properties for the purpose of testing */
> -	prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop);
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
> +
> +	/* Test that we can remove a property */
> +	KUNIT_EXPECT_EQ(test, of_remove_property(np, prop0), 0);
> +}
> +
> +static void of_test_dynamic_add_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
>  
>  	/* Add a new property - should pass*/
> -	prop->name = "new-property";
> -	prop->value = "new-property-data";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a new property failed\n");
>  
>  	/* Try to add an existing property - should fail */
> -	prop++;
> -	prop->name = "new-property";
> -	prop->value = "new-property-data-should-fail";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop), 0,
> +	prop1->name = "new-property";
> +	prop1->value = "new-property-data-should-fail";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop1), 0,
>  			    "Adding an existing property should have failed\n");
> +}
> +
> +static void of_test_dynamic_modify_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
> +
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
>  
>  	/* Try to modify an existing property - should pass */
> -	prop->value = "modify-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(
> -		test, of_update_property(np, prop), 0,
> -		"Updating an existing property should have passed\n");
> +	prop1->name = "new-property";
> +	prop1->value = "modify-property-data-should-pass";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop1), 0,
> +			    "Updating an existing property should have passed\n");
> +}
> +
> +static void of_test_dynamic_modify_non_existent_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Try to modify non-existent property - should pass*/
> -	prop++;
> -	prop->name = "modify-property";
> -	prop->value = "modify-missing-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop), 0,
> +	prop0->name = "modify-property";
> +	prop0->value = "modify-missing-property-data-should-pass";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop0), 0,
>  			    "Updating a missing property should have passed\n");
> +}
>  
> -	/* Remove property - should pass */
> -	KUNIT_EXPECT_EQ_MSG(test, of_remove_property(np, prop), 0,
> -			    "Removing a property should have passed\n");
> +static void of_test_dynamic_large_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Adding very large property - should pass */
> -	prop++;
> -	prop->name = "large-property-PAGE_SIZEx8";
> -	prop->length = PAGE_SIZE * 8;
> -	prop->value = kzalloc(prop->length, GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop->value);
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "large-property-PAGE_SIZEx8";
> +	prop0->length = PAGE_SIZE * 8;
> +	prop0->value = kunit_kzalloc(test, prop0->length, GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop0->value);
> +
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a large property should have passed\n");
>  }
>  
> -static int of_test_init(struct kunit *test)
> +static int of_test_dynamic_init(struct kunit *test)
>  {
> -	/* adding data for unittest */
> +	struct of_test_dynamic_context *ctx;
> +
>  	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
>  
>  	if (!of_aliases)
> @@ -197,18 +371,45 @@ static int of_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
>  			"/testcase-data/phandle-tests/consumer-a"));
>  
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	ctx->np = of_find_node_by_path("/testcase-data");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np);
> +
> +	ctx->prop0 = kunit_kzalloc(test, sizeof(*ctx->prop0), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop0);
> +
> +	ctx->prop1 = kunit_kzalloc(test, sizeof(*ctx->prop1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop1);
> +
>  	return 0;
>  }
>  
> -static struct kunit_case of_test_cases[] = {
> -	KUNIT_CASE(of_unittest_find_node_by_name),
> -	KUNIT_CASE(of_unittest_dynamic),
> +static void of_test_dynamic_exit(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +
> +	of_remove_property(np, ctx->prop0);
> +	of_remove_property(np, ctx->prop1);
> +	of_node_put(np);
> +}
> +
> +static struct kunit_case of_test_dynamic_cases[] = {
> +	KUNIT_CASE(of_test_dynamic_basic),
> +	KUNIT_CASE(of_test_dynamic_add_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_non_existent_property),
> +	KUNIT_CASE(of_test_dynamic_large_property),
>  	{},
>  };
>  
> -static struct kunit_module of_test_module = {
> -	.name = "of-base-test",
> -	.init = of_test_init,
> -	.test_cases = of_test_cases,
> +static struct kunit_module of_test_dynamic_module = {
> +	.name = "of-dynamic-test",
> +	.init = of_test_dynamic_init,
> +	.exit = of_test_dynamic_exit,
> +	.test_cases = of_test_dynamic_cases,
>  };
> -module_test(of_test_module);
> +module_test(of_test_dynamic_module);
> 

WARNING: multiple messages have this Message-ID (diff)
From: frowand.list at gmail.com (Frank Rowand)
Subject: [RFC v4 17/17] of: unittest: split up some super large test cases
Date: Thu, 21 Mar 2019 18:16:02 -0700	[thread overview]
Message-ID: <09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com> (raw)
In-Reply-To: <20190214213729.21702-18-brendanhiggins@google.com>

On 2/14/19 1:37 PM, Brendan Higgins wrote:
> Split up the super large test cases of_unittest_find_node_by_name and
> of_unittest_dynamic into properly sized and defined test cases.

I also still object to this patch.

-Frank


> 
> Signed-off-by: Brendan Higgins <brendanhiggins at google.com>
> ---
>  drivers/of/base-test.c | 297 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 249 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/of/base-test.c b/drivers/of/base-test.c
> index 3d3f4f1b74800..7b44c967ed2fd 100644
> --- a/drivers/of/base-test.c
> +++ b/drivers/of/base-test.c
> @@ -8,10 +8,10 @@
>  
>  #include "test-common.h"
>  
> -static void of_unittest_find_node_by_name(struct kunit *test)
> +static void of_test_find_node_by_name_basic(struct kunit *test)
>  {
>  	struct device_node *np;
> -	const char *options, *name;
> +	const char *name;
>  
>  	np = of_find_node_by_path("/testcase-data");
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -20,11 +20,21 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find /testcase-data failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_trailing_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("/testcase-data/"), NULL,
>  			    "trailing '/' on /testcase-data/ should fail\n");
>  
> +}
> +
> +static void of_test_find_node_by_name_multiple_components(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
> +
>  	np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -33,6 +43,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find /testcase-data/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_with_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -41,10 +57,23 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find testcase-alias failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_with_alias_and_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works on aliases */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("testcase-alias/"), NULL,
> -			    "trailing '/' on testcase-alias/ should fail\n");
> +			   "trailing '/' on testcase-alias/ should fail\n");
> +}
> +
> +/*
> + * TODO(brendanhiggins at google.com): This looks like a duplicate of
> + * of_test_find_node_by_name_multiple_components
> + */
> +static void of_test_find_node_by_name_multiple_components_2(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -54,17 +83,33 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find testcase-alias/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_missing_path(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
>  		np = of_find_node_by_path("/testcase-data/missing-path"), NULL,
>  		"non-existent path returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test, np = of_find_node_by_path("missing-alias"), NULL,
>  		"non-existent alias returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias_with_relative_path(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
> @@ -72,12 +117,24 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"non-existent alias with relative path returned node %pOF\n",
>  		np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	KUNIT_EXPECT_STREQ_MSG(test, "testoption", options,
>  			       "option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_and_slash(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -90,11 +147,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/option", options,
>  			       "option path test, subcase #2 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, np,
>  					 "NULL option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
>  				       &options);
> @@ -102,6 +170,13 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "testaliasoption", options,
>  			       "option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias_and_slash(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
>  				       &options);
> @@ -109,11 +184,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/alias/option", options,
>  			       "option alias path test, subcase #1 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(
>  			test, np, "NULL option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("testcase-alias", &options);
> @@ -121,6 +207,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, options, NULL,
>  			    "option clearing test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing_root(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("/", &options);
> @@ -130,65 +222,147 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	of_node_put(np);
>  }
>  
> -static void of_unittest_dynamic(struct kunit *test)
> +static int of_test_find_node_by_name_init(struct kunit *test)
>  {
> +	/* adding data for unittest */
> +	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
> +
> +	if (!of_aliases)
> +		of_aliases = of_find_node_by_path("/aliases");
> +
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
> +			"/testcase-data/phandle-tests/consumer-a"));
> +
> +	return 0;
> +}
> +
> +static struct kunit_case of_test_find_node_by_name_cases[] = {
> +	KUNIT_CASE(of_test_find_node_by_name_basic),
> +	KUNIT_CASE(of_test_find_node_by_name_trailing_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components_2),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_path),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias_with_relative_path),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing_root),
> +	{},
> +};
> +
> +static struct kunit_module of_test_find_node_by_name_module = {
> +	.name = "of-test-find-node-by-name",
> +	.init = of_test_find_node_by_name_init,
> +	.test_cases = of_test_find_node_by_name_cases,
> +};
> +module_test(of_test_find_node_by_name_module);
> +
> +struct of_test_dynamic_context {
>  	struct device_node *np;
> -	struct property *prop;
> +	struct property *prop0;
> +	struct property *prop1;
> +};
>  
> -	np = of_find_node_by_path("/testcase-data");
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> +static void of_test_dynamic_basic(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
> -	/* Array of 4 properties for the purpose of testing */
> -	prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop);
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
> +
> +	/* Test that we can remove a property */
> +	KUNIT_EXPECT_EQ(test, of_remove_property(np, prop0), 0);
> +}
> +
> +static void of_test_dynamic_add_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
>  
>  	/* Add a new property - should pass*/
> -	prop->name = "new-property";
> -	prop->value = "new-property-data";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a new property failed\n");
>  
>  	/* Try to add an existing property - should fail */
> -	prop++;
> -	prop->name = "new-property";
> -	prop->value = "new-property-data-should-fail";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop), 0,
> +	prop1->name = "new-property";
> +	prop1->value = "new-property-data-should-fail";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop1), 0,
>  			    "Adding an existing property should have failed\n");
> +}
> +
> +static void of_test_dynamic_modify_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
> +
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
>  
>  	/* Try to modify an existing property - should pass */
> -	prop->value = "modify-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(
> -		test, of_update_property(np, prop), 0,
> -		"Updating an existing property should have passed\n");
> +	prop1->name = "new-property";
> +	prop1->value = "modify-property-data-should-pass";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop1), 0,
> +			    "Updating an existing property should have passed\n");
> +}
> +
> +static void of_test_dynamic_modify_non_existent_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Try to modify non-existent property - should pass*/
> -	prop++;
> -	prop->name = "modify-property";
> -	prop->value = "modify-missing-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop), 0,
> +	prop0->name = "modify-property";
> +	prop0->value = "modify-missing-property-data-should-pass";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop0), 0,
>  			    "Updating a missing property should have passed\n");
> +}
>  
> -	/* Remove property - should pass */
> -	KUNIT_EXPECT_EQ_MSG(test, of_remove_property(np, prop), 0,
> -			    "Removing a property should have passed\n");
> +static void of_test_dynamic_large_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Adding very large property - should pass */
> -	prop++;
> -	prop->name = "large-property-PAGE_SIZEx8";
> -	prop->length = PAGE_SIZE * 8;
> -	prop->value = kzalloc(prop->length, GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop->value);
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "large-property-PAGE_SIZEx8";
> +	prop0->length = PAGE_SIZE * 8;
> +	prop0->value = kunit_kzalloc(test, prop0->length, GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop0->value);
> +
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a large property should have passed\n");
>  }
>  
> -static int of_test_init(struct kunit *test)
> +static int of_test_dynamic_init(struct kunit *test)
>  {
> -	/* adding data for unittest */
> +	struct of_test_dynamic_context *ctx;
> +
>  	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
>  
>  	if (!of_aliases)
> @@ -197,18 +371,45 @@ static int of_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
>  			"/testcase-data/phandle-tests/consumer-a"));
>  
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	ctx->np = of_find_node_by_path("/testcase-data");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np);
> +
> +	ctx->prop0 = kunit_kzalloc(test, sizeof(*ctx->prop0), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop0);
> +
> +	ctx->prop1 = kunit_kzalloc(test, sizeof(*ctx->prop1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop1);
> +
>  	return 0;
>  }
>  
> -static struct kunit_case of_test_cases[] = {
> -	KUNIT_CASE(of_unittest_find_node_by_name),
> -	KUNIT_CASE(of_unittest_dynamic),
> +static void of_test_dynamic_exit(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +
> +	of_remove_property(np, ctx->prop0);
> +	of_remove_property(np, ctx->prop1);
> +	of_node_put(np);
> +}
> +
> +static struct kunit_case of_test_dynamic_cases[] = {
> +	KUNIT_CASE(of_test_dynamic_basic),
> +	KUNIT_CASE(of_test_dynamic_add_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_non_existent_property),
> +	KUNIT_CASE(of_test_dynamic_large_property),
>  	{},
>  };
>  
> -static struct kunit_module of_test_module = {
> -	.name = "of-base-test",
> -	.init = of_test_init,
> -	.test_cases = of_test_cases,
> +static struct kunit_module of_test_dynamic_module = {
> +	.name = "of-dynamic-test",
> +	.init = of_test_dynamic_init,
> +	.exit = of_test_dynamic_exit,
> +	.test_cases = of_test_dynamic_cases,
>  };
> -module_test(of_test_module);
> +module_test(of_test_dynamic_module);
> 

WARNING: multiple messages have this Message-ID (diff)
From: frowand.list@gmail.com (Frank Rowand)
Subject: [RFC v4 17/17] of: unittest: split up some super large test cases
Date: Thu, 21 Mar 2019 18:16:02 -0700	[thread overview]
Message-ID: <09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com> (raw)
Message-ID: <20190322011602.Ml3f3yE5gY8EQ5zFyNYVkvjOpjw9piKOiQ-BWUVcZiQ@z> (raw)
In-Reply-To: <20190214213729.21702-18-brendanhiggins@google.com>

On 2/14/19 1:37 PM, Brendan Higgins wrote:
> Split up the super large test cases of_unittest_find_node_by_name and
> of_unittest_dynamic into properly sized and defined test cases.

I also still object to this patch.

-Frank


> 
> Signed-off-by: Brendan Higgins <brendanhiggins at google.com>
> ---
>  drivers/of/base-test.c | 297 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 249 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/of/base-test.c b/drivers/of/base-test.c
> index 3d3f4f1b74800..7b44c967ed2fd 100644
> --- a/drivers/of/base-test.c
> +++ b/drivers/of/base-test.c
> @@ -8,10 +8,10 @@
>  
>  #include "test-common.h"
>  
> -static void of_unittest_find_node_by_name(struct kunit *test)
> +static void of_test_find_node_by_name_basic(struct kunit *test)
>  {
>  	struct device_node *np;
> -	const char *options, *name;
> +	const char *name;
>  
>  	np = of_find_node_by_path("/testcase-data");
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -20,11 +20,21 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find /testcase-data failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_trailing_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("/testcase-data/"), NULL,
>  			    "trailing '/' on /testcase-data/ should fail\n");
>  
> +}
> +
> +static void of_test_find_node_by_name_multiple_components(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
> +
>  	np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -33,6 +43,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find /testcase-data/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_with_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -41,10 +57,23 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find testcase-alias failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_with_alias_and_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works on aliases */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("testcase-alias/"), NULL,
> -			    "trailing '/' on testcase-alias/ should fail\n");
> +			   "trailing '/' on testcase-alias/ should fail\n");
> +}
> +
> +/*
> + * TODO(brendanhiggins at google.com): This looks like a duplicate of
> + * of_test_find_node_by_name_multiple_components
> + */
> +static void of_test_find_node_by_name_multiple_components_2(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -54,17 +83,33 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find testcase-alias/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_missing_path(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
>  		np = of_find_node_by_path("/testcase-data/missing-path"), NULL,
>  		"non-existent path returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test, np = of_find_node_by_path("missing-alias"), NULL,
>  		"non-existent alias returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias_with_relative_path(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
> @@ -72,12 +117,24 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"non-existent alias with relative path returned node %pOF\n",
>  		np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	KUNIT_EXPECT_STREQ_MSG(test, "testoption", options,
>  			       "option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_and_slash(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -90,11 +147,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/option", options,
>  			       "option path test, subcase #2 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, np,
>  					 "NULL option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
>  				       &options);
> @@ -102,6 +170,13 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "testaliasoption", options,
>  			       "option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias_and_slash(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
>  				       &options);
> @@ -109,11 +184,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/alias/option", options,
>  			       "option alias path test, subcase #1 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(
>  			test, np, "NULL option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("testcase-alias", &options);
> @@ -121,6 +207,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, options, NULL,
>  			    "option clearing test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing_root(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("/", &options);
> @@ -130,65 +222,147 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	of_node_put(np);
>  }
>  
> -static void of_unittest_dynamic(struct kunit *test)
> +static int of_test_find_node_by_name_init(struct kunit *test)
>  {
> +	/* adding data for unittest */
> +	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
> +
> +	if (!of_aliases)
> +		of_aliases = of_find_node_by_path("/aliases");
> +
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
> +			"/testcase-data/phandle-tests/consumer-a"));
> +
> +	return 0;
> +}
> +
> +static struct kunit_case of_test_find_node_by_name_cases[] = {
> +	KUNIT_CASE(of_test_find_node_by_name_basic),
> +	KUNIT_CASE(of_test_find_node_by_name_trailing_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components_2),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_path),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias_with_relative_path),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing_root),
> +	{},
> +};
> +
> +static struct kunit_module of_test_find_node_by_name_module = {
> +	.name = "of-test-find-node-by-name",
> +	.init = of_test_find_node_by_name_init,
> +	.test_cases = of_test_find_node_by_name_cases,
> +};
> +module_test(of_test_find_node_by_name_module);
> +
> +struct of_test_dynamic_context {
>  	struct device_node *np;
> -	struct property *prop;
> +	struct property *prop0;
> +	struct property *prop1;
> +};
>  
> -	np = of_find_node_by_path("/testcase-data");
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> +static void of_test_dynamic_basic(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
> -	/* Array of 4 properties for the purpose of testing */
> -	prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop);
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
> +
> +	/* Test that we can remove a property */
> +	KUNIT_EXPECT_EQ(test, of_remove_property(np, prop0), 0);
> +}
> +
> +static void of_test_dynamic_add_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
>  
>  	/* Add a new property - should pass*/
> -	prop->name = "new-property";
> -	prop->value = "new-property-data";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a new property failed\n");
>  
>  	/* Try to add an existing property - should fail */
> -	prop++;
> -	prop->name = "new-property";
> -	prop->value = "new-property-data-should-fail";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop), 0,
> +	prop1->name = "new-property";
> +	prop1->value = "new-property-data-should-fail";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop1), 0,
>  			    "Adding an existing property should have failed\n");
> +}
> +
> +static void of_test_dynamic_modify_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
> +
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
>  
>  	/* Try to modify an existing property - should pass */
> -	prop->value = "modify-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(
> -		test, of_update_property(np, prop), 0,
> -		"Updating an existing property should have passed\n");
> +	prop1->name = "new-property";
> +	prop1->value = "modify-property-data-should-pass";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop1), 0,
> +			    "Updating an existing property should have passed\n");
> +}
> +
> +static void of_test_dynamic_modify_non_existent_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Try to modify non-existent property - should pass*/
> -	prop++;
> -	prop->name = "modify-property";
> -	prop->value = "modify-missing-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop), 0,
> +	prop0->name = "modify-property";
> +	prop0->value = "modify-missing-property-data-should-pass";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop0), 0,
>  			    "Updating a missing property should have passed\n");
> +}
>  
> -	/* Remove property - should pass */
> -	KUNIT_EXPECT_EQ_MSG(test, of_remove_property(np, prop), 0,
> -			    "Removing a property should have passed\n");
> +static void of_test_dynamic_large_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Adding very large property - should pass */
> -	prop++;
> -	prop->name = "large-property-PAGE_SIZEx8";
> -	prop->length = PAGE_SIZE * 8;
> -	prop->value = kzalloc(prop->length, GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop->value);
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "large-property-PAGE_SIZEx8";
> +	prop0->length = PAGE_SIZE * 8;
> +	prop0->value = kunit_kzalloc(test, prop0->length, GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop0->value);
> +
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a large property should have passed\n");
>  }
>  
> -static int of_test_init(struct kunit *test)
> +static int of_test_dynamic_init(struct kunit *test)
>  {
> -	/* adding data for unittest */
> +	struct of_test_dynamic_context *ctx;
> +
>  	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
>  
>  	if (!of_aliases)
> @@ -197,18 +371,45 @@ static int of_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
>  			"/testcase-data/phandle-tests/consumer-a"));
>  
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	ctx->np = of_find_node_by_path("/testcase-data");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np);
> +
> +	ctx->prop0 = kunit_kzalloc(test, sizeof(*ctx->prop0), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop0);
> +
> +	ctx->prop1 = kunit_kzalloc(test, sizeof(*ctx->prop1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop1);
> +
>  	return 0;
>  }
>  
> -static struct kunit_case of_test_cases[] = {
> -	KUNIT_CASE(of_unittest_find_node_by_name),
> -	KUNIT_CASE(of_unittest_dynamic),
> +static void of_test_dynamic_exit(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +
> +	of_remove_property(np, ctx->prop0);
> +	of_remove_property(np, ctx->prop1);
> +	of_node_put(np);
> +}
> +
> +static struct kunit_case of_test_dynamic_cases[] = {
> +	KUNIT_CASE(of_test_dynamic_basic),
> +	KUNIT_CASE(of_test_dynamic_add_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_non_existent_property),
> +	KUNIT_CASE(of_test_dynamic_large_property),
>  	{},
>  };
>  
> -static struct kunit_module of_test_module = {
> -	.name = "of-base-test",
> -	.init = of_test_init,
> -	.test_cases = of_test_cases,
> +static struct kunit_module of_test_dynamic_module = {
> +	.name = "of-dynamic-test",
> +	.init = of_test_dynamic_init,
> +	.exit = of_test_dynamic_exit,
> +	.test_cases = of_test_dynamic_cases,
>  };
> -module_test(of_test_module);
> +module_test(of_test_dynamic_module);
> 

WARNING: multiple messages have this Message-ID (diff)
From: Frank Rowand <frowand.list@gmail.com>
To: Brendan Higgins <brendanhiggins@google.com>,
	keescook@google.com, mcgrof@kernel.org, shuah@kernel.org,
	robh@kernel.org, kieran.bingham@ideasonboard.com
Cc: brakmo@fb.com, pmladek@suse.com, amir73il@gmail.com,
	dri-devel@lists.freedesktop.org, Alexander.Levin@microsoft.com,
	linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org,
	richard@nod.at, knut.omang@oracle.com, wfg@linux.intel.com,
	joel@jms.id.au, jdike@addtoit.com, dan.carpenter@oracle.com,
	devicetree@vger.kernel.org, Tim.Bird@sony.com,
	linux-um@lists.infradead.org, rostedt@goodmis.org,
	julia.lawall@lip6.fr, dan.j.williams@intel.com,
	kunit-dev@googlegroups.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, daniel@ffwll.ch,
	mpe@ellerman.id.au, joe@perches.com, khilman@baylibre.com
Subject: Re: [RFC v4 17/17] of: unittest: split up some super large test cases
Date: Thu, 21 Mar 2019 18:16:02 -0700	[thread overview]
Message-ID: <09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com> (raw)
In-Reply-To: <20190214213729.21702-18-brendanhiggins@google.com>

On 2/14/19 1:37 PM, Brendan Higgins wrote:
> Split up the super large test cases of_unittest_find_node_by_name and
> of_unittest_dynamic into properly sized and defined test cases.

I also still object to this patch.

-Frank


> 
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> ---
>  drivers/of/base-test.c | 297 ++++++++++++++++++++++++++++++++++-------
>  1 file changed, 249 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/of/base-test.c b/drivers/of/base-test.c
> index 3d3f4f1b74800..7b44c967ed2fd 100644
> --- a/drivers/of/base-test.c
> +++ b/drivers/of/base-test.c
> @@ -8,10 +8,10 @@
>  
>  #include "test-common.h"
>  
> -static void of_unittest_find_node_by_name(struct kunit *test)
> +static void of_test_find_node_by_name_basic(struct kunit *test)
>  {
>  	struct device_node *np;
> -	const char *options, *name;
> +	const char *name;
>  
>  	np = of_find_node_by_path("/testcase-data");
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -20,11 +20,21 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find /testcase-data failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_trailing_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("/testcase-data/"), NULL,
>  			    "trailing '/' on /testcase-data/ should fail\n");
>  
> +}
> +
> +static void of_test_find_node_by_name_multiple_components(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
> +
>  	np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	name = kasprintf(GFP_KERNEL, "%pOF", np);
> @@ -33,6 +43,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find /testcase-data/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_with_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -41,10 +57,23 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  			       "find testcase-alias failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
>  
> +static void of_test_find_node_by_name_with_alias_and_slash(struct kunit *test)
> +{
>  	/* Test if trailing '/' works on aliases */
>  	KUNIT_EXPECT_EQ_MSG(test, of_find_node_by_path("testcase-alias/"), NULL,
> -			    "trailing '/' on testcase-alias/ should fail\n");
> +			   "trailing '/' on testcase-alias/ should fail\n");
> +}
> +
> +/*
> + * TODO(brendanhiggins@google.com): This looks like a duplicate of
> + * of_test_find_node_by_name_multiple_components
> + */
> +static void of_test_find_node_by_name_multiple_components_2(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *name;
>  
>  	np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -54,17 +83,33 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"find testcase-alias/phandle-tests/consumer-a failed\n");
>  	of_node_put(np);
>  	kfree(name);
> +}
> +
> +static void of_test_find_node_by_name_missing_path(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
>  		np = of_find_node_by_path("/testcase-data/missing-path"), NULL,
>  		"non-existent path returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test, np = of_find_node_by_path("missing-alias"), NULL,
>  		"non-existent alias returned node %pOF\n", np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_missing_alias_with_relative_path(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	KUNIT_EXPECT_EQ_MSG(
>  		test,
> @@ -72,12 +117,24 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  		"non-existent alias with relative path returned node %pOF\n",
>  		np);
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
>  	KUNIT_EXPECT_STREQ_MSG(test, "testoption", options,
>  			       "option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_and_slash(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:test/option", &options);
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> @@ -90,11 +147,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/option", options,
>  			       "option path test, subcase #2 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("/testcase-data:testoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, np,
>  					 "NULL option path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption",
>  				       &options);
> @@ -102,6 +170,13 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "testaliasoption", options,
>  			       "option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_option_alias_and_slash(
> +		struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:test/alias/option",
>  				       &options);
> @@ -109,11 +184,22 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_STREQ_MSG(test, "test/alias/option", options,
>  			       "option alias path test, subcase #1 failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_with_null_option_alias(struct kunit *test)
> +{
> +	struct device_node *np;
>  
>  	np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL);
>  	KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(
>  			test, np, "NULL option alias path test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("testcase-alias", &options);
> @@ -121,6 +207,12 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, options, NULL,
>  			    "option clearing test failed\n");
>  	of_node_put(np);
> +}
> +
> +static void of_test_find_node_by_name_option_clearing_root(struct kunit *test)
> +{
> +	struct device_node *np;
> +	const char *options;
>  
>  	options = "testoption";
>  	np = of_find_node_opts_by_path("/", &options);
> @@ -130,65 +222,147 @@ static void of_unittest_find_node_by_name(struct kunit *test)
>  	of_node_put(np);
>  }
>  
> -static void of_unittest_dynamic(struct kunit *test)
> +static int of_test_find_node_by_name_init(struct kunit *test)
>  {
> +	/* adding data for unittest */
> +	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
> +
> +	if (!of_aliases)
> +		of_aliases = of_find_node_by_path("/aliases");
> +
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
> +			"/testcase-data/phandle-tests/consumer-a"));
> +
> +	return 0;
> +}
> +
> +static struct kunit_case of_test_find_node_by_name_cases[] = {
> +	KUNIT_CASE(of_test_find_node_by_name_basic),
> +	KUNIT_CASE(of_test_find_node_by_name_trailing_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_multiple_components_2),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_path),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_missing_alias_with_relative_path),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_with_option_alias_and_slash),
> +	KUNIT_CASE(of_test_find_node_by_name_with_null_option_alias),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing),
> +	KUNIT_CASE(of_test_find_node_by_name_option_clearing_root),
> +	{},
> +};
> +
> +static struct kunit_module of_test_find_node_by_name_module = {
> +	.name = "of-test-find-node-by-name",
> +	.init = of_test_find_node_by_name_init,
> +	.test_cases = of_test_find_node_by_name_cases,
> +};
> +module_test(of_test_find_node_by_name_module);
> +
> +struct of_test_dynamic_context {
>  	struct device_node *np;
> -	struct property *prop;
> +	struct property *prop0;
> +	struct property *prop1;
> +};
>  
> -	np = of_find_node_by_path("/testcase-data");
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np);
> +static void of_test_dynamic_basic(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
> -	/* Array of 4 properties for the purpose of testing */
> -	prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop);
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
> +
> +	/* Test that we can remove a property */
> +	KUNIT_EXPECT_EQ(test, of_remove_property(np, prop0), 0);
> +}
> +
> +static void of_test_dynamic_add_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
>  
>  	/* Add a new property - should pass*/
> -	prop->name = "new-property";
> -	prop->value = "new-property-data";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a new property failed\n");
>  
>  	/* Try to add an existing property - should fail */
> -	prop++;
> -	prop->name = "new-property";
> -	prop->value = "new-property-data-should-fail";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop), 0,
> +	prop1->name = "new-property";
> +	prop1->value = "new-property-data-should-fail";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_NE_MSG(test, of_add_property(np, prop1), 0,
>  			    "Adding an existing property should have failed\n");
> +}
> +
> +static void of_test_dynamic_modify_existing_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0, *prop1 = ctx->prop1;
> +
> +	/* Add a new property - should pass*/
> +	prop0->name = "new-property";
> +	prop0->value = "new-property-data";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
> +			    "Adding a new property failed\n");
>  
>  	/* Try to modify an existing property - should pass */
> -	prop->value = "modify-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(
> -		test, of_update_property(np, prop), 0,
> -		"Updating an existing property should have passed\n");
> +	prop1->name = "new-property";
> +	prop1->value = "modify-property-data-should-pass";
> +	prop1->length = strlen(prop1->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop1), 0,
> +			    "Updating an existing property should have passed\n");
> +}
> +
> +static void of_test_dynamic_modify_non_existent_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Try to modify non-existent property - should pass*/
> -	prop++;
> -	prop->name = "modify-property";
> -	prop->value = "modify-missing-property-data-should-pass";
> -	prop->length = strlen(prop->value) + 1;
> -	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop), 0,
> +	prop0->name = "modify-property";
> +	prop0->value = "modify-missing-property-data-should-pass";
> +	prop0->length = strlen(prop0->value) + 1;
> +	KUNIT_EXPECT_EQ_MSG(test, of_update_property(np, prop0), 0,
>  			    "Updating a missing property should have passed\n");
> +}
>  
> -	/* Remove property - should pass */
> -	KUNIT_EXPECT_EQ_MSG(test, of_remove_property(np, prop), 0,
> -			    "Removing a property should have passed\n");
> +static void of_test_dynamic_large_property(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +	struct property *prop0 = ctx->prop0;
>  
>  	/* Adding very large property - should pass */
> -	prop++;
> -	prop->name = "large-property-PAGE_SIZEx8";
> -	prop->length = PAGE_SIZE * 8;
> -	prop->value = kzalloc(prop->length, GFP_KERNEL);
> -	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop->value);
> -	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop), 0,
> +	prop0->name = "large-property-PAGE_SIZEx8";
> +	prop0->length = PAGE_SIZE * 8;
> +	prop0->value = kunit_kzalloc(test, prop0->length, GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, prop0->value);
> +
> +	KUNIT_EXPECT_EQ_MSG(test, of_add_property(np, prop0), 0,
>  			    "Adding a large property should have passed\n");
>  }
>  
> -static int of_test_init(struct kunit *test)
> +static int of_test_dynamic_init(struct kunit *test)
>  {
> -	/* adding data for unittest */
> +	struct of_test_dynamic_context *ctx;
> +
>  	KUNIT_ASSERT_EQ(test, 0, unittest_data_add());
>  
>  	if (!of_aliases)
> @@ -197,18 +371,45 @@ static int of_test_init(struct kunit *test)
>  	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, of_find_node_by_path(
>  			"/testcase-data/phandle-tests/consumer-a"));
>  
> +	ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
> +	test->priv = ctx;
> +
> +	ctx->np = of_find_node_by_path("/testcase-data");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->np);
> +
> +	ctx->prop0 = kunit_kzalloc(test, sizeof(*ctx->prop0), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop0);
> +
> +	ctx->prop1 = kunit_kzalloc(test, sizeof(*ctx->prop1), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx->prop1);
> +
>  	return 0;
>  }
>  
> -static struct kunit_case of_test_cases[] = {
> -	KUNIT_CASE(of_unittest_find_node_by_name),
> -	KUNIT_CASE(of_unittest_dynamic),
> +static void of_test_dynamic_exit(struct kunit *test)
> +{
> +	struct of_test_dynamic_context *ctx = test->priv;
> +	struct device_node *np = ctx->np;
> +
> +	of_remove_property(np, ctx->prop0);
> +	of_remove_property(np, ctx->prop1);
> +	of_node_put(np);
> +}
> +
> +static struct kunit_case of_test_dynamic_cases[] = {
> +	KUNIT_CASE(of_test_dynamic_basic),
> +	KUNIT_CASE(of_test_dynamic_add_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_existing_property),
> +	KUNIT_CASE(of_test_dynamic_modify_non_existent_property),
> +	KUNIT_CASE(of_test_dynamic_large_property),
>  	{},
>  };
>  
> -static struct kunit_module of_test_module = {
> -	.name = "of-base-test",
> -	.init = of_test_init,
> -	.test_cases = of_test_cases,
> +static struct kunit_module of_test_dynamic_module = {
> +	.name = "of-dynamic-test",
> +	.init = of_test_dynamic_init,
> +	.exit = of_test_dynamic_exit,
> +	.test_cases = of_test_dynamic_cases,
>  };
> -module_test(of_test_module);
> +module_test(of_test_dynamic_module);
> 


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


  reply	other threads:[~2019-03-22  1:16 UTC|newest]

Thread overview: 316+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 21:37 [RFC v4 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework Brendan Higgins
2019-02-14 21:37 ` Brendan Higgins
2019-02-14 21:37 ` Brendan Higgins
2019-02-14 21:37 ` brendanhiggins
2019-02-14 21:37 ` [RFC v4 02/17] kunit: test: add test resource management API Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` brendanhiggins
2019-02-15 21:01   ` Stephen Boyd
2019-02-15 21:01     ` Stephen Boyd
2019-02-15 21:01     ` Stephen Boyd
2019-02-15 21:01     ` sboyd
2019-02-15 21:01     ` Stephen Boyd
2019-02-19 23:24     ` Brendan Higgins
2019-02-19 23:24       ` Brendan Higgins
2019-02-19 23:24       ` Brendan Higgins
2019-02-19 23:24       ` brendanhiggins
2019-02-19 23:24       ` Brendan Higgins
2019-02-14 21:37 ` [RFC v4 07/17] kunit: test: add initial tests Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` brendanhiggins
2019-02-14 21:37 ` [RFC v4 16/17] of: unittest: split out a couple of test cases from unittest Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` brendanhiggins
2019-03-22  1:14   ` Frank Rowand
2019-03-22  1:14     ` Frank Rowand
2019-03-22  1:14     ` Frank Rowand
2019-03-22  1:14     ` frowand.list
2019-03-22  1:14     ` Frank Rowand
2019-03-22  1:45     ` Brendan Higgins
2019-03-22  1:45       ` Brendan Higgins
2019-03-22  1:45       ` Brendan Higgins
2019-03-22  1:45       ` brendanhiggins
2019-03-22  1:45       ` Brendan Higgins
2019-03-22  1:45       ` Brendan Higgins
2019-02-14 21:37 ` [RFC v4 17/17] of: unittest: split up some super large test cases Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` Brendan Higgins
2019-02-14 21:37   ` brendanhiggins
2019-03-22  1:16   ` Frank Rowand [this message]
2019-03-22  1:16     ` Frank Rowand
2019-03-22  1:16     ` Frank Rowand
2019-03-22  1:16     ` frowand.list
2019-03-22  1:16     ` Frank Rowand
2019-03-22  1:16     ` Frank Rowand
     [not found]     ` <09b06e6d-fd36-707e-cb7a-e935bd930510-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-22  1:45       ` Brendan Higgins
2019-03-22  1:45         ` Brendan Higgins
2019-03-22  1:45         ` Brendan Higgins
2019-03-22  1:45         ` brendanhiggins
2019-03-22  1:45         ` Brendan Higgins
2019-02-18 20:02 ` [RFC v4 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework Frank Rowand
2019-02-18 20:02   ` Frank Rowand
2019-02-18 20:02   ` Frank Rowand
2019-02-18 20:02   ` frowand.list
2019-02-20  6:34   ` Brendan Higgins
2019-02-20  6:34     ` Brendan Higgins
2019-02-20  6:34     ` Brendan Higgins
2019-02-20  6:34     ` brendanhiggins
2019-02-20  6:34     ` Brendan Higgins
2019-02-20  6:46     ` Frank Rowand
2019-02-20  6:46       ` Frank Rowand
2019-02-20  6:46       ` Frank Rowand
2019-02-20  6:46       ` frowand.list
2019-02-20  6:46       ` Frank Rowand
2019-02-22 20:52       ` Thiago Jung Bauermann
2019-02-22 20:52         ` Thiago Jung Bauermann
2019-02-22 20:52         ` Thiago Jung Bauermann
2019-02-22 20:52         ` bauerman
2019-02-22 20:52         ` Thiago Jung Bauermann
2019-02-28  4:18         ` Brendan Higgins
2019-02-28  4:18           ` Brendan Higgins
2019-02-28  4:18           ` brendanhiggins
2019-02-28  4:18           ` Brendan Higgins
2019-02-28  4:15       ` Brendan Higgins
2019-02-28  4:15         ` Brendan Higgins
2019-02-28  4:15         ` Brendan Higgins
2019-02-28  4:15         ` brendanhiggins
2019-02-28  4:15         ` Brendan Higgins
2019-03-04 23:01 ` Brendan Higgins
2019-03-04 23:01   ` Brendan Higgins
2019-03-04 23:01   ` Brendan Higgins
2019-03-04 23:01   ` brendanhiggins
2019-03-04 23:01   ` Brendan Higgins
2019-03-22  1:23   ` Frank Rowand
2019-03-22  1:23     ` Frank Rowand
2019-03-22  1:23     ` Frank Rowand
2019-03-22  1:23     ` frowand.list
2019-03-22  1:23     ` Frank Rowand
2019-03-22  1:23     ` Frank Rowand
     [not found]     ` <0e6eb370-3e62-e1a5-1b91-bccc5868e8e4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-25 22:11       ` Brendan Higgins
2019-03-25 22:11         ` Brendan Higgins
2019-03-25 22:11         ` Brendan Higgins
2019-03-25 22:11         ` brendanhiggins
2019-03-25 22:11         ` Brendan Higgins
     [not found] ` <20190214213729.21702-1-brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2019-02-14 21:37   ` [RFC v4 01/17] kunit: test: add KUnit test runner core Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 03/17] kunit: test: add string_stream a std::stream like string builder Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 04/17] kunit: test: add test_stream a std::stream like logger Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 05/17] kunit: test: add the concept of expectations Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 06/17] kbuild: enable building KUnit Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 08/17] kunit: test: add support for test abort Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
     [not found]     ` <20190214213729.21702-9-brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2019-02-18 19:52       ` Frank Rowand
2019-02-18 19:52         ` Frank Rowand
2019-02-18 19:52         ` frowand.list
2019-02-18 19:52         ` Frank Rowand
     [not found]         ` <da1995fa-a362-dfe6-8184-7fcdf2b923e8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-02-20  3:39           ` Brendan Higgins
2019-02-20  3:39             ` Brendan Higgins
2019-02-20  3:39             ` Brendan Higgins
2019-02-20  3:39             ` brendanhiggins
2019-02-20  3:39             ` Brendan Higgins
2019-02-20  6:44             ` Frank Rowand
2019-02-20  6:44               ` Frank Rowand
2019-02-20  6:44               ` Frank Rowand
2019-02-20  6:44               ` frowand.list
2019-02-20  6:44               ` Frank Rowand
2019-02-20  6:44               ` Frank Rowand
2019-02-28  7:42               ` Brendan Higgins
2019-02-28  7:42                 ` Brendan Higgins
2019-02-28  7:42                 ` Brendan Higgins
2019-02-28  7:42                 ` brendanhiggins
2019-02-28  7:42                 ` Brendan Higgins
     [not found]                 ` <CAFd5g47EDmsBWKNiW0jpHW2VG_GWCfe8UO+=ofgM2_ru+_UBQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-22  1:09                   ` Frank Rowand
2019-03-22  1:09                     ` Frank Rowand
2019-03-22  1:09                     ` Frank Rowand
2019-03-22  1:09                     ` frowand.list
2019-03-22  1:09                     ` Frank Rowand
2019-03-22  1:41                     ` Brendan Higgins
2019-03-22  1:41                       ` Brendan Higgins
2019-03-22  1:41                       ` Brendan Higgins
2019-03-22  1:41                       ` brendanhiggins
2019-03-22  1:41                       ` Brendan Higgins
     [not found]                       ` <CAFd5g46AP9yZQ+z+60HGaZuqhJQmfSBw9+r62w4k=cGiMEkqLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-22  7:10                         ` Knut Omang
2019-03-22  7:10                           ` Knut Omang
2019-03-22  7:10                           ` Knut Omang
2019-03-22  7:10                           ` knut.omang
2019-03-22  7:10                           ` Knut Omang
2019-03-25 22:32                           ` Brendan Higgins
2019-03-25 22:32                             ` Brendan Higgins
2019-03-25 22:32                             ` brendanhiggins
2019-03-25 22:32                             ` Brendan Higgins
     [not found]                             ` <CAFd5g44eqjN-nVCJuoeYFCxwVa5AorWiAnXe-tFCAc11zDgJFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-26  7:44                               ` Knut Omang
2019-03-26  7:44                                 ` Knut Omang
2019-03-26  7:44                                 ` Knut Omang
2019-03-26  7:44                                 ` knut.omang
2019-03-26  7:44                                 ` Knut Omang
2019-02-26 20:35       ` Stephen Boyd
2019-02-26 20:35         ` Stephen Boyd
2019-02-26 20:35         ` Stephen Boyd
2019-02-26 20:35         ` sboyd
2019-02-26 20:35         ` Stephen Boyd
     [not found]         ` <155121334527.260864.5324117081460979741-n1Xw8LXHxjTHt/MElyovVYaSKrA+ACpX0E9HWUfgJXw@public.gmane.org>
2019-02-28  9:03           ` Brendan Higgins
2019-02-28  9:03             ` Brendan Higgins
2019-02-28  9:03             ` brendanhiggins
2019-02-28  9:03             ` Brendan Higgins
2019-02-28 13:54             ` Dan Carpenter
2019-02-28 13:54               ` Dan Carpenter
2019-02-28 13:54               ` Dan Carpenter
2019-02-28 13:54               ` dan.carpenter
2019-02-28 13:54               ` Dan Carpenter
2019-03-04 22:28               ` Brendan Higgins
2019-03-04 22:28                 ` Brendan Higgins
2019-03-04 22:28                 ` Brendan Higgins
2019-03-04 22:28                 ` brendanhiggins
2019-03-04 22:28                 ` Brendan Higgins
2019-02-28 18:02             ` Stephen Boyd
2019-02-28 18:02               ` Stephen Boyd
     [not found]               ` <155137694423.260864.2846034318906225490-n1Xw8LXHxjTHt/MElyovVYaSKrA+ACpX0E9HWUfgJXw@public.gmane.org>
2019-03-04 22:39                 ` Brendan Higgins
2019-03-04 22:39                   ` Brendan Higgins
2019-03-04 22:39                   ` Brendan Higgins
2019-03-04 22:39                   ` brendanhiggins
2019-03-04 22:39                   ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 09/17] kunit: test: add the concept of assertions Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 10/17] kunit: test: add test managed resource tests Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
     [not found]     ` <20190214213729.21702-11-brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2019-02-15 20:54       ` Stephen Boyd
2019-02-15 20:54         ` Stephen Boyd
2019-02-15 20:54         ` Stephen Boyd
2019-02-15 20:54         ` sboyd
2019-02-15 20:54         ` Stephen Boyd
2019-02-19 23:20         ` Brendan Higgins
2019-02-19 23:20           ` Brendan Higgins
2019-02-19 23:20           ` Brendan Higgins
2019-02-19 23:20           ` brendanhiggins
2019-02-19 23:20           ` Brendan Higgins
2019-02-20 22:03           ` Stephen Boyd
2019-02-20 22:03             ` Stephen Boyd
2019-02-14 21:37   ` [RFC v4 11/17] kunit: tool: add Python wrappers for running KUnit tests Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 12/17] kunit: defconfig: add defconfigs for building " Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 13/17] Documentation: kunit: add documentation for KUnit Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 14/17] MAINTAINERS: add entry for KUnit the unit testing framework Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37   ` [RFC v4 15/17] of: unittest: migrate tests to run on KUnit Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` Brendan Higgins
2019-02-14 21:37     ` brendanhiggins
2019-02-14 21:37     ` Brendan Higgins
     [not found]     ` <20190214213729.21702-16-brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2019-02-16  0:24       ` Frank Rowand
2019-02-16  0:24         ` Frank Rowand
2019-02-16  0:24         ` Frank Rowand
2019-02-16  0:24         ` frowand.list
2019-02-16  0:24         ` Frank Rowand
     [not found]         ` <cda7c8db-a6d0-6a93-5c33-9ccf32dfd29a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-02-20  2:24           ` Brendan Higgins
2019-02-20  2:24             ` Brendan Higgins
2019-02-20  2:24             ` Brendan Higgins
2019-02-20  2:24             ` brendanhiggins
2019-02-20  2:24             ` Brendan Higgins
2019-03-21  1:07   ` [RFC v4 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework Logan Gunthorpe
2019-03-21  1:07     ` Logan Gunthorpe
2019-03-21  1:07     ` Logan Gunthorpe
2019-03-21  1:07     ` logang
2019-03-21  1:07     ` Logan Gunthorpe
     [not found]     ` <6d9b3b21-1179-3a45-7545-30aa15306cb4-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2019-03-21  5:23       ` Knut Omang
2019-03-21  5:23         ` Knut Omang
2019-03-21  5:23         ` Knut Omang
2019-03-21  5:23         ` knut.omang
2019-03-21  5:23         ` Knut Omang
2019-03-21 15:56         ` Logan Gunthorpe
2019-03-21 15:56           ` Logan Gunthorpe
2019-03-21 15:56           ` Logan Gunthorpe
2019-03-21 15:56           ` logang
2019-03-21 15:56           ` Logan Gunthorpe
2019-03-21 15:56           ` Logan Gunthorpe
     [not found]           ` <ce355f5c-189c-816c-cde4-fb4e816d44e7-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2019-03-21 16:55             ` Brendan Higgins
2019-03-21 16:55               ` Brendan Higgins
2019-03-21 16:55               ` Brendan Higgins
2019-03-21 16:55               ` brendanhiggins
2019-03-21 16:55               ` Brendan Higgins
     [not found]               ` <CAFd5g45LKU+SZAFzn3RNCoxhzum0NAr9t+UJ80SJDMc_FeKgBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-21 19:13                 ` Knut Omang
2019-03-21 19:13                   ` Knut Omang
2019-03-21 19:13                   ` Knut Omang
2019-03-21 19:13                   ` knut.omang
2019-03-21 19:13                   ` Knut Omang
2019-03-21 19:29                   ` Logan Gunthorpe
2019-03-21 19:29                     ` Logan Gunthorpe
2019-03-21 19:29                     ` Logan Gunthorpe
2019-03-21 19:29                     ` logang
2019-03-21 19:29                     ` Logan Gunthorpe
2019-03-21 19:29                     ` Logan Gunthorpe
     [not found]                     ` <961494a3-d08c-2720-c59d-7d7008edb288-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
2019-03-21 20:14                       ` Knut Omang
2019-03-21 20:14                         ` Knut Omang
2019-03-21 20:14                         ` Knut Omang
2019-03-21 20:14                         ` knut.omang
2019-03-21 20:14                         ` Knut Omang
2019-03-21 22:07       ` Brendan Higgins
2019-03-21 22:07         ` Brendan Higgins
2019-03-21 22:07         ` Brendan Higgins
2019-03-21 22:07         ` brendanhiggins
2019-03-21 22:07         ` Brendan Higgins
2019-03-21 22:26         ` Logan Gunthorpe
2019-03-21 22:26           ` Logan Gunthorpe
2019-03-21 22:26           ` Logan Gunthorpe
2019-03-21 22:26           ` logang
2019-03-21 22:26           ` Logan Gunthorpe
2019-03-21 23:33           ` Brendan Higgins
2019-03-21 23:33             ` Brendan Higgins
2019-03-21 23:33             ` Brendan Higgins
2019-03-21 23:33             ` brendanhiggins
2019-03-21 23:33             ` Brendan Higgins
2019-03-22  1:12             ` Frank Rowand
2019-03-22  1:12               ` Frank Rowand
2019-03-22  1:12               ` Frank Rowand
2019-03-22  1:12               ` frowand.list
2019-03-22  1:12               ` Frank Rowand
2019-03-22  1:12               ` Frank Rowand
     [not found]               ` <aea24c8e-5ce8-5f33-c81b-d2eeef588ec8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-25 22:12                 ` Brendan Higgins
2019-03-25 22:12                   ` Brendan Higgins
2019-03-25 22:12                   ` Brendan Higgins
2019-03-25 22:12                   ` brendanhiggins
2019-03-25 22:12                   ` Brendan Higgins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09b06e6d-fd36-707e-cb7a-e935bd930510@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=Alexander.Levin@microsoft.com \
    --cc=Tim.Bird@sony.com \
    --cc=amir73il@gmail.com \
    --cc=brakmo@fb.com \
    --cc=brendanhiggins@google.com \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdike@addtoit.com \
    --cc=joe@perches.com \
    --cc=joel@jms.id.au \
    --cc=julia.lawall@lip6.fr \
    --cc=keescook@google.com \
    --cc=khilman@baylibre.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=knut.omang@oracle.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-um@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=pmladek@suse.com \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=wfg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.