* Fix "readlink -f" problem in iotests on macOS (to fix the Cirrus-CI tests)

* Some minor qtest improvements
 * Fix the unit tests to work on MSYS2, too
 * Enable building and testing on MSYS2 in the Cirrus-CI
 * Build FreeBSD with one task again in the Cirrus-CI
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAl9h9e0RHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbXXMA/6AvNOOEgYeW+YrkIjMgh+jjgrmBK5FH0J
 REJiJ5CxQBh9v3gPV5ehWv4/R9pmaEPtbsZ4Bc1jmRwLHcAWIJ/JTYo11M4vTYa3
 IjS9+dlqgznzxZHFavwJ8USjcyeVjkqyaUTE7CNPgzE2b0237oQ8MHzFGlsHwGZV
 AiRhDHI0StCE3QeKICnpB91Us+KF/+UjZnCwSaC/SM8Sq+6LnTF0bEYYUH44SfZe
 AX3ax9kxzWFtzpXXh/3qL0gdGwiVqwv35V7MYpQWZJAPA3TdxVnUDE7/XP1RTOjL
 hhJLf6IqgPwbRWLszmYmTiUCDGE8kqO8wj5MkKlJcjLY9n4zv0ErOjy6Nhnr8b5Q
 TA9hjRfkRkUoquVRm7ZBOE9l2jIkWV9olxYFqBipqBMujSlt9T0seUi+eaY6NuAA
 Z8NOQslqi8xP7wN4Lw3DpGOfbeTvtOlDtA7O7HwwTChTlhCJX7FCoNmpqhCiFRpH
 s7VkNCXoc6l8NDI+Py5sjpRRHMQIsFWUCnZLWJQ+UJWZvfnNoLTM3ErdqzIasVLt
 vW/behHRd7L/hGMa7zNtQa+wv2bgXY/hbFFpNK6RUEaPBzUq3ZixFrMW2Fw6X7mg
 eIVPNrh/LloiJGQfpUuNkqiZ4vdgUeBq7Z89TCU49xskQAgHb0KglnveU42nP8Yf
 pO8OCBOjfJg=
 =ErBp
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-09-16' into staging

* Fix "readlink -f" problem in iotests on macOS (to fix the Cirrus-CI tests)
* Some minor qtest improvements
* Fix the unit tests to work on MSYS2, too
* Enable building and testing on MSYS2 in the Cirrus-CI
* Build FreeBSD with one task again in the Cirrus-CI

# gpg: Signature made Wed 16 Sep 2020 12:24:29 BST
# 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

* remotes/huth-gitlab/tags/pull-request-2020-09-16: (24 commits)
  cirrus: Building freebsd in a single shot
  ci: Enable msys2 ci in cirrus
  tests: Fixes test-qdev-global-props.c
  tests: fix test-util-sockets.c
  tests: Fixes test-io-channel-file by mask only owner file state mask bits
  tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c
  tests: Fixes test-io-channel-socket.c tests under msys2/mingw
  vmstate: Fixes test-vmstate.c on msys2/mingw
  meson: remove empty else and duplicated gio deps
  meson: Use -b to ignore CR vs. CR-LF issues on Windows
  osdep: file locking functions are not available on Win32
  tests: test-replication disable /replication/secondary/* on msys2/mingw.
  tests: Fixes test-replication.c on msys2/mingw.
  meson: disable crypto tests are empty under win32
  meson: Disable test-char on msys2/mingw for fixing tests stuck
  rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full
  tests: Convert g_free to g_autofree macro in test-logging.c
  rcu: Implement drain_call_rcu
  qga/commands-win32: Fix problem with redundant protype declaration
  Simplify the .gitignore file
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-09-17 13:38:08 +01:00
commit 5e0a8fda65
21 changed files with 207 additions and 215 deletions

View File

@ -1,38 +1,19 @@
env:
CIRRUS_CLONE_DEPTH: 1
freebsd_1st_task:
freebsd_12_task:
freebsd_instance:
image_family: freebsd-12-1
cpu: 4
memory: 4G
install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y
bash curl cyrus-sasl git glib gmake gnutls gsed
nettle perl5 pixman pkgconf png usbredir
cpu: 8
memory: 8G
install_script:
- ASSUME_ALWAYS_YES=yes pkg bootstrap -f ;
- pkg install -y bash curl cyrus-sasl git glib gmake gnutls gsed
nettle perl5 pixman pkgconf png usbredir
script:
- mkdir build
- cd build
- ../configure --disable-user --target-list-exclude='alpha-softmmu
ppc64-softmmu ppc-softmmu riscv32-softmmu riscv64-softmmu s390x-softmmu
sparc64-softmmu sparc-softmmu x86_64-softmmu i386-softmmu'
--enable-werror || { cat config.log; exit 1; }
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) check
freebsd_2nd_task:
freebsd_instance:
image_family: freebsd-12-1
cpu: 4
memory: 4G
install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y
bash curl cyrus-sasl git glib gmake gnutls gtk3 gsed libepoxy mesa-libs
nettle perl5 pixman pkgconf png SDL2 usbredir
script:
- ./configure --enable-werror --target-list='alpha-softmmu ppc64-softmmu
ppc-softmmu riscv32-softmmu riscv64-softmmu s390x-softmmu
sparc64-softmmu sparc-softmmu x86_64-softmmu i386-softmmu
sparc-bsd-user sparc64-bsd-user x86_64-bsd-user i386-bsd-user'
|| { cat config.log; exit 1; }
- ../configure --enable-werror || { cat config.log; exit 1; }
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) check
@ -63,3 +44,66 @@ macos_xcode_task:
--enable-werror --cc=clang || { cat config.log; exit 1; }
- gmake -j$(sysctl -n hw.ncpu)
- gmake check
windows_msys2_task:
windows_container:
image: cirrusci/windowsservercore:cmake
os_version: 2019
cpu: 8
memory: 8G
env:
MSYS: winsymlinks:nativestrict
MSYSTEM: MINGW64
CHERE_INVOKING: 1
printenv_script:
- C:\tools\msys64\usr\bin\bash.exe -lc 'printenv'
install_script:
- C:\tools\msys64\usr\bin\bash.exe -lc "cd /c/tools &&
curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
- C:\tools\msys64\usr\bin\bash.exe -lc "cd /c/tools &&
curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig"
- C:\tools\msys64\usr\bin\bash.exe -lc "cd /c/tools &&
pacman -U --noconfirm msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
- C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Sy"
- C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed
bash pacman pacman-mirrors msys2-runtime"
- taskkill /F /IM gpg-agent.exe
- C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Su"
- C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed
base-devel
git
mingw-w64-x86_64-python
mingw-w64-x86_64-python-setuptools
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-capstone
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-SDL2_image
mingw-w64-x86_64-gtk3
mingw-w64-x86_64-glib2
mingw-w64-x86_64-ninja
mingw-w64-x86_64-make
mingw-w64-x86_64-lzo2
mingw-w64-x86_64-zstd
mingw-w64-x86_64-libjpeg-turbo
mingw-w64-x86_64-pixman
mingw-w64-x86_64-libgcrypt
mingw-w64-x86_64-libpng
mingw-w64-x86_64-libssh
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-snappy
mingw-w64-x86_64-libusb
mingw-w64-x86_64-usbredir
mingw-w64-x86_64-libtasn1
mingw-w64-x86_64-nettle
mingw-w64-x86_64-cyrus-sasl
mingw-w64-x86_64-curl
mingw-w64-x86_64-gnutls
mingw-w64-x86_64-zstd"
script:
- C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build"
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure
--python=python3 --ninja=ninja
--target-list-exclude=i386-softmmu,arm-softmmu,ppc-softmmu,mips-softmmu"
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make -j$NUMBER_OF_PROCESSORS"
test_script:
- C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make V=1 check"

152
.gitignore vendored
View File

@ -1,163 +1,11 @@
/GNUmakefile
/build/
/.doctrees
/config-devices.*
/config-host.*
/config-target.*
/config.status
/config-temp
/tools/virtiofsd/50-qemu-virtiofsd.json
/elf2dmp
/trace-events-all
/trace/generated-events.h
/trace/generated-events.c
/trace/generated-helpers-wrappers.h
/trace/generated-helpers.h
/trace/generated-helpers.c
/trace/generated-tcg-tracers.h
/ui/shader/texture-blit-frag.h
/ui/shader/texture-blit-vert.h
/ui/shader/texture-blit-flip-vert.h
/ui/input-keymap-*.c.inc
*-timestamp
/*-softmmu
/*-darwin-user
/*-linux-user
/*-bsd-user
/ivshmem-client
/ivshmem-server
/libdis*
/libuser
/linux-headers/asm
/qga/qapi-generated
/qapi-gen-timestamp
/qapi/qapi-builtin-types.[ch]
/qapi/qapi-builtin-visit.[ch]
/qapi/qapi-commands-*.[ch]
**/qapi/qapi-commands.[ch]
**/qapi/qapi-emit-events.[ch]
/qapi/qapi-events-*.[ch]
**/qapi/qapi-events.[ch]
**/qapi/qapi-init-commands.[ch]
**/qapi/qapi-introspect.[ch]
/qapi/qapi-types-*.[ch]
**/qapi/qapi-types.[ch]
/qapi/qapi-visit-*.[ch]
!/qapi/qapi-visit-core.c
**/qapi/qapi-visit.[ch]
**/qapi/qapi-doc.texi
/qemu-edid
/qemu-img
/qemu-nbd
/qemu-options.def
/qemu-options.texi
/qemu-img-cmds.texi
/qemu-img-cmds.h
/qemu-io
/qemu-ga
/qemu-bridge-helper
/qemu-keymap
/qemu-monitor.texi
/qemu-monitor-info.texi
/qemu-storage-daemon
/qemu-version.h
/qemu-version.h.tmp
/module_block.h
/scsi/qemu-pr-helper
/vhost-user-scsi
/vhost-user-blk
/vhost-user-gpu
/vhost-user-input
/fsdev/virtfs-proxy-helper
*.tmp
*.[1-9]
*.a
*.aux
*.cp
*.exe
*.msi
*.dll
*.so
*.fn
*.ky
*.log
*.pdf
*.pod
*.cps
*.fns
*.kys
*.pg
*.pyc
*.toc
*.tp
*.vr
*.d
!/.gitlab-ci.d
!/scripts/qemu-guest-agent/fsfreeze-hook.d
*.o
.sdk
*.gcda
*.gcno
*.gcov
/pc-bios/bios-pq/status
/pc-bios/edk2-*.fd
/pc-bios/vgabios-pq/status
/pc-bios/optionrom/linuxboot.asm
/pc-bios/optionrom/linuxboot.bin
/pc-bios/optionrom/linuxboot.raw
/pc-bios/optionrom/linuxboot.img
/pc-bios/optionrom/linuxboot_dma.asm
/pc-bios/optionrom/linuxboot_dma.bin
/pc-bios/optionrom/linuxboot_dma.raw
/pc-bios/optionrom/linuxboot_dma.img
/pc-bios/optionrom/pvh.asm
/pc-bios/optionrom/pvh.bin
/pc-bios/optionrom/pvh.raw
/pc-bios/optionrom/pvh.img
/pc-bios/optionrom/multiboot.asm
/pc-bios/optionrom/multiboot.bin
/pc-bios/optionrom/multiboot.raw
/pc-bios/optionrom/multiboot.img
/pc-bios/optionrom/kvmvapic.asm
/pc-bios/optionrom/kvmvapic.bin
/pc-bios/optionrom/kvmvapic.raw
/pc-bios/optionrom/kvmvapic.img
/pc-bios/s390-ccw/s390-ccw.elf
/pc-bios/s390-ccw/s390-ccw.img
/docs/built
/docs/interop/qemu-ga-qapi.texi
/docs/interop/qemu-ga-ref.html
/docs/interop/qemu-ga-ref.info*
/docs/interop/qemu-ga-ref.txt
/docs/interop/qemu-qmp-qapi.texi
/docs/interop/qemu-qmp-ref.html
/docs/interop/qemu-qmp-ref.info*
/docs/interop/qemu-qmp-ref.txt
/docs/version.texi
/contrib/vhost-user-gpu/50-qemu-gpu.json
*.tps
.stgit-*
.git-submodule-status
cscope.*
tags
TAGS
docker-src.*
*~
*.ast_raw
*.depend_raw
trace.c
trace-ust.h
trace-ust.h
trace-dtrace.h
trace-dtrace.dtrace
trace-root.h
trace-root.c
trace-ust-root.h
trace-ust-root.h
trace-ust-all.h
trace-ust-all.c
trace-dtrace-root.h
trace-dtrace-root.dtrace
trace-ust-all.h
trace-ust-all.c
/target/arm/decode-sve.c.inc

View File

@ -509,11 +509,11 @@ int qemu_unlink(const char *name);
#ifndef _WIN32
int qemu_dup_flags(int fd, int flags);
int qemu_dup(int fd);
#endif
int qemu_lock_fd(int fd, int64_t start, int64_t len, bool exclusive);
int qemu_unlock_fd(int fd, int64_t start, int64_t len);
int qemu_lock_fd_test(int fd, int64_t start, int64_t len, bool exclusive);
bool qemu_has_ofd_lock(void);
#endif
#if defined(__HAIKU__) && defined(__i386__)
#define FMT_pid "%ld"

View File

@ -133,6 +133,7 @@ struct rcu_head {
};
extern void call_rcu1(struct rcu_head *head, RCUCBFunc *func);
extern void drain_call_rcu(void);
/* The operands of the minus operator must have the same type,
* which must be the one that we specify in the cast.

View File

@ -317,7 +317,6 @@ opengl = not_found
if 'CONFIG_OPENGL' in config_host
opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
link_args: config_host['OPENGL_LIBS'].split())
else
endif
gtk = not_found
if 'CONFIG_GTK' in config_host
@ -344,11 +343,6 @@ if 'CONFIG_ICONV' in config_host
iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
link_args: config_host['ICONV_LIBS'].split())
endif
gio = not_found
if 'CONFIG_GIO' in config_host
gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
link_args: config_host['GIO_LIBS'].split())
endif
vnc = not_found
png = not_found
jpeg = not_found

View File

@ -57,8 +57,10 @@ DEFINE_DEVPROPKEY(qga_DEVPKEY_Device_DriverDate, 0xa8b865dd, 0x2e3d,
DEFINE_DEVPROPKEY(qga_DEVPKEY_Device_DriverVersion, 0xa8b865dd, 0x2e3d,
0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 3);
/* DEVPROP_TYPE_STRING */
/* The following shoud be in cfgmgr32.h, but it isn't */
/* The CM_Get_DevNode_PropertyW prototype is only sometimes in cfgmgr32.h */
#ifndef CM_Get_DevNode_Property
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls"
CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW(
DEVINST dnDevInst,
CONST DEVPROPKEY * PropertyKey,
@ -68,6 +70,7 @@ CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW(
ULONG ulFlags
);
#define CM_Get_DevNode_Property CM_Get_DevNode_PropertyW
#pragma GCC diagnostic pop
#endif
#ifndef SHTDN_REASON_FLAG_PLANNED

View File

@ -145,7 +145,8 @@ if have_block
'test-crypto-block': [io],
}
if 'CONFIG_GNUTLS' in config_host and \
'CONFIG_TASN1' in config_host
'CONFIG_TASN1' in config_host and \
'CONFIG_POSIX' in config_host
tests += {
'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
tasn1, crypto],
@ -195,8 +196,13 @@ if have_system
# are not runnable under TSan due to a known issue.
# https://github.com/google/sanitizers/issues/1116
if 'CONFIG_TSAN' not in config_host
if 'CONFIG_POSIX' in config_host
tests += {
'test-char': ['socket-helpers.c', qom, io, chardev]
}
endif
tests += {
'test-char': ['socket-helpers.c', qom, io, chardev],
'test-qdev-global-props': [qom, hwcore, testqapi]
}
endif

View File

@ -220,6 +220,6 @@ qapi_doc = custom_target('QAPI doc',
# "full_path()" needed here to work around
# https://github.com/mesonbuild/meson/issues/7585
test('QAPI doc', diff, args: ['-u', files('doc-good.texi'), qapi_doc[0].full_path()],
test('QAPI doc', diff, args: ['-b', '-u', files('doc-good.texi'), qapi_doc[0].full_path()],
depends: qapi_doc,
suite: ['qapi-schema', 'qapi-doc'])

View File

@ -44,7 +44,7 @@ then
_init_error "failed to obtain source tree name from check symlink"
fi
source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
build_iotests=$(readlink -f $(dirname "$0"))
build_iotests=$(cd "$(dirname "$0")"; pwd)
else
# called from the source tree
source_iotests=$PWD

View File

@ -202,9 +202,8 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
/* Run QEMU's softmmu main with the fuzz-target dependent arguments */
GString *cmd_line = fuzz_target->get_init_cmdline(fuzz_target);
g_string_append_printf(cmd_line,
" -qtest /dev/null -qtest-log %s",
getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null");
g_string_append_printf(cmd_line, " %s -qtest /dev/null ",
getenv("QTEST_LOG") ? "" : "-qtest-log none");
/* Split the runcmd into an argv and argc */
wordexp_t result;

View File

@ -82,9 +82,9 @@ static void test_query(const void *data)
qtest_quit(qts);
}
static bool query_is_blacklisted(const char *cmd)
static bool query_is_ignored(const char *cmd)
{
const char *blacklist[] = {
const char *ignored[] = {
/* Not actually queries: */
"add-fd",
/* Success depends on target arch: */
@ -101,8 +101,8 @@ static bool query_is_blacklisted(const char *cmd)
};
int i;
for (i = 0; blacklist[i]; i++) {
if (!strcmp(cmd, blacklist[i])) {
for (i = 0; ignored[i]; i++) {
if (!strcmp(cmd, ignored[i])) {
return true;
}
}
@ -179,7 +179,7 @@ static void add_query_tests(QmpSchema *schema)
continue;
}
if (query_is_blacklisted(si->name)) {
if (query_is_ignored(si->name)) {
continue;
}

View File

@ -59,8 +59,7 @@ static int socket_can_bind_connect(const char *hostname, int family)
/* lookup */
rc = getaddrinfo(hostname, NULL, &ai, &res);
if (rc != 0) {
if (rc == EAI_ADDRFAMILY ||
rc == EAI_FAMILY) {
if (rc == EAI_ADDRFAMILY || rc == EAI_FAMILY || rc == EAI_NONAME) {
errno = EADDRNOTAVAIL;
} else {
errno = EINVAL;

View File

@ -28,6 +28,16 @@
#define TEST_FILE "tests/test-io-channel-file.txt"
#define TEST_MASK 0600
/*
* On Windows the stat() function in the C library checks only
* the FAT-style READONLY attribute and does not look at the ACL at all.
*/
#ifdef _WIN32
#define TEST_MASK_EXPECT 0700
#else
#define TEST_MASK_EXPECT 0777
#endif
static void test_io_channel_file_helper(int flags)
{
QIOChannel *src, *dst;
@ -56,7 +66,7 @@ static void test_io_channel_file_helper(int flags)
umask(mask);
ret = stat(TEST_FILE, &st);
g_assert_cmpint(ret, >, -1);
g_assert_cmpuint(TEST_MASK & ~mask, ==, st.st_mode & 0777);
g_assert_cmpuint(TEST_MASK & ~mask, ==, st.st_mode & TEST_MASK_EXPECT);
unlink(TEST_FILE);
object_unref(OBJECT(src));

View File

@ -25,6 +25,7 @@
#include "socket-helpers.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "qemu/main-loop.h"
static void test_io_channel_set_socket_bufs(QIOChannel *src,
@ -556,6 +557,7 @@ int main(int argc, char **argv)
bool has_ipv4, has_ipv6;
module_call_init(MODULE_INIT_QOM);
qemu_init_main_loop(&error_abort);
socket_init();
g_test_init(&argc, &argv, NULL);

View File

@ -196,7 +196,7 @@ static void rmdir_full(gchar const *root)
int main(int argc, char **argv)
{
gchar *tmp_path = g_dir_make_tmp("qemu-test-logging.XXXXXX", NULL);
g_autofree gchar *tmp_path = g_dir_make_tmp("qemu-test-logging.XXXXXX", NULL);
int rc;
g_test_init(&argc, &argv, NULL);
@ -210,8 +210,9 @@ int main(int argc, char **argv)
tmp_path, test_logfile_lock);
rc = g_test_run();
qemu_log_close();
drain_call_rcu();
rmdir_full(tmp_path);
g_free(tmp_path);
return rc;
}

View File

@ -251,10 +251,13 @@ static void test_dynamic_globalprop(void)
g_test_trap_assert_passed();
g_test_trap_assert_stderr_unmatched("*prop1*");
g_test_trap_assert_stderr_unmatched("*prop2*");
g_test_trap_assert_stderr("*warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*");
g_test_trap_assert_stderr(
"*warning: global dynamic-prop-type-bad.prop3 has invalid class name*");
g_test_trap_assert_stderr_unmatched("*prop4*");
g_test_trap_assert_stderr("*warning: global nohotplug-type.prop5=105 not used\n*");
g_test_trap_assert_stderr("*warning: global nondevice-type.prop6 has invalid class name\n*");
g_test_trap_assert_stderr(
"*warning: global nohotplug-type.prop5=105 not used*");
g_test_trap_assert_stderr(
"*warning: global nondevice-type.prop6 has invalid class name*");
g_test_trap_assert_stdout("");
}

View File

@ -23,14 +23,14 @@
/* primary */
#define P_ID "primary-id"
static char p_local_disk[] = "/tmp/p_local_disk.XXXXXX";
static char *p_local_disk;
/* secondary */
#define S_ID "secondary-id"
#define S_LOCAL_DISK_ID "secondary-local-disk-id"
static char s_local_disk[] = "/tmp/s_local_disk.XXXXXX";
static char s_active_disk[] = "/tmp/s_active_disk.XXXXXX";
static char s_hidden_disk[] = "/tmp/s_hidden_disk.XXXXXX";
static char *s_local_disk;
static char *s_active_disk;
static char *s_hidden_disk;
/* FIXME: steal from blockdev.c */
QemuOptsList qemu_drive_opts = {
@ -392,6 +392,7 @@ static void test_secondary_write(void)
teardown_secondary();
}
#ifndef _WIN32
static void test_secondary_start(void)
{
BlockBackend *top_blk, *local_blk;
@ -546,6 +547,7 @@ static void test_secondary_get_error_all(void)
teardown_secondary();
}
#endif
static void sigabrt_handler(int signo)
{
@ -571,6 +573,11 @@ static void setup_sigabrt_handler(void)
int main(int argc, char **argv)
{
int ret;
const char *tmpdir = g_get_tmp_dir();
p_local_disk = g_strdup_printf("%s/p_local_disk.XXXXXX", tmpdir);
s_local_disk = g_strdup_printf("%s/s_local_disk.XXXXXX", tmpdir);
s_active_disk = g_strdup_printf("%s/s_active_disk.XXXXXX", tmpdir);
s_hidden_disk = g_strdup_printf("%s/s_hidden_disk.XXXXXX", tmpdir);
qemu_init_main_loop(&error_fatal);
bdrv_init();
@ -592,6 +599,7 @@ int main(int argc, char **argv)
/* Secondary */
g_test_add_func("/replication/secondary/read", test_secondary_read);
g_test_add_func("/replication/secondary/write", test_secondary_write);
#ifndef _WIN32
g_test_add_func("/replication/secondary/start", test_secondary_start);
g_test_add_func("/replication/secondary/stop", test_secondary_stop);
g_test_add_func("/replication/secondary/continuous_replication",
@ -600,10 +608,16 @@ int main(int argc, char **argv)
test_secondary_do_checkpoint);
g_test_add_func("/replication/secondary/get_error_all",
test_secondary_get_error_all);
#endif
ret = g_test_run();
cleanup_imgs();
g_free(p_local_disk);
g_free(s_local_disk);
g_free(s_active_disk);
g_free(s_hidden_disk);
return ret;
}

View File

@ -75,7 +75,7 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); }
void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp) {}
void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp) {}
#ifndef _WIN32
static void test_socket_fd_pass_name_good(void)
{
SocketAddress addr;
@ -227,6 +227,7 @@ static void test_socket_fd_pass_num_nocli(void)
g_free(addr.u.fd.str);
}
#endif
#ifdef __linux__
static gchar *abstract_sock_name;
@ -321,6 +322,7 @@ int main(int argc, char **argv)
{
bool has_ipv4, has_ipv6;
qemu_init_main_loop(&error_abort);
socket_init();
g_test_init(&argc, &argv, NULL);
@ -340,6 +342,7 @@ int main(int argc, char **argv)
test_fd_is_socket_bad);
g_test_add_func("/util/socket/is-socket/good",
test_fd_is_socket_good);
#ifndef _WIN32
g_test_add_func("/socket/fd-pass/name/good",
test_socket_fd_pass_name_good);
g_test_add_func("/socket/fd-pass/name/bad",
@ -352,6 +355,7 @@ int main(int argc, char **argv)
test_socket_fd_pass_num_bad);
g_test_add_func("/socket/fd-pass/num/nocli",
test_socket_fd_pass_num_nocli);
#endif
}
#ifdef __linux__

View File

@ -34,7 +34,6 @@
#include "qemu/module.h"
#include "io/channel-file.h"
static char temp_file[] = "/tmp/vmst.test.XXXXXX";
static int temp_fd;
@ -1484,6 +1483,8 @@ static void test_tmp_struct(void)
int main(int argc, char **argv)
{
g_autofree char *temp_file = g_strdup_printf("%s/vmst.test.XXXXXX",
g_get_tmp_dir());
temp_fd = mkstemp(temp_file);
module_call_init(MODULE_INIT_QOM);

View File

@ -37,6 +37,16 @@ struct AioHandler {
static void aio_remove_fd_handler(AioContext *ctx, AioHandler *node)
{
/*
* If the GSource is in the process of being destroyed then
* g_source_remove_poll() causes an assertion failure. Skip
* removal in that case, because glib cleans up its state during
* destruction anyway.
*/
if (!g_source_is_destroyed(&ctx->source)) {
g_source_remove_poll(&ctx->source, &node->pfd);
}
/* If aio_poll is in progress, just mark the node as deleted */
if (qemu_lockcnt_count(&ctx->list_lock)) {
node->deleted = 1;
@ -139,8 +149,6 @@ void aio_set_event_notifier(AioContext *ctx,
/* Are we deleting the fd handler? */
if (!io_notify) {
if (node) {
g_source_remove_poll(&ctx->source, &node->pfd);
aio_remove_fd_handler(ctx, node);
}
} else {

View File

@ -293,6 +293,61 @@ void call_rcu1(struct rcu_head *node, void (*func)(struct rcu_head *node))
qemu_event_set(&rcu_call_ready_event);
}
struct rcu_drain {
struct rcu_head rcu;
QemuEvent drain_complete_event;
};
static void drain_rcu_callback(struct rcu_head *node)
{
struct rcu_drain *event = (struct rcu_drain *)node;
qemu_event_set(&event->drain_complete_event);
}
/*
* This function ensures that all pending RCU callbacks
* on the current thread are done executing
* drops big qemu lock during the wait to allow RCU thread
* to process the callbacks
*
*/
void drain_call_rcu(void)
{
struct rcu_drain rcu_drain;
bool locked = qemu_mutex_iothread_locked();
memset(&rcu_drain, 0, sizeof(struct rcu_drain));
qemu_event_init(&rcu_drain.drain_complete_event, false);
if (locked) {
qemu_mutex_unlock_iothread();
}
/*
* RCU callbacks are invoked in the same order as in which they
* are registered, thus we can be sure that when 'drain_rcu_callback'
* is called, all RCU callbacks that were registered on this thread
* prior to calling this function are completed.
*
* Note that since we have only one global queue of the RCU callbacks,
* we also end up waiting for most of RCU callbacks that were registered
* on the other threads, but this is a side effect that shoudn't be
* assumed.
*/
call_rcu1(&rcu_drain.rcu, drain_rcu_callback);
qemu_event_wait(&rcu_drain.drain_complete_event);
if (locked) {
qemu_mutex_lock_iothread();
}
}
void rcu_register_thread(void)
{
assert(rcu_reader.ctr == 0);