qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/5] Unit test fixes + misc OS patches
@ 2021-03-21 17:18 Thomas Huth
  2021-03-21 17:18 ` [PULL 1/5] docs/devel/testing.rst: Fix references to unit tests Thomas Huth
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Thomas Huth @ 2021-03-21 17:18 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell

 Hi Peter!

The following changes since commit 2e1293cbaac75e84f541f9acfa8e26749f4c3562:

  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-03-16-v4' into staging (2021-03-19 16:40:00 +0000)

are available in the Git repository at:

  https://gitlab.com/thuth/qemu.git tags/pull-request-2021-03-21

for you to fetch changes up to 262fd27392128c180afc8f968d90d530574862f7:

  FreeBSD: Upgrade to 12.2 release (2021-03-20 06:33:17 +0100)

----------------------------------------------------------------
* Small fixes for the unit tests
* Compilation fixes for Illumos et al.
* Update the FreeBSD VM to 12.2
----------------------------------------------------------------

David CARLIER (2):
  configure: fix for SunOS based systems
  contrib: ivshmem client and server build fix for SunOS.

Emanuele Giuseppe Esposito (1):
  tests/unit/test-block-iothread: fix maybe-uninitialized error on GCC
    11

Wainer dos Santos Moschetta (1):
  docs/devel/testing.rst: Fix references to unit tests

Warner Losh (1):
  FreeBSD: Upgrade to 12.2 release

 configure                               |  2 +-
 contrib/ivshmem-client/ivshmem-client.c | 12 ++++++------
 contrib/ivshmem-server/ivshmem-server.c | 12 ++++++------
 docs/devel/testing.rst                  |  6 +++---
 tests/unit/test-block-iothread.c        |  6 +++---
 tests/vm/freebsd                        | 16 +++++++++++-----
 6 files changed, 30 insertions(+), 24 deletions(-)

-- 
2.27.0



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

* [PULL 1/5] docs/devel/testing.rst: Fix references to unit tests
  2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
@ 2021-03-21 17:18 ` Thomas Huth
  2021-03-21 17:18 ` [PULL 2/5] tests/unit/test-block-iothread: fix maybe-uninitialized error on GCC 11 Thomas Huth
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2021-03-21 17:18 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

With the recent move of the unit tests to tests/unit directory some
instructions under the "Unit tests" section became imprecise, which
are fixed by this change.

Fixes: da668aa15b99 ("tests: Move unit tests into a separate directory")
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20210318174407.2299930-1-wainersm@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 docs/devel/testing.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index 1434a50cc4..1da4c4e4c4 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -34,17 +34,17 @@ If you are writing new code in QEMU, consider adding a unit test, especially
 for utility modules that are relatively stateless or have few dependencies. To
 add a new unit test:
 
-1. Create a new source file. For example, ``tests/foo-test.c``.
+1. Create a new source file. For example, ``tests/unit/foo-test.c``.
 
 2. Write the test. Normally you would include the header file which exports
    the module API, then verify the interface behaves as expected from your
    test. The test code should be organized with the glib testing framework.
    Copying and modifying an existing test is usually a good idea.
 
-3. Add the test to ``tests/meson.build``. The unit tests are listed in a
+3. Add the test to ``tests/unit/meson.build``. The unit tests are listed in a
    dictionary called ``tests``.  The values are any additional sources and
    dependencies to be linked with the test.  For a simple test whose source
-   is in ``tests/foo-test.c``, it is enough to add an entry like::
+   is in ``tests/unit/foo-test.c``, it is enough to add an entry like::
 
      {
        ...
-- 
2.27.0



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

* [PULL 2/5] tests/unit/test-block-iothread: fix maybe-uninitialized error on GCC 11
  2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
  2021-03-21 17:18 ` [PULL 1/5] docs/devel/testing.rst: Fix references to unit tests Thomas Huth
@ 2021-03-21 17:18 ` Thomas Huth
  2021-03-21 17:18 ` [PULL 3/5] configure: fix for SunOS based systems Thomas Huth
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2021-03-21 17:18 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell

From: Emanuele Giuseppe Esposito <eesposit@redhat.com>

When building qemu with GCC 11, test-block-iothread produces the following
warning:

../tests/unit/test-block-iothread.c:148:11: error: ‘buf’ may be used
uninitialized [-Werror=maybe-uninitialized]

This is caused by buf[512] left uninitialized and passed to
bdrv_save_vmstate() that expects a const uint8_t *, so the compiler
assumes it will be read and expects the parameter to be initialized.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210319112218.49609-1-eesposit@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/unit/test-block-iothread.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
index 3f866a35c6..8cf172cb7a 100644
--- a/tests/unit/test-block-iothread.c
+++ b/tests/unit/test-block-iothread.c
@@ -89,7 +89,7 @@ static void test_sync_op_pread(BdrvChild *c)
 
 static void test_sync_op_pwrite(BdrvChild *c)
 {
-    uint8_t buf[512];
+    uint8_t buf[512] = { 0 };
     int ret;
 
     /* Success */
@@ -117,7 +117,7 @@ static void test_sync_op_blk_pread(BlockBackend *blk)
 
 static void test_sync_op_blk_pwrite(BlockBackend *blk)
 {
-    uint8_t buf[512];
+    uint8_t buf[512] = { 0 };
     int ret;
 
     /* Success */
@@ -141,7 +141,7 @@ static void test_sync_op_load_vmstate(BdrvChild *c)
 
 static void test_sync_op_save_vmstate(BdrvChild *c)
 {
-    uint8_t buf[512];
+    uint8_t buf[512] = { 0 };
     int ret;
 
     /* Error: Driver does not support snapshots */
-- 
2.27.0



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

* [PULL 3/5] configure: fix for SunOS based systems
  2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
  2021-03-21 17:18 ` [PULL 1/5] docs/devel/testing.rst: Fix references to unit tests Thomas Huth
  2021-03-21 17:18 ` [PULL 2/5] tests/unit/test-block-iothread: fix maybe-uninitialized error on GCC 11 Thomas Huth
@ 2021-03-21 17:18 ` Thomas Huth
  2021-03-21 17:18 ` [PULL 4/5] contrib: ivshmem client and server build fix for SunOS Thomas Huth
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2021-03-21 17:18 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell

From: David CARLIER <devnexen@gmail.com>

local directive make the configure fails on these systems.

Signed-off-by: David Carlier <devnexen@gmail.com>
Message-Id: <CA+XhMqy95D8X-QvBcEfL=a-Rkgy6aJtheskkqZwQkreru+T_Wg@mail.gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 847bc4d095..61872096a8 100755
--- a/configure
+++ b/configure
@@ -111,7 +111,7 @@ error_exit() {
 do_compiler() {
     # Run the compiler, capturing its output to the log. First argument
     # is compiler binary to execute.
-    local compiler="$1"
+    compiler="$1"
     shift
     if test -n "$BASH_VERSION"; then eval '
         echo >>config.log "
-- 
2.27.0



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

* [PULL 4/5] contrib: ivshmem client and server build fix for SunOS.
  2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
                   ` (2 preceding siblings ...)
  2021-03-21 17:18 ` [PULL 3/5] configure: fix for SunOS based systems Thomas Huth
@ 2021-03-21 17:18 ` Thomas Huth
  2021-03-21 17:18 ` [PULL 5/5] FreeBSD: Upgrade to 12.2 release Thomas Huth
  2021-03-22 11:24 ` [PULL 0/5] Unit test fixes + misc OS patches Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2021-03-21 17:18 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell

From: David CARLIER <devnexen@gmail.com>

sun is a macro on these systems, thus renaming the variables on the
client and server.

Signed-off-by: David Carlier <devnexen@gmail.com>
Message-Id: <CA+XhMqzHPG5ezqY-YxbA+tMoadA3VDFWBX8_LaLC5YsQOMrz+A@mail.gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 contrib/ivshmem-client/ivshmem-client.c | 12 ++++++------
 contrib/ivshmem-server/ivshmem-server.c | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/contrib/ivshmem-client/ivshmem-client.c b/contrib/ivshmem-client/ivshmem-client.c
index b1274b236a..182c79d27c 100644
--- a/contrib/ivshmem-client/ivshmem-client.c
+++ b/contrib/ivshmem-client/ivshmem-client.c
@@ -178,7 +178,7 @@ ivshmem_client_init(IvshmemClient *client, const char *unix_sock_path,
 int
 ivshmem_client_connect(IvshmemClient *client)
 {
-    struct sockaddr_un sun;
+    struct sockaddr_un s_un;
     int fd, ret;
     int64_t tmp;
 
@@ -192,16 +192,16 @@ ivshmem_client_connect(IvshmemClient *client)
         return -1;
     }
 
-    sun.sun_family = AF_UNIX;
-    ret = snprintf(sun.sun_path, sizeof(sun.sun_path), "%s",
+    s_un.sun_family = AF_UNIX;
+    ret = snprintf(s_un.sun_path, sizeof(s_un.sun_path), "%s",
                    client->unix_sock_path);
-    if (ret < 0 || ret >= sizeof(sun.sun_path)) {
+    if (ret < 0 || ret >= sizeof(s_un.sun_path)) {
         IVSHMEM_CLIENT_DEBUG(client, "could not copy unix socket path\n");
         goto err_close;
     }
 
-    if (connect(client->sock_fd, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
-        IVSHMEM_CLIENT_DEBUG(client, "cannot connect to %s: %s\n", sun.sun_path,
+    if (connect(client->sock_fd, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
+        IVSHMEM_CLIENT_DEBUG(client, "cannot connect to %s: %s\n", s_un.sun_path,
                              strerror(errno));
         goto err_close;
     }
diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
index 88daee812d..39a6ffdb5d 100644
--- a/contrib/ivshmem-server/ivshmem-server.c
+++ b/contrib/ivshmem-server/ivshmem-server.c
@@ -288,7 +288,7 @@ ivshmem_server_init(IvshmemServer *server, const char *unix_sock_path,
 int
 ivshmem_server_start(IvshmemServer *server)
 {
-    struct sockaddr_un sun;
+    struct sockaddr_un s_un;
     int shm_fd, sock_fd, ret;
 
     /* open shm file */
@@ -327,15 +327,15 @@ ivshmem_server_start(IvshmemServer *server)
         goto err_close_shm;
     }
 
-    sun.sun_family = AF_UNIX;
-    ret = snprintf(sun.sun_path, sizeof(sun.sun_path), "%s",
+    s_un.sun_family = AF_UNIX;
+    ret = snprintf(s_un.sun_path, sizeof(s_un.sun_path), "%s",
                    server->unix_sock_path);
-    if (ret < 0 || ret >= sizeof(sun.sun_path)) {
+    if (ret < 0 || ret >= sizeof(s_un.sun_path)) {
         IVSHMEM_SERVER_DEBUG(server, "could not copy unix socket path\n");
         goto err_close_sock;
     }
-    if (bind(sock_fd, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
-        IVSHMEM_SERVER_DEBUG(server, "cannot connect to %s: %s\n", sun.sun_path,
+    if (bind(sock_fd, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
+        IVSHMEM_SERVER_DEBUG(server, "cannot connect to %s: %s\n", s_un.sun_path,
                              strerror(errno));
         goto err_close_sock;
     }
-- 
2.27.0



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

* [PULL 5/5] FreeBSD: Upgrade to 12.2 release
  2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
                   ` (3 preceding siblings ...)
  2021-03-21 17:18 ` [PULL 4/5] contrib: ivshmem client and server build fix for SunOS Thomas Huth
@ 2021-03-21 17:18 ` Thomas Huth
  2021-03-22 11:24 ` [PULL 0/5] Unit test fixes + misc OS patches Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2021-03-21 17:18 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell

From: Warner Losh <imp@bsdimp.com>

FreeBSD 12.1 has reached end of life. Use 12.2 instead so that FreeBSD's
project's packages will work.  Update which timezone to pick. Work around a QEMU
bug that incorrectly raises an exception on a CRC32 instruction with the FPU
disabled.  The qemu bug is described here:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg784158.html

Signed-off-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20210307155654.993-2-imp@bsdimp.com>
[thuth: Disable gnutls to work-around a problem with libtasn1]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/vm/freebsd | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 09f3ee6cb8..6e20e84322 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -20,12 +20,16 @@ import socket
 import subprocess
 import basevm
 
+FREEBSD_CONFIG = {
+    'cpu'	: "max,sse4.2=off",
+}
+
 class FreeBSDVM(basevm.BaseVM):
     name = "freebsd"
     arch = "x86_64"
 
-    link = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-amd64-disc1.iso.xz"
-    csum = "7394c3f60a1e236e7bd3a05809cf43ae39a3b8e5d42d782004cf2f26b1cfcd88"
+    link = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-disc1.iso.xz"
+    csum = "a4530246cafbf1dd42a9bd3ea441ca9a78a6a0cd070278cbdf63f3a6f803ecae"
     size = "20G"
     pkgs = [
         # build tools
@@ -61,6 +65,8 @@ class FreeBSDVM(basevm.BaseVM):
         "zstd",
     ]
 
+    # TODO: Enable gnutls again once FreeBSD's libtasn1 got fixed
+    # See: https://gitlab.com/gnutls/libtasn1/-/merge_requests/71
     BUILD_SCRIPT = """
         set -e;
         rm -rf /home/qemu/qemu-test.*
@@ -68,7 +74,7 @@ class FreeBSDVM(basevm.BaseVM):
         mkdir src build; cd src;
         tar -xf /dev/vtbd1;
         cd ../build
-        ../src/configure --python=python3.7 {configure_opts};
+        ../src/configure --python=python3.7 --disable-gnutls {configure_opts};
         gmake --output-sync -j{jobs} {target} {verbose};
     """
 
@@ -125,7 +131,7 @@ class FreeBSDVM(basevm.BaseVM):
         self.console_wait_send("IPv6",                  "n")
         self.console_wait_send("Resolver",              "\n")
 
-        self.console_wait_send("Time Zone Selector",    "a\n")
+        self.console_wait_send("Time Zone Selector",    "0\n")
         self.console_wait_send("Confirmation",          "y")
         self.console_wait_send("Time & Date",           "\n")
         self.console_wait_send("Time & Date",           "\n")
@@ -206,4 +212,4 @@ class FreeBSDVM(basevm.BaseVM):
         self.print_step("All done")
 
 if __name__ == "__main__":
-    sys.exit(basevm.main(FreeBSDVM))
+    sys.exit(basevm.main(FreeBSDVM, config=FREEBSD_CONFIG))
-- 
2.27.0



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

* Re: [PULL 0/5] Unit test fixes + misc OS patches
  2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
                   ` (4 preceding siblings ...)
  2021-03-21 17:18 ` [PULL 5/5] FreeBSD: Upgrade to 12.2 release Thomas Huth
@ 2021-03-22 11:24 ` Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2021-03-22 11:24 UTC (permalink / raw)
  To: Thomas Huth; +Cc: QEMU Developers

On Sun, 21 Mar 2021 at 17:18, Thomas Huth <thuth@redhat.com> wrote:
>
>  Hi Peter!
>
> The following changes since commit 2e1293cbaac75e84f541f9acfa8e26749f4c3562:
>
>   Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-03-16-v4' into staging (2021-03-19 16:40:00 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/thuth/qemu.git tags/pull-request-2021-03-21
>
> for you to fetch changes up to 262fd27392128c180afc8f968d90d530574862f7:
>
>   FreeBSD: Upgrade to 12.2 release (2021-03-20 06:33:17 +0100)
>
> ----------------------------------------------------------------
> * Small fixes for the unit tests
> * Compilation fixes for Illumos et al.
> * Update the FreeBSD VM to 12.2
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2021-03-22 11:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-21 17:18 [PULL 0/5] Unit test fixes + misc OS patches Thomas Huth
2021-03-21 17:18 ` [PULL 1/5] docs/devel/testing.rst: Fix references to unit tests Thomas Huth
2021-03-21 17:18 ` [PULL 2/5] tests/unit/test-block-iothread: fix maybe-uninitialized error on GCC 11 Thomas Huth
2021-03-21 17:18 ` [PULL 3/5] configure: fix for SunOS based systems Thomas Huth
2021-03-21 17:18 ` [PULL 4/5] contrib: ivshmem client and server build fix for SunOS Thomas Huth
2021-03-21 17:18 ` [PULL 5/5] FreeBSD: Upgrade to 12.2 release Thomas Huth
2021-03-22 11:24 ` [PULL 0/5] Unit test fixes + misc OS patches Peter Maydell

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).