aboutsummaryrefslogtreecommitdiffstats
path: root/tests/path-references.c
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-01-12 21:44:53 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-01-12 21:44:53 +0000
commit2f36e4ecd0f0c04781c752e5382906a43feaf4e3 (patch)
tree27f6eba9c66c680c931ce0562e2586cc9a3c07de /tests/path-references.c
parentf059bd1ebfc4cf2e96c4639ad7fa6cf3a3198a2f (diff)
downloadsrc-vendor/dtc.tar.gz
src-vendor/dtc.zip
Notes
Notes: svn path=/vendor/dtc/dist/; revision=327893 svn path=/vendor/dtc/1.4.6/; revision=327894; tag=vendor/dtc/1.4.6
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();