qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS
@ 2025-02-20  8:02 Philippe Mathieu-Daudé
  2025-02-20  8:02 ` [PATCH v2 1/3] plugins: add explicit dependency in functional tests Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20  8:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Philippe Mathieu-Daudé,
	Mahmoud Mandour, Marc-André Lureau, Thomas Huth,
	Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

Pierrick kindly helped me to resolve this issue which ended
being trivial (to him!). Not tested on Windows so far.

Since v1:
- Include Pierrick's meson fix patch (adding Fixes: tag)
- Addressed Thomas review comments (config.py, os.path.join)

Philippe Mathieu-Daudé (2):
  tests/functional: Introduce the dso_suffix() helper
  tests/functional: Allow running TCG plugins tests on non-Linux/BSD
    hosts

Pierrick Bouvier (1):
  plugins: add explicit dependency in functional tests

 meson.build                                  |  1 +
 contrib/plugins/meson.build                  |  2 ++
 tests/functional/meson.build                 |  2 +-
 tests/functional/qemu_test/__init__.py       |  2 +-
 tests/functional/qemu_test/cmd.py            |  1 -
 tests/functional/qemu_test/config.py         |  6 ++++++
 tests/functional/test_aarch64_tcg_plugins.py | 11 ++++++++---
 tests/tcg/plugins/meson.build                |  2 ++
 8 files changed, 21 insertions(+), 6 deletions(-)

-- 
2.47.1



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

* [PATCH v2 1/3] plugins: add explicit dependency in functional tests
  2025-02-20  8:02 [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Philippe Mathieu-Daudé
@ 2025-02-20  8:02 ` Philippe Mathieu-Daudé
  2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20  8:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Philippe Mathieu-Daudé,
	Mahmoud Mandour, Marc-André Lureau, Thomas Huth,
	Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

From: Pierrick Bouvier <pierrick.bouvier@linaro.org>

./tests/functional/test_aarch64_tcg_plugins.py needs to have plugin
libinsn built. However, it's not listed as a dependency, so meson can't
know it needs to be built.

Thus, we keep track of all plugins, and add them as an explicit
dependency.

Fixes: 4c134d07b9e ("tests: add a new set of tests to exercise plugins")
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build                   | 1 +
 contrib/plugins/meson.build   | 2 ++
 tests/functional/meson.build  | 2 +-
 tests/tcg/plugins/meson.build | 2 ++
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 0ee79c664d3..4588bfd8642 100644
--- a/meson.build
+++ b/meson.build
@@ -3657,6 +3657,7 @@ qtest_module_ss = ss.source_set()
 
 modules = {}
 target_modules = {}
+plugin_modules = []
 hw_arch = {}
 target_arch = {}
 target_system_arch = {}
diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build
index 484b9a808c8..fa8a426c8b5 100644
--- a/contrib/plugins/meson.build
+++ b/contrib/plugins/meson.build
@@ -26,3 +26,5 @@ if t.length() > 0
 else
   run_target('contrib-plugins', command: find_program('true'))
 endif
+
+plugin_modules += t
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index b516d21cba1..2d41908c0a8 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -362,7 +362,7 @@ foreach speed : ['quick', 'thorough']
       # 'run_target' logic below & in Makefile.include
       test('func-' + testname,
            python,
-           depends: [test_deps, test_emulator, emulator_modules],
+           depends: [test_deps, test_emulator, emulator_modules, plugin_modules],
            env: test_env,
            args: [testpath],
            protocol: 'tap',
diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build
index 87a17d67bd4..c8cb0626a6d 100644
--- a/tests/tcg/plugins/meson.build
+++ b/tests/tcg/plugins/meson.build
@@ -19,3 +19,5 @@ if t.length() > 0
 else
   run_target('test-plugins', command: find_program('true'))
 endif
+
+plugin_modules += t
-- 
2.47.1



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

* [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper
  2025-02-20  8:02 [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Philippe Mathieu-Daudé
  2025-02-20  8:02 ` [PATCH v2 1/3] plugins: add explicit dependency in functional tests Philippe Mathieu-Daudé
@ 2025-02-20  8:02 ` Philippe Mathieu-Daudé
  2025-02-20  8:03   ` Philippe Mathieu-Daudé
                     ` (3 more replies)
  2025-02-20  8:02 ` [PATCH v2 3/3] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts Philippe Mathieu-Daudé
  2025-02-20  9:18 ` [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Alex Bennée
  3 siblings, 4 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20  8:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Philippe Mathieu-Daudé,
	Mahmoud Mandour, Marc-André Lureau, Thomas Huth,
	Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

Introduce a helper to get the default shared library
suffix used on the host.

Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 tests/functional/qemu_test/__init__.py | 2 +-
 tests/functional/qemu_test/cmd.py      | 1 -
 tests/functional/qemu_test/config.py   | 6 ++++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
index 5c972843a6d..45f7befa374 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -7,7 +7,7 @@
 
 
 from .asset import Asset
-from .config import BUILD_DIR
+from .config import BUILD_DIR, dso_suffix
 from .cmd import is_readable_executable_file, \
     interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
     exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
index dc5f422b77d..254e23ef748 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -15,7 +15,6 @@
 import os
 import os.path
 
-
 def which(tool):
     """ looks up the full path for @tool, returns None if not found
         or if @tool does not have executable permissions.
diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_test/config.py
index edd75b7fd06..0eab1baa541 100644
--- a/tests/functional/qemu_test/config.py
+++ b/tests/functional/qemu_test/config.py
@@ -13,6 +13,7 @@
 
 import os
 from pathlib import Path
+import platform
 
 
 def _source_dir():
@@ -34,3 +35,8 @@ def _build_dir():
     raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT")
 
 BUILD_DIR = _build_dir()
+
+def dso_suffix():
+    '''Return the dynamic libraries suffix for the current platform'''
+    DSO_SUFFIXES = { 'Linux': 'so', 'Darwin': 'dylib', 'Windows': 'dll' }
+    return DSO_SUFFIXES[platform.system()]
-- 
2.47.1



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

* [PATCH v2 3/3] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts
  2025-02-20  8:02 [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Philippe Mathieu-Daudé
  2025-02-20  8:02 ` [PATCH v2 1/3] plugins: add explicit dependency in functional tests Philippe Mathieu-Daudé
  2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
@ 2025-02-20  8:02 ` Philippe Mathieu-Daudé
  2025-02-20  8:28   ` Thomas Huth
  2025-02-20  9:18 ` [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Alex Bennée
  3 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20  8:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Philippe Mathieu-Daudé,
	Mahmoud Mandour, Marc-André Lureau, Thomas Huth,
	Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

Not all platforms use the '.so' suffix for shared libraries,
which is how plugins are built. Use the recently introduced
dso_suffix() helper to get the proper host suffix.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2804
Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 tests/functional/test_aarch64_tcg_plugins.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/functional/test_aarch64_tcg_plugins.py b/tests/functional/test_aarch64_tcg_plugins.py
index 7e8beacc833..5736b60545a 100755
--- a/tests/functional/test_aarch64_tcg_plugins.py
+++ b/tests/functional/test_aarch64_tcg_plugins.py
@@ -13,10 +13,11 @@
 
 import tempfile
 import mmap
+import os
 import re
 
 from qemu.machine.machine import VMLaunchFailure
-from qemu_test import LinuxKernelTest, Asset
+from qemu_test import LinuxKernelTest, Asset, dso_suffix
 
 
 class PluginKernelBase(LinuxKernelTest):
@@ -62,6 +63,10 @@ class PluginKernelNormal(PluginKernelBase):
         ('https://storage.tuxboot.com/20230331/arm64/Image'),
         'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')
 
+    def plugin_file(self, plugin_name):
+        sfx = dso_suffix()
+        return os.path.join('tests', 'tcg', 'plugins', f'{plugin_name}.{sfx}')
+
     def test_aarch64_virt_insn(self):
         self.set_machine('virt')
         self.cpu='cortex-a53'
@@ -74,7 +79,7 @@ def test_aarch64_virt_insn(self):
                                                  suffix=".log")
 
         self.run_vm(kernel_path, kernel_command_line,
-                    "tests/tcg/plugins/libinsn.so", plugin_log.name,
+                    self.plugin_file('libinsn'), plugin_log.name,
                     console_pattern)
 
         with plugin_log as lf, \
@@ -100,7 +105,7 @@ def test_aarch64_virt_insn_icount(self):
                                                  suffix=".log")
 
         self.run_vm(kernel_path, kernel_command_line,
-                    "tests/tcg/plugins/libinsn.so", plugin_log.name,
+                    self.plugin_file('libinsn'), plugin_log.name,
                     console_pattern,
                     args=('-icount', 'shift=1'))
 
-- 
2.47.1



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

* Re: [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper
  2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
@ 2025-02-20  8:03   ` Philippe Mathieu-Daudé
  2025-02-20  8:05   ` Thomas Huth
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-20  8:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Mahmoud Mandour, Marc-André Lureau,
	Thomas Huth, Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

On 20/2/25 09:02, Philippe Mathieu-Daudé wrote:
> Introduce a helper to get the default shared library
> suffix used on the host.
> 
> Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   tests/functional/qemu_test/__init__.py | 2 +-
>   tests/functional/qemu_test/cmd.py      | 1 -
>   tests/functional/qemu_test/config.py   | 6 ++++++
>   3 files changed, 7 insertions(+), 2 deletions(-)


> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77d..254e23ef748 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -15,7 +15,6 @@
>   import os
>   import os.path
>   
> -

Oops, Alex, should I respin a v3 removing this change?

>   def which(tool):
>       """ looks up the full path for @tool, returns None if not found
>           or if @tool does not have executable permissions.


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

* Re: [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper
  2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
  2025-02-20  8:03   ` Philippe Mathieu-Daudé
@ 2025-02-20  8:05   ` Thomas Huth
  2025-02-27  7:06   ` Akihiko Odaki
  2025-02-27  9:00   ` Daniel P. Berrangé
  3 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2025-02-20  8:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Mahmoud Mandour, Marc-André Lureau,
	Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

On 20/02/2025 09.02, Philippe Mathieu-Daudé wrote:
> Introduce a helper to get the default shared library
> suffix used on the host.
> 
> Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   tests/functional/qemu_test/__init__.py | 2 +-
>   tests/functional/qemu_test/cmd.py      | 1 -
>   tests/functional/qemu_test/config.py   | 6 ++++++
>   3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> index 5c972843a6d..45f7befa374 100644
> --- a/tests/functional/qemu_test/__init__.py
> +++ b/tests/functional/qemu_test/__init__.py
> @@ -7,7 +7,7 @@
>   
>   
>   from .asset import Asset
> -from .config import BUILD_DIR
> +from .config import BUILD_DIR, dso_suffix
>   from .cmd import is_readable_executable_file, \
>       interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
>       exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77d..254e23ef748 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -15,7 +15,6 @@
>   import os
>   import os.path
>   
> -
>   def which(tool):
>       """ looks up the full path for @tool, returns None if not found
>           or if @tool does not have executable permissions.

Please drop the change to cmd.py now.
With that fixed:
Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 3/3] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts
  2025-02-20  8:02 ` [PATCH v2 3/3] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts Philippe Mathieu-Daudé
@ 2025-02-20  8:28   ` Thomas Huth
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2025-02-20  8:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Mahmoud Mandour, Marc-André Lureau,
	Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

On 20/02/2025 09.02, Philippe Mathieu-Daudé wrote:
> Not all platforms use the '.so' suffix for shared libraries,
> which is how plugins are built. Use the recently introduced
> dso_suffix() helper to get the proper host suffix.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2804
> Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---

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



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

* Re: [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS
  2025-02-20  8:02 [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2025-02-20  8:02 ` [PATCH v2 3/3] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts Philippe Mathieu-Daudé
@ 2025-02-20  9:18 ` Alex Bennée
  3 siblings, 0 replies; 11+ messages in thread
From: Alex Bennée @ 2025-02-20  9:18 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Paolo Bonzini, Stefan Weil, Alexandre Iooss,
	Daniel P . Berrangé, Mahmoud Mandour, Marc-André Lureau,
	Thomas Huth, Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> Pierrick kindly helped me to resolve this issue which ended
> being trivial (to him!). Not tested on Windows so far.
>
> Since v1:
> - Include Pierrick's meson fix patch (adding Fixes: tag)
> - Addressed Thomas review comments (config.py, os.path.join)
>
> Philippe Mathieu-Daudé (2):
>   tests/functional: Introduce the dso_suffix() helper
>   tests/functional: Allow running TCG plugins tests on non-Linux/BSD
>     hosts
>
> Pierrick Bouvier (1):
>   plugins: add explicit dependency in functional tests
>
>  meson.build                                  |  1 +
>  contrib/plugins/meson.build                  |  2 ++
>  tests/functional/meson.build                 |  2 +-
>  tests/functional/qemu_test/__init__.py       |  2 +-
>  tests/functional/qemu_test/cmd.py            |  1 -
>  tests/functional/qemu_test/config.py         |  6 ++++++
>  tests/functional/test_aarch64_tcg_plugins.py | 11 ++++++++---
>  tests/tcg/plugins/meson.build                |  2 ++
>  8 files changed, 21 insertions(+), 6 deletions(-)

Queued to testing/next (I fixed the cmd.py whitespace change), thanks. 

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper
  2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
  2025-02-20  8:03   ` Philippe Mathieu-Daudé
  2025-02-20  8:05   ` Thomas Huth
@ 2025-02-27  7:06   ` Akihiko Odaki
  2025-02-27  7:55     ` Alex Bennée
  2025-02-27  9:00   ` Daniel P. Berrangé
  3 siblings, 1 reply; 11+ messages in thread
From: Akihiko Odaki @ 2025-02-27  7:06 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Stefan Weil, Alex Bennée, Alexandre Iooss,
	Daniel P . Berrangé, Mahmoud Mandour, Marc-André Lureau,
	Thomas Huth, Yonggang Luo, Pierrick Bouvier

On 2025/02/20 17:02, Philippe Mathieu-Daudé wrote:
> Introduce a helper to get the default shared library
> suffix used on the host.
> 
> Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   tests/functional/qemu_test/__init__.py | 2 +-
>   tests/functional/qemu_test/cmd.py      | 1 -
>   tests/functional/qemu_test/config.py   | 6 ++++++
>   3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> index 5c972843a6d..45f7befa374 100644
> --- a/tests/functional/qemu_test/__init__.py
> +++ b/tests/functional/qemu_test/__init__.py
> @@ -7,7 +7,7 @@
>   
>   
>   from .asset import Asset
> -from .config import BUILD_DIR
> +from .config import BUILD_DIR, dso_suffix
>   from .cmd import is_readable_executable_file, \
>       interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
>       exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77d..254e23ef748 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -15,7 +15,6 @@
>   import os
>   import os.path
>   
> -
>   def which(tool):
>       """ looks up the full path for @tool, returns None if not found
>           or if @tool does not have executable permissions.
> diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_test/config.py
> index edd75b7fd06..0eab1baa541 100644
> --- a/tests/functional/qemu_test/config.py
> +++ b/tests/functional/qemu_test/config.py
> @@ -13,6 +13,7 @@
>   
>   import os
>   from pathlib import Path
> +import platform
>   
>   
>   def _source_dir():
> @@ -34,3 +35,8 @@ def _build_dir():
>       raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT")
>   
>   BUILD_DIR = _build_dir()
> +
> +def dso_suffix():
> +    '''Return the dynamic libraries suffix for the current platform'''
> +    DSO_SUFFIXES = { 'Linux': 'so', 'Darwin': 'dylib', 'Windows': 'dll' }> +    return DSO_SUFFIXES[platform.system()]

It may be too late to comment, but:
I'm a bit worried that this can break tests on platforms (BSDs?) not 
listed here though I don't know if plugin tests work on BSDs in the 
first place.


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

* Re: [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper
  2025-02-27  7:06   ` Akihiko Odaki
@ 2025-02-27  7:55     ` Alex Bennée
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Bennée @ 2025-02-27  7:55 UTC (permalink / raw)
  To: Akihiko Odaki
  Cc: Philippe Mathieu-Daudé, qemu-devel, Paolo Bonzini,
	Stefan Weil, Alexandre Iooss, Daniel P . Berrangé,
	Mahmoud Mandour, Marc-André Lureau, Thomas Huth,
	Yonggang Luo, Pierrick Bouvier

Akihiko Odaki <akihiko.odaki@daynix.com> writes:

> On 2025/02/20 17:02, Philippe Mathieu-Daudé wrote:
>> Introduce a helper to get the default shared library
>> suffix used on the host.
>> Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>   tests/functional/qemu_test/__init__.py | 2 +-
>>   tests/functional/qemu_test/cmd.py      | 1 -
>>   tests/functional/qemu_test/config.py   | 6 ++++++
>>   3 files changed, 7 insertions(+), 2 deletions(-)
>> diff --git a/tests/functional/qemu_test/__init__.py
>> b/tests/functional/qemu_test/__init__.py
>> index 5c972843a6d..45f7befa374 100644
>> --- a/tests/functional/qemu_test/__init__.py
>> +++ b/tests/functional/qemu_test/__init__.py
>> @@ -7,7 +7,7 @@
>>       from .asset import Asset
>> -from .config import BUILD_DIR
>> +from .config import BUILD_DIR, dso_suffix
>>   from .cmd import is_readable_executable_file, \
>>       interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
>>       exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
>> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
>> index dc5f422b77d..254e23ef748 100644
>> --- a/tests/functional/qemu_test/cmd.py
>> +++ b/tests/functional/qemu_test/cmd.py
>> @@ -15,7 +15,6 @@
>>   import os
>>   import os.path
>>   -
>>   def which(tool):
>>       """ looks up the full path for @tool, returns None if not found
>>           or if @tool does not have executable permissions.
>> diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_test/config.py
>> index edd75b7fd06..0eab1baa541 100644
>> --- a/tests/functional/qemu_test/config.py
>> +++ b/tests/functional/qemu_test/config.py
>> @@ -13,6 +13,7 @@
>>     import os
>>   from pathlib import Path
>> +import platform
>>       def _source_dir():
>> @@ -34,3 +35,8 @@ def _build_dir():
>>       raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT")
>>     BUILD_DIR = _build_dir()
>> +
>> +def dso_suffix():
>> +    '''Return the dynamic libraries suffix for the current platform'''
>> +    DSO_SUFFIXES = { 'Linux': 'so', 'Darwin': 'dylib', 'Windows': 'dll' }> +    return DSO_SUFFIXES[platform.system()]
>
> It may be too late to comment, but:
> I'm a bit worried that this can break tests on platforms (BSDs?) not
> listed here though I don't know if plugin tests work on BSDs in the
> first place.

Currently we don't run any of the check-tcg tests on BSD. Mostly because
I couldn't find cross compilers packaged for BSD (and there is no
docker-like thing to bring them in) and for the "native" cross compiler
we currently block clang - although there are some fixes for that in my
current maintainer series.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper
  2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
                     ` (2 preceding siblings ...)
  2025-02-27  7:06   ` Akihiko Odaki
@ 2025-02-27  9:00   ` Daniel P. Berrangé
  3 siblings, 0 replies; 11+ messages in thread
From: Daniel P. Berrangé @ 2025-02-27  9:00 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Paolo Bonzini, Stefan Weil, Alex Bennée,
	Alexandre Iooss, Mahmoud Mandour, Marc-André Lureau,
	Thomas Huth, Yonggang Luo, Akihiko Odaki, Pierrick Bouvier

On Thu, Feb 20, 2025 at 09:02:14AM +0100, Philippe Mathieu-Daudé wrote:
> Introduce a helper to get the default shared library
> suffix used on the host.
> 
> Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>  tests/functional/qemu_test/__init__.py | 2 +-
>  tests/functional/qemu_test/cmd.py      | 1 -
>  tests/functional/qemu_test/config.py   | 6 ++++++
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> index 5c972843a6d..45f7befa374 100644
> --- a/tests/functional/qemu_test/__init__.py
> +++ b/tests/functional/qemu_test/__init__.py
> @@ -7,7 +7,7 @@
>  
>  
>  from .asset import Asset
> -from .config import BUILD_DIR
> +from .config import BUILD_DIR, dso_suffix
>  from .cmd import is_readable_executable_file, \
>      interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
>      exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77d..254e23ef748 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -15,7 +15,6 @@
>  import os
>  import os.path
>  
> -
>  def which(tool):
>      """ looks up the full path for @tool, returns None if not found
>          or if @tool does not have executable permissions.
> diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_test/config.py
> index edd75b7fd06..0eab1baa541 100644
> --- a/tests/functional/qemu_test/config.py
> +++ b/tests/functional/qemu_test/config.py
> @@ -13,6 +13,7 @@
>  
>  import os
>  from pathlib import Path
> +import platform
>  
>  
>  def _source_dir():
> @@ -34,3 +35,8 @@ def _build_dir():
>      raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT")
>  
>  BUILD_DIR = _build_dir()
> +
> +def dso_suffix():
> +    '''Return the dynamic libraries suffix for the current platform'''
> +    DSO_SUFFIXES = { 'Linux': 'so', 'Darwin': 'dylib', 'Windows': 'dll' }
> +    return DSO_SUFFIXES[platform.system()]

Windows and Darwin are the two odd-ball platforms we target, Linux and
all the BSDs use .so, so it makes sense to use .so as the general
fallback, at which point I'm not sure the lookup table is worthwhile
compared to:

  if platform.system() == "Darwin"
    return "dylib"
  elif platform.system() == "Windows"
    return "dll"
  else
    return "so"

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



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

end of thread, other threads:[~2025-02-27  9:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20  8:02 [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Philippe Mathieu-Daudé
2025-02-20  8:02 ` [PATCH v2 1/3] plugins: add explicit dependency in functional tests Philippe Mathieu-Daudé
2025-02-20  8:02 ` [PATCH v2 2/3] tests/functional: Introduce the dso_suffix() helper Philippe Mathieu-Daudé
2025-02-20  8:03   ` Philippe Mathieu-Daudé
2025-02-20  8:05   ` Thomas Huth
2025-02-27  7:06   ` Akihiko Odaki
2025-02-27  7:55     ` Alex Bennée
2025-02-27  9:00   ` Daniel P. Berrangé
2025-02-20  8:02 ` [PATCH v2 3/3] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts Philippe Mathieu-Daudé
2025-02-20  8:28   ` Thomas Huth
2025-02-20  9:18 ` [PATCH v2 0/3] tests/functional: Allow running TCG plugins tests on macOS Alex Bennée

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