1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /*
3 * libfdt - Flat Device Tree manipulation
4 * Testcase for fdt_get_mem_rsv() and fdt_num_mem_rsv()
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[])18 int main(int argc, char *argv[])
19 {
20 void *fdt;
21 int rc;
22
23 test_init(argc, argv);
24 fdt = load_blob_arg(argc, argv);
25
26 rc = fdt_num_mem_rsv(fdt);
27 if (rc < 0)
28 FAIL("fdt_num_mem_rsv(): %s", fdt_strerror(rc));
29 if (rc != 2)
30 FAIL("fdt_num_mem_rsv() returned %d instead of 2", rc);
31
32 check_mem_rsv(fdt, 0, TEST_ADDR_1, TEST_SIZE_1);
33 check_mem_rsv(fdt, 1, TEST_ADDR_2, TEST_SIZE_2);
34 PASS();
35 }
36