summaryrefslogtreecommitdiff
path: root/tests/subnode_offset.c
diff options
context:
space:
mode:
authorRafal Jaworowski <raj@FreeBSD.org>2010-02-27 20:38:41 +0000
committerRafal Jaworowski <raj@FreeBSD.org>2010-02-27 20:38:41 +0000
commitb7b62f41399c6bc3ef3f9583dbc35cbd0a28101f (patch)
tree4a3082cc96b5344610019e2defaf32a043234c98 /tests/subnode_offset.c
parentcb591ed2094735990f9316644c81ffd8534e7228 (diff)
Notes
Diffstat (limited to 'tests/subnode_offset.c')
-rw-r--r--tests/subnode_offset.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/subnode_offset.c b/tests/subnode_offset.c
index ac2f32e18a3b..b961070905d6 100644
--- a/tests/subnode_offset.c
+++ b/tests/subnode_offset.c
@@ -28,7 +28,7 @@
#include "tests.h"
#include "testdata.h"
-int check_subnode(struct fdt_header *fdt, int parent, const char *name)
+static int check_subnode(struct fdt_header *fdt, int parent, const char *name)
{
int offset;
const struct fdt_node_header *nh;
@@ -60,6 +60,7 @@ int main(int argc, char *argv[])
void *fdt;
int subnode1_offset, subnode2_offset;
int subsubnode1_offset, subsubnode2_offset, subsubnode2_offset2;
+ int ss11_off, ss12_off, ss21_off, ss22_off;
test_init(argc, argv);
fdt = load_blob_arg(argc, argv);
@@ -84,5 +85,15 @@ int main(int argc, char *argv[])
if (subsubnode2_offset != subsubnode2_offset2)
FAIL("Different offsets with and without unit address");
+ ss11_off = check_subnode(fdt, subnode1_offset, "ss1");
+ ss21_off = fdt_subnode_offset(fdt, subnode2_offset, "ss1");
+ if (ss21_off != -FDT_ERR_NOTFOUND)
+ FAIL("Incorrectly found ss1 in subnode2");
+
+ ss12_off = fdt_subnode_offset(fdt, subnode1_offset, "ss2");
+ if (ss12_off != -FDT_ERR_NOTFOUND)
+ FAIL("Incorrectly found ss2 in subnode1");
+ ss22_off = check_subnode(fdt, subnode2_offset, "ss2");
+
PASS();
}