aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2022-08-31 18:18:59 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2022-08-31 18:19:03 -0400
commite93ded1bf6c94ab95015b33e188bc8b0b0c32670 (patch)
treefb503e07137df4e5b8188c447d9c536de0ee1ffa
parent3a2a29ebbdf47138ffa3cb729afeaa5286948521 (diff)
parentda55be562ea2b082da5d55cc12730fe8fe118852 (diff)
Merge tag 'testing-pull-request-2022-08-30' of https://gitlab.com/thuth/qemu into staging
* First batch of patches to get qtests adapted for Windows * Two preparation patches for the upcoming removal of the slirp submodule * Some other small test fixes (typos, etc.) # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmMOVvcRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbUcOA//d4MU0VWbMRXHLLTvaIO+0I1JhiMP5PbU # qgDwGfIu7uY58hXvjDCSmoV5Lj35I/VdsmWYcC4dwQcIr9BwZq3H+jthB4sxMDIJ # UAnowmO22x5iTZr4PBY3GuYKRRUaf7EuqqOwmNAtrvDV+3BVn2sQFLtjWhqnyhqR # syonfyVhlFhqnFXPs6fXTXQxiuziuMmmHGSQMNRGuBudkivvOTQzElb3gxTp7pRe # FfIoAUVohUXptd26U+5Zr2KPxQQ/eZ2Elhnhjc6/r4u4JpbyfCQrGTFAMSuvq4HM # z/kKr/JA0v6vmX5ARjbCL0RhoNOM/DcOooxzX6YO3VkZTrQAHZxAsk25mihURRX3 # UgGLDlagNuPSTl1fkUuumH86fFQ54bFBFFOV3yJWQF5UDuWKoy3bPlSf5L0/bwRp # z5gYnf0lJxMG3kGgmaOnW4gj0Z0amn9AzI33BQDIldVNTHnp8/hNpscrsq5Voi2j # ot1G/aZt9OH+DeqAB8TJfbsHE8mtTgioihZ2QQOMAKVkF25UImFjNWliX8SUHG2h # E3ro9QLugV2FgIggJwRyN9w394hEn7BR8DMyiPCRemcjnT4Fuy9IoEBEkJ2gj3n4 # QiDPdrr/1dw8uApGBts3YyRbSmajqKUegXCuOYXjpU90f4Kno0WN2/jkTx8pvfcE # bJvG21nzrdY= # =MCyJ # -----END PGP SIGNATURE----- # gpg: Signature made Tue 30 Aug 2022 14:29:11 EDT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'testing-pull-request-2022-08-30' of https://gitlab.com/thuth/qemu: (23 commits) tests/avocado/migration: Get find_free_port() from the ports tests/qtest/ac97-test: Correct reference to driver gitlab-ci: Only use one process in Windows jobs for compilation docs/devel/testing: fix minor typo tests/avocado: Fix trivial typo tests/avocado: Do not run tests that require libslirp if it is not available tests/vm: Add libslirp to the VM tests tests/qtest: prom-env-test: Use double quotes to pass the prom-env option tests/qtest: npcm7xx_emc-test: Skip running test_{tx, rx} on win32 tests/qtest: machine-none-test: Use double quotes to pass the cpu option tests/qtest: device-plug-test: Reverse the usage of double/single quotes tests/qtest: libqos: Rename malloc.h to libqos-malloc.h tests/qtest: libqos: Drop inclusion of <sys/wait.h> tests/qtest: migration-test: Skip running test_migrate_fd_proto on win32 tests/qtest: i440fx-test: Skip running request_{bios, pflash} for win32 tests/qtest: Build cases that use memory-backend-file for posix only tests/qtest: Build e1000e-test for posix only tests/qtest: Adapt {m48t59,rtc}-test cases for win32 backends/tpm: Exclude headers and macros that don't exist on win32 tests/qtest: migration-test: Handle link() for win32 ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--.gitlab-ci.d/windows.yml4
-rw-r--r--backends/tpm/tpm_ioctl.h4
-rw-r--r--docs/devel/testing.rst2
-rw-r--r--tests/avocado/avocado_qemu/__init__.py9
-rw-r--r--tests/avocado/info_usernet.py1
-rw-r--r--tests/avocado/migration.py4
-rw-r--r--tests/avocado/replay_linux.py1
-rw-r--r--tests/migration/stress.c2
-rw-r--r--tests/qtest/ac97-test.c2
-rw-r--r--tests/qtest/bios-tables-test.c10
-rw-r--r--tests/qtest/cdrom-test.c2
-rw-r--r--tests/qtest/cxl-test.c10
-rw-r--r--tests/qtest/device-plug-test.c2
-rw-r--r--tests/qtest/e1000e-test.c2
-rw-r--r--tests/qtest/fuzz/generic_fuzz.c8
-rw-r--r--tests/qtest/fuzz/generic_fuzz_configs.h2
-rw-r--r--tests/qtest/fuzz/qos_fuzz.c2
-rw-r--r--tests/qtest/i440fx-test.c6
-rw-r--r--tests/qtest/ivshmem-test.c4
-rw-r--r--tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c2
-rw-r--r--tests/qtest/libqos/arm-imx25-pdk-machine.c2
-rw-r--r--tests/qtest/libqos/arm-n800-machine.c2
-rw-r--r--tests/qtest/libqos/arm-raspi2-machine.c2
-rw-r--r--tests/qtest/libqos/arm-sabrelite-machine.c2
-rw-r--r--tests/qtest/libqos/arm-smdkc210-machine.c2
-rw-r--r--tests/qtest/libqos/arm-virt-machine.c2
-rw-r--r--tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c2
-rw-r--r--tests/qtest/libqos/e1000e.c2
-rw-r--r--tests/qtest/libqos/generic-pcihost.h2
-rw-r--r--tests/qtest/libqos/libqos-malloc.c (renamed from tests/qtest/libqos/malloc.c)2
-rw-r--r--tests/qtest/libqos/libqos-malloc.h (renamed from tests/qtest/libqos/malloc.h)0
-rw-r--r--tests/qtest/libqos/libqos.c2
-rw-r--r--tests/qtest/libqos/libqos.h2
-rw-r--r--tests/qtest/libqos/malloc-pc.h2
-rw-r--r--tests/qtest/libqos/malloc-spapr.h2
-rw-r--r--tests/qtest/libqos/meson.build2
-rw-r--r--tests/qtest/libqos/pci-pc.h2
-rw-r--r--tests/qtest/libqos/pci-spapr.h2
-rw-r--r--tests/qtest/libqos/qgraph.h2
-rw-r--r--tests/qtest/libqos/qos_external.c2
-rw-r--r--tests/qtest/libqos/qos_external.h2
-rw-r--r--tests/qtest/libqos/rtas.h2
-rw-r--r--tests/qtest/libqos/virtio-9p.c4
-rw-r--r--tests/qtest/libqos/virtio-mmio.c2
-rw-r--r--tests/qtest/libqos/virtio-pci.c2
-rw-r--r--tests/qtest/libqos/virtio.h2
-rw-r--r--tests/qtest/libqtest.c4
-rw-r--r--tests/qtest/m48t59-test.c2
-rw-r--r--tests/qtest/machine-none-test.c2
-rw-r--r--tests/qtest/meson.build7
-rw-r--r--tests/qtest/migration-helpers.c2
-rw-r--r--tests/qtest/migration-helpers.h2
-rw-r--r--tests/qtest/migration-test.c22
-rw-r--r--tests/qtest/npcm7xx_emc-test.c8
-rw-r--r--tests/qtest/prom-env-test.c4
-rw-r--r--tests/qtest/qmp-test.c4
-rw-r--r--tests/qtest/qos-test.c2
-rw-r--r--tests/qtest/rtc-test.c2
-rw-r--r--tests/qtest/vhost-user-test.c4
-rw-r--r--tests/unit/test-crypto-tlscredsx509.c4
-rw-r--r--tests/unit/test-crypto-tlssession.c6
-rw-r--r--tests/unit/test-io-channel-tls.c6
-rw-r--r--tests/unit/test-qga.c2
-rwxr-xr-xtests/vm/freebsd3
-rwxr-xr-xtests/vm/haiku.x86_643
-rwxr-xr-xtests/vm/netbsd3
66 files changed, 144 insertions, 79 deletions
diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml
index c4bde758be..da6013904a 100644
--- a/.gitlab-ci.d/windows.yml
+++ b/.gitlab-ci.d/windows.yml
@@ -61,7 +61,7 @@ msys2-64bit:
- .\msys64\usr\bin\bash -lc './configure --target-list=x86_64-softmmu
--enable-capstone --without-default-devices'
- .\msys64\usr\bin\bash -lc "sed -i '/^ROMS=/d' build/config-host.mak"
- - .\msys64\usr\bin\bash -lc 'make -j2'
+ - .\msys64\usr\bin\bash -lc 'make'
- .\msys64\usr\bin\bash -lc 'make check'
msys2-32bit:
@@ -94,5 +94,5 @@ msys2-32bit:
- mkdir output
- cd output
- ..\msys64\usr\bin\bash -lc "../configure --target-list=ppc64-softmmu"
- - ..\msys64\usr\bin\bash -lc 'make -j2'
+ - ..\msys64\usr\bin\bash -lc 'make'
- ..\msys64\usr\bin\bash -lc 'make check'
diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index bd6c12cb86..d67bf0283b 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -9,8 +9,10 @@
#ifndef TPM_IOCTL_H
#define TPM_IOCTL_H
+#ifndef _WIN32
#include <sys/uio.h>
#include <sys/ioctl.h>
+#endif
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
@@ -222,6 +224,7 @@ typedef struct ptm_setbuffersize ptm_setbuffersize;
#define PTM_CAP_SET_DATAFD (1 << 12)
#define PTM_CAP_SET_BUFFERSIZE (1 << 13)
+#ifndef _WIN32
enum {
PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
PTM_INIT = _IOWR('P', 1, ptm_init),
@@ -241,6 +244,7 @@ enum {
PTM_SET_DATAFD = _IOR('P', 15, ptm_res),
PTM_SET_BUFFERSIZE = _IOWR('P', 16, ptm_setbuffersize),
};
+#endif
/*
* Commands used by the non-CUSE TPMs
diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 3f6ebd5073..f35f117d95 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -297,7 +297,7 @@ build and test QEMU in predefined and widely accessible Linux
environments. This makes it possible to expand the test coverage
across distros, toolchain flavors and library versions. The support
was originally written for Docker although we also support Podman as
-an alternative container runtime. Although the many of the target
+an alternative container runtime. Although many of the target
names and scripts are prefixed with "docker" the system will
automatically run on whichever is configured.
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 9d17a287cf..5f1d3e551c 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -299,6 +299,12 @@ class QemuSystemTest(QemuBaseTest):
self.cancel("%s accelerator does not seem to be "
"available" % accelerator)
+ def require_netdev(self, netdevname):
+ netdevhelp = run_cmd([self.qemu_bin,
+ '-M', 'none', '-netdev', 'help'])[0];
+ if netdevhelp.find('\n' + netdevname + '\n') < 0:
+ self.cancel('no support for user networking')
+
def _new_vm(self, name, *args):
self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
@@ -512,7 +518,7 @@ class LinuxDistro:
class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
"""Facilitates having a cloud-image Linux based available.
- For tests that indent to interact with guests, this is a better choice
+ For tests that intend to interact with guests, this is a better choice
to start with than the more vanilla `QemuSystemTest` class.
"""
@@ -550,6 +556,7 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
super().setUp()
+ self.require_netdev('user')
self._set_distro()
self.vm.add_args('-smp', self.smp)
self.vm.add_args('-m', self.memory)
diff --git a/tests/avocado/info_usernet.py b/tests/avocado/info_usernet.py
index dc01f74150..b862a47dba 100644
--- a/tests/avocado/info_usernet.py
+++ b/tests/avocado/info_usernet.py
@@ -16,6 +16,7 @@ from qemu.utils import get_info_usernet_hostfwd_port
class InfoUsernet(QemuSystemTest):
def test_hostfwd(self):
+ self.require_netdev('user')
self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22')
self.vm.launch()
res = self.vm.command('human-monitor-command',
diff --git a/tests/avocado/migration.py b/tests/avocado/migration.py
index 584d6ef53f..4b25680c50 100644
--- a/tests/avocado/migration.py
+++ b/tests/avocado/migration.py
@@ -14,7 +14,7 @@ import tempfile
from avocado_qemu import QemuSystemTest
from avocado import skipUnless
-from avocado.utils import network
+from avocado.utils.network import ports
from avocado.utils import wait
from avocado.utils.path import find_command
@@ -57,7 +57,7 @@ class Migration(QemuSystemTest):
self.assert_migration(source_vm, dest_vm)
def _get_free_port(self):
- port = network.find_free_port()
+ port = ports.find_free_port()
if port is None:
self.cancel('Failed to find a free port')
return port
diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py
index e1f9981a34..a76dd507fc 100644
--- a/tests/avocado/replay_linux.py
+++ b/tests/avocado/replay_linux.py
@@ -55,6 +55,7 @@ class ReplayLinux(LinuxTest):
'%s,drive=disk%s-rr%s' % (device, id, bus_string))
def launch_and_wait(self, record, args, shift):
+ self.require_netdev('user')
vm = self.get_vm()
vm.add_args('-smp', '1')
vm.add_args('-m', '1024')
diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index b7240a15c8..88acf8dc25 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -232,7 +232,7 @@ static void stress(unsigned long long ramsizeGB, int ncpus)
static int mount_misc(const char *fstype, const char *dir)
{
- if (mkdir(dir, 0755) < 0 && errno != EEXIST) {
+ if (g_mkdir_with_parents(dir, 0755) < 0 && errno != EEXIST) {
fprintf(stderr, "%s (%05d): ERROR: cannot create %s: %s\n",
argv0, gettid(), dir, strerror(errno));
return -1;
diff --git a/tests/qtest/ac97-test.c b/tests/qtest/ac97-test.c
index b084e31bff..74103efdfa 100644
--- a/tests/qtest/ac97-test.c
+++ b/tests/qtest/ac97-test.c
@@ -28,7 +28,7 @@ static void *ac97_get_driver(void *obj, const char *interface)
return &ac97->dev;
}
- fprintf(stderr, "%s not present in e1000e\n", interface);
+ fprintf(stderr, "%s not present in ac97\n", interface);
g_assert_not_reached();
}
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 7c5f736b51..36783966b0 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1461,6 +1461,7 @@ static void test_acpi_piix4_tcg_acpi_hmat(void)
test_acpi_tcg_acpi_hmat(MACHINE_PC);
}
+#ifdef CONFIG_POSIX
static void test_acpi_erst(const char *machine)
{
gchar *tmp_path = g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL);
@@ -1511,6 +1512,7 @@ static void test_acpi_microvm_acpi_erst(void)
g_free(tmp_path);
free_test_data(&data);
}
+#endif /* CONFIG_POSIX */
static void test_acpi_virt_tcg(void)
{
@@ -1551,6 +1553,7 @@ static void test_acpi_q35_viot(void)
free_test_data(&data);
}
+#ifdef CONFIG_POSIX
static void test_acpi_q35_cxl(void)
{
gchar *tmp_path = g_dir_make_tmp("qemu-test-cxl.XXXXXX", NULL);
@@ -1593,6 +1596,7 @@ static void test_acpi_q35_cxl(void)
g_free(tmp_path);
free_test_data(&data);
}
+#endif /* CONFIG_POSIX */
static void test_acpi_virt_viot(void)
{
@@ -1805,8 +1809,10 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
+#ifdef CONFIG_POSIX
qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_acpi_erst);
qtest_add_func("acpi/q35/acpierst", test_acpi_q35_acpi_erst);
+#endif
qtest_add_func("acpi/q35/applesmc", test_acpi_q35_applesmc);
qtest_add_func("acpi/q35/pvpanic-isa", test_acpi_q35_pvpanic_isa);
qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
@@ -1818,7 +1824,9 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs);
if (strcmp(arch, "x86_64") == 0) {
qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+#ifdef CONFIG_POSIX
qtest_add_func("acpi/microvm/acpierst", test_acpi_microvm_acpi_erst);
+#endif
}
}
if (has_kvm) {
@@ -1826,7 +1834,9 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
}
qtest_add_func("acpi/q35/viot", test_acpi_q35_viot);
+#ifdef CONFIG_POSIX
qtest_add_func("acpi/q35/cxl", test_acpi_q35_cxl);
+#endif
qtest_add_func("acpi/q35/slic", test_acpi_q35_slic);
} else if (strcmp(arch, "aarch64") == 0) {
if (has_tcg) {
diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
index a7766a9e65..26a2400181 100644
--- a/tests/qtest/cdrom-test.c
+++ b/tests/qtest/cdrom-test.c
@@ -52,7 +52,7 @@ static int prepare_image(const char *arch, char *isoimage)
perror("Error creating temporary iso image file");
return -1;
}
- if (!mkdtemp(srcdir)) {
+ if (!g_mkdtemp(srcdir)) {
perror("Error creating temporary directory");
goto cleanup;
}
diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c
index 2133e973f4..2e14da7dee 100644
--- a/tests/qtest/cxl-test.c
+++ b/tests/qtest/cxl-test.c
@@ -89,13 +89,14 @@ static void cxl_2root_port(void)
qtest_end();
}
+#ifdef CONFIG_POSIX
static void cxl_t3d(void)
{
g_autoptr(GString) cmdline = g_string_new(NULL);
char template[] = "/tmp/cxl-test-XXXXXX";
const char *tmpfs;
- tmpfs = mkdtemp(template);
+ tmpfs = g_mkdtemp(template);
g_string_printf(cmdline, QEMU_PXB_CMD QEMU_RP QEMU_T3D, tmpfs, tmpfs);
@@ -109,7 +110,7 @@ static void cxl_1pxb_2rp_2t3d(void)
char template[] = "/tmp/cxl-test-XXXXXX";
const char *tmpfs;
- tmpfs = mkdtemp(template);
+ tmpfs = g_mkdtemp(template);
g_string_printf(cmdline, QEMU_PXB_CMD QEMU_2RP QEMU_2T3D,
tmpfs, tmpfs, tmpfs, tmpfs);
@@ -124,7 +125,7 @@ static void cxl_2pxb_4rp_4t3d(void)
char template[] = "/tmp/cxl-test-XXXXXX";
const char *tmpfs;
- tmpfs = mkdtemp(template);
+ tmpfs = g_mkdtemp(template);
g_string_printf(cmdline, QEMU_2PXB_CMD QEMU_4RP QEMU_4T3D,
tmpfs, tmpfs, tmpfs, tmpfs, tmpfs, tmpfs,
@@ -133,6 +134,7 @@ static void cxl_2pxb_4rp_4t3d(void)
qtest_start(cmdline->str);
qtest_end();
}
+#endif /* CONFIG_POSIX */
int main(int argc, char **argv)
{
@@ -144,8 +146,10 @@ int main(int argc, char **argv)
qtest_add_func("/pci/cxl/pxb_x2_with_window", cxl_2pxb_with_window);
qtest_add_func("/pci/cxl/rp", cxl_root_port);
qtest_add_func("/pci/cxl/rp_x2", cxl_2root_port);
+#ifdef CONFIG_POSIX
qtest_add_func("/pci/cxl/type3_device", cxl_t3d);
qtest_add_func("/pci/cxl/rp_x2_type3_x2", cxl_1pxb_2rp_2t3d);
qtest_add_func("/pci/cxl/pxb_x2_root_port_x4_type3_x4", cxl_2pxb_4rp_4t3d);
+#endif
return g_test_run();
}
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 2e3137843e..a1fb99c8ff 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -95,7 +95,7 @@ static void test_pci_unplug_json_request(void)
}
QTestState *qtest = qtest_initf(
- "%s -device '{\"driver\": \"virtio-mouse-pci\", \"id\": \"dev0\"}'",
+ "%s -device \"{'driver': 'virtio-mouse-pci', 'id': 'dev0'}\"",
machine_addition);
/*
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index c98779c7c0..4cdd8238f2 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -31,7 +31,7 @@
#include "qemu/iov.h"
#include "qemu/module.h"
#include "qemu/bitops.h"
-#include "libqos/malloc.h"
+#include "libqos/libqos-malloc.h"
#include "libqos/e1000e.h"
static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *alloc)
diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index 447ffe8178..afc1d20355 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -994,16 +994,16 @@ static GString *generic_fuzz_predefined_config_cmdline(FuzzTarget *t)
g_assert(t->opaque);
config = t->opaque;
- setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1);
+ g_setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1);
if (config->argfunc) {
args = config->argfunc();
- setenv("QEMU_FUZZ_ARGS", args, 1);
+ g_setenv("QEMU_FUZZ_ARGS", args, 1);
g_free(args);
} else {
g_assert_nonnull(config->args);
- setenv("QEMU_FUZZ_ARGS", config->args, 1);
+ g_setenv("QEMU_FUZZ_ARGS", config->args, 1);
}
- setenv("QEMU_FUZZ_OBJECTS", config->objects, 1);
+ g_setenv("QEMU_FUZZ_OBJECTS", config->objects, 1);
return generic_fuzz_cmdline(t);
}
diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h
index 004c701915..0775e6702b 100644
--- a/tests/qtest/fuzz/generic_fuzz_configs.h
+++ b/tests/qtest/fuzz/generic_fuzz_configs.h
@@ -21,7 +21,7 @@ typedef struct generic_fuzz_config {
static inline gchar *generic_fuzzer_virtio_9p_args(void){
char tmpdir[] = "/tmp/qemu-fuzz.XXXXXX";
- g_assert_nonnull(mkdtemp(tmpdir));
+ g_assert_nonnull(g_mkdtemp(tmpdir));
return g_strdup_printf("-machine q35 -nodefaults "
"-device virtio-9p,fsdev=hshare,mount_tag=hshare "
diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c
index c856d3d500..3a3d9c16dd 100644
--- a/tests/qtest/fuzz/qos_fuzz.c
+++ b/tests/qtest/fuzz/qos_fuzz.c
@@ -23,7 +23,7 @@
#include "qemu/main-loop.h"
#include "tests/qtest/libqtest.h"
-#include "tests/qtest/libqos/malloc.h"
+#include "tests/qtest/libqos/libqos-malloc.h"
#include "tests/qtest/libqos/qgraph.h"
#include "tests/qtest/libqos/qgraph_internal.h"
#include "tests/qtest/libqos/qos_external.h"
diff --git a/tests/qtest/i440fx-test.c b/tests/qtest/i440fx-test.c
index 6d7d4d8d8f..3890f1237c 100644
--- a/tests/qtest/i440fx-test.c
+++ b/tests/qtest/i440fx-test.c
@@ -278,6 +278,8 @@ static void test_i440fx_pam(gconstpointer opaque)
qtest_end();
}
+#ifndef _WIN32
+
#define BLOB_SIZE ((size_t)65536)
#define ISA_BIOS_MAXSZ ((size_t)(128 * 1024))
@@ -396,6 +398,8 @@ static void request_pflash(FirmwareTestFixture *fixture,
fixture->is_bios = false;
}
+#endif /* _WIN32 */
+
int main(int argc, char **argv)
{
TestData data;
@@ -406,8 +410,10 @@ int main(int argc, char **argv)
qtest_add_data_func("i440fx/defaults", &data, test_i440fx_defaults);
qtest_add_data_func("i440fx/pam", &data, test_i440fx_pam);
+#ifndef _WIN32
add_firmware_test("i440fx/firmware/bios", request_bios);
add_firmware_test("i440fx/firmware/pflash", request_pflash);
+#endif
return g_test_run();
}
diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c
index e23a97fa8e..9611d05eb5 100644
--- a/tests/qtest/ivshmem-test.c
+++ b/tests/qtest/ivshmem-test.c
@@ -481,8 +481,8 @@ int main(int argc, char **argv)
tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
g_assert(tmpshmem != MAP_FAILED);
/* server */
- if (mkdtemp(dir) == NULL) {
- g_error("mkdtemp: %s", g_strerror(errno));
+ if (g_mkdtemp(dir) == NULL) {
+ g_error("g_mkdtemp: %s", g_strerror(errno));
}
tmpdir = dir;
tmpserver = g_strconcat(tmpdir, "/server", NULL);
diff --git a/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c b/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c
index c8a3ea11eb..ab24add8eb 100644
--- a/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c
+++ b/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "sdhci.h"
diff --git a/tests/qtest/libqos/arm-imx25-pdk-machine.c b/tests/qtest/libqos/arm-imx25-pdk-machine.c
index 54d0c95330..8fe128fae8 100644
--- a/tests/qtest/libqos/arm-imx25-pdk-machine.c
+++ b/tests/qtest/libqos/arm-imx25-pdk-machine.c
@@ -20,7 +20,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "i2c.h"
diff --git a/tests/qtest/libqos/arm-n800-machine.c b/tests/qtest/libqos/arm-n800-machine.c
index ecd46b1daf..4e5afe0164 100644
--- a/tests/qtest/libqos/arm-n800-machine.c
+++ b/tests/qtest/libqos/arm-n800-machine.c
@@ -20,7 +20,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "i2c.h"
diff --git a/tests/qtest/libqos/arm-raspi2-machine.c b/tests/qtest/libqos/arm-raspi2-machine.c
index 0a2943440b..367c6c17a5 100644
--- a/tests/qtest/libqos/arm-raspi2-machine.c
+++ b/tests/qtest/libqos/arm-raspi2-machine.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "sdhci.h"
diff --git a/tests/qtest/libqos/arm-sabrelite-machine.c b/tests/qtest/libqos/arm-sabrelite-machine.c
index ec19a01660..94f6a20fc7 100644
--- a/tests/qtest/libqos/arm-sabrelite-machine.c
+++ b/tests/qtest/libqos/arm-sabrelite-machine.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "sdhci.h"
diff --git a/tests/qtest/libqos/arm-smdkc210-machine.c b/tests/qtest/libqos/arm-smdkc210-machine.c
index 4bff249ee8..9bbce924ea 100644
--- a/tests/qtest/libqos/arm-smdkc210-machine.c
+++ b/tests/qtest/libqos/arm-smdkc210-machine.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "sdhci.h"
diff --git a/tests/qtest/libqos/arm-virt-machine.c b/tests/qtest/libqos/arm-virt-machine.c
index 139eaba142..4e87405b58 100644
--- a/tests/qtest/libqos/arm-virt-machine.c
+++ b/tests/qtest/libqos/arm-virt-machine.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "virtio-mmio.h"
#include "generic-pcihost.h"
diff --git a/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c b/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c
index 3be80020a6..daac762a06 100644
--- a/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c
+++ b/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "../libqtest.h"
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "sdhci.h"
diff --git a/tests/qtest/libqos/e1000e.c b/tests/qtest/libqos/e1000e.c
index f87e0e84b2..fc14b07884 100644
--- a/tests/qtest/libqos/e1000e.c
+++ b/tests/qtest/libqos/e1000e.c
@@ -23,7 +23,7 @@
#include "qemu/iov.h"
#include "qemu/module.h"
#include "qemu/bitops.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "e1000e.h"
diff --git a/tests/qtest/libqos/generic-pcihost.h b/tests/qtest/libqos/generic-pcihost.h
index c693c769df..6493a8712a 100644
--- a/tests/qtest/libqos/generic-pcihost.h
+++ b/tests/qtest/libqos/generic-pcihost.h
@@ -14,7 +14,7 @@
#define LIBQOS_GENERIC_PCIHOST_H
#include "pci.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
typedef struct QGenericPCIBus {
diff --git a/tests/qtest/libqos/malloc.c b/tests/qtest/libqos/libqos-malloc.c
index f0c8f950c8..d7566972c4 100644
--- a/tests/qtest/libqos/malloc.c
+++ b/tests/qtest/libqos/libqos-malloc.c
@@ -11,7 +11,7 @@
*/
#include "qemu/osdep.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qemu/host-utils.h"
typedef struct MemBlock {
diff --git a/tests/qtest/libqos/malloc.h b/tests/qtest/libqos/libqos-malloc.h
index bbb8c743cc..bbb8c743cc 100644
--- a/tests/qtest/libqos/malloc.h
+++ b/tests/qtest/libqos/libqos-malloc.h
diff --git a/tests/qtest/libqos/libqos.c b/tests/qtest/libqos/libqos.c
index 85c7641add..5ffda080ec 100644
--- a/tests/qtest/libqos/libqos.c
+++ b/tests/qtest/libqos/libqos.c
@@ -1,6 +1,4 @@
#include "qemu/osdep.h"
-#include <sys/wait.h>
-
#include "../libqtest.h"
#include "libqos.h"
#include "pci.h"
diff --git a/tests/qtest/libqos/libqos.h b/tests/qtest/libqos/libqos.h
index ba7df448ca..9b4dd509f0 100644
--- a/tests/qtest/libqos/libqos.h
+++ b/tests/qtest/libqos/libqos.h
@@ -3,7 +3,7 @@
#include "../libqtest.h"
#include "pci.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
typedef struct QOSState QOSState;
diff --git a/tests/qtest/libqos/malloc-pc.h b/tests/qtest/libqos/malloc-pc.h
index d8d79853c8..e531473601 100644
--- a/tests/qtest/libqos/malloc-pc.h
+++ b/tests/qtest/libqos/malloc-pc.h
@@ -13,7 +13,7 @@
#ifndef LIBQOS_MALLOC_PC_H
#define LIBQOS_MALLOC_PC_H
-#include "malloc.h"
+#include "libqos-malloc.h"
void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags);
diff --git a/tests/qtest/libqos/malloc-spapr.h b/tests/qtest/libqos/malloc-spapr.h
index f99572fd71..f544c0d611 100644
--- a/tests/qtest/libqos/malloc-spapr.h
+++ b/tests/qtest/libqos/malloc-spapr.h
@@ -8,7 +8,7 @@
#ifndef LIBQOS_MALLOC_SPAPR_H
#define LIBQOS_MALLOC_SPAPR_H
-#include "malloc.h"
+#include "libqos-malloc.h"
void spapr_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags);
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
index fd5d6e5ae1..cff83c86d9 100644
--- a/tests/qtest/libqos/meson.build
+++ b/tests/qtest/libqos/meson.build
@@ -6,7 +6,7 @@ libqos_srcs = files(
'qos_external.c',
'pci.c',
'fw_cfg.c',
- 'malloc.c',
+ 'libqos-malloc.c',
'libqos.c',
'sdhci-cmd.c',
diff --git a/tests/qtest/libqos/pci-pc.h b/tests/qtest/libqos/pci-pc.h
index 49ec9507f2..849bd493de 100644
--- a/tests/qtest/libqos/pci-pc.h
+++ b/tests/qtest/libqos/pci-pc.h
@@ -14,7 +14,7 @@
#define LIBQOS_PCI_PC_H
#include "pci.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
typedef struct QPCIBusPC {
diff --git a/tests/qtest/libqos/pci-spapr.h b/tests/qtest/libqos/pci-spapr.h
index 20a43718b7..3dbf1e58ae 100644
--- a/tests/qtest/libqos/pci-spapr.h
+++ b/tests/qtest/libqos/pci-spapr.h
@@ -8,7 +8,7 @@
#ifndef LIBQOS_PCI_SPAPR_H
#define LIBQOS_PCI_SPAPR_H
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "pci.h"
#include "qgraph.h"
diff --git a/tests/qtest/libqos/qgraph.h b/tests/qtest/libqos/qgraph.h
index 871740c0dc..6e94824d09 100644
--- a/tests/qtest/libqos/qgraph.h
+++ b/tests/qtest/libqos/qgraph.h
@@ -21,7 +21,7 @@
#include <gmodule.h>
#include "qemu/module.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
/* maximum path length */
#define QOS_PATH_MAX_ELEMENT_SIZE 50
diff --git a/tests/qtest/libqos/qos_external.c b/tests/qtest/libqos/qos_external.c
index b7a0b873a3..c6bb8bff09 100644
--- a/tests/qtest/libqos/qos_external.c
+++ b/tests/qtest/libqos/qos_external.c
@@ -24,7 +24,7 @@
#include "qapi/qmp/qstring.h"
#include "qemu/module.h"
#include "qapi/qmp/qlist.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "qgraph_internal.h"
#include "qos_external.h"
diff --git a/tests/qtest/libqos/qos_external.h b/tests/qtest/libqos/qos_external.h
index 8446e3df0b..ea37364887 100644
--- a/tests/qtest/libqos/qos_external.h
+++ b/tests/qtest/libqos/qos_external.h
@@ -21,7 +21,7 @@
#include "qgraph.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qapi/qapi-types-machine.h"
#include "qapi/qapi-types-qom.h"
diff --git a/tests/qtest/libqos/rtas.h b/tests/qtest/libqos/rtas.h
index f38f99dfab..be8353d505 100644
--- a/tests/qtest/libqos/rtas.h
+++ b/tests/qtest/libqos/rtas.h
@@ -5,7 +5,7 @@
#ifndef LIBQOS_RTAS_H
#define LIBQOS_RTAS_H
-#include "malloc.h"
+#include "libqos-malloc.h"
int qrtas_get_time_of_day(QTestState *qts, QGuestAllocator *alloc,
struct tm *tm, uint32_t *ns);
diff --git a/tests/qtest/libqos/virtio-9p.c b/tests/qtest/libqos/virtio-9p.c
index 70aea8bf62..ae9b0a20e2 100644
--- a/tests/qtest/libqos/virtio-9p.c
+++ b/tests/qtest/libqos/virtio-9p.c
@@ -48,9 +48,9 @@ void virtio_9p_create_local_test_dir(void)
*/
char *template = concat_path(pwd, "qtest-9p-local-XXXXXX");
- local_test_path = mkdtemp(template);
+ local_test_path = g_mkdtemp(template);
if (!local_test_path) {
- g_test_message("mkdtemp('%s') failed: %s", template, strerror(errno));
+ g_test_message("g_mkdtemp('%s') failed: %s", template, strerror(errno));
}
g_assert(local_test_path != NULL);
diff --git a/tests/qtest/libqos/virtio-mmio.c b/tests/qtest/libqos/virtio-mmio.c
index a6cca8613b..bd0b1d890b 100644
--- a/tests/qtest/libqos/virtio-mmio.c
+++ b/tests/qtest/libqos/virtio-mmio.c
@@ -12,7 +12,7 @@
#include "qemu/module.h"
#include "virtio.h"
#include "virtio-mmio.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "qgraph.h"
#include "standard-headers/linux/virtio_ring.h"
diff --git a/tests/qtest/libqos/virtio-pci.c b/tests/qtest/libqos/virtio-pci.c
index 67c2498c84..485b8f6b7e 100644
--- a/tests/qtest/libqos/virtio-pci.c
+++ b/tests/qtest/libqos/virtio-pci.c
@@ -13,7 +13,7 @@
#include "virtio-pci.h"
#include "pci.h"
#include "pci-pc.h"
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "malloc-pc.h"
#include "qgraph.h"
#include "standard-headers/linux/virtio_ring.h"
diff --git a/tests/qtest/libqos/virtio.h b/tests/qtest/libqos/virtio.h
index b8bd06e1b8..7adc7cbd10 100644
--- a/tests/qtest/libqos/virtio.h
+++ b/tests/qtest/libqos/virtio.h
@@ -10,7 +10,7 @@
#ifndef LIBQOS_VIRTIO_H
#define LIBQOS_VIRTIO_H
-#include "malloc.h"
+#include "libqos-malloc.h"
#include "standard-headers/linux/virtio_ring.h"
#define QVIRTIO_F_BAD_FEATURE 0x40000000ull
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 8c159eacf5..7c9fc07de4 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -393,7 +393,7 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
char *sock_path, sock_dir[] = "/tmp/qtest-serial-XXXXXX";
QTestState *qts;
- g_assert_true(mkdtemp(sock_dir) != NULL);
+ g_assert_true(g_mkdtemp(sock_dir) != NULL);
sock_path = g_strdup_printf("%s/sock", sock_dir);
sock_fd_init = init_socket(sock_path);
@@ -1424,7 +1424,7 @@ QTestState *qtest_inproc_init(QTestState **s, bool log, const char* arch,
* way, qtest_get_arch works for inproc qtest.
*/
gchar *bin_path = g_strconcat("/qemu-system-", arch, NULL);
- setenv("QTEST_QEMU_BINARY", bin_path, 0);
+ g_setenv("QTEST_QEMU_BINARY", bin_path, 0);
g_free(bin_path);
return qts;
diff --git a/tests/qtest/m48t59-test.c b/tests/qtest/m48t59-test.c
index b94a1230f7..843d2ced8e 100644
--- a/tests/qtest/m48t59-test.c
+++ b/tests/qtest/m48t59-test.c
@@ -137,7 +137,7 @@ static void cmos_get_date_time(QTestState *s, struct tm *date)
date->tm_mday = mday;
date->tm_mon = mon - 1;
date->tm_year = base_year + year - 1900;
-#ifndef __sun__
+#if !defined(__sun__) && !defined(_WIN32)
date->tm_gmtoff = 0;
#endif
diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-test.c
index f92fab479f..31cc0bfb01 100644
--- a/tests/qtest/machine-none-test.c
+++ b/tests/qtest/machine-none-test.c
@@ -81,7 +81,7 @@ static void test_machine_cpu_cli(void)
" add it to cpus_map\n", arch);
return; /* TODO: die here to force all targets have a test */
}
- qts = qtest_initf("-machine none -cpu '%s'", cpu_model);
+ qts = qtest_initf("-machine none -cpu \"%s\"", cpu_model);
response = qtest_qmp(qts, "{ 'execute': 'quit' }");
g_assert(qdict_haskey(response, "return"));
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index be4b30dea2..e910cb32ca 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -71,7 +71,8 @@ qtests_i386 = \
(config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \
(config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \
(config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \
- (config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \
+ (config_host.has_key('CONFIG_POSIX') and \
+ config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \
(config_all_devices.has_key('CONFIG_VIRTIO_NET') and \
config_all_devices.has_key('CONFIG_Q35') and \
config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \
@@ -239,7 +240,6 @@ qos_test_ss.add(
'adm1272-test.c',
'ds1338-test.c',
'e1000-test.c',
- 'e1000e-test.c',
'eepro100-test.c',
'es1370-test.c',
'ipoctal232-test.c',
@@ -267,6 +267,9 @@ qos_test_ss.add(
'virtio-iommu-test.c',
'vmxnet3-test.c',
)
+if config_host.has_key('CONFIG_POSIX')
+ qos_test_ss.add(files('e1000e-test.c'))
+endif
if have_virtfs
qos_test_ss.add(files('virtio-9p-test.c'))
endif
diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index c6fbeb3974..f6f3c6680f 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -34,6 +34,7 @@ static void check_stop_event(QTestState *who)
}
}
+#ifndef _WIN32
/*
* Events can get in the way of responses we are actually waiting for.
*/
@@ -58,6 +59,7 @@ QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...)
return ret;
}
+#endif
/*
* Events can get in the way of responses we are actually waiting for.
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index 59561898d0..db0684de48 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -17,8 +17,10 @@
extern bool got_stop;
+#ifndef _WIN32
G_GNUC_PRINTF(3, 4)
QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...);
+#endif
G_GNUC_PRINTF(2, 3)
QDict *wait_command(QTestState *who, const char *command, ...);
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index f63edd0bc8..4728d528bb 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -761,14 +761,14 @@ test_migrate_tls_psk_start_common(QTestState *from,
data->workdir = g_strdup_printf("%s/tlscredspsk0", tmpfs);
data->pskfile = g_strdup_printf("%s/%s", data->workdir,
QCRYPTO_TLS_CREDS_PSKFILE);
- mkdir(data->workdir, 0700);
+ g_mkdir_with_parents(data->workdir, 0700);
test_tls_psk_init(data->pskfile);
if (mismatch) {
data->workdiralt = g_strdup_printf("%s/tlscredspskalt0", tmpfs);
data->pskfilealt = g_strdup_printf("%s/%s", data->workdiralt,
QCRYPTO_TLS_CREDS_PSKFILE);
- mkdir(data->workdiralt, 0700);
+ g_mkdir_with_parents(data->workdiralt, 0700);
test_tls_psk_init_alt(data->pskfilealt);
}
@@ -873,12 +873,20 @@ test_migrate_tls_x509_start_common(QTestState *from,
data->clientcert = g_strdup_printf("%s/client-cert.pem", data->workdir);
}
- mkdir(data->workdir, 0700);
+ g_mkdir_with_parents(data->workdir, 0700);
test_tls_init(data->keyfile);
+#ifndef _WIN32
g_assert(link(data->keyfile, data->serverkey) == 0);
+#else
+ g_assert(CreateHardLink(data->serverkey, data->keyfile, NULL) != 0);
+#endif
if (args->clientcert) {
+#ifndef _WIN32
g_assert(link(data->keyfile, data->clientkey) == 0);
+#else
+ g_assert(CreateHardLink(data->clientkey, data->keyfile, NULL) != 0);
+#endif
}
TLS_ROOT_REQ_SIMPLE(cacertreq, data->cacert);
@@ -1623,6 +1631,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_client(void)
#endif /* CONFIG_TASN1 */
#endif /* CONFIG_GNUTLS */
+#ifndef _WIN32
static void *test_migrate_fd_start_hook(QTestState *from,
QTestState *to)
{
@@ -1691,6 +1700,7 @@ static void test_migrate_fd_proto(void)
};
test_precopy_common(&args);
}
+#endif /* _WIN32 */
static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
{
@@ -2452,9 +2462,9 @@ int main(int argc, char **argv)
return g_test_run();
}
- tmpfs = mkdtemp(template);
+ tmpfs = g_mkdtemp(template);
if (!tmpfs) {
- g_test_message("mkdtemp on path (%s): %s", template, strerror(errno));
+ g_test_message("g_mkdtemp on path (%s): %s", template, strerror(errno));
}
g_assert(tmpfs);
@@ -2523,7 +2533,9 @@ int main(int argc, char **argv)
#endif /* CONFIG_GNUTLS */
/* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */
+#ifndef _WIN32
qtest_add_func("/migration/fd_proto", test_migrate_fd_proto);
+#endif
qtest_add_func("/migration/validate_uuid", test_validate_uuid);
qtest_add_func("/migration/validate_uuid_error", test_validate_uuid_error);
qtest_add_func("/migration/validate_uuid_src_not_set",
diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
index a353fef0ca..c373d24e1e 100644
--- a/tests/qtest/npcm7xx_emc-test.c
+++ b/tests/qtest/npcm7xx_emc-test.c
@@ -209,6 +209,7 @@ static int emc_module_index(const EMCModule *mod)
return diff;
}
+#ifndef _WIN32
static void packet_test_clear(void *sockets)
{
int *test_sockets = sockets;
@@ -243,6 +244,7 @@ static int *packet_test_init(int module_num, GString *cmd_line)
g_test_queue_destroy(packet_test_clear, test_sockets);
return test_sockets;
}
+#endif /* _WIN32 */
static uint32_t emc_read(QTestState *qts, const EMCModule *mod,
NPCM7xxPWMRegister regno)
@@ -250,6 +252,7 @@ static uint32_t emc_read(QTestState *qts, const EMCModule *mod,
return qtest_readl(qts, mod->base_addr + regno * sizeof(uint32_t));
}
+#ifndef _WIN32
static void emc_write(QTestState *qts, const EMCModule *mod,
NPCM7xxPWMRegister regno, uint32_t value)
{
@@ -339,6 +342,7 @@ static bool emc_soft_reset(QTestState *qts, const EMCModule *mod)
g_message("%s: Timeout expired", __func__);
return false;
}
+#endif /* _WIN32 */
/* Check emc registers are reset to default value. */
static void test_init(gconstpointer test_data)
@@ -387,6 +391,7 @@ static void test_init(gconstpointer test_data)
qtest_quit(qts);
}
+#ifndef _WIN32
static bool emc_wait_irq(QTestState *qts, const EMCModule *mod, int step,
bool is_tx)
{
@@ -843,6 +848,7 @@ static void test_rx(gconstpointer test_data)
qtest_quit(qts);
}
+#endif /* _WIN32 */
static void emc_add_test(const char *name, const TestData* td,
GTestDataFunc fn)
@@ -865,8 +871,10 @@ int main(int argc, char **argv)
td->module = &emc_module_list[i];
add_test(init, td);
+#ifndef _WIN32
add_test(tx, td);
add_test(rx, td);
+#endif
}
return g_test_run();
diff --git a/tests/qtest/prom-env-test.c b/tests/qtest/prom-env-test.c
index c2b0448e55..39ccb59797 100644
--- a/tests/qtest/prom-env-test.c
+++ b/tests/qtest/prom-env-test.c
@@ -58,8 +58,8 @@ static void test_machine(const void *machine)
" -machine " PSERIES_DEFAULT_CAPABILITIES;
}
- qts = qtest_initf("-M %s -accel tcg %s -prom-env 'use-nvramrc?=true' "
- "-prom-env 'nvramrc=%x %x l!' ", (const char *)machine,
+ qts = qtest_initf("-M %s -accel tcg %s -prom-env \"use-nvramrc?=true\" "
+ "-prom-env \"nvramrc=%x %x l!\" ", (const char *)machine,
extra_args, MAGIC, ADDRESS);
check_guest_memory(qts);
qtest_quit(qts);
diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c
index 9a42480cef..bf7304c7dc 100644
--- a/tests/qtest/qmp-test.c
+++ b/tests/qtest/qmp-test.c
@@ -166,8 +166,8 @@ char *fifo_name;
static void setup_blocking_cmd(void)
{
- if (!mkdtemp(tmpdir)) {
- g_error("mkdtemp: %s", strerror(errno));
+ if (!g_mkdtemp(tmpdir)) {
+ g_error("g_mkdtemp: %s", strerror(errno));
}
fifo_name = g_strdup_printf("%s/fifo", tmpdir);
if (mkfifo(fifo_name, 0666)) {
diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c
index f97d0a08fd..831db5cf2a 100644
--- a/tests/qtest/qos-test.c
+++ b/tests/qtest/qos-test.c
@@ -25,7 +25,7 @@
#include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-visit-machine.h"
#include "qapi/qapi-visit-qom.h"
-#include "libqos/malloc.h"
+#include "libqos/libqos-malloc.h"
#include "libqos/qgraph.h"
#include "libqos/qgraph_internal.h"
#include "libqos/qos_external.h"
diff --git a/tests/qtest/rtc-test.c b/tests/qtest/rtc-test.c
index 8126ab1bdb..02ed4e1238 100644
--- a/tests/qtest/rtc-test.c
+++ b/tests/qtest/rtc-test.c
@@ -111,7 +111,7 @@ static void cmos_get_date_time(struct tm *date)
date->tm_mday = mday;
date->tm_mon = mon - 1;
date->tm_year = base_year + year - 1900;
-#ifndef __sun__
+#if !defined(__sun__) && !defined(_WIN32)
date->tm_gmtoff = 0;
#endif
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 8bf390be20..d7d6cfc9bd 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -491,9 +491,9 @@ static TestServer *test_server_new(const gchar *name,
/* run the main loop thread so the chardev may operate */
server->thread = g_thread_new(NULL, thread_function, server->loop);
- tmpfs = mkdtemp(template);
+ tmpfs = g_mkdtemp(template);
if (!tmpfs) {
- g_test_message("mkdtemp on path (%s): %s", template, strerror(errno));
+ g_test_message("g_mkdtemp on path (%s): %s", template, strerror(errno));
}
g_assert(tmpfs);
diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
index aab4149b56..3c25d75ca1 100644
--- a/tests/unit/test-crypto-tlscredsx509.c
+++ b/tests/unit/test-crypto-tlscredsx509.c
@@ -75,7 +75,7 @@ static void test_tls_creds(const void *opaque)
QCryptoTLSCreds *creds;
#define CERT_DIR "tests/test-crypto-tlscredsx509-certs/"
- mkdir(CERT_DIR, 0700);
+ g_mkdir_with_parents(CERT_DIR, 0700);
unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
if (data->isServer) {
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
- mkdir(WORKDIR, 0700);
+ g_mkdir_with_parents(WORKDIR, 0700);
test_tls_init(KEYFILE);
diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c
index f222959d36..615a1344b4 100644
--- a/tests/unit/test-crypto-tlssession.c
+++ b/tests/unit/test-crypto-tlssession.c
@@ -249,8 +249,8 @@ static void test_crypto_tls_session_x509(const void *opaque)
#define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/"
#define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/"
- mkdir(CLIENT_CERT_DIR, 0700);
- mkdir(SERVER_CERT_DIR, 0700);
+ g_mkdir_with_parents(CLIENT_CERT_DIR, 0700);
+ g_mkdir_with_parents(SERVER_CERT_DIR, 0700);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
@@ -398,7 +398,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
- mkdir(WORKDIR, 0700);
+ g_mkdir_with_parents(WORKDIR, 0700);
test_tls_init(KEYFILE);
test_tls_psk_init(PSKFILE);
diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c
index f6fb988c01..cc39247556 100644
--- a/tests/unit/test-io-channel-tls.c
+++ b/tests/unit/test-io-channel-tls.c
@@ -125,8 +125,8 @@ static void test_io_channel_tls(const void *opaque)
#define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/"
#define SERVER_CERT_DIR "tests/test-io-channel-tls-server/"
- mkdir(CLIENT_CERT_DIR, 0700);
- mkdir(SERVER_CERT_DIR, 0700);
+ g_mkdir_with_parents(CLIENT_CERT_DIR, 0700);
+ g_mkdir_with_parents(SERVER_CERT_DIR, 0700);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
@@ -273,7 +273,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
- mkdir(WORKDIR, 0700);
+ g_mkdir_with_parents(WORKDIR, 0700);
test_tls_init(KEYFILE);
diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index b27c77a695..a05a4628ed 100644
--- a/tests/unit/test-qga.c
+++ b/tests/unit/test-qga.c
@@ -60,7 +60,7 @@ fixture_setup(TestFixture *fixture, gconstpointer data, gchar **envp)
fixture->loop = g_main_loop_new(NULL, FALSE);
fixture->test_dir = g_strdup("/tmp/qgatest.XXXXXX");
- g_assert_nonnull(mkdtemp(fixture->test_dir));
+ g_assert_nonnull(g_mkdtemp(fixture->test_dir));
path = g_build_filename(fixture->test_dir, "sock", NULL);
cwd = g_get_current_dir();
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index cd1fabde52..3643fe325d 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -63,6 +63,9 @@ class FreeBSDVM(basevm.BaseVM):
# libs: migration
"zstd",
+
+ # libs: networking
+ "libslirp",
]
BUILD_SCRIPT = """
diff --git a/tests/vm/haiku.x86_64 b/tests/vm/haiku.x86_64
index 936f7d2ae2..29668bc272 100755
--- a/tests/vm/haiku.x86_64
+++ b/tests/vm/haiku.x86_64
@@ -71,6 +71,7 @@ class HaikuVM(basevm.BaseVM):
"devel:libpixman_1",
"devel:libpng16",
"devel:libsdl2_2.0",
+ "devel:libslirp",
"devel:libsnappy",
"devel:libssh2",
"devel:libtasn1",
@@ -89,7 +90,7 @@ class HaikuVM(basevm.BaseVM):
mkdir -p /usr/bin
ln -s /boot/system/bin/env /usr/bin/env
cd ../build
- ../src/configure --disable-slirp {configure_opts};
+ ../src/configure {configure_opts};
make --output-sync -j{jobs} {target} {verbose};
"""
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index aa883ec23c..da6773ff59 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -54,6 +54,9 @@ class NetBSDVM(basevm.BaseVM):
# libs: migration
"zstd",
+
+ # libs: networking
+ "libslirp",
]
BUILD_SCRIPT = """