summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ahci-test.c4
-rw-r--r--tests/fw_cfg-test.c4
-rw-r--r--tests/libqos/ahci.c2
-rw-r--r--tests/libqos/libqos.c2
-rw-r--r--tests/libqos/malloc.c6
-rw-r--r--tests/libqtest.c2
-rw-r--r--tests/pc-cpu-test.c2
-rw-r--r--tests/prom-env-test.c14
-rw-r--r--tests/pxe-test.c31
-rwxr-xr-xtests/qemu-iotests/nbd-fault-injector.py4
-rw-r--r--tests/vhost-user-bridge.c1
11 files changed, 43 insertions, 29 deletions
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 999121bb7c..cb84edc8fb 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -155,7 +155,7 @@ static AHCIQState *ahci_vboot(const char *cli, va_list ap)
{
AHCIQState *s;
- s = g_malloc0(sizeof(AHCIQState));
+ s = g_new0(AHCIQState, 1);
s->parent = qtest_pc_vboot(cli, ap);
alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);
@@ -1806,7 +1806,7 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
char *name;
AHCIIOTestOptions *opts;
- opts = g_malloc(sizeof(AHCIIOTestOptions));
+ opts = g_new(AHCIIOTestOptions, 1);
opts->length = len;
opts->address_type = addr;
opts->io_type = type;
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 688342bed5..81f45bdfc8 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -79,8 +79,8 @@ static void test_fw_cfg_numa(void)
g_assert_cmpint(qfw_cfg_get_u64(fw_cfg, FW_CFG_NUMA), ==, nb_nodes);
- cpu_mask = g_malloc0(sizeof(uint64_t) * max_cpus);
- node_mask = g_malloc0(sizeof(uint64_t) * nb_nodes);
+ cpu_mask = g_new0(uint64_t, max_cpus);
+ node_mask = g_new0(uint64_t, nb_nodes);
qfw_cfg_read_data(fw_cfg, cpu_mask, sizeof(uint64_t) * max_cpus);
qfw_cfg_read_data(fw_cfg, node_mask, sizeof(uint64_t) * nb_nodes);
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 1ca7f456b5..13c0749582 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -843,7 +843,7 @@ AHCICommand *ahci_command_create(uint8_t command_name)
AHCICommand *cmd;
g_assert(props);
- cmd = g_malloc0(sizeof(AHCICommand));
+ cmd = g_new0(AHCICommand, 1);
g_assert(!(props->dma && props->pio));
g_assert(!(props->lba28 && props->lba48));
g_assert(!(props->read && props->write));
diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
index 6226546c28..991bc1aec2 100644
--- a/tests/libqos/libqos.c
+++ b/tests/libqos/libqos.c
@@ -17,7 +17,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)
{
char *cmdline;
- struct QOSState *qs = g_malloc(sizeof(QOSState));
+ struct QOSState *qs = g_new(QOSState, 1);
cmdline = g_strdup_vprintf(cmdline_fmt, ap);
qs->qts = qtest_start(cmdline);
diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index b8eff5f495..ac05874b0a 100644
--- a/tests/libqos/malloc.c
+++ b/tests/libqos/malloc.c
@@ -129,7 +129,7 @@ static MemBlock *mlist_new(uint64_t addr, uint64_t size)
if (!size) {
return NULL;
}
- block = g_malloc0(sizeof(MemBlock));
+ block = g_new0(MemBlock, 1);
block->addr = addr;
block->size = size;
@@ -305,8 +305,8 @@ QGuestAllocator *alloc_init(uint64_t start, uint64_t end)
s->start = start;
s->end = end;
- s->used = g_malloc(sizeof(MemList));
- s->free = g_malloc(sizeof(MemList));
+ s->used = g_new(MemList, 1);
+ s->free = g_new(MemList, 1);
QTAILQ_INIT(s->used);
QTAILQ_INIT(s->free);
diff --git a/tests/libqtest.c b/tests/libqtest.c
index cbd709470b..adf71188b6 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -171,7 +171,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
gchar *command;
const char *qemu_binary = qtest_qemu_binary();
- s = g_malloc(sizeof(*s));
+ s = g_new(QTestState, 1);
socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid());
qmp_socket_path = g_strdup_printf("/tmp/qtest-%d.qmp", getpid());
diff --git a/tests/pc-cpu-test.c b/tests/pc-cpu-test.c
index c4211a4e85..11d3e810ef 100644
--- a/tests/pc-cpu-test.c
+++ b/tests/pc-cpu-test.c
@@ -87,7 +87,7 @@ static void add_pc_test_case(const char *mname)
if (!g_str_has_prefix(mname, "pc-")) {
return;
}
- data = g_malloc(sizeof(PCTestData));
+ data = g_new(PCTestData, 1);
data->machine = g_strdup(mname);
data->cpu_model = "Haswell"; /* 1.3+ theoretically */
data->sockets = 1;
diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c
index eac207b30e..bc8b616912 100644
--- a/tests/prom-env-test.c
+++ b/tests/prom-env-test.c
@@ -1,7 +1,7 @@
/*
- * Test OpenBIOS-based machines.
+ * Test Open-Firmware-based machines.
*
- * Copyright (c) 2016 Red Hat Inc.
+ * Copyright (c) 2016, 2017 Red Hat Inc.
*
* Author:
* Thomas Huth <thuth@redhat.com>
@@ -30,8 +30,8 @@ static void check_guest_memory(void)
uint32_t signature;
int i;
- /* Poll until code has run and modified memory. Wait at most 120 seconds */
- for (i = 0; i < 12000; ++i) {
+ /* Poll until code has run and modified memory. Wait at most 600 seconds */
+ for (i = 0; i < 60000; ++i) {
signature = readl(ADDRESS);
if (signature == MAGIC) {
break;
@@ -78,7 +78,6 @@ int main(int argc, char *argv[])
const char *sparc_machines[] = { "SPARCbook", "Voyager", "SS-20", NULL };
const char *sparc64_machines[] = { "sun4u", NULL };
const char *ppc_machines[] = { "mac99", "g3beige", NULL };
- const char *ppc64_machines[] = { "mac99", "g3beige", "pseries", NULL };
const char *arch = qtest_get_arch();
g_test_init(&argc, &argv, NULL);
@@ -86,7 +85,10 @@ int main(int argc, char *argv[])
if (!strcmp(arch, "ppc")) {
add_tests(ppc_machines);
} else if (!strcmp(arch, "ppc64")) {
- add_tests(ppc64_machines);
+ add_tests(ppc_machines);
+ if (g_test_slow()) {
+ qtest_add_data_func("prom-env/pseries", "pseries", test_machine);
+ }
} else if (!strcmp(arch, "sparc")) {
add_tests(sparc_machines);
} else if (!strcmp(arch, "sparc64")) {
diff --git a/tests/pxe-test.c b/tests/pxe-test.c
index 0d70afccd6..937f29e631 100644
--- a/tests/pxe-test.c
+++ b/tests/pxe-test.c
@@ -1,11 +1,12 @@
/*
* PXE test cases.
*
- * Copyright (c) 2016 Red Hat Inc.
+ * Copyright (c) 2016, 2017 Red Hat Inc.
*
* Authors:
* Michael S. Tsirkin <mst@redhat.com>,
* Victor Kaplansky <victork@redhat.com>
+ * Thomas Huth <thuth@redhat.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
@@ -36,14 +37,14 @@ static void test_pxe_one(const char *params, bool ipv6)
g_free(args);
}
-static void test_pxe_e1000(void)
+static void test_pxe_ipv4(gconstpointer data)
{
- test_pxe_one("-device e1000,netdev=" NETNAME, false);
-}
+ const char *model = data;
+ char *dev_arg;
-static void test_pxe_virtio_pci(void)
-{
- test_pxe_one("-device virtio-net-pci,netdev=" NETNAME, false);
+ dev_arg = g_strdup_printf("-device %s,netdev=" NETNAME, model);
+ test_pxe_one(dev_arg, false);
+ g_free(dev_arg);
}
static void test_pxe_spapr_vlan(void)
@@ -68,11 +69,21 @@ int main(int argc, char *argv[])
g_test_init(&argc, &argv, NULL);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
- qtest_add_func("pxe/e1000", test_pxe_e1000);
- qtest_add_func("pxe/virtio", test_pxe_virtio_pci);
+ qtest_add_data_func("pxe/e1000", "e1000", test_pxe_ipv4);
+ qtest_add_data_func("pxe/virtio", "virtio-net-pci", test_pxe_ipv4);
+ if (g_test_slow()) {
+ qtest_add_data_func("pxe/ne2000", "ne2k_pci", test_pxe_ipv4);
+ qtest_add_data_func("pxe/eepro100", "i82550", test_pxe_ipv4);
+ qtest_add_data_func("pxe/pcnet", "pcnet", test_pxe_ipv4);
+ qtest_add_data_func("pxe/rtl8139", "rtl8139", test_pxe_ipv4);
+ qtest_add_data_func("pxe/vmxnet3", "vmxnet3", test_pxe_ipv4);
+ }
} else if (strcmp(arch, "ppc64") == 0) {
- qtest_add_func("pxe/virtio", test_pxe_virtio_pci);
qtest_add_func("pxe/spapr-vlan", test_pxe_spapr_vlan);
+ if (g_test_slow()) {
+ qtest_add_data_func("pxe/virtio", "virtio-net-pci", test_pxe_ipv4);
+ qtest_add_data_func("pxe/e1000", "e1000", test_pxe_ipv4);
+ }
} else if (g_str_equal(arch, "s390x")) {
qtest_add_func("pxe/virtio-ccw", test_pxe_virtio_ccw);
}
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
index 1c10dcb51c..8a04d979aa 100755
--- a/tests/qemu-iotests/nbd-fault-injector.py
+++ b/tests/qemu-iotests/nbd-fault-injector.py
@@ -56,7 +56,7 @@ NBD_CMD_READ = 0
NBD_CMD_WRITE = 1
NBD_CMD_DISC = 2
NBD_REQUEST_MAGIC = 0x25609513
-NBD_REPLY_MAGIC = 0x67446698
+NBD_SIMPLE_REPLY_MAGIC = 0x67446698
NBD_PASSWD = 0x4e42444d41474943
NBD_OPTS_MAGIC = 0x49484156454F5054
NBD_CLIENT_MAGIC = 0x0000420281861253
@@ -166,7 +166,7 @@ def read_request(conn):
return req
def write_reply(conn, error, handle):
- buf = reply_struct.pack(NBD_REPLY_MAGIC, error, handle)
+ buf = reply_struct.pack(NBD_SIMPLE_REPLY_MAGIC, error, handle)
conn.send(buf, event='reply')
def handle_connection(conn, use_export):
diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
index f922cc75ae..d820033a72 100644
--- a/tests/vhost-user-bridge.c
+++ b/tests/vhost-user-bridge.c
@@ -277,6 +277,7 @@ vubr_backend_recv_cb(int sock, void *ctx)
DPRINT(" hdrlen = %d\n", hdrlen);
if (!vu_queue_enabled(dev, vq) ||
+ !vu_queue_started(dev, vq) ||
!vu_queue_avail_bytes(dev, vq, hdrlen, 0)) {
DPRINT("Got UDP packet, but no available descriptors on RX virtq.\n");
return;