s390x/tcg: STOPPED cpus can never wake up
[qemu.git] / tests / pxe-test.c
blob937f29e631937fef6d857d12453bfbc6b0356baa
1 /*
2 * PXE test cases.
4 * Copyright (c) 2016, 2017 Red Hat Inc.
6 * Authors:
7 * Michael S. Tsirkin <mst@redhat.com>,
8 * Victor Kaplansky <victork@redhat.com>
9 * Thomas Huth <thuth@redhat.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
12 * See the COPYING file in the top-level directory.
15 #include "qemu/osdep.h"
16 #include <glib/gstdio.h>
17 #include "qemu-common.h"
18 #include "libqtest.h"
19 #include "boot-sector.h"
21 #define NETNAME "net0"
23 static char disk[] = "tests/pxe-test-disk-XXXXXX";
25 static void test_pxe_one(const char *params, bool ipv6)
27 char *args;
29 args = g_strdup_printf("-machine accel=kvm:tcg -nodefaults -boot order=n "
30 "-netdev user,id=" NETNAME ",tftp=./,bootfile=%s,"
31 "ipv4=%s,ipv6=%s %s", disk, ipv6 ? "off" : "on",
32 ipv6 ? "on" : "off", params);
34 qtest_start(args);
35 boot_sector_test();
36 qtest_quit(global_qtest);
37 g_free(args);
40 static void test_pxe_ipv4(gconstpointer data)
42 const char *model = data;
43 char *dev_arg;
45 dev_arg = g_strdup_printf("-device %s,netdev=" NETNAME, model);
46 test_pxe_one(dev_arg, false);
47 g_free(dev_arg);
50 static void test_pxe_spapr_vlan(void)
52 test_pxe_one("-device spapr-vlan,netdev=" NETNAME, true);
55 static void test_pxe_virtio_ccw(void)
57 test_pxe_one("-device virtio-net-ccw,bootindex=1,netdev=" NETNAME, false);
60 int main(int argc, char *argv[])
62 int ret;
63 const char *arch = qtest_get_arch();
65 ret = boot_sector_init(disk);
66 if(ret)
67 return ret;
69 g_test_init(&argc, &argv, NULL);
71 if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
72 qtest_add_data_func("pxe/e1000", "e1000", test_pxe_ipv4);
73 qtest_add_data_func("pxe/virtio", "virtio-net-pci", test_pxe_ipv4);
74 if (g_test_slow()) {
75 qtest_add_data_func("pxe/ne2000", "ne2k_pci", test_pxe_ipv4);
76 qtest_add_data_func("pxe/eepro100", "i82550", test_pxe_ipv4);
77 qtest_add_data_func("pxe/pcnet", "pcnet", test_pxe_ipv4);
78 qtest_add_data_func("pxe/rtl8139", "rtl8139", test_pxe_ipv4);
79 qtest_add_data_func("pxe/vmxnet3", "vmxnet3", test_pxe_ipv4);
81 } else if (strcmp(arch, "ppc64") == 0) {
82 qtest_add_func("pxe/spapr-vlan", test_pxe_spapr_vlan);
83 if (g_test_slow()) {
84 qtest_add_data_func("pxe/virtio", "virtio-net-pci", test_pxe_ipv4);
85 qtest_add_data_func("pxe/e1000", "e1000", test_pxe_ipv4);
87 } else if (g_str_equal(arch, "s390x")) {
88 qtest_add_func("pxe/virtio-ccw", test_pxe_virtio_ccw);
90 ret = g_test_run();
91 boot_sector_cleanup(disk);
92 return ret;