aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.ibm.com>2018-10-10 16:19:47 +1100
committerStewart Smith <stewart@linux.ibm.com>2018-10-16 18:26:24 +1100
commit8fba29a2b5e5af920e28c1bccbbc900b84ebe218 (patch)
tree086ce6eb64f6e63ddb297590ad25377a93ef822c /core
parent2d68e6fa582213db565e19ad241c2484423a893d (diff)
downloadskiboot-8fba29a2b5e5af920e28c1bccbbc900b84ebe218.zip
skiboot-8fba29a2b5e5af920e28c1bccbbc900b84ebe218.tar.gz
skiboot-8fba29a2b5e5af920e28c1bccbbc900b84ebe218.tar.bz2
core/device: Add test for duplicate nodes with dt_attach_root()
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/test/run-device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/test/run-device.c b/core/test/run-device.c
index c3e4679..c317d4c 100644
--- a/core/test/run-device.c
+++ b/core/test/run-device.c
@@ -103,7 +103,7 @@ const char **props_to_fix(struct dt_node *node)
int main(void)
{
- struct dt_node *root, *c1, *c2, *gc1, *gc2, *gc3, *ggc1, *ggc2;
+ struct dt_node *root, *other_root, *c1, *c2, *gc1, *gc2, *gc3, *ggc1, *ggc2;
struct dt_node *addrs, *addr1, *addr2;
struct dt_node *i, *subtree, *ev1, *ut1, *ut2;
const struct dt_property *p;
@@ -388,6 +388,13 @@ int main(void)
assert(is_sorted(root));
+ /* Now test dt_attach_root */
+ other_root = dt_new_root("other_root");
+ dt_new(other_root, "d@1");
+
+ assert(dt_attach_root(root, other_root));
+ other_root = dt_new_root("other_root");
+ assert(!dt_attach_root(root, other_root));
dt_free(root);
/* Test child node sorting */