aboutsummaryrefslogtreecommitdiffstats
path: root/tests/path-references.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/path-references.c')
-rw-r--r--tests/path-references.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/path-references.c b/tests/path-references.c
index c8d25fb85fdd..5e332e8f32ca 100644
--- a/tests/path-references.c
+++ b/tests/path-references.c
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
void *fdt;
const char *p;
int len, multilen;
- int n1, n2;
+ int n1, n2, n3, n4;
test_init(argc, argv);
fdt = load_blob_arg(argc, argv);
@@ -92,6 +92,16 @@ int main(int argc, char *argv[])
if ((!streq(p, "/node1") || !streq(p + strlen("/node1") + 1, "/node2")))
FAIL("multiref has wrong value");
+ /* Check reference to nested nodes with common prefix */
+ n3 = fdt_path_offset(fdt, "/foo/baz");
+ if (n3 < 0)
+ FAIL("fdt_path_offset(/foo/baz): %s", fdt_strerror(n3));
+ n4 = fdt_path_offset(fdt, "/foobar/baz");
+ if (n4 < 0)
+ FAIL("fdt_path_offset(/foobar/baz): %s", fdt_strerror(n4));
+ check_ref(fdt, n3, "/foobar/baz");
+ check_ref(fdt, n4, "/foo/baz");
+
check_rref(fdt);
PASS();