migration/ram: Consolidate variable reset after placement in ram_load_postcopy()
[qemu/kevin.git] / tests / qtest / hexloader-test.c
blob8b7aa2d72d0dfda9f5cafb56128206aa9e2382bb
1 /*
2 * QTest testcase for the Intel Hexadecimal Object File Loader
4 * Authors:
5 * Su Hang <suhang16@mails.ucas.ac.cn> 2018
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
12 #include "qemu/osdep.h"
13 #include "libqtest.h"
15 /* Load 'test.hex' and verify that the in-memory contents are as expected.
16 * 'test.hex' is a memory test pattern stored in Hexadecimal Object
17 * format. It loads at 0x10000 in RAM and contains values from 0 through
18 * 255.
20 static void hex_loader_test(void)
22 unsigned int i;
23 const unsigned int base_addr = 0x00010000;
25 QTestState *s = qtest_initf(
26 "-M vexpress-a9 -device loader,file=tests/data/hex-loader/test.hex");
28 for (i = 0; i < 256; ++i) {
29 uint8_t val = qtest_readb(s, base_addr + i);
30 g_assert_cmpuint(i, ==, val);
32 qtest_quit(s);
35 int main(int argc, char **argv)
37 int ret;
39 g_test_init(&argc, &argv, NULL);
41 qtest_add_func("/tmp/hex_loader", hex_loader_test);
42 ret = g_test_run();
44 return ret;