4 * Copyright (c) 2016 Red Hat Inc.
7 * Michael S. Tsirkin <mst@redhat.com>,
8 * Victor Kaplansky <victork@redhat.com>
10 * This work is licensed under the terms of the GNU GPL, version 2 or later.
11 * See the COPYING file in the top-level directory.
14 #include "qemu/osdep.h"
16 #include <glib/gstdio.h>
17 #include "qemu-common.h"
19 #include "boot-sector.h"
21 #define NETNAME "net0"
23 static const char *disk
= "tests/pxe-test-disk.raw";
25 static void test_pxe_one(const char *params
)
29 args
= g_strdup_printf("-machine accel=tcg "
30 "-netdev user,id=" NETNAME
",tftp=./,bootfile=%s "
36 qtest_quit(global_qtest
);
40 static void test_pxe_e1000(void)
42 test_pxe_one("-device e1000,netdev=" NETNAME
);
45 static void test_pxe_virtio_pci(void)
47 test_pxe_one("-device virtio-net-pci,netdev=" NETNAME
);
50 int main(int argc
, char *argv
[])
53 const char *arch
= qtest_get_arch();
55 ret
= boot_sector_init(disk
);
59 g_test_init(&argc
, &argv
, NULL
);
61 if (strcmp(arch
, "i386") == 0 || strcmp(arch
, "x86_64") == 0) {
62 qtest_add_func("pxe/e1000", test_pxe_e1000
);
63 qtest_add_func("pxe/virtio", test_pxe_virtio_pci
);
66 boot_sector_cleanup(disk
);