Home | History | Annotate | Line # | Download | only in tests
      1 /*	$NetBSD: get_mem_rsv.c,v 1.1.1.3 2019/12/22 12:34:07 skrll Exp $	*/
      2 
      3 // SPDX-License-Identifier: LGPL-2.1-or-later
      4 /*
      5  * libfdt - Flat Device Tree manipulation
      6  *	Testcase for fdt_get_mem_rsv() and fdt_num_mem_rsv()
      7  * Copyright (C) 2006 David Gibson, IBM Corporation.
      8  */
      9 
     10 #include <stdlib.h>
     11 #include <stdio.h>
     12 #include <string.h>
     13 #include <stdint.h>
     14 
     15 #include <libfdt.h>
     16 
     17 #include "tests.h"
     18 #include "testdata.h"
     19 
     20 int main(int argc, char *argv[])
     21 {
     22 	void *fdt;
     23 	int rc;
     24 
     25 	test_init(argc, argv);
     26 	fdt = load_blob_arg(argc, argv);
     27 
     28 	rc = fdt_num_mem_rsv(fdt);
     29 	if (rc < 0)
     30 		FAIL("fdt_num_mem_rsv(): %s", fdt_strerror(rc));
     31 	if (rc != 2)
     32 		FAIL("fdt_num_mem_rsv() returned %d instead of 2", rc);
     33 
     34 	check_mem_rsv(fdt, 0, TEST_ADDR_1, TEST_SIZE_1);
     35 	check_mem_rsv(fdt, 1, TEST_ADDR_2, TEST_SIZE_2);
     36 	PASS();
     37 }
     38