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>
This commit is contained in:
Stefan Hajnoczi
2022-08-31 18:19:03 -04:00
66 changed files with 144 additions and 79 deletions
+2 -2
View File
@@ -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'
+4
View File
@@ -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
+1 -1
View File
@@ -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.
+8 -1
View File
@@ -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)
+1
View File
@@ -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',
+2 -2
View File
@@ -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
+1
View File
@@ -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')
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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();
}
+10
View File
@@ -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) {
+1 -1
View File
@@ -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;
}
+7 -3
View File
@@ -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();
}
+1 -1
View File
@@ -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);
/*
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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);
}
+1 -1
View File
@@ -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 "
+1 -1
View File
@@ -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"
+6
View File
@@ -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();
}
+2 -2
View File
@@ -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);
@@ -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"

Some files were not shown because too many files have changed in this diff Show More