mbox series

[00/51] tests/qtest: Enable running qtest on Windows

Message ID 20220824094029.1634519-1-bmeng.cn@gmail.com (mailing list archive)
Headers show
Series tests/qtest: Enable running qtest on Windows | expand

Message

Bin Meng Aug. 24, 2022, 9:39 a.m. UTC
In prepartion to adding virtio-9p support on Windows, this series
enables running qtest on Windows, so that we can run the virtio-9p
tests on Windows to make sure it does not break accidently.

Patch 1-22 updates various components (mostly test cases) so that
they can build on Windows with the same functionality.

Patch 23 supports the qtest accelerator for Windows.

Patch 31 updates the libqtest core for Windows.

Patch 32-47 are the fixes of qtest errors exposed when running on Windows.

Patch 49 fixes the instability of running qtests on Windows.

Patch 50 updates the CI to run qtests on Windows.

Patch 51 documents best practices of writing portable test cases as
we learned during the enablement of running qtest on Windows.

Based-on: <20220802075200.907360-1-bmeng.cn@gmail.com>


Bin Meng (41):
  tests/qtest: Use g_setenv()
  tests/qtest: Use g_mkdtemp()
  block: Unify the get_tmp_filename() implementation
  semihosting/arm-compat-semi: Avoid using hardcoded /tmp
  tcg: Avoid using hardcoded /tmp
  util/qemu-sockets: Use g_get_tmp_dir() to get the directory for
    temporary files
  tests: Avoid using hardcoded /tmp in test cases
  block/vvfat: Unify the mkdir() call
  fsdev/virtfs-proxy-helper: Use g_mkdir_with_parents()
  hw/usb: dev-mtp: Use g_mkdir_with_parents()
  qga/commands-posix-ssh: Use g_mkdir_with_parents()
  tests: Use g_mkdir_with_parents()
  tests/qtest: migration-test: Handle link() for win32
  backends/tpm: Exclude headers and macros that don't exist on win32
  tests/qtest: Adapt {m48t59,rtc}-test cases for win32
  tests/qtest: Build e1000e-test for posix only
  tests/qtest: Build virtio-net-test for posix only
  tests/qtest: Build cases that use memory-backend-file for posix only
  tests/qtest: Build test-filter-{mirror,redirector} cases for posix
    only
  tests/qtest: i440fx-test: Skip running request_{bios,pflash} for win32
  tests/qtest: migration-test: Skip running test_migrate_fd_proto on
    win32
  tests/qtest: qmp-test: Skip running test_qmp_oob for win32
  tests/qtest: libqtest: Exclude the *_fds APIs for win32
  tests/qtest: libqtest: Install signal handler via signal()
  tests: Skip iotests and qtest when '--without-default-devices'
  tests/qtest: Support libqtest to build and run on Windows
  tests/qtest: Fix ERROR_SHARING_VIOLATION for win32
  tests/qtest: {ahci,ide}-test: Use relative path for temporary files
  tests/qtest: bios-tables-test: Adapt the case for win32
  tests/qtest: device-plug-test: Reverse the usage of double/single
    quotes
  tests/qtest: machine-none-test: Use double quotes to pass the cpu
    option
  tests/qtest: migration-test: Disable IO redirection for win32
  tests/qtest: npcm7xx_emc-test: Skip running test_{tx,rx} on win32
  tests/qtest: microbit-test: Fix socket access for win32
  tests/qtest: prom-env-test: Use double quotes to pass the prom-env
    option
  tests/qtest: libqtest: Replace the call to close a socket with
    closesocket()
  tests/qtest: libqtest: Correct the timeout unit of blocking receive
    calls for win32
  io/channel-watch: Drop a superfluous '#ifdef WIN32'
  io/channel-watch: Fix socket watch on Windows
  .gitlab-ci.d/windows.yml: Increase the timeout to the runner limit
  docs/devel: testing: Document writing portable test cases

Xuzhou Cheng (10):
  accel/qtest: Support qtest accelerator for Windows
  tests/qtest: libqos: Drop inclusion of <sys/wait.h>
  tests/qtest: libqos: Rename malloc.h to libqos-malloc.h
  tests/qtest: libqtest: Move global_qtest definition back to libqtest.c
  tests/qtest: Use send/recv for socket communication
  tests/qtest: {ahci,ide}-test: Open file in binary mode
  tests/qtest: virtio-net-failover: Disable migration tests for win32
  chardev/char-file: Add FILE_SHARE_WRITE when openning the file for
    win32
  tests/qtest: migration-test: Kill "to" after migration is canceled
  hw/ppc: spapr: Use qemu_vfree() to free spapr->htab

 docs/devel/testing.rst                        |  30 ++++
 backends/tpm/tpm_ioctl.h                      |   4 +
 include/hw/core/cpu.h                         |   1 +
 tests/qtest/fuzz/generic_fuzz_configs.h       |   8 +-
 tests/qtest/libqos/generic-pcihost.h          |   2 +-
 .../libqos/{malloc.h => libqos-malloc.h}      |   0
 tests/qtest/libqos/libqos.h                   |   2 +-
 tests/qtest/libqos/malloc-pc.h                |   2 +-
 tests/qtest/libqos/malloc-spapr.h             |   2 +-
 tests/qtest/libqos/pci-pc.h                   |   2 +-
 tests/qtest/libqos/pci-spapr.h                |   2 +-
 tests/qtest/libqos/qgraph.h                   |   2 +-
 tests/qtest/libqos/qos_external.h             |   2 +-
 tests/qtest/libqos/rtas.h                     |   2 +-
 tests/qtest/libqos/virtio.h                   |   2 +-
 tests/qtest/libqtest-single.h                 |   2 +-
 tests/qtest/libqtest.h                        |   8 +
 tests/qtest/migration-helpers.h               |   2 +
 accel/dummy-cpus.c                            |  14 +-
 block.c                                       |  16 +-
 block/vvfat.c                                 |   8 +-
 chardev/char-file.c                           |   4 +-
 fsdev/virtfs-proxy-helper.c                   |   2 +-
 hw/ppc/spapr.c                                |   2 +-
 hw/usb/dev-mtp.c                              |   2 +-
 io/channel-watch.c                            |   6 -
 qga/commands-posix-ssh.c                      |   2 +-
 semihosting/arm-compat-semi.c                 |   3 +-
 softmmu/cpus.c                                |   9 +-
 tcg/tcg.c                                     |   4 +-
 tests/migration/stress.c                      |   2 +-
 tests/qtest/ahci-test.c                       |  44 ++++-
 tests/qtest/aspeed_smc-test.c                 |   4 +-
 tests/qtest/bios-tables-test.c                |  22 ++-
 tests/qtest/boot-serial-test.c                |  21 ++-
 tests/qtest/cdrom-test.c                      |   2 +-
 tests/qtest/cxl-test.c                        |  19 +-
 tests/qtest/device-plug-test.c                |   2 +-
 tests/qtest/e1000e-test.c                     |   2 +-
 tests/qtest/fdc-test.c                        |   4 +-
 tests/qtest/fuzz/generic_fuzz.c               |   8 +-
 tests/qtest/fuzz/qos_fuzz.c                   |   2 +-
 tests/qtest/fuzz/virtio_blk_fuzz.c            |   2 +-
 tests/qtest/hd-geo-test.c                     |   8 +-
 tests/qtest/i440fx-test.c                     |   6 +
 tests/qtest/ide-test.c                        |  26 ++-
 tests/qtest/ivshmem-test.c                    |   4 +-
 tests/qtest/libqmp.c                          |   4 +-
 .../libqos/aarch64-xlnx-zcu102-machine.c      |   2 +-
 tests/qtest/libqos/arm-imx25-pdk-machine.c    |   2 +-
 tests/qtest/libqos/arm-n800-machine.c         |   2 +-
 tests/qtest/libqos/arm-raspi2-machine.c       |   2 +-
 tests/qtest/libqos/arm-sabrelite-machine.c    |   2 +-
 tests/qtest/libqos/arm-smdkc210-machine.c     |   2 +-
 tests/qtest/libqos/arm-virt-machine.c         |   2 +-
 .../qtest/libqos/arm-xilinx-zynq-a9-machine.c |   2 +-
 tests/qtest/libqos/e1000e.c                   |   2 +-
 .../libqos/{malloc.c => libqos-malloc.c}      |   2 +-
 tests/qtest/libqos/libqos.c                   |   2 -
 tests/qtest/libqos/qos_external.c             |   2 +-
 tests/qtest/libqos/virtio-9p.c                |   4 +-
 tests/qtest/libqos/virtio-mmio.c              |   2 +-
 tests/qtest/libqos/virtio-pci.c               |   2 +-
 tests/qtest/libqtest.c                        | 164 +++++++++++++++---
 tests/qtest/m48t59-test.c                     |   2 +-
 tests/qtest/machine-none-test.c               |   2 +-
 tests/qtest/microbit-test.c                   |  10 +-
 tests/qtest/migration-helpers.c               |   2 +
 tests/qtest/migration-test.c                  |  69 +++++---
 tests/qtest/npcm7xx_emc-test.c                |   8 +
 tests/qtest/pflash-cfi02-test.c               |   7 +-
 tests/qtest/prom-env-test.c                   |   4 +-
 tests/qtest/qmp-test.c                        |  14 +-
 tests/qtest/qos-test.c                        |   2 +-
 tests/qtest/rtc-test.c                        |   2 +-
 tests/qtest/vhost-user-blk-test.c             |   3 +-
 tests/qtest/vhost-user-test.c                 |   7 +-
 tests/qtest/virtio-blk-test.c                 |   2 +-
 tests/qtest/virtio-net-failover.c             |   9 +-
 tests/qtest/virtio-net-test.c                 |   6 -
 tests/qtest/virtio-scsi-test.c                |   3 +-
 tests/unit/test-crypto-tlscredsx509.c         |   4 +-
 tests/unit/test-crypto-tlssession.c           |   6 +-
 tests/unit/test-image-locking.c               |   6 +-
 tests/unit/test-io-channel-tls.c              |   6 +-
 tests/unit/test-qga.c                         |   4 +-
 tests/vhost-user-bridge.c                     |   3 +-
 util/qemu-sockets.c                           |   5 +-
 .gitlab-ci.d/windows.yml                      |   4 +-
 accel/meson.build                             |   1 +
 accel/qtest/meson.build                       |   1 +
 tests/qemu-iotests/meson.build                |   5 +
 tests/qtest/libqos/meson.build                |   2 +-
 tests/qtest/meson.build                       |  46 +++--
 94 files changed, 549 insertions(+), 221 deletions(-)
 rename tests/qtest/libqos/{malloc.h => libqos-malloc.h} (100%)
 rename tests/qtest/libqos/{malloc.c => libqos-malloc.c} (99%)