1
2
3
4
5
6
7
8
9
10
11
12#include "qemu/osdep.h"
13#include "libqtest.h"
14
15
16
17
18
19
20static void hex_loader_test(void)
21{
22 unsigned int i;
23 const unsigned int base_addr = 0x00010000;
24
25 QTestState *s = qtest_initf(
26 "-M vexpress-a9 -device loader,file=tests/data/hex-loader/test.hex");
27
28 for (i = 0; i < 256; ++i) {
29 uint8_t val = qtest_readb(s, base_addr + i);
30 g_assert_cmpuint(i, ==, val);
31 }
32 qtest_quit(s);
33}
34
35int main(int argc, char **argv)
36{
37 int ret;
38
39 g_test_init(&argc, &argv, NULL);
40
41 qtest_add_func("/tmp/hex_loader", hex_loader_test);
42 ret = g_test_run();
43
44 return ret;
45}
46