Add qemu 2.4.0
[kvmfornfv.git] / qemu / dtc / tests / char_literal.c
1 /*
2  * libfdt - Flat Device Tree manipulation
3  *      Testcase for character literals in dtc
4  * Copyright (C) 2006 David Gibson, IBM Corporation.
5  * Copyright (C) 2011 The Chromium Authors. All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdint.h>
25
26 #include <libfdt.h>
27
28 #include "tests.h"
29 #include "testdata.h"
30
31 int main(int argc, char *argv[])
32 {
33         void *fdt;
34         uint32_t expected_cells[5];
35
36         expected_cells[0] = cpu_to_fdt32((unsigned char)TEST_CHAR1);
37         expected_cells[1] = cpu_to_fdt32((unsigned char)TEST_CHAR2);
38         expected_cells[2] = cpu_to_fdt32((unsigned char)TEST_CHAR3);
39         expected_cells[3] = cpu_to_fdt32((unsigned char)TEST_CHAR4);
40         expected_cells[4] = cpu_to_fdt32((unsigned char)TEST_CHAR5);
41
42         test_init(argc, argv);
43         fdt = load_blob_arg(argc, argv);
44
45         check_getprop(fdt, 0, "char-literal-cells",
46                       sizeof(expected_cells), expected_cells);
47
48         PASS();
49 }