All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 00/27] W32, W64 msys2/mingw patches
@ 2020-09-12 22:44 Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 01/27] rcu: Implement drain_call_rcu Yonggang Luo
                   ` (28 more replies)
  0 siblings, 29 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

It first introduce msys2 CI on cirrus by fixes nfs, capstone, curses and
disable partial test-char tests.
And then fixes all unit tests failure on msys2/mingw
This fixes the reviews suggested in the mailling list
All cirrus CI are passed

Maxim Levitsky (1):
  rcu: Implement drain_call_rcu

Yonggang Luo (26):
  block: Fixes nfs compiling error on msys2/mingw
  ci: fixes msys2 build by upgrading capstone to 4.0.2
  configure: Fixes ncursesw detection under msys2/mingw and enable
    curses
  win32: Simplify gmtime_r detection direct base on
    _POSIX_THREAD_SAFE_FUNCTIONS.
  curses: Fixes curses compiling errors.
  tests: disable /char/stdio/* tests in test-char.c on win32
  tests: Fixes test-replication.c on msys2/mingw.
  tests: test-replication disable /replication/secondary/* on
    msys2/mingw.
  osdep: file locking functions are not available on Win32
  meson: Use -b to ignore CR vs. CR-LF issues on Windows
  gcrypt: test_tls_psk_init should write binary file instead text file.
  tests: Enable crypto tests under msys2/mingw
  meson: remove empty else and duplicated gio deps
  vmstate: Fixes test-vmstate.c on msys2/mingw
  cirrus: Building freebsd in a single short
  tests: Convert g_free to g_autofree macro in test-logging.c
  tests: Fixes test-io-channel-socket.c tests under msys2/mingw
  tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence
    with aio-posix.c
  tests: Fixes test-io-channel-file by mask only owner file state mask
    bits
  tests: fix test-util-sockets.c
  tests: Fixes test-qdev-global-props.c
  rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full
  ci: Enable msys2 ci in cirrus
  meson: upgrade meson for execute custom ninjatool under msys2 properly
  meson: remove --ninja option in configure.
  Revert "configure: add --ninja option"

 .cirrus.yml                      |  95 ++++++++++++-----
 block/nfs.c                      |  26 ++++-
 capstone                         |   2 +-
 configure                        |  77 ++++----------
 include/qemu/osdep.h             |   2 +-
 include/qemu/rcu.h               |   1 +
 include/sysemu/os-win32.h        |   4 +-
 meson                            |   2 +-
 meson.build                      |   6 --
 tests/crypto-tls-psk-helpers.c   |   6 +-
 tests/crypto-tls-x509-helpers.c  | 169 ++++++++++++++++++++++++++++++-
 tests/crypto-tls-x509-helpers.h  |   9 +-
 tests/qapi-schema/meson.build    |   2 +-
 tests/test-char.c                |  26 +++--
 tests/test-crypto-tlscredsx509.c |  47 +++++----
 tests/test-crypto-tlssession.c   |  68 +++++++------
 tests/test-io-channel-file.c     |  10 +-
 tests/test-io-channel-socket.c   |   2 +
 tests/test-io-channel-tls.c      |  51 ++++++----
 tests/test-logging.c             |   5 +-
 tests/test-qdev-global-props.c   |   6 +-
 tests/test-replication.c         |  22 +++-
 tests/test-util-sockets.c        |   6 +-
 tests/test-vmstate.c             |   3 +-
 ui/curses.c                      |  14 +--
 util/aio-win32.c                 |  11 +-
 util/oslib-win32.c               |   2 +-
 util/rcu.c                       |  55 ++++++++++
 28 files changed, 514 insertions(+), 215 deletions(-)

-- 
2.28.0.windows.1



^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH v8 01/27] rcu: Implement drain_call_rcu
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw Yonggang Luo
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Maxim Levitsky, Ed Maste, Michael Roth, qemu-block,
	Stefan Hajnoczi, Stefan Weil, Xie Changlong, Peter Lieven,
	Markus Armbruster, Max Reitz, Gerd Hoffmann, Stefan Hajnoczi,
	Wen Congyang, Paolo Bonzini, Richard Henderson, Li-Wen Hsu

From: Maxim Levitsky <mlevitsk@redhat.com>

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 <mlevitsk@redhat.com>
Suggested-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 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);
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 01/27] rcu: Implement drain_call_rcu Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 15:47   ` Philippe Mathieu-Daudé
  2020-09-12 22:44 ` [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
                   ` (26 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

These compiling errors are fixed:
../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
   27 | #include <poll.h>
      |          ^~~~~~~~
compilation terminated.

../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
   63 |     blkcnt_t st_blocks;
      |     ^~~~~~~~
../block/nfs.c: In function 'nfs_client_open':
../block/nfs.c:550:27: error: 'struct _stat64' has no member named 'st_blocks'
  550 |     client->st_blocks = st.st_blocks;
      |                           ^
../block/nfs.c: In function 'nfs_get_allocated_file_size':
../block/nfs.c:751:41: error: 'struct _stat64' has no member named 'st_blocks'
  751 |     return (task.ret < 0 ? task.ret : st.st_blocks * 512);
      |                                         ^
../block/nfs.c: In function 'nfs_reopen_prepare':
../block/nfs.c:805:31: error: 'struct _stat64' has no member named 'st_blocks'
  805 |         client->st_blocks = st.st_blocks;
      |                               ^
../block/nfs.c: In function 'nfs_get_allocated_file_size':
../block/nfs.c:752:1: error: control reaches end of non-void function [-Werror=return-type]
  752 | }
      | ^

On msys2/mingw, there is no st_blocks in struct _stat64, so we use consistence st_size instead.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 block/nfs.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/block/nfs.c b/block/nfs.c
index 61a249a9fc..98b48f363b 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -24,7 +24,9 @@
 
 #include "qemu/osdep.h"
 
+#if !defined(_WIN32)
 #include <poll.h>
+#endif
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
@@ -51,6 +53,12 @@
 #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
 #define QEMU_NFS_MAX_DEBUG_LEVEL 2
 
+#if defined (_WIN32)
+#define nfs_stat __stat64
+#else
+#define nfs_stat stat
+#endif
+
 typedef struct NFSClient {
     struct nfs_context *context;
     struct nfsfh *fh;
@@ -58,7 +66,9 @@ typedef struct NFSClient {
     bool has_zero_init;
     AioContext *aio_context;
     QemuMutex mutex;
+#if !defined (_WIN32)
     blkcnt_t st_blocks;
+#endif
     bool cache_used;
     NFSServer *server;
     char *path;
@@ -70,7 +80,7 @@ typedef struct NFSRPC {
     int ret;
     int complete;
     QEMUIOVector *iov;
-    struct stat *st;
+    struct nfs_stat *st;
     Coroutine *co;
     NFSClient *client;
 } NFSRPC;
@@ -419,7 +429,7 @@ static int64_t nfs_client_open(NFSClient *client, BlockdevOptionsNfs *opts,
                                int flags, int open_flags, Error **errp)
 {
     int64_t ret = -EINVAL;
-    struct stat st;
+    struct nfs_stat st;
     char *file = NULL, *strp = NULL;
 
     qemu_mutex_init(&client->mutex);
@@ -545,7 +555,9 @@ static int64_t nfs_client_open(NFSClient *client, BlockdevOptionsNfs *opts,
     }
 
     ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
+#if !defined (_WIN32)
     client->st_blocks = st.st_blocks;
+#endif
     client->has_zero_init = S_ISREG(st.st_mode);
     *strp = '/';
     goto out;
@@ -706,6 +718,7 @@ static int nfs_has_zero_init(BlockDriverState *bs)
     return client->has_zero_init;
 }
 
+#if !defined (_WIN32)
 /* Called (via nfs_service) with QemuMutex held.  */
 static void
 nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
@@ -729,7 +742,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
 {
     NFSClient *client = bs->opaque;
     NFSRPC task = {0};
-    struct stat st;
+    struct nfs_stat st;
 
     if (bdrv_is_read_only(bs) &&
         !(bs->open_flags & BDRV_O_NOCACHE)) {
@@ -748,6 +761,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
 
     return (task.ret < 0 ? task.ret : st.st_blocks * 512);
 }
+#endif
 
 static int coroutine_fn
 nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
@@ -778,7 +792,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
                               BlockReopenQueue *queue, Error **errp)
 {
     NFSClient *client = state->bs->opaque;
-    struct stat st;
+    struct nfs_stat st;
     int ret = 0;
 
     if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {
@@ -800,7 +814,9 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
                        nfs_get_error(client->context));
             return ret;
         }
+#if !defined (_WIN32)
         client->st_blocks = st.st_blocks;
+#endif
     }
 
     return 0;
@@ -869,7 +885,9 @@ static BlockDriver bdrv_nfs = {
     .create_opts                    = &nfs_create_opts,
 
     .bdrv_has_zero_init             = nfs_has_zero_init,
+#if !defined (_WIN32)
     .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
+#endif
     .bdrv_co_truncate               = nfs_file_co_truncate,
 
     .bdrv_file_open                 = nfs_file_open,
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 01/27] rcu: Implement drain_call_rcu Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-14  7:10   ` Thomas Huth
  2020-09-12 22:44 ` [PATCH v8 04/27] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
                   ` (25 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

The currently random version capstone have the following compiling issue:
  CC      /c/work/xemu/qemu/build/slirp/src/arp_table.o
make[1]: *** No rule to make target “/c/work/xemu/qemu/build/capstone/capstone.lib”。 Stop.

Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1 are the tagged version 4.0.2
when upgrading to this version, the folder structure of include are changed to
qemu\capstone\include
│  platform.h
│
├─capstone
│      arm.h
│      arm64.h
│      capstone.h
│      evm.h
│      m680x.h
│      m68k.h
│      mips.h
│      platform.h
│      ppc.h
│      sparc.h
│      systemz.h
│      tms320c64x.h
│      x86.h
│      xcore.h
│
└─windowsce
        intrin.h
        stdint.h

in capstone. so we need add extra include path -I${source_path}/capstone/include/capstone
for directly #include <capstone.h>, and the exist include path should preserve, because
in capstone code there something like #include "capstone/capstone.h"

If only using
    capstone_cflags="-I${source_path}/capstone/include/capstone"
Then will cause the following compiling error:

  CC      cs.o
cs.c:17:10: fatal error: 'capstone/capstone.h' file not found
#include <capstone/capstone.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 capstone  | 2 +-
 configure | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/capstone b/capstone
index 22ead3e0bf..1d23053284 160000
--- a/capstone
+++ b/capstone
@@ -1 +1 @@
-Subproject commit 22ead3e0bfdb87516656453336160e0a37b066bf
+Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1
diff --git a/configure b/configure
index 4231d56bcc..f4f8bc3756 100755
--- a/configure
+++ b/configure
@@ -5156,7 +5156,7 @@ case "$capstone" in
       LIBCAPSTONE=libcapstone.a
     fi
     capstone_libs="-Lcapstone -lcapstone"
-    capstone_cflags="-I${source_path}/capstone/include"
+    capstone_cflags="-I${source_path}/capstone/include -I${source_path}/capstone/include/capstone"
     ;;
 
   system)
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 04/27] configure: Fixes ncursesw detection under msys2/mingw and enable curses
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (2 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 05/27] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS Yonggang Luo
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

The mingw pkg-config are showing following absolute path and contains : as the separator,
so we must not use : as path separator. and we know the command line parameter are not likely
contains newline, we could use newline as path command line parameter separator

-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI-Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw:
-DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -pipe -lncursesw -lgnurx -ltre -lintl -liconv
-DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -lncursesw
-DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -lcursesw
-DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
-DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -lncursesw
-DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -lcursesw
-DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
-DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw
-DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw

Refer to https://unix.stackexchange.com/a/103011/218958

If your file names are guaranteed not to contain newlines, you can use newlines as the separator. W
hen you expand the variable, first turn off globbing with set -f and set the list of field splitting characters
IFS to contain only a newline.

msys2/mingw lacks the POSIX-required langinfo.h.

gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
test.c:4:10: fatal error: langinfo.h: No such file or directory
    4 | #include <langinfo.h>
      |          ^~~~~~~~~~~~
compilation terminated.

So we using g_get_codeset instead of nl_langinfo(CODESET)

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure   | 25 +++++++++++++++----------
 ui/curses.c | 10 +++++-----
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index f4f8bc3756..b21843fdb9 100755
--- a/configure
+++ b/configure
@@ -3653,35 +3653,40 @@ if test "$iconv" = "no" ; then
 fi
 if test "$curses" != "no" ; then
   if test "$mingw32" = "yes" ; then
-    curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
-    curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
+    curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null)
+      $($pkg_config --cflags ncursesw 2>/dev/null)"
+    curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null)
+      $($pkg_config --libs ncursesw 2>/dev/null)
+      -lpdcurses"
   else
-    curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
-    curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
+    curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null)
+      -I/usr/include/ncursesw:"
+    curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null)
+      -lncursesw
+      -lcursesw"
   fi
   curses_found=no
   cat > $TMPC << EOF
 #include <locale.h>
 #include <curses.h>
 #include <wchar.h>
-#include <langinfo.h>
 int main(void) {
-  const char *codeset;
   wchar_t wch = L'w';
   setlocale(LC_ALL, "");
   resize_term(0, 0);
   addwstr(L"wide chars\n");
   addnwstr(&wch, 1);
   add_wch(WACS_DEGREE);
-  codeset = nl_langinfo(CODESET);
-  return codeset != 0;
+  return 0;
 }
 EOF
-  IFS=:
+  IFS='
+'                           # turn off variable value expansion except for splitting at newlines
   for curses_inc in $curses_inc_list; do
     # Make sure we get the wide character prototypes
     curses_inc="-DNCURSES_WIDECHAR $curses_inc"
-    IFS=:
+    IFS='
+'                           # turn off variable value expansion except for splitting at newlines
     for curses_lib in $curses_lib_list; do
       unset IFS
       if compile_prog "$curses_inc" "$curses_lib" ; then
diff --git a/ui/curses.c b/ui/curses.c
index a59b23a9cf..12bc682cf9 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -30,7 +30,6 @@
 #endif
 #include <locale.h>
 #include <wchar.h>
-#include <langinfo.h>
 #include <iconv.h>
 
 #include "qapi/error.h"
@@ -526,6 +525,7 @@ static void font_setup(void)
     iconv_t nativecharset_to_ucs2;
     iconv_t font_conv;
     int i;
+    g_autofree gchar *local_codeset = g_get_codeset();
 
     /*
      * Control characters are normally non-printable, but VGA does have
@@ -566,14 +566,14 @@ static void font_setup(void)
       0x25bc
     };
 
-    ucs2_to_nativecharset = iconv_open(nl_langinfo(CODESET), "UCS-2");
+    ucs2_to_nativecharset = iconv_open(local_codeset, "UCS-2");
     if (ucs2_to_nativecharset == (iconv_t) -1) {
         fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n",
                         strerror(errno));
         exit(1);
     }
 
-    nativecharset_to_ucs2 = iconv_open("UCS-2", nl_langinfo(CODESET));
+    nativecharset_to_ucs2 = iconv_open("UCS-2", local_codeset);
     if (nativecharset_to_ucs2 == (iconv_t) -1) {
         iconv_close(ucs2_to_nativecharset);
         fprintf(stderr, "Could not convert font glyphs to UCS-2: '%s'\n",
@@ -581,7 +581,7 @@ static void font_setup(void)
         exit(1);
     }
 
-    font_conv = iconv_open(nl_langinfo(CODESET), font_charset);
+    font_conv = iconv_open(local_codeset, font_charset);
     if (font_conv == (iconv_t) -1) {
         iconv_close(ucs2_to_nativecharset);
         iconv_close(nativecharset_to_ucs2);
@@ -602,7 +602,7 @@ static void font_setup(void)
     /* DEL */
     convert_ucs(0x7F, 0x2302, ucs2_to_nativecharset);
 
-    if (strcmp(nl_langinfo(CODESET), "UTF-8")) {
+    if (strcmp(local_codeset, "UTF-8")) {
         /* Non-Unicode capable, use termcap equivalents for those available */
         for (i = 0; i <= 0xFF; i++) {
             wchar_t wch[CCHARW_MAX];
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 05/27] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS.
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (3 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 04/27] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 06/27] curses: Fixes curses compiling errors Yonggang Luo
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

First, this reduce the size of configure, configure are tending to removal in future,
and this didn't introduce any new feature or remove any exist feature.
Second, the current localtime_r detection are conflict with ncursesw detection in
mingw, when ncursesw detected, it will provide the following compile flags
pkg-config --cflags ncursesw
-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI-Tools/msys64/mingw64/include/ncursesw
And the compile flag _POSIX_C_SOURCE will always cause _POSIX_THREAD_SAFE_FUNCTIONS to
be defined, in new version of mingw, that's will cause localtime_r to be defined.
But the configure script didn't provide _POSIX_C_SOURCE macro, and that's will result
localtime_r not detected because localtime_r are defined in forceinline manner.

And finally cause conflict between QEMU defined localtime_r
struct tm *localtime_r(const time_t *timep, struct tm *result);
with mingw defined localtime_r

```
#if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
#endif

#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
__forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
  return localtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
  return gmtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) {
  return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
}
__forceinline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) {
  return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
}
#endif
```

So I suggest remove this configure script, and restrict msys2/mingw version to easy to maintain.
And use _POSIX_THREAD_SAFE_FUNCTIONS to guard the localtime_r and counterpart functions

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 configure                 | 34 ----------------------------------
 include/sysemu/os-win32.h |  4 ++--
 util/oslib-win32.c        |  2 +-
 3 files changed, 3 insertions(+), 37 deletions(-)

diff --git a/configure b/configure
index b21843fdb9..af86ba1db3 100755
--- a/configure
+++ b/configure
@@ -2495,37 +2495,6 @@ if test "$vhost_net" = ""; then
   test "$vhost_kernel" = "yes" && vhost_net=yes
 fi
 
-##########################################
-# MinGW / Mingw-w64 localtime_r/gmtime_r check
-
-if test "$mingw32" = "yes"; then
-    # Some versions of MinGW / Mingw-w64 lack localtime_r
-    # and gmtime_r entirely.
-    #
-    # Some versions of Mingw-w64 define a macro for
-    # localtime_r/gmtime_r.
-    #
-    # Some versions of Mingw-w64 will define functions
-    # for localtime_r/gmtime_r, but only if you have
-    # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
-    # though, unistd.h and pthread.h both define
-    # that for you.
-    #
-    # So this #undef localtime_r and #include <unistd.h>
-    # are not in fact redundant.
-cat > $TMPC << EOF
-#include <unistd.h>
-#include <time.h>
-#undef localtime_r
-int main(void) { localtime_r(NULL, NULL); return 0; }
-EOF
-    if compile_prog "" "" ; then
-        localtime_r="yes"
-    else
-        localtime_r="no"
-    fi
-fi
-
 ##########################################
 # pkg-config probe
 
@@ -7087,9 +7056,6 @@ if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak
 fi
 
-if test "$localtime_r" = "yes" ; then
-  echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
-fi
 if test "$qom_cast_debug" = "yes" ; then
   echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
 fi
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index d8978e28c0..3ac8a53bac 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -48,12 +48,12 @@
 #define siglongjmp(env, val) longjmp(env, val)
 
 /* Missing POSIX functions. Don't use MinGW-w64 macros. */
-#ifndef CONFIG_LOCALTIME_R
+#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
 #undef gmtime_r
 struct tm *gmtime_r(const time_t *timep, struct tm *result);
 #undef localtime_r
 struct tm *localtime_r(const time_t *timep, struct tm *result);
-#endif /* CONFIG_LOCALTIME_R */
+#endif
 
 static inline void os_setup_signal_handling(void) {}
 static inline void os_daemonize(void) {}
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index c654dafd93..f2fa9a3549 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -106,7 +106,7 @@ void qemu_anon_ram_free(void *ptr, size_t size)
     }
 }
 
-#ifndef CONFIG_LOCALTIME_R
+#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
 /* FIXME: add proper locking */
 struct tm *gmtime_r(const time_t *timep, struct tm *result)
 {
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 06/27] curses: Fixes curses compiling errors.
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (4 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 05/27] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 07/27] tests: disable /char/stdio/* tests in test-char.c on win32 Yonggang Luo
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

This is the compiling error:
../ui/curses.c: In function 'curses_refresh':
../ui/curses.c:256:5: error: 'next_maybe_keycode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  256 |     curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keycode)
      |     ^~~~~~~~~~
../ui/curses.c:302:32: note: 'next_maybe_keycode' was declared here
  302 |             enum maybe_keycode next_maybe_keycode;
      |                                ^~~~~~~~~~~~~~~~~~
../ui/curses.c:256:5: error: 'maybe_keycode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  256 |     curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keycode)
      |     ^~~~~~~~~~
../ui/curses.c:265:24: note: 'maybe_keycode' was declared here
  265 |     enum maybe_keycode maybe_keycode;
      |                        ^~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors

gcc version 10.2.0 (Rev1, Built by MSYS2 project)

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 ui/curses.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/curses.c b/ui/curses.c
index 12bc682cf9..e4f9588c3e 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -262,7 +262,7 @@ static int curses2foo(const int _curses2foo[], const int _curseskey2foo[],
 static void curses_refresh(DisplayChangeListener *dcl)
 {
     int chr, keysym, keycode, keycode_alt;
-    enum maybe_keycode maybe_keycode;
+    enum maybe_keycode maybe_keycode = CURSES_KEYCODE;
 
     curses_winch_check();
 
@@ -299,7 +299,7 @@ static void curses_refresh(DisplayChangeListener *dcl)
 
         /* alt or esc key */
         if (keycode == 1) {
-            enum maybe_keycode next_maybe_keycode;
+            enum maybe_keycode next_maybe_keycode = CURSES_KEYCODE;
             int nextchr = console_getch(&next_maybe_keycode);
 
             if (nextchr != -1) {
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 07/27] tests: disable /char/stdio/* tests in test-char.c on win32
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (5 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 06/27] curses: Fixes curses compiling errors Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 08/27] tests: Fixes test-replication.c on msys2/mingw Yonggang Luo
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

These tests are blocking test-char to be finished.
Disable them by using variable is_win32, so we doesn't
need macro to open it. and easy recover those function
latter.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 tests/test-char.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/tests/test-char.c b/tests/test-char.c
index d35cc839bc..184ddceab8 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -77,7 +77,6 @@ static void fe_event(void *opaque, QEMUChrEvent event)
     }
 }
 
-#ifdef _WIN32
 static void char_console_test_subprocess(void)
 {
     QemuOpts *opts;
@@ -102,7 +101,7 @@ static void char_console_test(void)
     g_test_trap_assert_passed();
     g_test_trap_assert_stdout("CONSOLE");
 }
-#endif
+
 static void char_stdio_test_subprocess(void)
 {
     Chardev *chr;
@@ -1448,7 +1447,11 @@ static SocketAddress unixaddr = {
 
 int main(int argc, char **argv)
 {
-    bool has_ipv4, has_ipv6;
+    bool has_ipv4, has_ipv6, is_win32 = false;
+
+#ifdef _WIN32
+    is_win32 = true;
+#endif
 
     qemu_init_main_loop(&error_abort);
     socket_init();
@@ -1467,12 +1470,15 @@ int main(int argc, char **argv)
     g_test_add_func("/char/invalid", char_invalid_test);
     g_test_add_func("/char/ringbuf", char_ringbuf_test);
     g_test_add_func("/char/mux", char_mux_test);
-#ifdef _WIN32
-    g_test_add_func("/char/console/subprocess", char_console_test_subprocess);
-    g_test_add_func("/char/console", char_console_test);
-#endif
-    g_test_add_func("/char/stdio/subprocess", char_stdio_test_subprocess);
-    g_test_add_func("/char/stdio", char_stdio_test);
+    if (0) {
+        g_test_add_func("/char/console/subprocess", char_console_test_subprocess);
+        g_test_add_func("/char/console", char_console_test);
+    }
+
+    if (!is_win32) {
+        g_test_add_func("/char/stdio/subprocess", char_stdio_test_subprocess);
+        g_test_add_func("/char/stdio", char_stdio_test);
+    }
 #ifndef _WIN32
     g_test_add_func("/char/pipe", char_pipe_test);
 #endif
@@ -1534,7 +1540,7 @@ int main(int argc, char **argv)
     g_test_add_data_func("/char/socket/client/dupid-reconnect/" # name, \
                          &client8 ##name, char_socket_client_dupid_test)
 
-    if (has_ipv4) {
+    if (has_ipv4 && !is_win32) {
         SOCKET_SERVER_TEST(tcp, &tcpaddr);
         SOCKET_CLIENT_TEST(tcp, &tcpaddr);
         g_test_add_data_func("/char/socket/server/two-clients/tcp", &tcpaddr,
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 08/27] tests: Fixes test-replication.c on msys2/mingw.
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (6 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 07/27] tests: disable /char/stdio/* tests in test-char.c on win32 Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 15:37   ` Philippe Mathieu-Daudé
  2020-09-12 22:44 ` [PATCH v8 09/27] tests: test-replication disable /replication/secondary/* " Yonggang Luo
                   ` (20 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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;
 }
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 09/27] tests: test-replication disable /replication/secondary/* on msys2/mingw.
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (7 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 08/27] tests: Fixes test-replication.c on msys2/mingw Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 10/27] osdep: file locking functions are not available on Win32 Yonggang Luo
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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();
 
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 10/27] osdep: file locking functions are not available on Win32
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (8 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 09/27] tests: test-replication disable /replication/secondary/* " Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 15:36   ` Philippe Mathieu-Daudé
  2020-09-12 22:44 ` [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows Yonggang Luo
                   ` (18 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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"
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (9 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 10/27] osdep: file locking functions are not available on Win32 Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 15:35   ` Philippe Mathieu-Daudé
  2020-09-12 22:44 ` [PATCH v8 12/27] gcrypt: test_tls_psk_init should write binary file instead text file Yonggang Luo
                   ` (17 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

On windows, a difference in line endings causes testsuite failures
complaining that every single line in files such as
'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b to diff.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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'])
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 12/27] gcrypt: test_tls_psk_init should write binary file instead text file.
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (10 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 15:31   ` Philippe Mathieu-Daudé
  2020-09-12 22:44 ` [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw Yonggang Luo
                   ` (16 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

On windows, if open file with "w", it's will automatically convert
"\n" to "\r\n" when writing to file.

Convert unlink to use g_remove.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 tests/crypto-tls-psk-helpers.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/crypto-tls-psk-helpers.c b/tests/crypto-tls-psk-helpers.c
index a8395477c3..58888d5537 100644
--- a/tests/crypto-tls-psk-helpers.c
+++ b/tests/crypto-tls-psk-helpers.c
@@ -26,13 +26,15 @@
 #include "crypto-tls-psk-helpers.h"
 #include "qemu/sockets.h"
 
+#include <glib/gstdio.h>
+
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
 void test_tls_psk_init(const char *pskfile)
 {
     FILE *fp;
 
-    fp = fopen(pskfile, "w");
+    fp = fopen(pskfile, "wb");
     if (fp == NULL) {
         g_critical("Failed to create pskfile %s", pskfile);
         abort();
@@ -44,7 +46,7 @@ void test_tls_psk_init(const char *pskfile)
 
 void test_tls_psk_cleanup(const char *pskfile)
 {
-    unlink(pskfile);
+    g_remove(pskfile);
 }
 
 #endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (11 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 12/27] gcrypt: test_tls_psk_init should write binary file instead text file Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-14  7:23   ` Thomas Huth
  2020-09-12 22:44 ` [PATCH v8 14/27] meson: remove empty else and duplicated gio deps Yonggang Luo
                   ` (15 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

Fixes 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 in the header

Add qemu_socket_pair for cross platform support, convert file system
handling functions to glib
Add qemu_link function instead posix only link function.
Use send ad recv from qemu that convert Windows Socks error
to errno properly.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 tests/crypto-tls-x509-helpers.c  | 169 ++++++++++++++++++++++++++++++-
 tests/crypto-tls-x509-helpers.h  |   9 +-
 tests/test-crypto-tlscredsx509.c |  47 +++++----
 tests/test-crypto-tlssession.c   |  68 +++++++------
 tests/test-io-channel-tls.c      |  51 ++++++----
 5 files changed, 266 insertions(+), 78 deletions(-)

diff --git a/tests/crypto-tls-x509-helpers.c b/tests/crypto-tls-x509-helpers.c
index 01b3daf358..c624d8799b 100644
--- a/tests/crypto-tls-x509-helpers.c
+++ b/tests/crypto-tls-x509-helpers.c
@@ -23,6 +23,8 @@
 #include "crypto-tls-x509-helpers.h"
 #include "crypto/init.h"
 #include "qemu/sockets.h"
+#include <glib.h>
+#include <glib/gstdio.h>
 
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
@@ -133,7 +135,7 @@ void test_tls_init(const char *keyfile)
 void test_tls_cleanup(const char *keyfile)
 {
     asn1_delete_structure(&pkix_asn1);
-    unlink(keyfile);
+    g_remove(keyfile);
 }
 
 /*
@@ -501,8 +503,171 @@ void test_tls_discard_cert(QCryptoTLSTestCertReq *req)
     req->crt = NULL;
 
     if (getenv("QEMU_TEST_DEBUG_CERTS") == NULL) {
-        unlink(req->filename);
+        g_remove(req->filename);
     }
 }
 
+int qemu_link(const char *exist_path1, const char *new_path2)
+{
+#ifdef _WIN32
+    g_autofree gchar *current_dir = g_get_current_dir();
+    g_autofree gchar *full_path = g_build_filename(current_dir, exist_path1, NULL);
+    return CreateSymbolicLinkA(new_path2, full_path, 0 | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE) ? 0 : -1;
+#else
+    return link(exist_path1, new_path2);
+#endif
+}
+
+#ifdef _WIN32
+
+static int __stream_socketpair(struct addrinfo* addr_info, int sock[2]){
+    SOCKET listener, client, server;
+    int opt = 1;
+
+    listener = server = client = INVALID_SOCKET;
+    listener = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);
+    if (INVALID_SOCKET == listener)
+        goto fail;
+
+    setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,(const char*)&opt, sizeof(opt));
+
+    if(SOCKET_ERROR == bind(listener, addr_info->ai_addr, addr_info->ai_addrlen))
+        goto fail;
+
+    if (SOCKET_ERROR == getsockname(listener, addr_info->ai_addr, (int*)&addr_info->ai_addrlen))
+        goto fail;
+
+    if(SOCKET_ERROR == listen(listener, 5))
+        goto fail;
+
+    client = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);
+
+    if (INVALID_SOCKET == client)
+        goto fail;
+
+    if (SOCKET_ERROR == connect(client,addr_info->ai_addr,addr_info->ai_addrlen))
+        goto fail;
+
+    server = accept(listener, 0, 0);
+
+    if (INVALID_SOCKET == server)
+        goto fail;
+
+    closesocket(listener);
+
+    sock[0] = client;
+    sock[1] = server;
+
+    return 0;
+fail:
+    if(INVALID_SOCKET!=listener)
+        closesocket(listener);
+    if (INVALID_SOCKET!=client)
+        closesocket(client);
+    return -1;
+}
+
+static int __dgram_socketpair(struct addrinfo* addr_info, int sock[2])
+{
+    SOCKET client, server;
+    struct addrinfo addr, *result = NULL;
+    const char* address;
+    int opt = 1;
+
+    server = client = INVALID_SOCKET;
+
+    server = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);  
+    if (INVALID_SOCKET == server)
+        goto fail;
+
+    setsockopt(server, SOL_SOCKET,SO_REUSEADDR, (const char*)&opt, sizeof(opt));
+
+    if(SOCKET_ERROR == bind(server, addr_info->ai_addr, addr_info->ai_addrlen))
+        goto fail;
+
+    if (SOCKET_ERROR == getsockname(server, addr_info->ai_addr, (int*)&addr_info->ai_addrlen))
+        goto fail;
+
+    client = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol); 
+    if (INVALID_SOCKET == client)
+        goto fail;
+
+    memset(&addr,0,sizeof(addr));
+    addr.ai_family = addr_info->ai_family;
+    addr.ai_socktype = addr_info->ai_socktype;
+    addr.ai_protocol = addr_info->ai_protocol;
+
+    if (AF_INET6==addr.ai_family)
+        address = "0:0:0:0:0:0:0:1";
+    else
+        address = "127.0.0.1";
+
+    if (getaddrinfo(address, "0", &addr, &result))
+        goto fail;
+
+    setsockopt(client,SOL_SOCKET,SO_REUSEADDR,(const char*)&opt, sizeof(opt));
+    if(SOCKET_ERROR == bind(client, result->ai_addr, result->ai_addrlen))
+        goto fail;
+
+    if (SOCKET_ERROR == getsockname(client, result->ai_addr, (int*)&result->ai_addrlen))
+        goto fail;
+
+    if (SOCKET_ERROR == connect(server, result->ai_addr, result->ai_addrlen))
+        goto fail;
+
+    if (SOCKET_ERROR == connect(client, addr_info->ai_addr, addr_info->ai_addrlen))
+        goto fail;
+
+    freeaddrinfo(result);
+    sock[0] = client;
+    sock[1] = server;
+    return 0;
+
+fail:
+    if (INVALID_SOCKET!=client)
+        closesocket(client);
+    if (INVALID_SOCKET!=server)
+        closesocket(server);
+    if (result)
+        freeaddrinfo(result);
+    return -1;
+}
+
+int qemu_socketpair(int family, int type, int protocol,int recv[2]){
+    const char* address;
+    struct addrinfo addr_info,*p_addrinfo;
+    int result = -1;
+
+    if (family == AF_UNIX)
+    {
+        family = AF_INET;
+    }
+
+    memset(&addr_info, 0, sizeof(addr_info));
+    addr_info.ai_family = family;
+    addr_info.ai_socktype = type;
+    addr_info.ai_protocol = protocol;
+    if (AF_INET6==family)
+        address = "0:0:0:0:0:0:0:1";
+    else
+        address = "127.0.0.1";
+
+    if (0 == getaddrinfo(address, "0", &addr_info, &p_addrinfo)){
+        if (SOCK_STREAM == type)
+            result = __stream_socketpair(p_addrinfo, recv);
+        else if(SOCK_DGRAM == type)
+            result = __dgram_socketpair(p_addrinfo, recv);
+        freeaddrinfo(p_addrinfo);
+    }
+    return result;
+}
+
+#else
+
+int qemu_socketpair(int family, int type, int protocol,int recv[2]) {
+    return socketpair(family, type, protocol, recv);
+}
+
+#endif
+
 #endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
diff --git a/tests/crypto-tls-x509-helpers.h b/tests/crypto-tls-x509-helpers.h
index 08efba4e19..75a902278c 100644
--- a/tests/crypto-tls-x509-helpers.h
+++ b/tests/crypto-tls-x509-helpers.h
@@ -24,8 +24,9 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
-#if !(defined WIN32) && \
-    defined(CONFIG_TASN1)
+#include "qemu/osdep.h"
+
+#if defined(CONFIG_TASN1)
 # define QCRYPTO_HAVE_TLS_TEST_SUPPORT
 #endif
 
@@ -127,6 +128,10 @@ void test_tls_cleanup(const char *keyfile);
 
 extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
 
+int qemu_link(const char *exist_path1, const char *new_path2);
+
+int qemu_socketpair(int family, int type, int protocol,int recv[2]);
+
 #endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
 
 #endif
diff --git a/tests/test-crypto-tlscredsx509.c b/tests/test-crypto-tlscredsx509.c
index f487349c32..620fbde1ca 100644
--- a/tests/test-crypto-tlscredsx509.c
+++ b/tests/test-crypto-tlscredsx509.c
@@ -25,6 +25,9 @@
 #include "qapi/error.h"
 #include "qemu/module.h"
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
 #define WORKDIR "tests/test-crypto-tlscredsx509-work/"
@@ -77,34 +80,34 @@ static void test_tls_creds(const void *opaque)
     QCryptoTLSCreds *creds;
 
 #define CERT_DIR "tests/test-crypto-tlscredsx509-certs/"
-    mkdir(CERT_DIR, 0700);
+    g_mkdir_with_parents(CERT_DIR, 0700);
 
-    unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove (CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
     if (data->isServer) {
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
+        g_remove (CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
+        g_remove (CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
     } else {
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
+        g_remove (CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
+        g_remove (CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
     }
 
-    if (access(data->cacrt, R_OK) == 0) {
-        g_assert(link(data->cacrt,
+    if (g_access(data->cacrt, R_OK) == 0) {
+        g_assert(qemu_link(data->cacrt,
                       CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
     }
     if (data->isServer) {
-        if (access(data->crt, R_OK) == 0) {
-            g_assert(link(data->crt,
+        if (g_access(data->crt, R_OK) == 0) {
+            g_assert(qemu_link(data->crt,
                           CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT) == 0);
         }
-        g_assert(link(KEYFILE,
+        g_assert(qemu_link(KEYFILE,
                       CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY) == 0);
     } else {
-        if (access(data->crt, R_OK) == 0) {
-            g_assert(link(data->crt,
+        if (g_access(data->crt, R_OK) == 0) {
+            g_assert(qemu_link(data->crt,
                           CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT) == 0);
         }
-        g_assert(link(KEYFILE,
+        g_assert(qemu_link(KEYFILE,
                       CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY) == 0);
     }
 
@@ -121,15 +124,15 @@ static void test_tls_creds(const void *opaque)
         g_assert(creds != NULL);
     }
 
-    unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
     if (data->isServer) {
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
+        g_remove(CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
+        g_remove(CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
     } else {
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
-        unlink(CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
+        g_remove(CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
+        g_remove(CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
     }
-    rmdir(CERT_DIR);
+    g_rmdir(CERT_DIR);
     if (creds) {
         object_unparent(OBJECT(creds));
     }
@@ -143,7 +146,7 @@ int main(int argc, char **argv)
     g_test_init(&argc, &argv, NULL);
     g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
 
-    mkdir(WORKDIR, 0700);
+    g_mkdir_with_parents(WORKDIR, 0700);
 
     test_tls_init(KEYFILE);
 
@@ -699,7 +702,7 @@ int main(int argc, char **argv)
     test_tls_discard_cert(&cacertlevel2areq);
     test_tls_discard_cert(&servercertlevel3areq);
     test_tls_discard_cert(&clientcertlevel2breq);
-    unlink(WORKDIR "cacertchain-ctx.pem");
+    g_remove(WORKDIR "cacertchain-ctx.pem");
 
     test_tls_cleanup(KEYFILE);
     rmdir(WORKDIR);
diff --git a/tests/test-crypto-tlssession.c b/tests/test-crypto-tlssession.c
index 8b2453fa79..f726219593 100644
--- a/tests/test-crypto-tlssession.c
+++ b/tests/test-crypto-tlssession.c
@@ -28,9 +28,13 @@
 #include "qom/object_interfaces.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
+#include "qemu/main-loop.h"
 #include "qemu/sockets.h"
 #include "authz/list.h"
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
 #define WORKDIR "tests/test-crypto-tlssession-work/"
@@ -40,15 +44,16 @@
 static ssize_t testWrite(const char *buf, size_t len, void *opaque)
 {
     int *fd = opaque;
-
-    return write(*fd, buf, len);
+    int written = send(*fd, buf, len, 0);
+    return written;
 }
 
 static ssize_t testRead(char *buf, size_t len, void *opaque)
 {
     int *fd = opaque;
 
-    return read(*fd, buf, len);
+    int readed = recv(*fd, buf, len, 0);
+    return readed;
 }
 
 static QCryptoTLSCreds *test_tls_creds_psk_create(
@@ -84,7 +89,7 @@ static void test_crypto_tls_session_psk(void)
     int ret;
 
     /* We'll use this for our fake client-server connection */
-    ret = socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
+    ret = qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
     g_assert(ret == 0);
 
     /*
@@ -238,7 +243,7 @@ static void test_crypto_tls_session_x509(const void *opaque)
     int ret;
 
     /* We'll use this for our fake client-server connection */
-    ret = socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
+    ret = qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
     g_assert(ret == 0);
 
     /*
@@ -251,29 +256,29 @@ static void test_crypto_tls_session_x509(const void *opaque)
 
 #define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/"
 #define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/"
-    mkdir(CLIENT_CERT_DIR, 0700);
-    mkdir(SERVER_CERT_DIR, 0700);
+    g_mkdir_with_parents(CLIENT_CERT_DIR, 0700);
+    g_mkdir_with_parents(SERVER_CERT_DIR, 0700);
 
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
 
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
 
-    g_assert(link(data->servercacrt,
+    g_assert(qemu_link(data->servercacrt,
                   SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
-    g_assert(link(data->servercrt,
+    g_assert(qemu_link(data->servercrt,
                   SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT) == 0);
-    g_assert(link(KEYFILE,
+    g_assert(qemu_link(KEYFILE,
                   SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY) == 0);
 
-    g_assert(link(data->clientcacrt,
+    g_assert(qemu_link(data->clientcacrt,
                   CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
-    g_assert(link(data->clientcrt,
+    g_assert(qemu_link(data->clientcrt,
                   CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT) == 0);
-    g_assert(link(KEYFILE,
+    g_assert(qemu_link(KEYFILE,
                   CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY) == 0);
 
     clientCreds = test_tls_creds_x509_create(
@@ -369,16 +374,16 @@ static void test_crypto_tls_session_x509(const void *opaque)
         g_assert(!data->expectClientFail);
     }
 
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
 
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
 
-    rmdir(CLIENT_CERT_DIR);
-    rmdir(SERVER_CERT_DIR);
+    g_rmdir(CLIENT_CERT_DIR);
+    g_rmdir(SERVER_CERT_DIR);
 
     object_unparent(OBJECT(serverCreds));
     object_unparent(OBJECT(clientCreds));
@@ -397,10 +402,13 @@ int main(int argc, char **argv)
     int ret;
 
     module_call_init(MODULE_INIT_QOM);
+    qemu_init_main_loop(&error_abort);
+    socket_init();
+
     g_test_init(&argc, &argv, NULL);
     g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
 
-    mkdir(WORKDIR, 0700);
+    g_mkdir_with_parents(WORKDIR, 0700);
 
     test_tls_init(KEYFILE);
     test_tls_psk_init(PSKFILE);
@@ -640,11 +648,11 @@ int main(int argc, char **argv)
     test_tls_discard_cert(&cacertlevel2areq);
     test_tls_discard_cert(&servercertlevel3areq);
     test_tls_discard_cert(&clientcertlevel2breq);
-    unlink(WORKDIR "cacertchain-sess.pem");
+    g_remove(WORKDIR "cacertchain-sess.pem");
 
     test_tls_psk_cleanup(PSKFILE);
     test_tls_cleanup(KEYFILE);
-    rmdir(WORKDIR);
+    g_rmdir(WORKDIR);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c
index ad7554c534..e858716192 100644
--- a/tests/test-io-channel-tls.c
+++ b/tests/test-io-channel-tls.c
@@ -31,9 +31,13 @@
 #include "crypto/tlscredsx509.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
+#include "qemu/main-loop.h"
 #include "authz/list.h"
 #include "qom/object_interfaces.h"
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
 #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
 
 #define WORKDIR "tests/test-io-channel-tls-work/"
@@ -123,33 +127,33 @@ static void test_io_channel_tls(const void *opaque)
     GMainContext *mainloop;
 
     /* We'll use this for our fake client-server connection */
-    g_assert(socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == 0);
+    g_assert(qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == 0);
 
 #define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/"
 #define SERVER_CERT_DIR "tests/test-io-channel-tls-server/"
-    mkdir(CLIENT_CERT_DIR, 0700);
-    mkdir(SERVER_CERT_DIR, 0700);
+    g_mkdir(CLIENT_CERT_DIR, 0700);
+    g_mkdir(SERVER_CERT_DIR, 0700);
 
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
 
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
 
-    g_assert(link(data->servercacrt,
+    g_assert(qemu_link(data->servercacrt,
                   SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
-    g_assert(link(data->servercrt,
+    g_assert(qemu_link(data->servercrt,
                   SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT) == 0);
-    g_assert(link(KEYFILE,
+    g_assert(qemu_link(KEYFILE,
                   SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY) == 0);
 
-    g_assert(link(data->clientcacrt,
+    g_assert(qemu_link(data->clientcacrt,
                   CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT) == 0);
-    g_assert(link(data->clientcrt,
+    g_assert(qemu_link(data->clientcrt,
                   CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT) == 0);
-    g_assert(link(KEYFILE,
+    g_assert(qemu_link(KEYFILE,
                   CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY) == 0);
 
     clientCreds = test_tls_creds_create(
@@ -238,13 +242,13 @@ static void test_io_channel_tls(const void *opaque)
                                  QIO_CHANNEL(serverChanTLS));
     qio_channel_test_validate(test);
 
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-    unlink(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
+    g_remove(SERVER_CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
 
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
-    unlink(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CA_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT);
+    g_remove(CLIENT_CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY);
 
     rmdir(CLIENT_CERT_DIR);
     rmdir(SERVER_CERT_DIR);
@@ -272,10 +276,13 @@ int main(int argc, char **argv)
     g_assert(qcrypto_init(NULL) == 0);
 
     module_call_init(MODULE_INIT_QOM);
+    qemu_init_main_loop(&error_abort);
+    socket_init();
+
     g_test_init(&argc, &argv, NULL);
     g_setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
 
-    mkdir(WORKDIR, 0700);
+    g_mkdir(WORKDIR, 0700);
 
     test_tls_init(KEYFILE);
 
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 14/27] meson: remove empty else and duplicated gio deps
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (12 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 15/27] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 meson.build | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/meson.build b/meson.build
index bd84a1e777..a725b66a83 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
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 15/27] vmstate: Fixes test-vmstate.c on msys2/mingw
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (13 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 14/27] meson: remove empty else and duplicated gio deps Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 16/27] cirrus: Building freebsd in a single short Yonggang Luo
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Michael Roth, qemu-block,
	Stefan Weil, Xie Changlong, Peter Lieven, Markus Armbruster,
	Max Reitz, Yonggang Luo, Gerd Hoffmann, Daniel P . Berrangé,
	Wen Congyang, Paolo Bonzini, Richard Henderson,
	Philippe Mathieu-Daudé,
	Li-Wen Hsu

The vmstate are valid on win32, just need generate tmp path properly

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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..ac38bfcfe8 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);
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 16/27] cirrus: Building freebsd in a single short
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (14 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 15/27] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-14  7:27   ` Thomas Huth
  2020-09-12 22:44 ` [PATCH v8 17/27] tests: Convert g_free to g_autofree macro in test-logging.c Yonggang Luo
                   ` (12 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ed Maste <emaste@FreeBSD.org>
---
 .cirrus.yml | 35 ++++++++---------------------------
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 3dd9fcff7f..690c6882e8 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
 
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 17/27] tests: Convert g_free to g_autofree macro in test-logging.c
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (15 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 16/27] cirrus: Building freebsd in a single short Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 18/27] tests: Fixes test-io-channel-socket.c tests under msys2/mingw Yonggang Luo
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Philippe Mathieu-Daudé,
	Li-Wen Hsu

g_autofree are prefer than g_free when possible.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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;
 }
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 18/27] tests: Fixes test-io-channel-socket.c tests under msys2/mingw
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (16 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 17/27] tests: Convert g_free to g_autofree macro in test-logging.c Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 19/27] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c Yonggang Luo
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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);
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 19/27] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (17 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 18/27] tests: Fixes test-io-channel-socket.c tests under msys2/mingw Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 20/27] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

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 <luoyonggang@gmail.com>
---
 util/aio-win32.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/util/aio-win32.c b/util/aio-win32.c
index 953c56ab48..9899546a8a 100644
--- a/util/aio-win32.c
+++ b/util/aio-win32.c
@@ -37,6 +37,15 @@ 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 +148,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 {
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 20/27] tests: Fixes test-io-channel-file by mask only owner file state mask bits
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (18 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 19/27] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 15:28   ` Philippe Mathieu-Daudé
  2020-09-12 22:44 ` [PATCH v8 21/27] tests: fix test-util-sockets.c Yonggang Luo
                   ` (8 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

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 <luoyonggang@gmail.com>
---
 tests/test-io-channel-file.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c
index bac2b07562..1b0e8d7c1b 100644
--- a/tests/test-io-channel-file.c
+++ b/tests/test-io-channel-file.c
@@ -28,6 +28,12 @@
 #define TEST_FILE "tests/test-io-channel-file.txt"
 #define TEST_MASK 0600
 
+#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 +62,9 @@ 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);
+    /* 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. */
+    g_assert_cmpuint(TEST_MASK & ~mask, ==, st.st_mode & TEST_MASK_EXPECT);
 
     unlink(TEST_FILE);
     object_unref(OBJECT(src));
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 21/27] tests: fix test-util-sockets.c
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (19 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 20/27] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 22/27] tests: Fixes test-qdev-global-props.c Yonggang Luo
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 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__
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 22/27] tests: Fixes test-qdev-global-props.c
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (20 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 21/27] tests: fix test-util-sockets.c Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 23/27] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full Yonggang Luo
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

On win32 the line ending are \r\n, so we skip the \n in function test_dynamic_globalprop

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/test-qdev-global-props.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c
index 8a3c14d92c..be6bcfc46b 100644
--- a/tests/test-qdev-global-props.c
+++ b/tests/test-qdev-global-props.c
@@ -251,10 +251,10 @@ 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("");
 }
 
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 23/27] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (21 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 22/27] tests: Fixes test-qdev-global-props.c Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 24/27] ci: Enable msys2 ci in cirrus Yonggang Luo
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

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 <luoyonggang@gmail.com>
---
 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;
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 24/27] ci: Enable msys2 ci in cirrus
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (22 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 23/27] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-14  7:38   ` Thomas Huth
  2020-09-12 22:44 ` [PATCH v8 25/27] meson: upgrade meson for execute custom ninjatool under msys2 properly Yonggang Luo
                   ` (4 subsequent siblings)
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, Michael Roth, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Markus Armbruster, Max Reitz, Yonggang Luo,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu

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 using environment variable settings:
    MSYS: winsymlinks:nativestrict
    MSYSTEM: MINGW64
    CHERE_INVOKING: 1
to opening mingw64 native shell.
We now running tests with make -i check to skip tests errors.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 .cirrus.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 690c6882e8..1ff9f0a72f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -44,3 +44,63 @@ 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 -Sy --noconfirm"
+    - C:\tools\msys64\usr\bin\bash.exe -lc "pacman --needed --noconfirm -S 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-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-jemalloc
+        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-capstone
+        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-libnfs
+        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"
+    - 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"
+
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 25/27] meson: upgrade meson for execute custom ninjatool under msys2 properly
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (23 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 24/27] ci: Enable msys2 ci in cirrus Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 26/27] meson: remove --ninja option in configure Yonggang Luo
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

* Bump versions to 0.55.2 for release

* Tag Info:
object 008d13038f95e7c7d8ad553f14e408da5b94c360
type commit
tag 0.55.2
tagger Jussi Pakkanen <jpakkane@gmail.com> 2020/9/11 1:24:47

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 meson | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson b/meson
index 68ed748f84..008d13038f 160000
--- a/meson
+++ b/meson
@@ -1 +1 @@
-Subproject commit 68ed748f84f14c2d4e62dcbd123816e5898eb04c
+Subproject commit 008d13038f95e7c7d8ad553f14e408da5b94c360
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 26/27] meson: remove --ninja option in configure.
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (24 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 25/27] meson: upgrade meson for execute custom ninjatool under msys2 properly Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-12 22:44 ` [PATCH v8 27/27] Revert "configure: add --ninja option" Yonggang Luo
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 1ff9f0a72f..87bd110d28 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -99,7 +99,7 @@ windows_msys2_task:
         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"
+    - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure --python=python3"
     - 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"
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (25 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 26/27] meson: remove --ninja option in configure Yonggang Luo
@ 2020-09-12 22:44 ` Yonggang Luo
  2020-09-13 14:08   ` Paolo Bonzini
  2020-09-12 23:06 ` [PATCH v8 00/27] W32, W64 msys2/mingw patches no-reply
  2020-09-14  6:10 ` Thomas Huth
  28 siblings, 1 reply; 71+ messages in thread
From: Yonggang Luo @ 2020-09-12 22:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu

This reverts commit 48328880fddf0145bdccc499160fb24dfabfbd41.

The --ninja option doesn't need anymore because of upgrade meson to 0.55.2
At that version we can use ninjatool

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 configure | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/configure b/configure
index af86ba1db3..dc7cc0f411 100755
--- a/configure
+++ b/configure
@@ -535,7 +535,6 @@ rng_none="no"
 secret_keyring=""
 libdaxctl=""
 meson=""
-ninja=""
 skip_meson=no
 gettext=""
 
@@ -1003,8 +1002,6 @@ for opt do
   ;;
   --meson=*) meson="$optarg"
   ;;
-  --ninja=*) ninja="$optarg"
-  ;;
   --smbd=*) smbd="$optarg"
   ;;
   --extra-cflags=*)
@@ -1777,7 +1774,6 @@ Advanced options (experts only):
   --python=PYTHON          use specified python [$python]
   --sphinx-build=SPHINX    use specified sphinx-build [$sphinx_build]
   --meson=MESON            use specified meson [$meson]
-  --ninja=NINJA            use specified ninja [$ninja]
   --smbd=SMBD              use specified smbd [$smbd]
   --with-git=GIT           use specified git [$git]
   --static                 enable static build [$static]
@@ -2014,16 +2010,6 @@ case "$meson" in
     *) meson=$(command -v meson) ;;
 esac
 
-# Probe for ninja (used for compdb)
-
-if test -z "$ninja"; then
-    for c in ninja ninja-build samu; do
-        if has $c; then
-            ninja=$(command -v "$c")
-            break
-        fi
-    done
-fi
 
 # Check that the C compiler works. Doing this here before testing
 # the host CPU ensures that we had a valid CC to autodetect the
@@ -7952,7 +7938,7 @@ fi
 mv $cross config-meson.cross
 
 rm -rf meson-private meson-info meson-logs
-NINJA=${ninja:-$PWD/ninjatool} $meson setup \
+NINJA=$PWD/ninjatool $meson setup \
         --prefix "${pre_prefix}$prefix" \
         --libdir "${pre_prefix}$libdir" \
         --libexecdir "${pre_prefix}$libexecdir" \
-- 
2.28.0.windows.1



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (26 preceding siblings ...)
  2020-09-12 22:44 ` [PATCH v8 27/27] Revert "configure: add --ninja option" Yonggang Luo
@ 2020-09-12 23:06 ` no-reply
  2020-09-14  7:00   ` 罗勇刚(Yonggang Luo)
  2020-09-14  6:10 ` Thomas Huth
  28 siblings, 1 reply; 71+ messages in thread
From: no-reply @ 2020-09-12 23:06 UTC (permalink / raw)
  To: luoyonggang
  Cc: kwolf, emaste, qemu-block, sw, xiechanglong.d, pl, qemu-devel,
	mdroth, luoyonggang, richard.henderson, kraxel, wencongyang2,
	pbonzini, mreitz, lwhsu, armbru

Patchew URL: https://patchew.org/QEMU/20200912224431.1428-1-luoyonggang@gmail.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

N/A. Internal error while reading log file



The full log is available at
http://patchew.org/logs/20200912224431.1428-1-luoyonggang@gmail.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-12 22:44 ` [PATCH v8 27/27] Revert "configure: add --ninja option" Yonggang Luo
@ 2020-09-13 14:08   ` Paolo Bonzini
  2020-09-13 16:03     ` 罗勇刚(Yonggang Luo)
                       ` (2 more replies)
  0 siblings, 3 replies; 71+ messages in thread
From: Paolo Bonzini @ 2020-09-13 14:08 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Markus Armbruster, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu

On 13/09/20 00:44, Yonggang Luo wrote:
> This reverts commit 48328880fddf0145bdccc499160fb24dfabfbd41.
> 
> The --ninja option doesn't need anymore because of upgrade meson to 0.55.2
> At that version we can use ninjatool

We might actually get rid of ninjatool before QEMU 5.2 goes out, if we
decide to make Ninja a mandatory build dependency.  So we can hold on
patches 26 and 27.  Thanks for testing though!

I'm also not sure about patch 16, since that's not my area, but Daniel
and Ed both reviewed it so that's okay.

Finally, instead of checking !_WIN32 it's better to check CONFIG_POSIX
or CONFIG_WIN32.  That can be changed on commit though.

Everything else seems okay.  I'll wait a couple days and queue the whole
bunch up to patch 25.

Paolo



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 20/27] tests: Fixes test-io-channel-file by mask only owner file state mask bits
  2020-09-12 22:44 ` [PATCH v8 20/27] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
@ 2020-09-13 15:28   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 15:28 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu

On 9/13/20 12:44 AM, Yonggang Luo wrote:
> 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 <luoyonggang@gmail.com>
> ---
>  tests/test-io-channel-file.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c
> index bac2b07562..1b0e8d7c1b 100644
> --- a/tests/test-io-channel-file.c
> +++ b/tests/test-io-channel-file.c
> @@ -28,6 +28,12 @@
>  #define TEST_FILE "tests/test-io-channel-file.txt"
>  #define TEST_MASK 0600
>  

[*]

> +#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 +62,9 @@ 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);
> +    /* 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. */

This comment would be better located in [*].

> +    g_assert_cmpuint(TEST_MASK & ~mask, ==, st.st_mode & TEST_MASK_EXPECT);
>  
>      unlink(TEST_FILE);
>      object_unref(OBJECT(src));
> 



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 12/27] gcrypt: test_tls_psk_init should write binary file instead text file.
  2020-09-12 22:44 ` [PATCH v8 12/27] gcrypt: test_tls_psk_init should write binary file instead text file Yonggang Luo
@ 2020-09-13 15:31   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 15:31 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu

On 9/13/20 12:44 AM, Yonggang Luo wrote:
> On windows, if open file with "w", it's will automatically convert
> "\n" to "\r\n" when writing to file.

This is one change.

> 
> Convert unlink to use g_remove.

This is another (unrelated) change.

We expect patches to be atomic (only one change at
a time). Can you split this patch in 2?

> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  tests/crypto-tls-psk-helpers.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/crypto-tls-psk-helpers.c b/tests/crypto-tls-psk-helpers.c
> index a8395477c3..58888d5537 100644
> --- a/tests/crypto-tls-psk-helpers.c
> +++ b/tests/crypto-tls-psk-helpers.c
> @@ -26,13 +26,15 @@
>  #include "crypto-tls-psk-helpers.h"
>  #include "qemu/sockets.h"
>  
> +#include <glib/gstdio.h>
> +
>  #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
>  
>  void test_tls_psk_init(const char *pskfile)
>  {
>      FILE *fp;
>  
> -    fp = fopen(pskfile, "w");
> +    fp = fopen(pskfile, "wb");
>      if (fp == NULL) {
>          g_critical("Failed to create pskfile %s", pskfile);
>          abort();
> @@ -44,7 +46,7 @@ void test_tls_psk_init(const char *pskfile)
>  
>  void test_tls_psk_cleanup(const char *pskfile)
>  {
> -    unlink(pskfile);
> +    g_remove(pskfile);
>  }
>  
>  #endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
> 



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-12 22:44 ` [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows Yonggang Luo
@ 2020-09-13 15:35   ` Philippe Mathieu-Daudé
  2020-09-13 16:01     ` 罗勇刚(Yonggang Luo)
  2020-09-14 14:01     ` Eric Blake
  0 siblings, 2 replies; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 15:35 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Paolo Bonzini, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu

On 9/13/20 12:44 AM, Yonggang Luo wrote:
> On windows, a difference in line endings causes testsuite failures
> complaining that every single line in files such as
> 'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b to diff.

Isn't '--strip-trailing-cr' more adapted?

> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  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'])
> 



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 10/27] osdep: file locking functions are not available on Win32
  2020-09-12 22:44 ` [PATCH v8 10/27] osdep: file locking functions are not available on Win32 Yonggang Luo
@ 2020-09-13 15:36   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 15:36 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Paolo Bonzini, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu

Please add here:

"Do not declare the following locking functions on Win32:"

On 9/13/20 12:44 AM, Yonggang Luo wrote:
> 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 <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  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"
> 



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 08/27] tests: Fixes test-replication.c on msys2/mingw.
  2020-09-12 22:44 ` [PATCH v8 08/27] tests: Fixes test-replication.c on msys2/mingw Yonggang Luo
@ 2020-09-13 15:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 15:37 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Paolo Bonzini, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu

On 9/13/20 12:44 AM, Yonggang Luo wrote:
> 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 <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  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;
>  }
> 



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw
  2020-09-12 22:44 ` [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw Yonggang Luo
@ 2020-09-13 15:47   ` Philippe Mathieu-Daudé
  2020-09-13 16:00     ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 15:47 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu

On 9/13/20 12:44 AM, Yonggang Luo wrote:
> These compiling errors are fixed:
> ../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
>    27 | #include <poll.h>
>       |          ^~~~~~~~
> compilation terminated.
> 
> ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
>    63 |     blkcnt_t st_blocks;
>       |     ^~~~~~~~
> ../block/nfs.c: In function 'nfs_client_open':
> ../block/nfs.c:550:27: error: 'struct _stat64' has no member named 'st_blocks'
>   550 |     client->st_blocks = st.st_blocks;
>       |                           ^
> ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> ../block/nfs.c:751:41: error: 'struct _stat64' has no member named 'st_blocks'
>   751 |     return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>       |                                         ^
> ../block/nfs.c: In function 'nfs_reopen_prepare':
> ../block/nfs.c:805:31: error: 'struct _stat64' has no member named 'st_blocks'
>   805 |         client->st_blocks = st.st_blocks;
>       |                               ^
> ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> ../block/nfs.c:752:1: error: control reaches end of non-void function [-Werror=return-type]
>   752 | }
>       | ^
> 
> On msys2/mingw, there is no st_blocks in struct _stat64, so we use consistence st_size instead.
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  block/nfs.c | 26 ++++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index 61a249a9fc..98b48f363b 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -24,7 +24,9 @@
>  
>  #include "qemu/osdep.h"
>  
> +#if !defined(_WIN32)
>  #include <poll.h>
> +#endif
>  #include "qemu/config-file.h"
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
> @@ -51,6 +53,12 @@
>  #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
>  #define QEMU_NFS_MAX_DEBUG_LEVEL 2
>  
> +#if defined (_WIN32)
> +#define nfs_stat __stat64
> +#else
> +#define nfs_stat stat
> +#endif
> +
>  typedef struct NFSClient {
>      struct nfs_context *context;
>      struct nfsfh *fh;
> @@ -58,7 +66,9 @@ typedef struct NFSClient {
>      bool has_zero_init;
>      AioContext *aio_context;
>      QemuMutex mutex;
> +#if !defined (_WIN32)
>      blkcnt_t st_blocks;

What about adding a "typedef off_t blkcnt_t;" or
similar typedef instead? Then no need to #ifdef
the st_blocks uses.

> +#endif
>      bool cache_used;
>      NFSServer *server;
>      char *path;
> @@ -70,7 +80,7 @@ typedef struct NFSRPC {
>      int ret;
>      int complete;
>      QEMUIOVector *iov;
> -    struct stat *st;
> +    struct nfs_stat *st;
>      Coroutine *co;
>      NFSClient *client;
>  } NFSRPC;
> @@ -419,7 +429,7 @@ static int64_t nfs_client_open(NFSClient *client, BlockdevOptionsNfs *opts,
>                                 int flags, int open_flags, Error **errp)
>  {
>      int64_t ret = -EINVAL;
> -    struct stat st;
> +    struct nfs_stat st;
>      char *file = NULL, *strp = NULL;
>  
>      qemu_mutex_init(&client->mutex);
> @@ -545,7 +555,9 @@ static int64_t nfs_client_open(NFSClient *client, BlockdevOptionsNfs *opts,
>      }
>  
>      ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
> +#if !defined (_WIN32)
>      client->st_blocks = st.st_blocks;
> +#endif
>      client->has_zero_init = S_ISREG(st.st_mode);
>      *strp = '/';
>      goto out;
> @@ -706,6 +718,7 @@ static int nfs_has_zero_init(BlockDriverState *bs)
>      return client->has_zero_init;
>  }
>  
> +#if !defined (_WIN32)
>  /* Called (via nfs_service) with QemuMutex held.  */
>  static void
>  nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
> @@ -729,7 +742,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
>  {
>      NFSClient *client = bs->opaque;
>      NFSRPC task = {0};
> -    struct stat st;
> +    struct nfs_stat st;
>  
>      if (bdrv_is_read_only(bs) &&
>          !(bs->open_flags & BDRV_O_NOCACHE)) {
> @@ -748,6 +761,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)
>  
>      return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>  }
> +#endif
>  
>  static int coroutine_fn
>  nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
> @@ -778,7 +792,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
>                                BlockReopenQueue *queue, Error **errp)
>  {
>      NFSClient *client = state->bs->opaque;
> -    struct stat st;
> +    struct nfs_stat st;
>      int ret = 0;
>  
>      if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {
> @@ -800,7 +814,9 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
>                         nfs_get_error(client->context));
>              return ret;
>          }
> +#if !defined (_WIN32)
>          client->st_blocks = st.st_blocks;
> +#endif
>      }
>  
>      return 0;
> @@ -869,7 +885,9 @@ static BlockDriver bdrv_nfs = {
>      .create_opts                    = &nfs_create_opts,
>  
>      .bdrv_has_zero_init             = nfs_has_zero_init,
> +#if !defined (_WIN32)
>      .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
> +#endif
>      .bdrv_co_truncate               = nfs_file_co_truncate,
>  
>      .bdrv_file_open                 = nfs_file_open,
> 



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw
  2020-09-13 15:47   ` Philippe Mathieu-Daudé
@ 2020-09-13 16:00     ` 罗勇刚(Yonggang Luo)
  2020-09-13 18:58       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-13 16:00 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 6024 bytes --]

On Sun, Sep 13, 2020 at 11:47 PM Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> On 9/13/20 12:44 AM, Yonggang Luo wrote:
> > These compiling errors are fixed:
> > ../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
> >    27 | #include <poll.h>
> >       |          ^~~~~~~~
> > compilation terminated.
> >
> > ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
> >    63 |     blkcnt_t st_blocks;
> >       |     ^~~~~~~~
> > ../block/nfs.c: In function 'nfs_client_open':
> > ../block/nfs.c:550:27: error: 'struct _stat64' has no member named
> 'st_blocks'
> >   550 |     client->st_blocks = st.st_blocks;
> >       |                           ^
> > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> > ../block/nfs.c:751:41: error: 'struct _stat64' has no member named
> 'st_blocks'
> >   751 |     return (task.ret < 0 ? task.ret : st.st_blocks * 512);
> >       |                                         ^
> > ../block/nfs.c: In function 'nfs_reopen_prepare':
> > ../block/nfs.c:805:31: error: 'struct _stat64' has no member named
> 'st_blocks'
> >   805 |         client->st_blocks = st.st_blocks;
> >       |                               ^
> > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> > ../block/nfs.c:752:1: error: control reaches end of non-void function
> [-Werror=return-type]
> >   752 | }
> >       | ^
> >
> > On msys2/mingw, there is no st_blocks in struct _stat64, so we use
> consistence st_size instead.
> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > ---
> >  block/nfs.c | 26 ++++++++++++++++++++++----
> >  1 file changed, 22 insertions(+), 4 deletions(-)
> >
> > diff --git a/block/nfs.c b/block/nfs.c
> > index 61a249a9fc..98b48f363b 100644
> > --- a/block/nfs.c
> > +++ b/block/nfs.c
> > @@ -24,7 +24,9 @@
> >
> >  #include "qemu/osdep.h"
> >
> > +#if !defined(_WIN32)
> >  #include <poll.h>
> > +#endif
> >  #include "qemu/config-file.h"
> >  #include "qemu/error-report.h"
> >  #include "qapi/error.h"
> > @@ -51,6 +53,12 @@
> >  #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
> >  #define QEMU_NFS_MAX_DEBUG_LEVEL 2
> >
> > +#if defined (_WIN32)
> > +#define nfs_stat __stat64
> > +#else
> > +#define nfs_stat stat
> > +#endif
> > +
> >  typedef struct NFSClient {
> >      struct nfs_context *context;
> >      struct nfsfh *fh;
> > @@ -58,7 +66,9 @@ typedef struct NFSClient {
> >      bool has_zero_init;
> >      AioContext *aio_context;
> >      QemuMutex mutex;
> > +#if !defined (_WIN32)
> >      blkcnt_t st_blocks;
>
> What about adding a "typedef off_t blkcnt_t;" or
> similar typedef instead? Then no need to #ifdef
> the st_blocks uses.
>
No, I did that before and someone else have objection

>
> > +#endif
> >      bool cache_used;
> >      NFSServer *server;
> >      char *path;
> > @@ -70,7 +80,7 @@ typedef struct NFSRPC {
> >      int ret;
> >      int complete;
> >      QEMUIOVector *iov;
> > -    struct stat *st;
> > +    struct nfs_stat *st;
> >      Coroutine *co;
> >      NFSClient *client;
> >  } NFSRPC;
> > @@ -419,7 +429,7 @@ static int64_t nfs_client_open(NFSClient *client,
> BlockdevOptionsNfs *opts,
> >                                 int flags, int open_flags, Error **errp)
> >  {
> >      int64_t ret = -EINVAL;
> > -    struct stat st;
> > +    struct nfs_stat st;
> >      char *file = NULL, *strp = NULL;
> >
> >      qemu_mutex_init(&client->mutex);
> > @@ -545,7 +555,9 @@ static int64_t nfs_client_open(NFSClient *client,
> BlockdevOptionsNfs *opts,
> >      }
> >
> >      ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
> > +#if !defined (_WIN32)
> >      client->st_blocks = st.st_blocks;
> > +#endif
> >      client->has_zero_init = S_ISREG(st.st_mode);
> >      *strp = '/';
> >      goto out;
> > @@ -706,6 +718,7 @@ static int nfs_has_zero_init(BlockDriverState *bs)
> >      return client->has_zero_init;
> >  }
> >
> > +#if !defined (_WIN32)
> >  /* Called (via nfs_service) with QemuMutex held.  */
> >  static void
> >  nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void
> *data,
> > @@ -729,7 +742,7 @@ static int64_t
> nfs_get_allocated_file_size(BlockDriverState *bs)
> >  {
> >      NFSClient *client = bs->opaque;
> >      NFSRPC task = {0};
> > -    struct stat st;
> > +    struct nfs_stat st;
> >
> >      if (bdrv_is_read_only(bs) &&
> >          !(bs->open_flags & BDRV_O_NOCACHE)) {
> > @@ -748,6 +761,7 @@ static int64_t
> nfs_get_allocated_file_size(BlockDriverState *bs)
> >
> >      return (task.ret < 0 ? task.ret : st.st_blocks * 512);
> >  }
> > +#endif
> >
> >  static int coroutine_fn
> >  nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
> > @@ -778,7 +792,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
> >                                BlockReopenQueue *queue, Error **errp)
> >  {
> >      NFSClient *client = state->bs->opaque;
> > -    struct stat st;
> > +    struct nfs_stat st;
> >      int ret = 0;
> >
> >      if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {
> > @@ -800,7 +814,9 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
> >                         nfs_get_error(client->context));
> >              return ret;
> >          }
> > +#if !defined (_WIN32)
> >          client->st_blocks = st.st_blocks;
> > +#endif
> >      }
> >
> >      return 0;
> > @@ -869,7 +885,9 @@ static BlockDriver bdrv_nfs = {
> >      .create_opts                    = &nfs_create_opts,
> >
> >      .bdrv_has_zero_init             = nfs_has_zero_init,
> > +#if !defined (_WIN32)
> >      .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
> > +#endif
> >      .bdrv_co_truncate               = nfs_file_co_truncate,
> >
> >      .bdrv_file_open                 = nfs_file_open,
> >
>
>

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 8021 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-13 15:35   ` Philippe Mathieu-Daudé
@ 2020-09-13 16:01     ` 罗勇刚(Yonggang Luo)
  2020-09-13 18:49       ` Philippe Mathieu-Daudé
  2020-09-14 14:01     ` Eric Blake
  1 sibling, 1 reply; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-13 16:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Richard Henderson,
	Paolo Bonzini, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

On Sun, Sep 13, 2020 at 11:35 PM Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> On 9/13/20 12:44 AM, Yonggang Luo wrote:
> > On windows, a difference in line endings causes testsuite failures
> > complaining that every single line in files such as
> > 'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b to diff.
>
> Isn't '--strip-trailing-cr' more adapted?
>
> er, I did that before.....

> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > Reviewed-by: Eric Blake <eblake@redhat.com>
> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  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'])
> >
>
>

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 2512 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-13 14:08   ` Paolo Bonzini
@ 2020-09-13 16:03     ` 罗勇刚(Yonggang Luo)
  2020-09-13 16:12       ` Paolo Bonzini
  2020-09-13 16:14     ` 罗勇刚(Yonggang Luo)
  2020-09-15 11:44     ` Thomas Huth
  2 siblings, 1 reply; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-13 16:03 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

On Sun, Sep 13, 2020 at 10:08 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 13/09/20 00:44, Yonggang Luo wrote:
> > This reverts commit 48328880fddf0145bdccc499160fb24dfabfbd41.
> >
> > The --ninja option doesn't need anymore because of upgrade meson to
> 0.55.2
> > At that version we can use ninjatool
>
> We might actually get rid of ninjatool before QEMU 5.2 goes out, if we
> decide to make Ninja a mandatory build dependency.  So we can hold on
> patches 26 and 27.  Thanks for testing though!
>
> I'm also not sure about patch 16, since that's not my area, but Daniel
> and Ed both reviewed it so that's okay.
>
> Finally, instead of checking !_WIN32 it's better to check CONFIG_POSIX
> or CONFIG_WIN32.  That can be changed on commit though.
>
> Everything else seems okay.  I'll wait a couple days and queue the whole
> bunch up to patch 25.
>


>
> Paolo
>
>   _WIN32 are more precise and only depends on the compiler, on the other
hand,    CONFIG_POSIX  and  CONFIG_WIN32  need
configure scripts. I prefer  _WIN32  unless the compiler can not provide
enough information.

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 1841 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-13 16:03     ` 罗勇刚(Yonggang Luo)
@ 2020-09-13 16:12       ` Paolo Bonzini
  2020-09-13 16:16         ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Paolo Bonzini @ 2020-09-13 16:12 UTC (permalink / raw)
  To: luoyonggang
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

On 13/09/20 18:03, 罗勇刚(Yonggang Luo) wrote:
> 
> _WIN32 are more precise and only depends on the compiler, on the
> other hand, CONFIG_POSIX  and  CONFIG_WIN32  need configure
> scripts. I prefer  _WIN32  unless the compiler can not provide enough
> information.

That's not what the QEMU coding standards say; we generally don't test
the preprocessor symbols.  If we were to change to _WIN32, it should be
done at once on the whole codebase (don't do it :)).

Paolo



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-13 14:08   ` Paolo Bonzini
  2020-09-13 16:03     ` 罗勇刚(Yonggang Luo)
@ 2020-09-13 16:14     ` 罗勇刚(Yonggang Luo)
  2020-09-14  8:45       ` Paolo Bonzini
  2020-09-15 11:44     ` Thomas Huth
  2 siblings, 1 reply; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-13 16:14 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

On Sun, Sep 13, 2020 at 10:08 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 13/09/20 00:44, Yonggang Luo wrote:
> > This reverts commit 48328880fddf0145bdccc499160fb24dfabfbd41.
> >
> > The --ninja option doesn't need anymore because of upgrade meson to
> 0.55.2
> > At that version we can use ninjatool
>
> We might actually get rid of ninjatool before QEMU 5.2 goes out, if we
> decide to make Ninja a mandatory build dependency.  So we can hold on
> patches 26 and 27.  Thanks for testing though!
>
I am hurry to revert --ninja option because when the meson are changed, the
make -j10 can not automatically re configure, that would raise ninja can
not found error

>
> I'm also not sure about patch 16, since that's not my area, but Daniel
> and Ed both reviewed it so that's okay.
>
> Finally, instead of checking !_WIN32 it's better to check CONFIG_POSIX
> or CONFIG_WIN32.  That can be changed on commit though.
>
> Everything else seems okay.  I'll wait a couple days and queue the whole
> bunch up to patch 25.
>
> Paolo
>
>

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 1776 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-13 16:12       ` Paolo Bonzini
@ 2020-09-13 16:16         ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-13 16:16 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 5931 bytes --]

On Mon, Sep 14, 2020 at 12:12 AM Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 13/09/20 18:03, 罗勇刚(Yonggang Luo) wrote:
> >
> > _WIN32 are more precise and only depends on the compiler, on the
> > other hand, CONFIG_POSIX  and  CONFIG_WIN32  need configure
> > scripts. I prefer  _WIN32  unless the compiler can not provide enough
> > information.
>
> That's not what the QEMU coding standards say; we generally don't test
> the preprocessor symbols.  If we were to change to _WIN32, it should be
> done at once on the whole codebase (don't do it :)).>
>

  CONFIG_WIN32  are rarely used, most of the are using _WIN32

Search CONFIG_WIN32
```

> 36 results - 20 files
>
> configure:
>   6511  if test "$mingw32" = "yes" ; then
>   6512:   echo "CONFIG_WIN32=y" >> $config_host_mak
>   6513    rc_version=$(cat $source_path/VERSION)
>
> Makefile:
>   274   @echo  ''
>   275: ifdef CONFIG_WIN32
>   276   @echo  'Windows targets:'
>
> meson.build:
>   853  blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
>   854: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
>   855
>
> backends\qemu\configure:
>   6511  if test "$mingw32" = "yes" ; then
>   6512:   echo "CONFIG_WIN32=y" >> $config_host_mak
>   6513    rc_version=$(cat $source_path/VERSION)
>
> backends\qemu\Makefile:
>   272   @echo  ''
>   273: ifdef CONFIG_WIN32
>   274   @echo  'Windows targets:'
>
> backends\qemu\meson.build:
>   856  blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
>   857: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
>   858
>
> block\meson.build:
>   58  block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true:
> files('parallels.c'))
>   59: block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c',
> 'win32-aio.c'))
>   60  block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'),
> coref, iokit])
>
> chardev\meson.build:
>   20  ))
>   21: chardev_ss.add(when: 'CONFIG_WIN32', if_true: files(
>   22    'char-console.c',
>
> hw\usb\host-libusb.c:
>     37  #include "qom/object.h"
>     38: #ifndef CONFIG_WIN32
>     39  #include <poll.h>
>
>    228
>    229: #ifndef CONFIG_WIN32
>    230
>
>    249
>    250: #endif /* !CONFIG_WIN32 */
>    251
>
>    253  {
>    254: #ifndef CONFIG_WIN32
>    255      const struct libusb_pollfd **poll;
>
>    270  #endif
>    271: #ifdef CONFIG_WIN32
>    272      /* FIXME: add support for Windows. */
>
>    916      } else {
>    917: #if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
>    918          trace_usb_host_open_hostfd(hostfd);
>
>   1145
>   1146: #if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
>   1147      if (s->hostdevice) {
>
> io\channel-watch.c:
>    32
>    33: #ifdef CONFIG_WIN32
>    34  typedef struct QIOChannelSocketSource QIOChannelSocketSource;
>
>    98
>    99: #ifdef CONFIG_WIN32
>   100  static gboolean
>
>   267
>   268: #ifdef CONFIG_WIN32
>   269      ssource->fd.fd = (gint64)_get_osfhandle(fd);
>
>   279
>   280: #ifdef CONFIG_WIN32
>   281  GSource *qio_channel_create_socket_watch(QIOChannel *ioc,
>
>   337
>   338: #ifdef CONFIG_WIN32
>   339      ssource->fdread.fd = (gint64)_get_osfhandle(fdread);
>
> net\meson.build:
>   36  softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix))
>   37: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c'))
>   38  softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true:
> files('vhost-vdpa.c'))
>
> qga\meson.build:
>   39    'commands-posix.c'))
>   40: qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
>   41    'channel-win32.c',
>
> scripts\checkpatch.pl:
>   2775  # check of hardware specific defines
>   2776: # we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases
>   2777  # where they might be necessary.
>
> target\i386\hax-i386.h:
>   22
>   23: #ifdef CONFIG_WIN32
>   24  typedef HANDLE hax_fd;
>
>   87
>   88: #ifdef CONFIG_WIN32
>   89  #include "target/i386/hax-windows.h"
>
> target\i386\meson.build:
>   34  i386_softmmu_ss.add(when: ['CONFIG_POSIX', 'CONFIG_HAX'], if_true:
> files('hax-all.c', 'hax-mem.c', 'hax-posix.c'))
>   35: i386_softmmu_ss.add(when: ['CONFIG_WIN32', 'CONFIG_HAX'], if_true:
> files('hax-all.c', 'hax-mem.c', 'hax-windows.c'))
>   36
>
> ui\gtk.c:
>   1171  {
>   1172: #ifdef CONFIG_WIN32
>   1173      /*
>
> ui\meson.build:
>   48  if config_host.has_key('CONFIG_GTK')
>   49:   softmmu_ss.add(when: 'CONFIG_WIN32', if_true:
> files('win32-kbd-hook.c'))
>   50
>
>   59  if sdl.found()
>   60:   softmmu_ss.add(when: 'CONFIG_WIN32', if_true:
> files('win32-kbd-hook.c'))
>   61
>
> ui\sdl2.c:
>   332  {
>   333: #ifdef CONFIG_WIN32
>   334      SDL_SysWMinfo info;
>
> util\meson.build:
>   14  util_ss.add(when: 'CONFIG_POSIX', if_true: files('memfd.c'))
>   15: util_ss.add(when: 'CONFIG_WIN32', if_true: files('aio-win32.c'))
>   16: util_ss.add(when: 'CONFIG_WIN32', if_true:
> files('event_notifier-win32.c'))
>   17: util_ss.add(when: 'CONFIG_WIN32', if_true: files('oslib-win32.c'))
>   18: util_ss.add(when: 'CONFIG_WIN32', if_true:
> files('qemu-thread-win32.c'))
>   19: util_ss.add(when: 'CONFIG_WIN32', if_true: winmm)
>   20  util_ss.add(files('envlist.c', 'path.c', 'module.c'))
>
> util\sys_membarrier.c:
>   25  {
>   26: #if defined CONFIG_WIN32
>   27      FlushProcessWriteBuffers();
> ```
>


> Paolo
>
>

Search _WIN32
```
561 results - 257 files

block.c:
   59
   60: #ifdef _WIN32
   61  #include <windows.h>

   85
   86: #ifdef _WIN32
   87  static int is_windows_drive_prefix(const char *filename)

  130
  131: #ifdef _WIN32
  132      if (is_windows_drive(path) ||
```

  145  {--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 7683 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-13 16:01     ` 罗勇刚(Yonggang Luo)
@ 2020-09-13 18:49       ` Philippe Mathieu-Daudé
  2020-09-14 14:41         ` Peter Maydell
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 18:49 UTC (permalink / raw)
  To: luoyonggang, Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Richard Henderson,
	Paolo Bonzini, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu, Markus Armbruster

On 9/13/20 6:01 PM, 罗勇刚(Yonggang Luo) wrote:
> 
> 
> On Sun, Sep 13, 2020 at 11:35 PM Philippe Mathieu-Daudé
> <philmd@redhat.com <mailto:philmd@redhat.com>> wrote:
> 
>     On 9/13/20 12:44 AM, Yonggang Luo wrote:
>     > On windows, a difference in line endings causes testsuite failures
>     > complaining that every single line in files such as
>     > 'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b to
>     diff.
> 
>     Isn't '--strip-trailing-cr' more adapted?
> 
> er, I did that before..... 

So, yes/no? We can not follow all patches, so better if you
add a note about your changes, either in the patch description
if you think it's worthwhile keeping that information in the
git history, else below the '---' separator, so that information
is stripped from the patch when applying.

Looking at the archive I see Thomas said this option is not
POSIX thus not portable.

What about adding this?

"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 <luoyonggang@gmail.com
>     <mailto:luoyonggang@gmail.com>>
>     > Reviewed-by: Eric Blake <eblake@redhat.com <mailto:eblake@redhat.com>>
>     > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com
>     <mailto:berrange@redhat.com>>
>     > ---
>     >  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'])
>     >
> 
> 
> 
> -- 
>          此致
> 礼
> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw
  2020-09-13 16:00     ` 罗勇刚(Yonggang Luo)
@ 2020-09-13 18:58       ` Philippe Mathieu-Daudé
  2020-09-14 10:26         ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 18:58 UTC (permalink / raw)
  To: luoyonggang, Peter Lieven
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Richard Henderson, qemu-level, Michael Roth, Gerd Hoffmann,
	Wen Congyang, Paolo Bonzini, Max Reitz, Li-Wen Hsu,
	Markus Armbruster

On 9/13/20 6:00 PM, 罗勇刚(Yonggang Luo) wrote:
> 
> 
> On Sun, Sep 13, 2020 at 11:47 PM Philippe Mathieu-Daudé
> <philmd@redhat.com <mailto:philmd@redhat.com>> wrote:
> 
>     On 9/13/20 12:44 AM, Yonggang Luo wrote:
>     > These compiling errors are fixed:
>     > ../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
>     >    27 | #include <poll.h>
>     >       |          ^~~~~~~~
>     > compilation terminated.
>     >
>     > ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
>     >    63 |     blkcnt_t st_blocks;
>     >       |     ^~~~~~~~
>     > ../block/nfs.c: In function 'nfs_client_open':
>     > ../block/nfs.c:550:27: error: 'struct _stat64' has no member named
>     'st_blocks'
>     >   550 |     client->st_blocks = st.st_blocks;
>     >       |                           ^
>     > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
>     > ../block/nfs.c:751:41: error: 'struct _stat64' has no member named
>     'st_blocks'
>     >   751 |     return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>     >       |                                         ^
>     > ../block/nfs.c: In function 'nfs_reopen_prepare':
>     > ../block/nfs.c:805:31: error: 'struct _stat64' has no member named
>     'st_blocks'
>     >   805 |         client->st_blocks = st.st_blocks;
>     >       |                               ^
>     > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
>     > ../block/nfs.c:752:1: error: control reaches end of non-void
>     function [-Werror=return-type]
>     >   752 | }
>     >       | ^
>     >
>     > On msys2/mingw, there is no st_blocks in struct _stat64, so we use
>     consistence st_size instead.
>     >
>     > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
>     <mailto:luoyonggang@gmail.com>>
>     > ---
>     >  block/nfs.c | 26 ++++++++++++++++++++++----
>     >  1 file changed, 22 insertions(+), 4 deletions(-)
>     >
>     > diff --git a/block/nfs.c b/block/nfs.c
>     > index 61a249a9fc..98b48f363b 100644
>     > --- a/block/nfs.c
>     > +++ b/block/nfs.c
>     > @@ -24,7 +24,9 @@
>     > 
>     >  #include "qemu/osdep.h"
>     > 
>     > +#if !defined(_WIN32)
>     >  #include <poll.h>
>     > +#endif
>     >  #include "qemu/config-file.h"
>     >  #include "qemu/error-report.h"
>     >  #include "qapi/error.h"
>     > @@ -51,6 +53,12 @@
>     >  #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
>     >  #define QEMU_NFS_MAX_DEBUG_LEVEL 2
>     > 
>     > +#if defined (_WIN32)
>     > +#define nfs_stat __stat64
>     > +#else
>     > +#define nfs_stat stat
>     > +#endif
>     > +
>     >  typedef struct NFSClient {
>     >      struct nfs_context *context;
>     >      struct nfsfh *fh;
>     > @@ -58,7 +66,9 @@ typedef struct NFSClient {
>     >      bool has_zero_init;
>     >      AioContext *aio_context;
>     >      QemuMutex mutex;
>     > +#if !defined (_WIN32)
>     >      blkcnt_t st_blocks;
> 
>     What about adding a "typedef off_t blkcnt_t;" or
>     similar typedef instead? Then no need to #ifdef
>     the st_blocks uses.
> 
> No, I did that before and someone else have objection 

What objection?

Again I had to look at the archives to find a comment from
Peter.

Maybe can be justified with:

"As st_blocks and st_size are not the same (st_blocks is
the number of allocated blocks on disk, while st_size is
the virtual size of a file as it may contain holes), we can
not easily add a typedef for blkcnt_t.
Anyhow as the get_allocated_file_size() block drive handler
is not mandatory, we can avoid implementing it on WIN32 by
using some #ifdef'ry."

These comments are useful for future developers. Because else
someone might want to improve your patch, add the typedef and
if Peter is not reviewing this, we might miss that again.

> 
> 
>     > +#endif
>     >      bool cache_used;
>     >      NFSServer *server;
>     >      char *path;
>     > @@ -70,7 +80,7 @@ typedef struct NFSRPC {
>     >      int ret;
>     >      int complete;
>     >      QEMUIOVector *iov;
>     > -    struct stat *st;
>     > +    struct nfs_stat *st;
>     >      Coroutine *co;
>     >      NFSClient *client;
>     >  } NFSRPC;
>     > @@ -419,7 +429,7 @@ static int64_t nfs_client_open(NFSClient
>     *client, BlockdevOptionsNfs *opts,
>     >                                 int flags, int open_flags, Error
>     **errp)
>     >  {
>     >      int64_t ret = -EINVAL;
>     > -    struct stat st;
>     > +    struct nfs_stat st;
>     >      char *file = NULL, *strp = NULL;
>     > 
>     >      qemu_mutex_init(&client->mutex);
>     > @@ -545,7 +555,9 @@ static int64_t nfs_client_open(NFSClient
>     *client, BlockdevOptionsNfs *opts,
>     >      }
>     > 
>     >      ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
>     > +#if !defined (_WIN32)
>     >      client->st_blocks = st.st_blocks;
>     > +#endif
>     >      client->has_zero_init = S_ISREG(st.st_mode);
>     >      *strp = '/';
>     >      goto out;
>     > @@ -706,6 +718,7 @@ static int nfs_has_zero_init(BlockDriverState *bs)
>     >      return client->has_zero_init;
>     >  }
>     > 
>     > +#if !defined (_WIN32)
>     >  /* Called (via nfs_service) with QemuMutex held.  */
>     >  static void
>     >  nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs,
>     void *data,
>     > @@ -729,7 +742,7 @@ static int64_t
>     nfs_get_allocated_file_size(BlockDriverState *bs)
>     >  {
>     >      NFSClient *client = bs->opaque;
>     >      NFSRPC task = {0};
>     > -    struct stat st;
>     > +    struct nfs_stat st;
>     > 
>     >      if (bdrv_is_read_only(bs) &&
>     >          !(bs->open_flags & BDRV_O_NOCACHE)) {
>     > @@ -748,6 +761,7 @@ static int64_t
>     nfs_get_allocated_file_size(BlockDriverState *bs)
>     > 
>     >      return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>     >  }
>     > +#endif
>     > 
>     >  static int coroutine_fn
>     >  nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool
>     exact,
>     > @@ -778,7 +792,7 @@ static int nfs_reopen_prepare(BDRVReopenState
>     *state,
>     >                                BlockReopenQueue *queue, Error **errp)
>     >  {
>     >      NFSClient *client = state->bs->opaque;
>     > -    struct stat st;
>     > +    struct nfs_stat st;
>     >      int ret = 0;
>     > 
>     >      if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {
>     > @@ -800,7 +814,9 @@ static int nfs_reopen_prepare(BDRVReopenState
>     *state,
>     >                         nfs_get_error(client->context));
>     >              return ret;
>     >          }
>     > +#if !defined (_WIN32)
>     >          client->st_blocks = st.st_blocks;
>     > +#endif
>     >      }
>     > 
>     >      return 0;
>     > @@ -869,7 +885,9 @@ static BlockDriver bdrv_nfs = {
>     >      .create_opts                    = &nfs_create_opts,
>     > 
>     >      .bdrv_has_zero_init             = nfs_has_zero_init,
>     > +#if !defined (_WIN32)
>     >      .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
>     > +#endif
>     >      .bdrv_co_truncate               = nfs_file_co_truncate,
>     > 
>     >      .bdrv_file_open                 = nfs_file_open,
>     >
> 
> 
> 
> -- 
>          此致
> 礼
> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (27 preceding siblings ...)
  2020-09-12 23:06 ` [PATCH v8 00/27] W32, W64 msys2/mingw patches no-reply
@ 2020-09-14  6:10 ` Thomas Huth
  2020-09-14  6:27   ` 罗勇刚(Yonggang Luo)
  28 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-14  6:10 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu

On 13/09/2020 00.44, Yonggang Luo wrote:
> It first introduce msys2 CI on cirrus by fixes nfs, capstone, curses and
> disable partial test-char tests.
> And then fixes all unit tests failure on msys2/mingw
> This fixes the reviews suggested in the mailling list
> All cirrus CI are passed

 Hi,

since you're very often sending new versions of your patch series, could
you please add a history to the cover letter to say what you changed in
each version? Otherwise, your work is very hard to follow.
I'd also suggest to really slow down the sending a little bit. Let your
patches mature in your tests first, then send out a new series only if
you feel that they are really ready. Nobody has the bandwith to review a
patch series with 27 patches each day...

 Thanks,
  Thomas




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-14  6:10 ` Thomas Huth
@ 2020-09-14  6:27   ` 罗勇刚(Yonggang Luo)
  2020-09-14  6:37     ` Stefan Weil
  2020-09-14  6:49     ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14  6:27 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

On Mon, Sep 14, 2020 at 2:10 PM Thomas Huth <thuth@redhat.com> wrote:

> On 13/09/2020 00.44, Yonggang Luo wrote:
> > It first introduce msys2 CI on cirrus by fixes nfs, capstone, curses and
> > disable partial test-char tests.
> > And then fixes all unit tests failure on msys2/mingw
> > This fixes the reviews suggested in the mailling list
> > All cirrus CI are passed
>
>  Hi,
>
> since you're very often sending new versions of your patch series, could
> you please add a history to the cover letter to say what you changed in
> each version? Otherwise, your work is very hard to follow.
> I'd also suggest to really slow down the sending a little bit. Let your
> patches mature in your tests first, then send out a new series only if
> you feel that they are really ready. Nobody has the bandwith to review a
> patch series with 27 patches each day...
>
> Thanks, I am learning how to submit patches properly, in old days,  when I
am using pull request on github have no such problems. easy to follow up

>  Thanks,
>   Thomas
>
>
>

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 1750 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-14  6:27   ` 罗勇刚(Yonggang Luo)
@ 2020-09-14  6:37     ` Stefan Weil
  2020-09-14  6:54       ` 罗勇刚(Yonggang Luo)
  2020-09-14  6:49     ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 71+ messages in thread
From: Stefan Weil @ 2020-09-14  6:37 UTC (permalink / raw)
  To: luoyonggang, Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Markus Armbruster,
	Xie Changlong, Peter Lieven, qemu-level, Michael Roth,
	Richard Henderson, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Max Reitz, Li-Wen Hsu

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

Am 14.09.20 um 08:27 schrieb 罗勇刚(Yonggang Luo):

>
> Thanks, I am learning how to submit patches properly, in old days, 
> when I am using pull request on github have no such problems. easy to
> follow up


May I also ask you to send text-only e-mails? Your HTML e-mails are
really hard to read.

Thanks,

Stefan Weil



[-- Attachment #2: Type: text/html, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-14  6:27   ` 罗勇刚(Yonggang Luo)
  2020-09-14  6:37     ` Stefan Weil
@ 2020-09-14  6:49     ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-14  6:49 UTC (permalink / raw)
  To: luoyonggang, Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Max Reitz, Gerd Hoffmann,
	Wen Congyang, Paolo Bonzini, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

On 9/14/20 8:27 AM, 罗勇刚(Yonggang Luo) wrote:
> 
> 
> On Mon, Sep 14, 2020 at 2:10 PM Thomas Huth <thuth@redhat.com
> <mailto:thuth@redhat.com>> wrote:
> 
>     On 13/09/2020 00.44, Yonggang Luo wrote:
>     > It first introduce msys2 CI on cirrus by fixes nfs, capstone,
>     curses and
>     > disable partial test-char tests.
>     > And then fixes all unit tests failure on msys2/mingw
>     > This fixes the reviews suggested in the mailling list
>     > All cirrus CI are passed
> 
>      Hi,
> 
>     since you're very often sending new versions of your patch series, could
>     you please add a history to the cover letter to say what you changed in
>     each version? Otherwise, your work is very hard to follow.
>     I'd also suggest to really slow down the sending a little bit. Let your
>     patches mature in your tests first, then send out a new series only if
>     you feel that they are really ready. Nobody has the bandwith to review a
>     patch series with 27 patches each day...
> 
> Thanks, I am learning how to submit patches properly, in old days,  when
> I am using pull request on github have no such problems. easy to follow up 

GitHub pull-request have the same problem, you can update its patches
and re-reviewing on top is very difficult. Some old review comments
even get deleted. At least having email archive allow us to look
back for older versions/comments.

Regards,

Phil.



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-14  6:37     ` Stefan Weil
@ 2020-09-14  6:54       ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14  6:54 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Qemu-block, Markus Armbruster,
	Xie Changlong, Peter Lieven, qemu-level, Michael Roth,
	Richard Henderson, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Max Reitz, Li-Wen Hsu

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

On Mon, Sep 14, 2020 at 2:38 PM Stefan Weil <sw@weilnetz.de> wrote:
>
> Am 14.09.20 um 08:27 schrieb 罗勇刚(Yonggang Luo):
>
>
> Thanks, I am learning how to submit patches properly, in old days,  when
I am using pull request on github have no such problems. easy to follow up
>
>
> May I also ask you to send text-only e-mails? Your HTML e-mails are
really hard to read.
>
> Thanks,
>
> Stefan Weil
>
>
Sorry, I am using gmail to send, I'll review the email format in latter
messages


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 769 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 00/27] W32, W64 msys2/mingw patches
  2020-09-12 23:06 ` [PATCH v8 00/27] W32, W64 msys2/mingw patches no-reply
@ 2020-09-14  7:00   ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14  7:00 UTC (permalink / raw)
  To: qemu-level
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

On Sun, Sep 13, 2020 at 7:07 AM <no-reply@patchew.org> wrote:
>
> Patchew URL:
https://patchew.org/QEMU/20200912224431.1428-1-luoyonggang@gmail.com/
>
>
>
> Hi,
>
> This series seems to have some coding style problems. See output below for
> more information:
>
> N/A. Internal error while reading log file
>
>
>
> The full log is available at
>
http://patchew.org/logs/20200912224431.1428-1-luoyonggang@gmail.com/testing.checkpatch/?type=message
.
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com
I also have a question about this,  This series seems to have some coding
style problems, but where
to find the logging, seems the logs of patchew are failed(out of disk)


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 1342 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2
  2020-09-12 22:44 ` [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
@ 2020-09-14  7:10   ` Thomas Huth
  2020-09-14  7:15     ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-14  7:10 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel, Paolo Bonzini, Richard Henderson
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Gerd Hoffmann,
	Wen Congyang, Max Reitz, Li-Wen Hsu

On 13/09/2020 00.44, Yonggang Luo wrote:
> The currently random version capstone have the following compiling issue:
>   CC      /c/work/xemu/qemu/build/slirp/src/arp_table.o
> make[1]: *** No rule to make target “/c/work/xemu/qemu/build/capstone/capstone.lib”。 Stop.
> 
> Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1 are the tagged version 4.0.2
> when upgrading to this version, the folder structure of include are changed to
> qemu\capstone\include
> │  platform.h
> │
> ├─capstone
> │      arm.h
> │      arm64.h
> │      capstone.h
> │      evm.h
> │      m680x.h
> │      m68k.h
> │      mips.h
> │      platform.h
> │      ppc.h
> │      sparc.h
> │      systemz.h
> │      tms320c64x.h
> │      x86.h
> │      xcore.h
> │
> └─windowsce
>         intrin.h
>         stdint.h
> 
> in capstone. so we need add extra include path -I${source_path}/capstone/include/capstone
> for directly #include <capstone.h>, and the exist include path should preserve, because
> in capstone code there something like #include "capstone/capstone.h"
> 
> If only using
>     capstone_cflags="-I${source_path}/capstone/include/capstone"
> Then will cause the following compiling error:
> 
>   CC      cs.o
> cs.c:17:10: fatal error: 'capstone/capstone.h' file not found
> #include <capstone/capstone.h>
>          ^~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  capstone  | 2 +-
>  configure | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/capstone b/capstone
> index 22ead3e0bf..1d23053284 160000
> --- a/capstone
> +++ b/capstone
> @@ -1 +1 @@
> -Subproject commit 22ead3e0bfdb87516656453336160e0a37b066bf
> +Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1

Richard has a patch series on the list now to update and improve the
capstone submodule (see "capstone + disassembler patches") ... I think
this patch here will then not be required anymore.

 Thomas



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2
  2020-09-14  7:10   ` Thomas Huth
@ 2020-09-14  7:15     ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14  7:15 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Richard Henderson, qemu-level, Michael Roth, Gerd Hoffmann,
	Wen Congyang, Paolo Bonzini, Max Reitz, Li-Wen Hsu,
	Markus Armbruster, Peter Lieven

[-- Attachment #1: Type: text/plain, Size: 2410 bytes --]

On Mon, Sep 14, 2020 at 3:10 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 13/09/2020 00.44, Yonggang Luo wrote:
> > The currently random version capstone have the following compiling
issue:
> >   CC      /c/work/xemu/qemu/build/slirp/src/arp_table.o
> > make[1]: *** No rule to make target
“/c/work/xemu/qemu/build/capstone/capstone.lib”。 Stop.
> >
> > Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1 are the
tagged version 4.0.2
> > when upgrading to this version, the folder structure of include are
changed to
> > qemu\capstone\include
> > │  platform.h
> > │
> > ├─capstone
> > │      arm.h
> > │      arm64.h
> > │      capstone.h
> > │      evm.h
> > │      m680x.h
> > │      m68k.h
> > │      mips.h
> > │      platform.h
> > │      ppc.h
> > │      sparc.h
> > │      systemz.h
> > │      tms320c64x.h
> > │      x86.h
> > │      xcore.h
> > │
> > └─windowsce
> >         intrin.h
> >         stdint.h
> >
> > in capstone. so we need add extra include path
-I${source_path}/capstone/include/capstone
> > for directly #include <capstone.h>, and the exist include path should
preserve, because
> > in capstone code there something like #include "capstone/capstone.h"
> >
> > If only using
> >     capstone_cflags="-I${source_path}/capstone/include/capstone"
> > Then will cause the following compiling error:
> >
> >   CC      cs.o
> > cs.c:17:10: fatal error: 'capstone/capstone.h' file not found
> > #include <capstone/capstone.h>
> >          ^~~~~~~~~~~~~~~~~~~~~
> > 1 error generated.
> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > ---
> >  capstone  | 2 +-
> >  configure | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/capstone b/capstone
> > index 22ead3e0bf..1d23053284 160000
> > --- a/capstone
> > +++ b/capstone
> > @@ -1 +1 @@
> > -Subproject commit 22ead3e0bfdb87516656453336160e0a37b066bf
> > +Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1
>
> Richard has a patch series on the list now to update and improve the
> capstone submodule (see "capstone + disassembler patches") ... I think
> this patch here will then not be required anymore.
I've seen that, of cause, this patch need to be dropped.
>
>  Thomas
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 3178 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-12 22:44 ` [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw Yonggang Luo
@ 2020-09-14  7:23   ` Thomas Huth
  2020-09-14  8:19     ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-14  7:23 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel, Paolo Bonzini, Daniel P. Berrange
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Max Reitz, Li-Wen Hsu

On 13/09/2020 00.44, Yonggang Luo wrote:
> Fixes 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 in the header
> 
> Add qemu_socket_pair for cross platform support, convert file system
> handling functions to glib
> Add qemu_link function instead posix only link function.
> Use send ad recv from qemu that convert Windows Socks error
> to errno properly.
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
[...]
> +static int __stream_socketpair(struct addrinfo* addr_info, int sock[2]){
> +    SOCKET listener, client, server;
> +    int opt = 1;
> +
> +    listener = server = client = INVALID_SOCKET;
> +    listener = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);
> +    if (INVALID_SOCKET == listener)
> +        goto fail;
> +
> +    setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,(const char*)&opt, sizeof(opt));
> +
> +    if(SOCKET_ERROR == bind(listener, addr_info->ai_addr, addr_info->ai_addrlen))
> +        goto fail;
> +
> +    if (SOCKET_ERROR == getsockname(listener, addr_info->ai_addr, (int*)&addr_info->ai_addrlen))
> +        goto fail;
> +
> +    if(SOCKET_ERROR == listen(listener, 5))
> +        goto fail;
> +
> +    client = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);
> +
> +    if (INVALID_SOCKET == client)
> +        goto fail;
> +
> +    if (SOCKET_ERROR == connect(client,addr_info->ai_addr,addr_info->ai_addrlen))
> +        goto fail;
> +
> +    server = accept(listener, 0, 0);
> +
> +    if (INVALID_SOCKET == server)
> +        goto fail;
> +
> +    closesocket(listener);
> +
> +    sock[0] = client;
> +    sock[1] = server;
> +
> +    return 0;
> +fail:
> +    if(INVALID_SOCKET!=listener)
> +        closesocket(listener);
> +    if (INVALID_SOCKET!=client)
> +        closesocket(client);
> +    return -1;
> +}
> +
> +static int __dgram_socketpair(struct addrinfo* addr_info, int sock[2])
> +{
> +    SOCKET client, server;
> +    struct addrinfo addr, *result = NULL;
> +    const char* address;
> +    int opt = 1;
> +
> +    server = client = INVALID_SOCKET;
> +
> +    server = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);  
> +    if (INVALID_SOCKET == server)
> +        goto fail;
> +
> +    setsockopt(server, SOL_SOCKET,SO_REUSEADDR, (const char*)&opt, sizeof(opt));
> +
> +    if(SOCKET_ERROR == bind(server, addr_info->ai_addr, addr_info->ai_addrlen))
> +        goto fail;
> +
> +    if (SOCKET_ERROR == getsockname(server, addr_info->ai_addr, (int*)&addr_info->ai_addrlen))
> +        goto fail;
> +
> +    client = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol); 
> +    if (INVALID_SOCKET == client)
> +        goto fail;
> +
> +    memset(&addr,0,sizeof(addr));
> +    addr.ai_family = addr_info->ai_family;
> +    addr.ai_socktype = addr_info->ai_socktype;
> +    addr.ai_protocol = addr_info->ai_protocol;
> +
> +    if (AF_INET6==addr.ai_family)
> +        address = "0:0:0:0:0:0:0:1";
> +    else
> +        address = "127.0.0.1";
> +
> +    if (getaddrinfo(address, "0", &addr, &result))
> +        goto fail;
> +
> +    setsockopt(client,SOL_SOCKET,SO_REUSEADDR,(const char*)&opt, sizeof(opt));
> +    if(SOCKET_ERROR == bind(client, result->ai_addr, result->ai_addrlen))
> +        goto fail;
> +
> +    if (SOCKET_ERROR == getsockname(client, result->ai_addr, (int*)&result->ai_addrlen))
> +        goto fail;
> +
> +    if (SOCKET_ERROR == connect(server, result->ai_addr, result->ai_addrlen))
> +        goto fail;
> +
> +    if (SOCKET_ERROR == connect(client, addr_info->ai_addr, addr_info->ai_addrlen))
> +        goto fail;
> +
> +    freeaddrinfo(result);
> +    sock[0] = client;
> +    sock[1] = server;
> +    return 0;
> +
> +fail:
> +    if (INVALID_SOCKET!=client)
> +        closesocket(client);
> +    if (INVALID_SOCKET!=server)
> +        closesocket(server);
> +    if (result)
> +        freeaddrinfo(result);
> +    return -1;
> +}
> +
> +int qemu_socketpair(int family, int type, int protocol,int recv[2]){
> +    const char* address;
> +    struct addrinfo addr_info,*p_addrinfo;
> +    int result = -1;
> +
> +    if (family == AF_UNIX)
> +    {
> +        family = AF_INET;
> +    }
> +
> +    memset(&addr_info, 0, sizeof(addr_info));
> +    addr_info.ai_family = family;
> +    addr_info.ai_socktype = type;
> +    addr_info.ai_protocol = protocol;
> +    if (AF_INET6==family)
> +        address = "0:0:0:0:0:0:0:1";
> +    else
> +        address = "127.0.0.1";
> +
> +    if (0 == getaddrinfo(address, "0", &addr_info, &p_addrinfo)){
> +        if (SOCK_STREAM == type)
> +            result = __stream_socketpair(p_addrinfo, recv);
> +        else if(SOCK_DGRAM == type)
> +            result = __dgram_socketpair(p_addrinfo, recv);
> +        freeaddrinfo(p_addrinfo);
> +    }
> +    return result;
> +}

Where do you've got this code from? It seems like this has been taken
from a 3rd party source? E.g.:

 https://blog.csdn.net/wufuhuai/article/details/79761889

What's the license of this new code? ... please clarify such details in
the commit description.

 Thanks,
  Thomas



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 16/27] cirrus: Building freebsd in a single short
  2020-09-12 22:44 ` [PATCH v8 16/27] cirrus: Building freebsd in a single short Yonggang Luo
@ 2020-09-14  7:27   ` Thomas Huth
  2020-09-14  8:50     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-14  7:27 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Paolo Bonzini, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu

On 13/09/2020 00.44, Yonggang Luo wrote:
> 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 <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Reviewed-by: Ed Maste <emaste@FreeBSD.org>
> ---
>  .cirrus.yml | 35 ++++++++---------------------------
>  1 file changed, 8 insertions(+), 27 deletions(-)

I tried this a couple of times now, and currently the problem seems to
be gone, indeed. I'd still prefer to understand first why we have seen
the slowdown a couple of weeks ago, but if people agree that we should
revert the patch now, that's ok for me now, too.

Tested-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 24/27] ci: Enable msys2 ci in cirrus
  2020-09-12 22:44 ` [PATCH v8 24/27] ci: Enable msys2 ci in cirrus Yonggang Luo
@ 2020-09-14  7:38   ` Thomas Huth
  2020-09-14  8:25     ` Stefan Weil
  0 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-14  7:38 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel, Stefan Weil
  Cc: Kevin Wolf, Ed Maste, qemu-block, Wen Congyang, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Paolo Bonzini, Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu

On 13/09/2020 00.44, Yonggang Luo wrote:
> 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.

I don't think that a request to update the wiki should be part of the
commit message here.
Stefan, could you please have a look at the wiki to see whether it needs
an update?

> There is no need of --cross-prefix, open mingw64.exe instead of msys2.exe then we don't
> need the --cross-prefix, besides we using environment variable settings:
>     MSYS: winsymlinks:nativestrict
>     MSYSTEM: MINGW64
>     CHERE_INVOKING: 1
> to opening mingw64 native shell.
> We now running tests with make -i check to skip tests errors.
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  .cirrus.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
> 
> diff --git a/.cirrus.yml b/.cirrus.yml
> index 690c6882e8..1ff9f0a72f 100644
> --- a/.cirrus.yml
> +++ b/.cirrus.yml
> @@ -44,3 +44,63 @@ 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"

The lines here are very long ... could you please put the stuff after
the "&&" on a new line?

> +    - C:\tools\msys64\usr\bin\bash.exe -lc "pacman -Sy --noconfirm"
> +    - C:\tools\msys64\usr\bin\bash.exe -lc "pacman --needed --noconfirm -S 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-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-jemalloc

Installing jemalloc only makes sense if you also use --enable-jemalloc
later. So I'd suggest to drop this package here.

> +        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-capstone

Hmm, so in an earlier patch, you've added an update to the capstone
submodule, but here you install the system-wide capstone as well? ...
that does not make too much sense. Which one do you intend to use?

> +        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-libnfs

I think your NFS patch needs a review/ack from the block layer folks
first, so for the time being, I'd suggest drop libnfs here first and add
it later, once the nfs patch has been merged via the block layer queue.

> +        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"
> +    - 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"
> +
> 

 Thomas



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-14  7:23   ` Thomas Huth
@ 2020-09-14  8:19     ` 罗勇刚(Yonggang Luo)
  2020-09-14 11:07       ` Thomas Huth
  0 siblings, 1 reply; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14  8:19 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Daniel P. Berrange, qemu-level,
	Richard Henderson, Gerd Hoffmann, Wen Congyang, Paolo Bonzini,
	Max Reitz, Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 6615 bytes --]

On Mon, Sep 14, 2020 at 3:23 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 13/09/2020 00.44, Yonggang Luo wrote:
> > Fixes 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 in the header
> >
> > Add qemu_socket_pair for cross platform support, convert file system
> > handling functions to glib
> > Add qemu_link function instead posix only link function.
> > Use send ad recv from qemu that convert Windows Socks error
> > to errno properly.
> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > ---
> [...]
> > +static int __stream_socketpair(struct addrinfo* addr_info, int
sock[2]){
> > +    SOCKET listener, client, server;
> > +    int opt = 1;
> > +
> > +    listener = server = client = INVALID_SOCKET;
> > +    listener = socket(addr_info->ai_family, addr_info->ai_socktype,
addr_info->ai_protocol);
> > +    if (INVALID_SOCKET == listener)
> > +        goto fail;
> > +
> > +    setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,(const char*)&opt,
sizeof(opt));
> > +
> > +    if(SOCKET_ERROR == bind(listener, addr_info->ai_addr,
addr_info->ai_addrlen))
> > +        goto fail;
> > +
> > +    if (SOCKET_ERROR == getsockname(listener, addr_info->ai_addr,
(int*)&addr_info->ai_addrlen))
> > +        goto fail;
> > +
> > +    if(SOCKET_ERROR == listen(listener, 5))
> > +        goto fail;
> > +
> > +    client = socket(addr_info->ai_family, addr_info->ai_socktype,
addr_info->ai_protocol);
> > +
> > +    if (INVALID_SOCKET == client)
> > +        goto fail;
> > +
> > +    if (SOCKET_ERROR ==
connect(client,addr_info->ai_addr,addr_info->ai_addrlen))
> > +        goto fail;
> > +
> > +    server = accept(listener, 0, 0);
> > +
> > +    if (INVALID_SOCKET == server)
> > +        goto fail;
> > +
> > +    closesocket(listener);
> > +
> > +    sock[0] = client;
> > +    sock[1] = server;
> > +
> > +    return 0;
> > +fail:
> > +    if(INVALID_SOCKET!=listener)
> > +        closesocket(listener);
> > +    if (INVALID_SOCKET!=client)
> > +        closesocket(client);
> > +    return -1;
> > +}
> > +
> > +static int __dgram_socketpair(struct addrinfo* addr_info, int sock[2])
> > +{
> > +    SOCKET client, server;
> > +    struct addrinfo addr, *result = NULL;
> > +    const char* address;
> > +    int opt = 1;
> > +
> > +    server = client = INVALID_SOCKET;
> > +
> > +    server = socket(addr_info->ai_family, addr_info->ai_socktype,
addr_info->ai_protocol);
> > +    if (INVALID_SOCKET == server)
> > +        goto fail;
> > +
> > +    setsockopt(server, SOL_SOCKET,SO_REUSEADDR, (const char*)&opt,
sizeof(opt));
> > +
> > +    if(SOCKET_ERROR == bind(server, addr_info->ai_addr,
addr_info->ai_addrlen))
> > +        goto fail;
> > +
> > +    if (SOCKET_ERROR == getsockname(server, addr_info->ai_addr,
(int*)&addr_info->ai_addrlen))
> > +        goto fail;
> > +
> > +    client = socket(addr_info->ai_family, addr_info->ai_socktype,
addr_info->ai_protocol);
> > +    if (INVALID_SOCKET == client)
> > +        goto fail;
> > +
> > +    memset(&addr,0,sizeof(addr));
> > +    addr.ai_family = addr_info->ai_family;
> > +    addr.ai_socktype = addr_info->ai_socktype;
> > +    addr.ai_protocol = addr_info->ai_protocol;
> > +
> > +    if (AF_INET6==addr.ai_family)
> > +        address = "0:0:0:0:0:0:0:1";
> > +    else
> > +        address = "127.0.0.1";
> > +
> > +    if (getaddrinfo(address, "0", &addr, &result))
> > +        goto fail;
> > +
> > +    setsockopt(client,SOL_SOCKET,SO_REUSEADDR,(const char*)&opt,
sizeof(opt));
> > +    if(SOCKET_ERROR == bind(client, result->ai_addr,
result->ai_addrlen))
> > +        goto fail;
> > +
> > +    if (SOCKET_ERROR == getsockname(client, result->ai_addr,
(int*)&result->ai_addrlen))
> > +        goto fail;
> > +
> > +    if (SOCKET_ERROR == connect(server, result->ai_addr,
result->ai_addrlen))
> > +        goto fail;
> > +
> > +    if (SOCKET_ERROR == connect(client, addr_info->ai_addr,
addr_info->ai_addrlen))
> > +        goto fail;
> > +
> > +    freeaddrinfo(result);
> > +    sock[0] = client;
> > +    sock[1] = server;
> > +    return 0;
> > +
> > +fail:
> > +    if (INVALID_SOCKET!=client)
> > +        closesocket(client);
> > +    if (INVALID_SOCKET!=server)
> > +        closesocket(server);
> > +    if (result)
> > +        freeaddrinfo(result);
> > +    return -1;
> > +}
> > +
> > +int qemu_socketpair(int family, int type, int protocol,int recv[2]){
> > +    const char* address;
> > +    struct addrinfo addr_info,*p_addrinfo;
> > +    int result = -1;
> > +
> > +    if (family == AF_UNIX)
> > +    {
> > +        family = AF_INET;
> > +    }
> > +
> > +    memset(&addr_info, 0, sizeof(addr_info));
> > +    addr_info.ai_family = family;
> > +    addr_info.ai_socktype = type;
> > +    addr_info.ai_protocol = protocol;
> > +    if (AF_INET6==family)
> > +        address = "0:0:0:0:0:0:0:1";
> > +    else
> > +        address = "127.0.0.1";
> > +
> > +    if (0 == getaddrinfo(address, "0", &addr_info, &p_addrinfo)){
> > +        if (SOCK_STREAM == type)
> > +            result = __stream_socketpair(p_addrinfo, recv);
> > +        else if(SOCK_DGRAM == type)
> > +            result = __dgram_socketpair(p_addrinfo, recv);
> > +        freeaddrinfo(p_addrinfo);
> > +    }
> > +    return result;
> > +}
>
> Where do you've got this code from? It seems like this has been taken
> from a 3rd party source? E.g.:
>
>  https://blog.csdn.net/wufuhuai/article/details/79761889
>
> What's the license of this new code? ... please clarify such details in
The original code have no license information, neither copyleft nor
copyright, what's your suggestion
or rewrite it?

>
> the commit description.
>
>  Thanks,
>   Thomas
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 8844 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 24/27] ci: Enable msys2 ci in cirrus
  2020-09-14  7:38   ` Thomas Huth
@ 2020-09-14  8:25     ` Stefan Weil
  0 siblings, 0 replies; 71+ messages in thread
From: Stefan Weil @ 2020-09-14  8:25 UTC (permalink / raw)
  To: Thomas Huth, Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Wen Congyang, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Paolo Bonzini, Daniel P . Berrangé,
	Max Reitz, Li-Wen Hsu

Am 14.09.20 um 09:38 schrieb Thomas Huth:

> On 13/09/2020 00.44, Yonggang Luo wrote:
>> 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.
> I don't think that a request to update the wiki should be part of the
> commit message here.
> Stefan, could you please have a look at the wiki to see whether it needs
> an update?


https://wiki.qemu.org/Hosts/W32 needs several updates.

I never use native builds with msys, so cannot say whether they work at all.

All I know is that cross builds with Mingw-w64 work, either on Linux (my usual environment is Debian Bullseye) or on Cygwin (very slow). https://github.com/stweil/qemu/tree/master/.github/workflows contains my build script and other required files.


Stefan




^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-13 16:14     ` 罗勇刚(Yonggang Luo)
@ 2020-09-14  8:45       ` Paolo Bonzini
  2020-09-14  8:48         ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Paolo Bonzini @ 2020-09-14  8:45 UTC (permalink / raw)
  To: luoyonggang
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

On 13/09/20 18:14, 罗勇刚(Yonggang Luo) wrote:
> I am hurry to revert --ninja option because when the meson are changed, the
> make -j10 can not automatically re configure, that would raise ninja can
> not found error 

My understanding is that with 0.55.2 you don't need --ninja at all (the
default search works), and also the previously configured build tree
should work.

What's the issue there?

Paolo



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-14  8:45       ` Paolo Bonzini
@ 2020-09-14  8:48         ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14  8:48 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kevin Wolf, Ed Maste, Michael Roth, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

On Mon, Sep 14, 2020 at 4:45 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 13/09/20 18:14, 罗勇刚(Yonggang Luo) wrote:
> > I am hurry to revert --ninja option because when the meson are changed,
the
> > make -j10 can not automatically re configure, that would raise ninja can
> > not found error
>
> My understanding is that with 0.55.2 you don't need --ninja at all (the
> default search works), and also the previously configured build tree
> should work.
>
> What's the issue there?
>
Oh, I mis-understood the --ninja option, so the ninja option doesn't have
to be revert, but upgrade meson to 0.55.2 are necessary
>
> Paolo
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 935 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 16/27] cirrus: Building freebsd in a single short
  2020-09-14  7:27   ` Thomas Huth
@ 2020-09-14  8:50     ` Philippe Mathieu-Daudé
  2020-09-14 10:43       ` Thomas Huth
  0 siblings, 1 reply; 71+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-14  8:50 UTC (permalink / raw)
  To: Thomas Huth, Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, qemu-block, Stefan Weil, Xie Changlong, Peter Lieven,
	Michael Roth, Markus Armbruster, Max Reitz, Gerd Hoffmann,
	Wen Congyang, Paolo Bonzini, Richard Henderson, Li-Wen Hsu

On 9/14/20 9:27 AM, Thomas Huth wrote:
> On 13/09/2020 00.44, Yonggang Luo wrote:
>> 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 <luoyonggang@gmail.com>
>> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>> Reviewed-by: Ed Maste <emaste@FreeBSD.org>
>> ---
>>  .cirrus.yml | 35 ++++++++---------------------------
>>  1 file changed, 8 insertions(+), 27 deletions(-)
> 
> I tried this a couple of times now, and currently the problem seems to
> be gone, indeed. I'd still prefer to understand first why we have seen
> the slowdown a couple of weeks ago, but if people agree that we should
> revert the patch now, that's ok for me now, too.

Not sure if related (probably not as failure and not timeout),
I hit this during the night:

  TEST    iotest-qcow2: 030 [fail]
QEMU          --
"/tmp/cirrus-ci-build/build/tests/qemu-iotests/../../qemu-system-alpha"
-nodefaults -display none -accel qtest
QEMU_IMG      --
"/tmp/cirrus-ci-build/build/tests/qemu-iotests/../../qemu-img"
QEMU_IO       --
"/tmp/cirrus-ci-build/build/tests/qemu-iotests/../../qemu-io"  --cache
writeback --aio threads -f qcow2
QEMU_NBD      --
"/tmp/cirrus-ci-build/build/tests/qemu-iotests/../../qemu-nbd"
IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- FreeBSD/amd64 cirrus-task-6204750985166848 12.1-RELEASE
TEST_DIR      -- /tmp/cirrus-ci-build/build/tests/qemu-iotests/scratch
SOCK_DIR      -- /tmp/tmp.VuwmKXUW
SOCKET_SCM_HELPER --
--- /tmp/cirrus-ci-build/tests/qemu-iotests/030.out	2020-09-13
21:08:32.261276000 +0000
+++ /tmp/cirrus-ci-build/build/tests/qemu-iotests/030.out.bad	2020-09-13
21:30:59.736699000 +0000
@@ -1,5 +1,17 @@
-...........................
+.............F.............
+======================================================================
+FAIL: test_stream_parallel (__main__.TestParallelOps)
 ----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "030", line 251, in test_stream_parallel
+    self.assert_qmp(result, 'return', {})
+  File "/tmp/cirrus-ci-build/tests/qemu-iotests/iotests.py", line 888,
in assert_qmp
+    result = self.dictpath(d, path)
+  File "/tmp/cirrus-ci-build/tests/qemu-iotests/iotests.py", line 862,
in dictpath
+    self.fail(f'failed path traversal for "{path}" in "{d}"')
+AssertionError: failed path traversal for "return" in "{'error':
{'class': 'DeviceNotActive', 'desc': "Block job 'stream-node8' not found"}}"
+
+----------------------------------------------------------------------
Failures: 030
Failed 1 of 74 iotests
gmake[1]: *** [/tmp/cirrus-ci-build/tests/Makefile.include:144:
check-block] Error 1
gmake[1]: Leaving directory '/tmp/cirrus-ci-build/build'

https://cirrus-ci.com/task/6204750985166848



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw
  2020-09-13 18:58       ` Philippe Mathieu-Daudé
@ 2020-09-14 10:26         ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14 10:26 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 3556 bytes --]

How about using the following patch with
+#if !defined (_WIN32)
     .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
+#endif
Also,
  +static blkcnt_t nfs_get_st_blocks(const struct nfs_stat *st)
+{
+#if defined(_WIN32)
+    return (st->st_size + 511) / 512;
+#else
+    return st->st_blocks;
+#endif
+}
Change to be
    +static blkcnt_t nfs_get_st_blocks(const struct nfs_stat *st)
+{
+#if defined(_WIN32)
+    return-1; /* TODO: unimplemented on win32 yet */
+#else
+    return st->st_blocks;
+#endif
+}

 block/nfs.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/block/nfs.c b/block/nfs.c
index cc2413d5ab..beebd566d1 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -24,7 +24,9 @@

 #include "qemu/osdep.h"

+#if !defined(_WIN32)
 #include <poll.h>
+#endif
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
@@ -51,6 +53,13 @@
 #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
 #define QEMU_NFS_MAX_DEBUG_LEVEL 2

+#if defined (_WIN32)
+#define nfs_stat __stat64
+typedef long long blkcnt_t;
+#else
+#define nfs_stat stat
+#endif
+
 typedef struct NFSClient {
     struct nfs_context *context;
     struct nfsfh *fh;
@@ -70,7 +79,7 @@ typedef struct NFSRPC {
     int ret;
     int complete;
     QEMUIOVector *iov;
-    struct stat *st;
+    struct nfs_stat *st;
     Coroutine *co;
     NFSClient *client;
 } NFSRPC;
@@ -418,11 +427,20 @@ static void nfs_file_close(BlockDriverState *bs)
     nfs_client_close(client);
 }

+static blkcnt_t nfs_get_st_blocks(const struct nfs_stat *st)
+{
+#if defined(_WIN32)
+    return (st->st_size + 511) / 512;
+#else
+    return st->st_blocks;
+#endif
+}
+
 static int64_t nfs_client_open(NFSClient *client, BlockdevOptionsNfs *opts,
                                int flags, int open_flags, Error **errp)
 {
     int64_t ret = -EINVAL;
-    struct stat st;
+    struct nfs_stat st;
     char *file = NULL, *strp = NULL;

     qemu_mutex_init(&client->mutex);
@@ -548,7 +566,7 @@ static int64_t nfs_client_open(NFSClient *client,
BlockdevOptionsNfs *opts,
     }

     ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
-    client->st_blocks = st.st_blocks;
+    client->st_blocks = nfs_get_st_blocks(&st);
     client->has_zero_init = S_ISREG(st.st_mode);
     *strp = '/';
     goto out;
@@ -733,7 +751,7 @@ static int64_t
nfs_get_allocated_file_size(BlockDriverState *bs)
 {
     NFSClient *client = bs->opaque;
     NFSRPC task = {0};
-    struct stat st;
+    struct nfs_stat st;

     if (bdrv_is_read_only(bs) &&
         !(bs->open_flags & BDRV_O_NOCACHE)) {
@@ -750,7 +768,7 @@ static int64_t
nfs_get_allocated_file_size(BlockDriverState *bs)
     nfs_set_events(client);
     BDRV_POLL_WHILE(bs, !task.complete);

-    return (task.ret < 0 ? task.ret : st.st_blocks * 512);
+    return (task.ret < 0 ? task.ret : nfs_get_st_blocks(&st) * 512);
 }

 static int coroutine_fn
@@ -781,7 +799,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
                               BlockReopenQueue *queue, Error **errp)
 {
     NFSClient *client = state->bs->opaque;
-    struct stat st;
+    struct nfs_stat st;
     int ret = 0;

     if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {
@@ -803,7 +821,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
                        nfs_get_error(client->context));
             return ret;
         }
-        client->st_blocks = st.st_blocks;
+        client->st_blocks = nfs_get_st_blocks(&st);
     }

     return 0;

[-- Attachment #2: Type: text/html, Size: 4447 bytes --]

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 16/27] cirrus: Building freebsd in a single short
  2020-09-14  8:50     ` Philippe Mathieu-Daudé
@ 2020-09-14 10:43       ` Thomas Huth
  0 siblings, 0 replies; 71+ messages in thread
From: Thomas Huth @ 2020-09-14 10:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, qemu-block, Stefan Weil, Xie Changlong, Peter Lieven,
	Michael Roth, Markus Armbruster, Max Reitz, Gerd Hoffmann,
	Wen Congyang, Paolo Bonzini, Richard Henderson, Li-Wen Hsu

On 14/09/2020 10.50, Philippe Mathieu-Daudé wrote:
> On 9/14/20 9:27 AM, Thomas Huth wrote:
>> On 13/09/2020 00.44, Yonggang Luo wrote:
>>> 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 <luoyonggang@gmail.com>
>>> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>>> Reviewed-by: Ed Maste <emaste@FreeBSD.org>
>>> ---
>>>  .cirrus.yml | 35 ++++++++---------------------------
>>>  1 file changed, 8 insertions(+), 27 deletions(-)
>>
>> I tried this a couple of times now, and currently the problem seems to
>> be gone, indeed. I'd still prefer to understand first why we have seen
>> the slowdown a couple of weeks ago, but if people agree that we should
>> revert the patch now, that's ok for me now, too.
> 
> Not sure if related (probably not as failure and not timeout),
> I hit this during the night:
> 
>   TEST    iotest-qcow2: 030 [fail]

No, that's a different (known) issue. See my patch on the list:

 [PATCH v2] iotests: Skip test_stream_parallel in test 030 when doing
"make check"

 Thomas



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-14  8:19     ` 罗勇刚(Yonggang Luo)
@ 2020-09-14 11:07       ` Thomas Huth
  2020-09-14 15:58         ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-14 11:07 UTC (permalink / raw)
  To: luoyonggang, Paolo Bonzini
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, qemu-level, Max Reitz, Gerd Hoffmann,
	Wen Congyang, Daniel P. Berrange, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

On 14/09/2020 10.19, 罗勇刚(Yonggang Luo) wrote:
> 
> 
> On Mon, Sep 14, 2020 at 3:23 PM Thomas Huth <thuth@redhat.com
> <mailto:thuth@redhat.com>> wrote:
>>
>> On 13/09/2020 00.44, Yonggang Luo wrote:
>> > Fixes 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 in the header
>> >
>> > Add qemu_socket_pair for cross platform support, convert file system
>> > handling functions to glib
>> > Add qemu_link function instead posix only link function.
>> > Use send ad recv from qemu that convert Windows Socks error
>> > to errno properly.
>> >
>> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
> <mailto:luoyonggang@gmail.com>>
>> > ---
[...]
>> Where do you've got this code from? It seems like this has been taken
>> from a 3rd party source? E.g.:
>>
>>  https://blog.csdn.net/wufuhuai/article/details/79761889
>>
>> What's the license of this new code? ... please clarify such details in
>> the commit description.
>
> The original code have no license information, neither copyleft nor
> copyright, what's your suggestion
> or rewrite it?
>  

You can not simply copy code without license information and submit this
as if it was your own! Please never do that again!
With your Signed-off-by line, you basically acknowledge that you've read
and followed the Developer Certificate of Origin:

 https://developercertificate.org/

If you haven't done that yet, please do it now!

And for this patch here, I don't think that it is acceptable without
proper license information.

 Thomas



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-13 15:35   ` Philippe Mathieu-Daudé
  2020-09-13 16:01     ` 罗勇刚(Yonggang Luo)
@ 2020-09-14 14:01     ` Eric Blake
  1 sibling, 0 replies; 71+ messages in thread
From: Eric Blake @ 2020-09-14 14:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Daniel P . Berrangé,
	Ed Maste, qemu-block, Stefan Weil, Xie Changlong, Peter Lieven,
	Michael Roth, Markus Armbruster, Max Reitz, Gerd Hoffmann,
	Wen Congyang, Paolo Bonzini, Richard Henderson, Li-Wen Hsu

On 9/13/20 10:35 AM, Philippe Mathieu-Daudé wrote:
> On 9/13/20 12:44 AM, Yonggang Luo wrote:
>> On windows, a difference in line endings causes testsuite failures
>> complaining that every single line in files such as
>> 'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b to diff.
> 
> Isn't '--strip-trailing-cr' more adapted?

No, BSD lacks that spelling.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-13 18:49       ` Philippe Mathieu-Daudé
@ 2020-09-14 14:41         ` Peter Maydell
  2020-09-14 15:20           ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Peter Maydell @ 2020-09-14 14:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Michael Roth,
	Yonggang Luo, Max Reitz, Gerd Hoffmann, Daniel P . Berrangé,
	Wen Congyang, Paolo Bonzini, Richard Henderson, Li-Wen Hsu,
	Markus Armbruster

On Sun, 13 Sep 2020 at 19:51, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> On 9/13/20 6:01 PM, 罗勇刚(Yonggang Luo) wrote:
> >
> >
> > On Sun, Sep 13, 2020 at 11:35 PM Philippe Mathieu-Daudé
> > <philmd@redhat.com <mailto:philmd@redhat.com>> wrote:
> >
> >     On 9/13/20 12:44 AM, Yonggang Luo wrote:
> >     > On windows, a difference in line endings causes testsuite failures
> >     > complaining that every single line in files such as
> >     > 'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b to
> >     diff.
> >
> >     Isn't '--strip-trailing-cr' more adapted?
> >
> > er, I did that before.....
>
> So, yes/no? We can not follow all patches, so better if you
> add a note about your changes, either in the patch description
> if you think it's worthwhile keeping that information in the
> git history, else below the '---' separator, so that information
> is stripped from the patch when applying.
>
> Looking at the archive I see Thomas said this option is not
> POSIX thus not portable.
>
> What about adding this?
>
> "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."

The other important point to note here is that because
texi output is mostly not case-sensitive, we are not
losing important test coverage by not checking for exact
whitespace matches between the known-good output and
the generated output. If we were checking the doc-good.out
text file, -b would be bad because there whitespace is
important and is part of what we need to be checking.

(Also the texi stuff is going to go away soon I hope :-))

thanks
-- PMM


^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows
  2020-09-14 14:41         ` Peter Maydell
@ 2020-09-14 15:20           ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14 15:20 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, qemu-level, Michael Roth, Max Reitz,
	Gerd Hoffmann, Daniel P . Berrangé,
	Wen Congyang, Paolo Bonzini, Richard Henderson,
	Philippe Mathieu-Daudé,
	Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 2152 bytes --]

On Mon, Sep 14, 2020 at 10:41 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Sun, 13 Sep 2020 at 19:51, Philippe Mathieu-Daudé <philmd@redhat.com>
> wrote:
> >
> > On 9/13/20 6:01 PM, 罗勇刚(Yonggang Luo) wrote:
> > >
> > >
> > > On Sun, Sep 13, 2020 at 11:35 PM Philippe Mathieu-Daudé
> > > <philmd@redhat.com <mailto:philmd@redhat.com>> wrote:
> > >
> > >     On 9/13/20 12:44 AM, Yonggang Luo wrote:
> > >     > On windows, a difference in line endings causes testsuite
> failures
> > >     > complaining that every single line in files such as
> > >     > 'tests/qapi-schemadoc-good.texi' is wrong.  Fix it by adding -b
> to
> > >     diff.
> > >
> > >     Isn't '--strip-trailing-cr' more adapted?
> > >
> > > er, I did that before.....
> >
> > So, yes/no? We can not follow all patches, so better if you
> > add a note about your changes, either in the patch description
> > if you think it's worthwhile keeping that information in the
> > git history, else below the '---' separator, so that information
> > is stripped from the patch when applying.
> >
> > Looking at the archive I see Thomas said this option is not
> > POSIX thus not portable.
> >
> > What about adding this?
> >
> > "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."
>
> The other important point to note here is that because
> texi output is mostly not case-sensitive, we are not
> losing important test coverage by not checking for exact
> whitespace matches between the known-good output and
> the generated output. If we were checking the doc-good.out
> text file, -b would be bad because there whitespace is
> important and is part of what we need to be checking.
>
> (Also the texi stuff is going to go away soon I hope :-))
>
So continue with -b are accepted? or I just diable it on win32?

>
> thanks
> -- PMM
>


-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 3183 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-14 11:07       ` Thomas Huth
@ 2020-09-14 15:58         ` 罗勇刚(Yonggang Luo)
  2020-09-14 16:13           ` Daniel P. Berrangé
  0 siblings, 1 reply; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14 15:58 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, qemu-level, Max Reitz,
	Daniel P. Berrange, Wen Congyang, Paolo Bonzini,
	Richard Henderson, Li-Wen Hsu, Markus Armbruster, Gerd Hoffmann

[-- Attachment #1: Type: text/plain, Size: 2744 bytes --]

On Mon, Sep 14, 2020 at 7:07 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 14/09/2020 10.19, 罗勇刚(Yonggang Luo) wrote:
> >
> >
> > On Mon, Sep 14, 2020 at 3:23 PM Thomas Huth <thuth@redhat.com
> > <mailto:thuth@redhat.com>> wrote:
> >>
> >> On 13/09/2020 00.44, Yonggang Luo wrote:
> >> > Fixes 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 in the header
> >> >
> >> > Add qemu_socket_pair for cross platform support, convert file system
> >> > handling functions to glib
> >> > Add qemu_link function instead posix only link function.
> >> > Use send ad recv from qemu that convert Windows Socks error
> >> > to errno properly.
> >> >
> >> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
> > <mailto:luoyonggang@gmail.com>>
> >> > ---
> [...]
> >> Where do you've got this code from? It seems like this has been taken
> >> from a 3rd party source? E.g.:
> >>
> >>  https://blog.csdn.net/wufuhuai/article/details/79761889
> >>
> >> What's the license of this new code? ... please clarify such details in
> >> the commit description.
> >
> > The original code have no license information, neither copyleft nor
> > copyright, what's your suggestion
> > or rewrite it?
> >
>
> You can not simply copy code without license information and submit this
> as if it was your own! Please never do that again!
> With your Signed-off-by line, you basically acknowledge that you've read
> and followed the Developer Certificate of Origin:
>
>  https://developercertificate.org/
>
> If you haven't done that yet, please do it now!
>
> And for this patch here, I don't think that it is acceptable without
> proper license information.
>
>  Thomas
>
See that, How about using
https://developer.gnome.org/glib/stable/glib-IO-Channels.html#g-io-channel-new-file
to act as socketpair? and it's cross-platform, I don't need to add
platform-dependent codes.

--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 4038 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-14 15:58         ` 罗勇刚(Yonggang Luo)
@ 2020-09-14 16:13           ` Daniel P. Berrangé
  2020-09-14 18:31             ` 罗勇刚(Yonggang Luo)
  0 siblings, 1 reply; 71+ messages in thread
From: Daniel P. Berrangé @ 2020-09-14 16:13 UTC (permalink / raw)
  To: 罗勇刚(Yonggang Luo)
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Michael Roth, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu, Markus Armbruster

On Mon, Sep 14, 2020 at 11:58:24PM +0800, 罗勇刚(Yonggang Luo) wrote:
> On Mon, Sep 14, 2020 at 7:07 PM Thomas Huth <thuth@redhat.com> wrote:
> >
> > On 14/09/2020 10.19, 罗勇刚(Yonggang Luo) wrote:
> > >
> > >
> > > On Mon, Sep 14, 2020 at 3:23 PM Thomas Huth <thuth@redhat.com
> > > <mailto:thuth@redhat.com>> wrote:
> > >>
> > >> On 13/09/2020 00.44, Yonggang Luo wrote:
> > >> > Fixes 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 in the header
> > >> >
> > >> > Add qemu_socket_pair for cross platform support, convert file system
> > >> > handling functions to glib
> > >> > Add qemu_link function instead posix only link function.
> > >> > Use send ad recv from qemu that convert Windows Socks error
> > >> > to errno properly.
> > >> >
> > >> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
> > > <mailto:luoyonggang@gmail.com>>
> > >> > ---
> > [...]
> > >> Where do you've got this code from? It seems like this has been taken
> > >> from a 3rd party source? E.g.:
> > >>
> > >>  https://blog.csdn.net/wufuhuai/article/details/79761889
> > >>
> > >> What's the license of this new code? ... please clarify such details in
> > >> the commit description.
> > >
> > > The original code have no license information, neither copyleft nor
> > > copyright, what's your suggestion
> > > or rewrite it?
> > >
> >
> > You can not simply copy code without license information and submit this
> > as if it was your own! Please never do that again!
> > With your Signed-off-by line, you basically acknowledge that you've read
> > and followed the Developer Certificate of Origin:
> >
> >  https://developercertificate.org/
> >
> > If you haven't done that yet, please do it now!
> >
> > And for this patch here, I don't think that it is acceptable without
> > proper license information.
> >
> >  Thomas
> >
> See that, How about using
> https://developer.gnome.org/glib/stable/glib-IO-Channels.html#g-io-channel-new-file
> to act as socketpair? and it's cross-platform, I don't need to add
> platform-dependent codes.

That doesn't provide socketpair functionality. QEMU already has its
QIOChannel impl that is more advanced, but again that doesn't have
socketpair either because Windows lacks that.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw
  2020-09-14 16:13           ` Daniel P. Berrangé
@ 2020-09-14 18:31             ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-14 18:31 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Qemu-block, Stefan Weil,
	Xie Changlong, Peter Lieven, Michael Roth, qemu-level, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Richard Henderson,
	Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 4103 bytes --]

On Tue, Sep 15, 2020 at 12:14 AM Daniel P. Berrangé <berrange@redhat.com>
wrote:
>
> On Mon, Sep 14, 2020 at 11:58:24PM +0800, 罗勇刚(Yonggang Luo) wrote:
> > On Mon, Sep 14, 2020 at 7:07 PM Thomas Huth <thuth@redhat.com> wrote:
> > >
> > > On 14/09/2020 10.19, 罗勇刚(Yonggang Luo) wrote:
> > > >
> > > >
> > > > On Mon, Sep 14, 2020 at 3:23 PM Thomas Huth <thuth@redhat.com
> > > > <mailto:thuth@redhat.com>> wrote:
> > > >>
> > > >> On 13/09/2020 00.44, Yonggang Luo wrote:
> > > >> > Fixes 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 in the header
> > > >> >
> > > >> > Add qemu_socket_pair for cross platform support, convert file
system
> > > >> > handling functions to glib
> > > >> > Add qemu_link function instead posix only link function.
> > > >> > Use send ad recv from qemu that convert Windows Socks error
> > > >> > to errno properly.
> > > >> >
> > > >> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com
> > > > <mailto:luoyonggang@gmail.com>>
> > > >> > ---
> > > [...]
> > > >> Where do you've got this code from? It seems like this has been
taken
> > > >> from a 3rd party source? E.g.:
> > > >>
> > > >>  https://blog.csdn.net/wufuhuai/article/details/79761889
> > > >>
> > > >> What's the license of this new code? ... please clarify such
details in
> > > >> the commit description.
> > > >
> > > > The original code have no license information, neither copyleft nor
> > > > copyright, what's your suggestion
> > > > or rewrite it?
> > > >
> > >
> > > You can not simply copy code without license information and submit
this
> > > as if it was your own! Please never do that again!
> > > With your Signed-off-by line, you basically acknowledge that you've
read
> > > and followed the Developer Certificate of Origin:
> > >
> > >  https://developercertificate.org/
> > >
> > > If you haven't done that yet, please do it now!
> > >
> > > And for this patch here, I don't think that it is acceptable without
> > > proper license information.
> > >
> > >  Thomas
> > >
> > See that, How about using
> >
https://developer.gnome.org/glib/stable/glib-IO-Channels.html#g-io-channel-new-file
> > to act as socketpair? and it's cross-platform, I don't need to add
> > platform-dependent codes.
>
> That doesn't provide socketpair functionality. QEMU already has its
> QIOChannel impl that is more advanced, but again that doesn't have
> socketpair either because Windows lacks that.

Doesn't need the   socketpair  functionality, we just need two FIFO, and
handle the fifo full empty by raising
EAGAIN error at
```
static ssize_t testWrite(const char *buf, size_t len, void *opaque)
{
    int *fd = opaque;
    int written = send(*fd, buf, len, 0);
    return written;
}

static ssize_t testRead(char *buf, size_t len, void *opaque)
{
    int *fd = opaque;

    int readed = recv(*fd, buf, len, 0);
    return readed;
}
```
>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-
https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-
https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-
https://www.instagram.com/dberrange :|
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 6263 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-13 14:08   ` Paolo Bonzini
  2020-09-13 16:03     ` 罗勇刚(Yonggang Luo)
  2020-09-13 16:14     ` 罗勇刚(Yonggang Luo)
@ 2020-09-15 11:44     ` Thomas Huth
  2020-09-15 11:56       ` 罗勇刚(Yonggang Luo)
  2 siblings, 1 reply; 71+ messages in thread
From: Thomas Huth @ 2020-09-15 11:44 UTC (permalink / raw)
  To: Paolo Bonzini, Yonggang Luo, qemu-devel
  Cc: Kevin Wolf, Ed Maste, qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, Michael Roth, Markus Armbruster, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Max Reitz, Li-Wen Hsu

On 13/09/2020 16.08, Paolo Bonzini wrote:
> On 13/09/20 00:44, Yonggang Luo wrote:
>> This reverts commit 48328880fddf0145bdccc499160fb24dfabfbd41.
>>
>> The --ninja option doesn't need anymore because of upgrade meson to 0.55.2
>> At that version we can use ninjatool
> 
> We might actually get rid of ninjatool before QEMU 5.2 goes out, if we
> decide to make Ninja a mandatory build dependency.  So we can hold on
> patches 26 and 27.  Thanks for testing though!
> 
> I'm also not sure about patch 16, since that's not my area, but Daniel
> and Ed both reviewed it so that's okay.
> 
> Finally, instead of checking !_WIN32 it's better to check CONFIG_POSIX
> or CONFIG_WIN32.  That can be changed on commit though.
> 
> Everything else seems okay.  I'll wait a couple days and queue the whole
> bunch up to patch 25.

Patch 13 definitely needs a replacement, and I think patch 2 should
likely go through the block tree instead...

But I recently started to experiment with these patches, too, and I
think I got a reasonable subset now which should be OK for getting
merged (e.g. disabling NFS and the crypto test in the CI for now). I'll
take those through my testing tree. The remaining work can then be done
on top later.

 Thomas



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v8 27/27] Revert "configure: add --ninja option"
  2020-09-15 11:44     ` Thomas Huth
@ 2020-09-15 11:56       ` 罗勇刚(Yonggang Luo)
  0 siblings, 0 replies; 71+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-09-15 11:56 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Kevin Wolf, Ed Maste, Qemu-block, Stefan Weil, Xie Changlong,
	Peter Lieven, qemu-level, Michael Roth, Richard Henderson,
	Gerd Hoffmann, Wen Congyang, Paolo Bonzini, Max Reitz,
	Li-Wen Hsu, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

On Tue, Sep 15, 2020 at 7:44 PM Thomas Huth <thuth@redhat.com> wrote:

> On 13/09/2020 16.08, Paolo Bonzini wrote:
> > On 13/09/20 00:44, Yonggang Luo wrote:
> >> This reverts commit 48328880fddf0145bdccc499160fb24dfabfbd41.
> >>
> >> The --ninja option doesn't need anymore because of upgrade meson to
> 0.55.2
> >> At that version we can use ninjatool
> >
> > We might actually get rid of ninjatool before QEMU 5.2 goes out, if we
> > decide to make Ninja a mandatory build dependency.  So we can hold on
> > patches 26 and 27.  Thanks for testing though!
> >
> > I'm also not sure about patch 16, since that's not my area, but Daniel
> > and Ed both reviewed it so that's okay.
> >
> > Finally, instead of checking !_WIN32 it's better to check CONFIG_POSIX
> > or CONFIG_WIN32.  That can be changed on commit though.
> >
> > Everything else seems okay.  I'll wait a couple days and queue the whole
> > bunch up to patch 25.
>
> Patch 13 definitely needs a replacement, and I think patch 2 should
> likely go through the block tree instead...
>
I am prepareing V9, and move nfs related things to the end  patch 13 are
re-implemented
please wait for some minutes

>
> But I recently started to experiment with these patches, too, and I
> think I got a reasonable subset now which should be OK for getting
> merged (e.g. disabling NFS and the crypto test in the CI for now). I'll
> take those through my testing tree. The remaining work can then be done
> on top later.
>
>  Thomas
>
>

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

[-- Attachment #2: Type: text/html, Size: 2301 bytes --]

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2020-09-15 11:57 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-12 22:44 [PATCH v8 00/27] W32, W64 msys2/mingw patches Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 01/27] rcu: Implement drain_call_rcu Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 02/27] block: Fixes nfs compiling error on msys2/mingw Yonggang Luo
2020-09-13 15:47   ` Philippe Mathieu-Daudé
2020-09-13 16:00     ` 罗勇刚(Yonggang Luo)
2020-09-13 18:58       ` Philippe Mathieu-Daudé
2020-09-14 10:26         ` 罗勇刚(Yonggang Luo)
2020-09-12 22:44 ` [PATCH v8 03/27] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
2020-09-14  7:10   ` Thomas Huth
2020-09-14  7:15     ` 罗勇刚(Yonggang Luo)
2020-09-12 22:44 ` [PATCH v8 04/27] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 05/27] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 06/27] curses: Fixes curses compiling errors Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 07/27] tests: disable /char/stdio/* tests in test-char.c on win32 Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 08/27] tests: Fixes test-replication.c on msys2/mingw Yonggang Luo
2020-09-13 15:37   ` Philippe Mathieu-Daudé
2020-09-12 22:44 ` [PATCH v8 09/27] tests: test-replication disable /replication/secondary/* " Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 10/27] osdep: file locking functions are not available on Win32 Yonggang Luo
2020-09-13 15:36   ` Philippe Mathieu-Daudé
2020-09-12 22:44 ` [PATCH v8 11/27] meson: Use -b to ignore CR vs. CR-LF issues on Windows Yonggang Luo
2020-09-13 15:35   ` Philippe Mathieu-Daudé
2020-09-13 16:01     ` 罗勇刚(Yonggang Luo)
2020-09-13 18:49       ` Philippe Mathieu-Daudé
2020-09-14 14:41         ` Peter Maydell
2020-09-14 15:20           ` 罗勇刚(Yonggang Luo)
2020-09-14 14:01     ` Eric Blake
2020-09-12 22:44 ` [PATCH v8 12/27] gcrypt: test_tls_psk_init should write binary file instead text file Yonggang Luo
2020-09-13 15:31   ` Philippe Mathieu-Daudé
2020-09-12 22:44 ` [PATCH v8 13/27] tests: Enable crypto tests under msys2/mingw Yonggang Luo
2020-09-14  7:23   ` Thomas Huth
2020-09-14  8:19     ` 罗勇刚(Yonggang Luo)
2020-09-14 11:07       ` Thomas Huth
2020-09-14 15:58         ` 罗勇刚(Yonggang Luo)
2020-09-14 16:13           ` Daniel P. Berrangé
2020-09-14 18:31             ` 罗勇刚(Yonggang Luo)
2020-09-12 22:44 ` [PATCH v8 14/27] meson: remove empty else and duplicated gio deps Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 15/27] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 16/27] cirrus: Building freebsd in a single short Yonggang Luo
2020-09-14  7:27   ` Thomas Huth
2020-09-14  8:50     ` Philippe Mathieu-Daudé
2020-09-14 10:43       ` Thomas Huth
2020-09-12 22:44 ` [PATCH v8 17/27] tests: Convert g_free to g_autofree macro in test-logging.c Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 18/27] tests: Fixes test-io-channel-socket.c tests under msys2/mingw Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 19/27] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 20/27] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
2020-09-13 15:28   ` Philippe Mathieu-Daudé
2020-09-12 22:44 ` [PATCH v8 21/27] tests: fix test-util-sockets.c Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 22/27] tests: Fixes test-qdev-global-props.c Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 23/27] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 24/27] ci: Enable msys2 ci in cirrus Yonggang Luo
2020-09-14  7:38   ` Thomas Huth
2020-09-14  8:25     ` Stefan Weil
2020-09-12 22:44 ` [PATCH v8 25/27] meson: upgrade meson for execute custom ninjatool under msys2 properly Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 26/27] meson: remove --ninja option in configure Yonggang Luo
2020-09-12 22:44 ` [PATCH v8 27/27] Revert "configure: add --ninja option" Yonggang Luo
2020-09-13 14:08   ` Paolo Bonzini
2020-09-13 16:03     ` 罗勇刚(Yonggang Luo)
2020-09-13 16:12       ` Paolo Bonzini
2020-09-13 16:16         ` 罗勇刚(Yonggang Luo)
2020-09-13 16:14     ` 罗勇刚(Yonggang Luo)
2020-09-14  8:45       ` Paolo Bonzini
2020-09-14  8:48         ` 罗勇刚(Yonggang Luo)
2020-09-15 11:44     ` Thomas Huth
2020-09-15 11:56       ` 罗勇刚(Yonggang Luo)
2020-09-12 23:06 ` [PATCH v8 00/27] W32, W64 msys2/mingw patches no-reply
2020-09-14  7:00   ` 罗勇刚(Yonggang Luo)
2020-09-14  6:10 ` Thomas Huth
2020-09-14  6:27   ` 罗勇刚(Yonggang Luo)
2020-09-14  6:37     ` Stefan Weil
2020-09-14  6:54       ` 罗勇刚(Yonggang Luo)
2020-09-14  6:49     ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.