[PATCH 33/41] tests: move libqtest.c under libqos/

marcandre.lureau@redhat.com posted 41 patches 3 years, 9 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Stefan Hajnoczi <stefanha@redhat.com>, Beniamino Galvani <b.galvani@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Antony Pavlov <antonynpavlov@gmail.com>, Igor Mitsyanko <i.mitsyanko@gmail.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Markus Armbruster <armbru@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Michael Roth <michael.roth@amd.com>, Eric Blake <eblake@redhat.com>, Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>, Konstantin Kostiuk <kkostiuk@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Fam Zheng <fam@euphon.net>, Taylor Simpson <tsimpson@quicinc.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Stafford Horne <shorne@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>, "Alex Bennée" <alex.bennee@linaro.org>, John Snow <jsnow@redhat.com>, Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Akihiko Odaki <akihiko.odaki@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>, Stefan Weil <sw@weilnetz.de>
There is a newer version of this series
[PATCH 33/41] tests: move libqtest.c under libqos/
Posted by marcandre.lureau@redhat.com 3 years, 9 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Since commit a2ce7dbd917 ("meson: convert tests/qtest to meson"),
libqtest.h is under libqos/ directory. Let's move the .c along with it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 docs/devel/qtest.rst                | 4 ++--
 tests/qtest/{ => libqos}/libqtest.c | 4 ++--
 tests/qtest/libqos/meson.build      | 2 +-
 tests/unit/meson.build              | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
 rename tests/qtest/{ => libqos}/libqtest.c (99%)

diff --git a/docs/devel/qtest.rst b/docs/devel/qtest.rst
index c3dceb6c8a1d..a9a6b0a7466b 100644
--- a/docs/devel/qtest.rst
+++ b/docs/devel/qtest.rst
@@ -18,8 +18,8 @@ QTest cases can be executed with
 
    make check-qtest
 
-The QTest library is implemented by ``tests/qtest/libqtest.c`` and the API is
-defined in ``tests/qtest/libqtest.h``.
+The QTest library is implemented by ``tests/qtest/libqos/libqtest.c`` and the API is
+defined in ``tests/qtest/libqos/libqtest.h``.
 
 Consider adding a new QTest case when you are introducing a new virtual
 hardware, or extending one if you are adding functionalities to an existing
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqos/libqtest.c
similarity index 99%
rename from tests/qtest/libqtest.c
rename to tests/qtest/libqos/libqtest.c
index 2b9bdb947d6f..9097329ce435 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqos/libqtest.c
@@ -20,7 +20,7 @@
 #include <sys/wait.h>
 #include <sys/un.h>
 
-#include "libqos/libqtest.h"
+#include "libqtest.h"
 #include "qemu/ctype.h"
 #include "qemu/cutils.h"
 #include "qapi/error.h"
@@ -268,7 +268,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
     /* It's possible that if an earlier test run crashed it might
      * have left a stale unix socket lying around. Delete any
      * stale old socket to avoid spurious test failures with
-     * tests/libqtest.c:70:init_socket: assertion failed (ret != -1): (-1 != -1)
+     * libqtest.c:70:init_socket: assertion failed (ret != -1): (-1 != -1)
      */
     unlink(socket_path);
     unlink(qmp_socket_path);
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
index e988d1579172..0c172f27533a 100644
--- a/tests/qtest/libqos/meson.build
+++ b/tests/qtest/libqos/meson.build
@@ -1,4 +1,4 @@
-libqos_srcs = files('../libqtest.c',
+libqos_srcs = files('libqtest.c',
         'qgraph.c',
         'qos_external.c',
         'pci.c',
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index ab01e00f12cf..188b0ea80c37 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -154,7 +154,7 @@ if have_system
 endif
 
 if have_ga and targetos == 'linux'
-  tests += {'test-qga': ['../qtest/libqtest.c']}
+  tests += {'test-qga': ['../qtest/libqos/libqtest.c']}
   test_deps += {'test-qga': qga}
 endif
 
-- 
2.35.1.693.g805e0a68082a


Re: [PATCH 33/41] tests: move libqtest.c under libqos/
Posted by Daniel P. Berrangé 3 years, 9 months ago
On Wed, Apr 20, 2022 at 05:26:16PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Since commit a2ce7dbd917 ("meson: convert tests/qtest to meson"),
> libqtest.h is under libqos/ directory. Let's move the .c along with it.

It is a bit odd for libqtest.h to be under libqos to begin with
IMHO. The commit doesn't explain why it was moved, so feels like
possibly a mistake.

> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  docs/devel/qtest.rst                | 4 ++--
>  tests/qtest/{ => libqos}/libqtest.c | 4 ++--
>  tests/qtest/libqos/meson.build      | 2 +-
>  tests/unit/meson.build              | 2 +-
>  4 files changed, 6 insertions(+), 6 deletions(-)
>  rename tests/qtest/{ => libqos}/libqtest.c (99%)
> 
> diff --git a/docs/devel/qtest.rst b/docs/devel/qtest.rst
> index c3dceb6c8a1d..a9a6b0a7466b 100644
> --- a/docs/devel/qtest.rst
> +++ b/docs/devel/qtest.rst
> @@ -18,8 +18,8 @@ QTest cases can be executed with
>  
>     make check-qtest
>  
> -The QTest library is implemented by ``tests/qtest/libqtest.c`` and the API is
> -defined in ``tests/qtest/libqtest.h``.
> +The QTest library is implemented by ``tests/qtest/libqos/libqtest.c`` and the API is
> +defined in ``tests/qtest/libqos/libqtest.h``.
>  
>  Consider adding a new QTest case when you are introducing a new virtual
>  hardware, or extending one if you are adding functionalities to an existing
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqos/libqtest.c
> similarity index 99%
> rename from tests/qtest/libqtest.c
> rename to tests/qtest/libqos/libqtest.c
> index 2b9bdb947d6f..9097329ce435 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqos/libqtest.c
> @@ -20,7 +20,7 @@
>  #include <sys/wait.h>
>  #include <sys/un.h>
>  
> -#include "libqos/libqtest.h"
> +#include "libqtest.h"
>  #include "qemu/ctype.h"
>  #include "qemu/cutils.h"
>  #include "qapi/error.h"
> @@ -268,7 +268,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
>      /* It's possible that if an earlier test run crashed it might
>       * have left a stale unix socket lying around. Delete any
>       * stale old socket to avoid spurious test failures with
> -     * tests/libqtest.c:70:init_socket: assertion failed (ret != -1): (-1 != -1)
> +     * libqtest.c:70:init_socket: assertion failed (ret != -1): (-1 != -1)
>       */
>      unlink(socket_path);
>      unlink(qmp_socket_path);
> diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
> index e988d1579172..0c172f27533a 100644
> --- a/tests/qtest/libqos/meson.build
> +++ b/tests/qtest/libqos/meson.build
> @@ -1,4 +1,4 @@
> -libqos_srcs = files('../libqtest.c',
> +libqos_srcs = files('libqtest.c',
>          'qgraph.c',
>          'qos_external.c',
>          'pci.c',
> diff --git a/tests/unit/meson.build b/tests/unit/meson.build
> index ab01e00f12cf..188b0ea80c37 100644
> --- a/tests/unit/meson.build
> +++ b/tests/unit/meson.build
> @@ -154,7 +154,7 @@ if have_system
>  endif
>  
>  if have_ga and targetos == 'linux'
> -  tests += {'test-qga': ['../qtest/libqtest.c']}
> +  tests += {'test-qga': ['../qtest/libqos/libqtest.c']}
>    test_deps += {'test-qga': qga}
>  endif
>  
> -- 
> 2.35.1.693.g805e0a68082a
> 
> 

With 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 :|


Re: [PATCH 33/41] tests: move libqtest.c under libqos/
Posted by Thomas Huth 3 years, 9 months ago
On 20/04/2022 15.26, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Since commit a2ce7dbd917 ("meson: convert tests/qtest to meson"),
> libqtest.h is under libqos/ directory. Let's move the .c along with it.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   docs/devel/qtest.rst                | 4 ++--
>   tests/qtest/{ => libqos}/libqtest.c | 4 ++--
>

This is definitely wrong. libqtest.c is the outer framework for the qtests, 
and should certainly not reside within libqos, i.e. the qtests that are not 
using the libqos framework should not depend on files in libqos.

Not sure why libqtest.h got moved there, but that certainly was a mistake, 
too. Please move libqtest.h back to the tests/qtest/ folder instead.

  Thomas