[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4ca881f69306a25b020432446a84c90.sboyd@kernel.org>
Date: Tue, 21 Mar 2023 11:24:45 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Rob Herring <robh@...nel.org>
Cc: Michael Turquette <mturquette@...libre.com>,
linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
patches@...ts.linux.dev,
Brendan Higgins <brendan.higgins@...ux.dev>,
David Gow <davidgow@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rafael@...nel.org, Frank Rowand <frowand.list@...il.com>,
Christian Marangi <ansuelsmth@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
devicetree@...r.kernel.org, linux-kselftest@...r.kernel.org,
kunit-dev@...glegroups.com, Maxime Ripard <maxime@...no.tech>
Subject: Re: [PATCH v2 01/11] of: Load KUnit DTB from of_core_init()
Quoting Stephen Boyd (2023-03-21 11:15:19)
> Quoting Rob Herring (2023-03-21 10:33:03)
> > On Wed, Mar 15, 2023 at 11:37:18AM -0700, Stephen Boyd wrote:
> > > diff --git a/drivers/of/of_test.c b/drivers/of/of_test.c
> > > new file mode 100644
> > > index 000000000000..a4d70ac344ad
> > > --- /dev/null
> > > +++ b/drivers/of/of_test.c
> > > @@ -0,0 +1,43 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * KUnit tests for OF APIs
> > > + */
> > > +#include <linux/kconfig.h>
> > > +#include <linux/of.h>
> > > +
> > > +#include <kunit/test.h>
> > > +
> > > +/*
> > > + * Test that the root node / exists.
> > > + */
> > > +static void dtb_root_node_exists(struct kunit *test)
> > > +{
> > > + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, of_find_node_by_path("/"));
> > > +}
> > > +
> > > +/*
> > > + * Test that the /__symbols__ node exists.
> > > + */
> > > +static void dtb_symbols_node_exists(struct kunit *test)
> > > +{
> > > + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, of_find_node_by_path("/__symbols__"));
> > > +}
> >
> > Many base DTs will not have this. And the kunit tests themselves
> > shouldn't need it because they should be independent of the base tree.
> >
>
> When I try to apply an overlay it fails
>
> OF: overlay: no fragments or symbols in overlay
> OF: overlay: init_overlay_changeset() failed, ret = -22
> # of_overlay_apply_kunit_apply: ASSERTION FAILED at drivers/of/overlay_test.c:18
> Expected 0 == ({ extern uint8_t __dtbo_kunit_overlay_test_begin[]; extern uint8_t __dtbo_kunit_overlay_test_end[]; __of_overlay_apply_kunit((test), __dtbo_kunit_overlay_test_begin, __dtbo_kunit_overlay_test_end); }), but
> ({ extern uint8_t __dtbo_kunit_overlay_test_begin[]; extern uint8_t __dtbo_kunit_overlay_test_end[]; __of_overlay_apply_kunit((test), __dtbo_kunit_overlay_test_begin, __dtbo_kunit_overlay_test_end); }) == -12 (0xfffffffffffffff4)
> [FAILED] of_overlay_apply_kunit_apply
>
> Now I'm trying to hack on the fake root node to see if I can make it work.
>
Aha I figured it out. Needed to read more documentation.
---8<---
diff --git a/drivers/of/kunit_overlay_test.dtso b/drivers/of/kunit_overlay_test.dtso
index e3ced1467dd9..7688f9ef1b6b 100644
--- a/drivers/of/kunit_overlay_test.dtso
+++ b/drivers/of/kunit_overlay_test.dtso
@@ -2,7 +2,7 @@
/dts-v1/;
/plugin/;
-/ {
+&{/} {
test-kunit {
compatible = "test,kunit-empty";
};
Powered by blists - more mailing lists