1 // SPDX-License-Identifier: LGPL-2.1-or-later 2 /* 3 * libfdt - Flat Device Tree manipulation 4 * Basic testcase for read-only access 5 * Copyright (C) 2006 David Gibson, IBM Corporation. 6 */ 7 8 #include <stdlib.h> 9 #include <stdio.h> 10 #include <string.h> 11 #include <stdint.h> 12 13 #include <libfdt.h> 14 15 #include "tests.h" 16 #include "testdata.h" 17 main(int argc,char * argv[])18int main(int argc, char *argv[]) 19 { 20 void *fdt; 21 const struct fdt_node_header *nh; 22 23 test_init(argc, argv); 24 fdt = load_blob_arg(argc, argv); 25 26 nh = fdt_offset_ptr(fdt, 0, sizeof(*nh)); 27 28 if (! nh) 29 FAIL("NULL retrieving root node"); 30 31 if (fdt32_to_cpu(nh->tag) != FDT_BEGIN_NODE) 32 FAIL("Wrong tag on root node"); 33 34 if (strlen(nh->name) != 0) 35 FAIL("Wrong name for root node, \"%s\" instead of empty", 36 nh->name); 37 38 PASS(); 39 } 40