qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/24] W32, W64 msys2/mingw patches
@ 2020-09-09 16:14 Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 01/24] file-win32: Fix "locking" option Yonggang Luo
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Li-Wen Hsu,
	Peter Lieven

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

Kevin Wolf (1):
  file-win32: Fix "locking" option

Maxim Levitsky (1):
  rcu: Implement drain_call_rcu

Yonggang Luo (22):
  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: Trying fixes test-replication.c on msys2/mingw.
  tests: test-replication disable /replication/secondary/* on
    msys2/mingw.
  osdep: osdep: file locking functions are not available on Win32
  meson: Use -b to ignore CR vs. CR-LF issues on Windows
  meson: disable crypto tests are empty under win32
  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

 .cirrus.yml                    | 96 ++++++++++++++++++++++++----------
 block/file-win32.c             | 22 +++++++-
 block/nfs.c                    | 26 +++++----
 capstone                       |  2 +-
 configure                      | 61 ++++++---------------
 include/qemu/osdep.h           |  2 +-
 include/qemu/rcu.h             |  1 +
 include/sysemu/os-win32.h      |  4 +-
 meson.build                    |  6 ---
 tests/meson.build              |  3 +-
 tests/qapi-schema/meson.build  |  2 +-
 tests/test-char.c              |  8 +--
 tests/test-io-channel-file.c   | 10 +++-
 tests/test-io-channel-socket.c |  2 +
 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 +++++++++++++++++++
 23 files changed, 248 insertions(+), 121 deletions(-)

-- 
2.28.0.windows.1



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

* [PATCH v4 01/24] file-win32: Fix "locking" option
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 02/24] rcu: Implement drain_call_rcu Yonggang Luo
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Gerd Hoffmann, Wen Congyang, Philippe Mathieu-Daudé,
	Li-Wen Hsu, Peter Lieven

From: Kevin Wolf <kwolf@redhat.com>

The intended behaviour was that locking=off/auto work and have no
effect (to remain compatible with file-posix), whereas locking=on would
return an error. Unfortunately, the code forgot to remove "locking" from
the options QDict, so any attempt to use the option would fail.

Replace the option parsing code for "locking" with something that is
part of the raw_runtime_opts QemuOptsList (so it is properly removed
from the QDict) and looks more like file-posix.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200907092739.9988-1-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/file-win32.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/block/file-win32.c b/block/file-win32.c
index ab69bd811a..e2900c3a51 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -299,6 +299,11 @@ static QemuOptsList raw_runtime_opts = {
             .type = QEMU_OPT_STRING,
             .help = "host AIO implementation (threads, native)",
         },
+        {
+            .name = "locking",
+            .type = QEMU_OPT_STRING,
+            .help = "file locking mode (on/off/auto, default: auto)",
+        },
         { /* end of list */ }
     },
 };
@@ -333,6 +338,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
     Error *local_err = NULL;
     const char *filename;
     bool use_aio;
+    OnOffAuto locking;
     int ret;
 
     s->type = FTYPE_FILE;
@@ -343,10 +349,24 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
 
-    if (qdict_get_try_bool(options, "locking", false)) {
+    locking = qapi_enum_parse(&OnOffAuto_lookup,
+                              qemu_opt_get(opts, "locking"),
+                              ON_OFF_AUTO_AUTO, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        ret = -EINVAL;
+        goto fail;
+    }
+    switch (locking) {
+    case ON_OFF_AUTO_ON:
         error_setg(errp, "locking=on is not supported on Windows");
         ret = -EINVAL;
         goto fail;
+    case ON_OFF_AUTO_OFF:
+    case ON_OFF_AUTO_AUTO:
+        break;
+    default:
+        g_assert_not_reached();
     }
 
     filename = qemu_opt_get(opts, "filename");
-- 
2.28.0.windows.1



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

* [PATCH v4 02/24] rcu: Implement drain_call_rcu
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 01/24] file-win32: Fix "locking" option Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 04/24] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Hajnoczi,
	Stefan Weil, Xie Changlong, Richard Henderson, Markus Armbruster,
	Max Reitz, Gerd Hoffmann, Stefan Hajnoczi, Wen Congyang,
	Maxim Levitsky, Li-Wen Hsu, Peter Lieven

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] 12+ messages in thread

* [PATCH v4 04/24] ci: fixes msys2 build by upgrading capstone to 4.0.2
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 01/24] file-win32: Fix "locking" option Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 02/24] rcu: Implement drain_call_rcu Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 05/24] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Li-Wen Hsu,
	Peter Lieven

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] 12+ messages in thread

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

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] 12+ messages in thread

* [PATCH v4 06/24] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS.
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (3 preceding siblings ...)
  2020-09-09 16:14 ` [PATCH v4 05/24] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 15/24] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Li-Wen Hsu,
	Peter Lieven

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] 12+ messages in thread

* [PATCH v4 15/24] vmstate: Fixes test-vmstate.c on msys2/mingw
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (4 preceding siblings ...)
  2020-09-09 16:14 ` [PATCH v4 06/24] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 16/24] cirrus: Building freebsd in a single short Yonggang Luo
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Thomas Huth, Ed Maste, Michael Roth, qemu-block,
	Stefan Weil, Xie Changlong, Richard Henderson, Markus Armbruster,
	Max Reitz, Yonggang Luo, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé, Philippe Mathieu-Daudé, Li-Wen Hsu,
	Peter Lieven

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 f8de709a0b..fc38e93d29 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;
 
 
@@ -1487,6 +1486,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] 12+ messages in thread

* [PATCH v4 16/24] cirrus: Building freebsd in a single short
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (5 preceding siblings ...)
  2020-09-09 16:14 ` [PATCH v4 15/24] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 20/24] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang,
	Daniel P . Berrangé, Li-Wen Hsu, Peter Lieven

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>
---
 .cirrus.yml | 37 +++++++++----------------------------
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 3dd9fcff7f..a18971aac4 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,40 +1,21 @@
 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; }
+    - ../configure --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; }
-    - gmake -j$(sysctl -n hw.ncpu)
-    - gmake -j$(sysctl -n hw.ncpu) check
+    - gmake check
 
 macos_task:
   osx_instance:
-- 
2.28.0.windows.1



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

* [PATCH v4 20/24] tests: Fixes test-io-channel-file by mask only owner file state mask bits
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (6 preceding siblings ...)
  2020-09-09 16:14 ` [PATCH v4 16/24] cirrus: Building freebsd in a single short Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 23/24] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 24/24] ci: Enable msys2 ci in cirrus Yonggang Luo
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Li-Wen Hsu,
	Peter Lieven

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] 12+ messages in thread

* [PATCH v4 23/24] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (7 preceding siblings ...)
  2020-09-09 16:14 ` [PATCH v4 20/24] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:14 ` [PATCH v4 24/24] ci: Enable msys2 ci in cirrus Yonggang Luo
  9 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Li-Wen Hsu,
	Peter Lieven

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] 12+ messages in thread

* [PATCH v4 24/24] ci: Enable msys2 ci in cirrus
  2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
                   ` (8 preceding siblings ...)
  2020-09-09 16:14 ` [PATCH v4 23/24] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full Yonggang Luo
@ 2020-09-09 16:14 ` Yonggang Luo
  2020-09-09 16:33   ` Daniel P. Berrangé
  9 siblings, 1 reply; 12+ messages in thread
From: Yonggang Luo @ 2020-09-09 16:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Ed Maste, Michael Roth, qemu-block, Stefan Weil,
	Xie Changlong, Richard Henderson, Markus Armbruster, Max Reitz,
	Yonggang Luo, Gerd Hoffmann, Wen Congyang, Li-Wen Hsu,
	Peter Lieven

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>
---
 .cirrus.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index a18971aac4..f819d202db 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -44,3 +44,62 @@ 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:
+    - mkdir build
+    - cd build
+    - ../configure --python=python3 --enable-werror --ninja=ninja --disable-pie
+    - make -j$NUMBER_OF_PROCESSORS
+    - make check
-- 
2.28.0.windows.1



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

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

On Thu, Sep 10, 2020 at 12:14:30AM +0800, 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.
> 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>
> ---
>  .cirrus.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 59 insertions(+)
> 
> diff --git a/.cirrus.yml b/.cirrus.yml
> index a18971aac4..f819d202db 100644
> --- a/.cirrus.yml
> +++ b/.cirrus.yml
> @@ -44,3 +44,62 @@ 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:
> +    - mkdir build
> +    - cd build
> +    - ../configure --python=python3 --enable-werror --ninja=ninja --disable-pie

You shouldn't need  --disable-pie anymore, as this is merged:

  commit fb648e9cacf4209ddaa8ee67d1a87a9b78a001c6
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Mon Aug 24 17:31:09 2020 +0100

    configure: default to PIE disabled on Windows platforms
    
    If Windows EXE files are built with -pie/-fpie they will fail to
    launch. Historically QEMU defaulted to disabling PIE for Windows,
    but this setting was accidentally lost when the configure summary
    text was removed in
    
      commit f9332757898a764d85e19d339ec421236e885b68
      Author: Paolo Bonzini <pbonzini@redhat.com>
      Date:   Mon Feb 3 13:28:38 2020 +0100
    
        meson: move summary to meson.build
    
        Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


IIUC, the --enable-werror is present by default too thanks to this code
snippet:

if test -z "$werror" ; then
    if test -e "$source_path/.git" && \
        { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
        werror="yes"
    else
        werror="no"
    fi
fi


If you remove the --disable-pie && --enable-werror args then you can add

  Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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] 12+ messages in thread

end of thread, other threads:[~2020-09-09 16:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09 16:14 [PATCH v4 00/24] W32, W64 msys2/mingw patches Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 01/24] file-win32: Fix "locking" option Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 02/24] rcu: Implement drain_call_rcu Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 04/24] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 05/24] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 06/24] win32: Simplify gmtime_r detection direct base on _POSIX_THREAD_SAFE_FUNCTIONS Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 15/24] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 16/24] cirrus: Building freebsd in a single short Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 20/24] tests: Fixes test-io-channel-file by mask only owner file state mask bits Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 23/24] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full Yonggang Luo
2020-09-09 16:14 ` [PATCH v4 24/24] ci: Enable msys2 ci in cirrus Yonggang Luo
2020-09-09 16:33   ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).