From 1f04fa3e002e28b96277bf3f09265a4221cdb39b Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Mon, 14 Sep 2020 16:56:06 +0200 Subject: [PATCH 01/24] iotests: Drop readlink -f On macOS, (out of the box) readlink does not have -f. We do not really need readlink here, though, it was just a replacement for realpath (which is not available on our BSD test systems), which we needed to make the $(dirname) into an absolute path. Instead of using either, just use "cd; pwd" like is done for $source_iotests. Fixes: b1cbc33a3971b6bb005d5ac3569feae35a71de0f ("iotests: Allow running from different directory") Suggested-by: Peter Maydell Reported-by: Claudio Fontana Reported-by: Thomas Huth Signed-off-by: Max Reitz Message-Id: <20200914145606.94620-1-mreitz@redhat.com> Signed-off-by: Thomas Huth --- tests/qemu-iotests/check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index e14a1f354d..678b6e4910 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -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 From d287961f25672d94a38dfdd03d1daa7e3d343c3c Mon Sep 17 00:00:00 2001 From: Alexander Bulekov Date: Wed, 19 Aug 2020 02:10:56 -0400 Subject: [PATCH 02/24] fuzz: Change the way we write qtest log to stderr Telling QTest to log to /dev/fd/2, essentially results in dup(2). This is fine, if other code isn't logging to stderr. Otherwise, the order of the logs is mixed due to buffering issues, since two file-descriptors are used to write to the same file. We can avoid this, since just specifying "-qtest" sets the log fd to stderr. If we want to disable qtest logs, we can just add -qtest-log none. Reviewed-by: Darren Kenny Signed-off-by: Alexander Bulekov Message-Id: <20200819061110.1320568-2-alxndr@bu.edu> Signed-off-by: Thomas Huth --- tests/qtest/fuzz/fuzz.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 1ceea84702..7f266ffc63 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -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; From d97b4b0d0c2313c567e88ef492f132d3e0c8df8f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 12 Sep 2020 09:43:07 +0200 Subject: [PATCH 03/24] tests/qtest/qmp-cmd-test: Use inclusive language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We simply want to ignore certain queries here, so let's rather use the term 'ignore' to express this intention. Message-Id: <20200914163755.42618-1-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- tests/qtest/qmp-cmd-test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c index 3109a9fe96..8a4c570e83 100644 --- a/tests/qtest/qmp-cmd-test.c +++ b/tests/qtest/qmp-cmd-test.c @@ -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; } From b822c05b812a39940f78e4d020852d134d49dc99 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 8 Sep 2020 13:48:13 +0200 Subject: [PATCH 04/24] tests/socket-helpers: Treat EAI_NONAME as EADDRNOTAVAIL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests/test-char test is currently always failing on my system since the getaddrinfo() in socket_can_bind_connect() returns EAI_NONAME when it is called from socket_check_protocol_support() to check for IPv6. socket_check_protocol_support() then returns -1 and thus the tests are not run at all - even though IPv4 is working fine. socket_can_bind_connect() connect should return EADDRNOTAVAIL in this case instead, so that socket_check_protocol_support() does not fail. Suggested-by: Daniel P. Berrangé Message-Id: <20200908121543.222872-1-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- tests/socket-helpers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/socket-helpers.c b/tests/socket-helpers.c index 19a51e887e..f704fd1a69 100644 --- a/tests/socket-helpers.c +++ b/tests/socket-helpers.c @@ -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; From 0e72b7df4d552f9da33d3559fd84febd86455a99 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 7 Sep 2020 19:38:01 +0200 Subject: [PATCH 05/24] Simplify the .gitignore file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we always do out-of-tree builds (and the in-tree builds are faked via a "build" directory), we can simplify out .gitignore file quite a bit. Message-Id: <20200909080305.258961-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- .gitignore | 152 ----------------------------------------------------- 1 file changed, 152 deletions(-) diff --git a/.gitignore b/.gitignore index b6fdd34ddf..5515f595e6 100644 --- a/.gitignore +++ b/.gitignore @@ -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 From 37d98abdc77cfbd158b453d22629e5c7d020c878 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 15 Sep 2020 12:18:03 +0200 Subject: [PATCH 06/24] qga/commands-win32: Fix problem with redundant protype declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compiling QEMU with MSYS2 on Windows, there is currently the following error: ../qga/commands-win32.c:62:24: error: redundant redeclaration of 'CM_Get_DevNode_PropertyW' [-Werror=redundant-decls] 62 | CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW( | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../qga/commands-win32.c:26: C:/tools/msys64/mingw64/x86_64-w64-mingw32/include/cfgmgr32.h:840:26: note: previous declaration of 'CM_Get_DevNode_PropertyW' was here 840 | CMAPI CONFIGRET WINAPI CM_Get_DevNode_PropertyW(DEVINST dnDevInst, const DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PBYTE PropertyBuffer, PULONG PropertyBufferSize, ULONG ulFlags); Seems like this protype is sometimes available in the cfgmgr32.h header, and sometimes not. Let's silence the compiler warning here to let the build pass with -Werror, too. Message-Id: <20200915114757.55635-1-thuth@redhat.com> Reviewed-by: Marc-André Lureau Signed-off-by: Thomas Huth --- qga/commands-win32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 48d8bbe649..0c3c05484f 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -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 From d816614ca4f5af89a2b6d50ac840d7b77973f2fc Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Tue, 15 Sep 2020 20:12:53 +0800 Subject: [PATCH 07/24] rcu: Implement drain_call_rcu This will allow is to preserve the semantics of hmp_device_del, that the device is deleted immediatly which was changed by previos patch that delayed this to RCU callback Signed-off-by: Maxim Levitsky Suggested-by: Stefan Hajnoczi Reviewed-by: Stefan Hajnoczi Message-Id: <20200915121318.247-2-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- include/qemu/rcu.h | 1 + util/rcu.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 570aa603eb..0e375ebe13 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -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. diff --git a/util/rcu.c b/util/rcu.c index 60a37f72c3..c4fefa9333 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -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); From 4ed79a1bfb82be118da4014bde007acaaa7a7e7a Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:08 +0800 Subject: [PATCH 08/24] tests: Convert g_free to g_autofree macro in test-logging.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g_autofree are prefer than g_free when possible. Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-17-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-logging.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test-logging.c b/tests/test-logging.c index 8a1161de1d..783fe09a27 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -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); @@ -212,6 +212,5 @@ int main(int argc, char **argv) rc = g_test_run(); rmdir_full(tmp_path); - g_free(tmp_path); return rc; } From 760064efe1f0c4c62cd4a5c3aa793c7b37280089 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:14 +0800 Subject: [PATCH 09/24] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full drain_call_rcu is necessary on win32, because under win32, if you don't close the file before remove it, the remove would be fail. Signed-off-by: Yonggang Luo Message-Id: <20200915121318.247-23-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-logging.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test-logging.c b/tests/test-logging.c index 783fe09a27..8b1522cfed 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -210,6 +210,8 @@ 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); return rc; From 2d89880003b5324596e44d4743d14a3be70e392d Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 8 Sep 2020 04:04:30 +0800 Subject: [PATCH 10/24] meson: Disable test-char on msys2/mingw for fixing tests stuck Signed-off-by: Yonggang Luo Message-Id: <20200907200432.2418-3-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index dae8a77df1..82342a2f97 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -195,8 +195,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 From 00650e6e46931a7d4d6b3c5bf36bc3bfdcb9b0db Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 9 Sep 2020 17:46:07 +0800 Subject: [PATCH 11/24] meson: disable crypto tests are empty under win32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable following tests on msys2/mingw 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', tasn1, crypto], 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c', tasn1, crypto], 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', tasn1, io, crypto]} These tests are failure with: ERROR test-crypto-tlscredsx509 - missing test plan ERROR test-crypto-tlssession - missing test plan ERROR test-io-channel-tls - missing test plan Because on win32 those test case are all disabled. Signed-off-by: Yonggang Luo Message-Id: <20200909094617.1582-12-luoyonggang@gmail.com> Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- tests/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 82342a2f97..8c3e930687 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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], From dce93184b52278983ed9b8db80bd65e18a45356b Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:12:59 +0800 Subject: [PATCH 12/24] tests: Fixes test-replication.c on msys2/mingw. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows there is no path like /tmp/s_local_disk.XXXXXX Use g_get_tmp_dir instead of /tmp. Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-8-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-replication.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test-replication.c b/tests/test-replication.c index 9ab3666a90..e7cbd6b144 100644 --- a/tests/test-replication.c +++ b/tests/test-replication.c @@ -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 = { @@ -571,6 +571,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(); @@ -605,5 +610,10 @@ int main(int argc, char **argv) cleanup_imgs(); + g_free(p_local_disk); + g_free(s_local_disk); + g_free(s_active_disk); + g_free(s_hidden_disk); + return ret; } From 09d631dbf81b5fb27459af218d8f093e51b94270 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:00 +0800 Subject: [PATCH 13/24] tests: test-replication disable /replication/secondary/* on msys2/mingw. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They caused failure on msys2/mingw, that's because file-win32.c not implement .bdrv_reopen_prepare/commit/abort yet. This is the error message: > $ ./tests/test-replication.exe > # random seed: R02S3f4d1c01af2b0a046990e0235c481faf > 1..13 > # Start of replication tests > # Start of primary tests > ok 1 /replication/primary/read > ok 2 /replication/primary/write > ok 3 /replication/primary/start > ok 4 /replication/primary/stop > ok 5 /replication/primary/do_checkpoint > ok 6 /replication/primary/get_error_all > # End of primary tests > # Start of secondary tests > ok 7 /replication/secondary/read > ok 8 /replication/secondary/write > Unexpected error in bdrv_reopen_prepare() at ../block.c:4191: > Block format 'file' used by node '#block4287' does not support reopening > files Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-9-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-replication.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test-replication.c b/tests/test-replication.c index e7cbd6b144..b067240add 100644 --- a/tests/test-replication.c +++ b/tests/test-replication.c @@ -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) { @@ -597,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", @@ -605,6 +608,7 @@ 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(); From 6333da0f0762ac02bac7dc2823f81ded8fceaaeb Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:01 +0800 Subject: [PATCH 14/24] osdep: file locking functions are not available on Win32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not declare the following locking functions on Win32: 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); Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-10-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- include/qemu/osdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 412962d91a..e80fddd1e8 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -502,11 +502,11 @@ int qemu_close(int fd); int qemu_unlink(const char *name); #ifndef _WIN32 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" From a84258e1f9702f1f6782bda06e97bf65632ccbb1 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:02 +0800 Subject: [PATCH 15/24] meson: Use -b to ignore CR vs. CR-LF issues on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ideally we would use the '--strip-trailing-cr' option, but not being POSIX is a portability problem (i.e. BSDs and Solaris based OSes). Instead use the '-b' option which, although doing slightly more, produce the expected result on Windows." Signed-off-by: Yonggang Luo Reviewed-by: Eric Blake Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-11-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/qapi-schema/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build index c87d141417..f1449298b0 100644 --- a/tests/qapi-schema/meson.build +++ b/tests/qapi-schema/meson.build @@ -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']) From e0d3d8015f858f4d8d2a846d5909f57b709bf2b5 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:05 +0800 Subject: [PATCH 16/24] meson: remove empty else and duplicated gio deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-14-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- meson.build | 6 ------ 1 file changed, 6 deletions(-) diff --git a/meson.build b/meson.build index bba766b4bc..f4d1ab1096 100644 --- a/meson.build +++ b/meson.build @@ -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 From 96c64746bf5154fdce3011391362fdcddfe1aa37 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 10 Sep 2020 18:30:50 +0800 Subject: [PATCH 17/24] vmstate: Fixes test-vmstate.c on msys2/mingw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vmstate are valid on win32, just need generate tmp path properly Signed-off-by: Yonggang Luo Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Reviewed-by: Daniel P. Berrangé Message-Id: <20200910103059.987-17-luoyonggang@gmail.com> [thuth: Make indentation a little bit nicer] Signed-off-by: Thomas Huth --- tests/test-vmstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 1c763015d0..a001879585 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -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); From dd65e4ad22805392924a9b2ebbe07c4260cae67c Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:09 +0800 Subject: [PATCH 18/24] tests: Fixes test-io-channel-socket.c tests under msys2/mingw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently test-io-channel-socket doesn't init with qemu_init_main_loop and that's cause the qemu_aio_context not inited, and the following is the stack when null pointer accessed: qemu_fd_register (c:\work\xemu\qemu\util\main-loop.c:336) qemu_try_set_nonblock (c:\work\xemu\qemu\util\oslib-win32.c:224) qemu_set_nonblock (c:\work\xemu\qemu\util\oslib-win32.c:230) socket_can_bind_connect (c:\work\xemu\qemu\tests\socket-helpers.c:93) socket_check_protocol_support (c:\work\xemu\qemu\tests\socket-helpers.c:141) main (c:\work\xemu\qemu\tests\test-io-channel-socket.c:568) __tmainCRTStartup (@__tmainCRTStartup:142) mainCRTStartup (@1400014f6..140001539:3) BaseThreadInitThunk (@BaseThreadInitThunk:9) RtlUserThreadStart (@RtlUserThreadStart:12) Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-18-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-io-channel-socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c index d43083a766..743577d744 100644 --- a/tests/test-io-channel-socket.c +++ b/tests/test-io-channel-socket.c @@ -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); From da0652c043c8014ed194a99a7989cc4b0093707e Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 16 Sep 2020 01:12:26 +0800 Subject: [PATCH 19/24] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c This is a fixes for (C:\work\xemu\qemu\build\tests\test-aio-multithread.exe:19100): GLib-CRITICAL **: 23:03:24.965: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed ERROR test-aio-multithread - Bail out! GLib-FATAL-CRITICAL: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed (C:\work\xemu\qemu\build\tests\test-bdrv-drain.exe:21036): GLib-CRITICAL **: 23:03:29.861: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed ERROR test-bdrv-drain - Bail out! GLib-FATAL-CRITICAL: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed And the idea comes from https://patchwork.kernel.org/patch/9975239/ Signed-off-by: Yonggang Luo Message-Id: <20200915171234.236-19-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- util/aio-win32.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/util/aio-win32.c b/util/aio-win32.c index 953c56ab48..49bd90e62e 100644 --- a/util/aio-win32.c +++ b/util/aio-win32.c @@ -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 { From a92a783d263ea956d4b45035e224e73852916b7d Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 16 Sep 2020 01:12:27 +0800 Subject: [PATCH 20/24] tests: Fixes test-io-channel-file by mask only owner file state mask bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the error on msys2/mingw Running test test-io-channel-file ** ERROR:../tests/test-io-channel-file.c:59:test_io_channel_file_helper: assertion failed (TEST_MASK & ~mask == st.st_mode & 0777): (384 == 438) ERROR test-io-channel-file - Bail out! ERROR:../tests/test-io-channel-file.c:59:test_io_channel_file_helper: assertion failed (TEST_MASK & ~mask == st.st_mode & 0777): (384 == 438) Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915171234.236-20-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-io-channel-file.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c index bac2b07562..0aa0477541 100644 --- a/tests/test-io-channel-file.c +++ b/tests/test-io-channel-file.c @@ -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)); From 8330bd536c809e3c9a07ce9e0de92a4a6509045e Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:12 +0800 Subject: [PATCH 21/24] tests: fix test-util-sockets.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes following errors: Running test test-util-sockets ERROR test-util-sockets - missing test plan # Start of name tests ** ERROR:../tests/test-util-sockets.c:93:test_socket_fd_pass_name_good: assertion failed (fd != -1): (-1 != -1) Bail out! ERROR:../tests/test-util-sockets.c:93:test_socket_fd_pass_name_good: assertion failed (fd != -1): (-1 != -1) First should call to qemu_init_main_loop before socket_init, then on win32 doesn't support for SOCKET_ADDRESS_TYPE_FD socket type Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-21-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-util-sockets.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c index af9f5c0c70..1bbb16d9b1 100644 --- a/tests/test-util-sockets.c +++ b/tests/test-util-sockets.c @@ -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__ From 61d9282cdc50b9e161ebdf6efebfc1ba10d92178 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Wed, 16 Sep 2020 01:12:29 +0800 Subject: [PATCH 22/24] tests: Fixes test-qdev-global-props.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On win32 the line ending are \r\n, so we skip the \n in function test_dynamic_globalprop Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915171234.236-22-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- tests/test-qdev-global-props.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index 8a3c14d92c..c8862cac5f 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -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(""); } From b1788880ba564a8593143dd61d6463b48628d29b Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:16 +0800 Subject: [PATCH 23/24] ci: Enable msys2 ci in cirrus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install msys2 in a proper way refer to: https://github.com/cirruslabs/cirrus-ci-docs/issues/699 The https://wiki.qemu.org/Hosts/W32#Native_builds_with_MSYS2 need to be updated. There is no need of --cross-prefix, open mingw64.exe instead of msys2.exe then we don't need the --cross-prefix, besides we use environment variable settings: MSYS: winsymlinks:nativestrict MSYSTEM: MINGW64 CHERE_INVOKING: 1 to opening mingw64 native shell. Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Message-Id: <20200915121318.247-25-luoyonggang@gmail.com> [thuth: Add --target-list-exclude to speed it up a little bit, and add capstone package to avoid build failure with internal capstone] Signed-off-by: Thomas Huth --- .cirrus.yml | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 3dd9fcff7f..e5feb53b54 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -63,3 +63,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" From 114daec31d64600e5a070abcdb8de2cf74d01e94 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 15 Sep 2020 20:13:07 +0800 Subject: [PATCH 24/24] cirrus: Building freebsd in a single shot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 45f7b7b9f38f5c4d1529a37c93dedfc26a231bba ("cirrus.yml: Split FreeBSD job into two parts"). freebsd 1 hour limit not hit anymore I think we going to a wrong direction, I think there is some tests a stall the test runner, please look at https://cirrus-ci.com/task/5110577531977728 When its running properly, the consumed time are little, but when tests running too long, look at the cpu usage, the cpu usage are nearly zero. doesn't consuming time. And look at https://cirrus-ci.com/task/6119341601062912 If the tests running properly, the time consuming are little We should not hide the error by split them Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé Reviewed-by: Ed Maste Message-Id: <20200915121318.247-16-luoyonggang@gmail.com> Signed-off-by: Thomas Huth --- .cirrus.yml | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e5feb53b54..d58782ce67 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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