Skip to contentSkip to conversation

tests/functional: Allow running TCG plugins tests on macOS

PATCH Superseded Philippe Mathieu-Daudé 5 participants 11 messages Feb 19, 2025 – Feb 24, 2025 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover tests/functional: Allow running TCG plugins tests on macOS

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

I'm still having some meson dependency problem, even on Linux:

  $ make check-functional-aarch64
  ...
  Traceback (most recent call last):
    File "python/qemu/qmp/protocol.py", line 834, in _bh_close_stream
      await wait_closed(self._writer)
    File "python/qemu/qmp/util.py", line 130, in wait_closed
      await writer.wait_closed()
    File "/usr/lib/python3.10/asyncio/streams.py", line 343, in wait_closed
      await self._protocol._get_close_waiter(self)
    File "/usr/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
      data = self._sock.recv(self.max_size)
  ConnectionResetError: [Errno 104] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "python/qemu/machine/machine.py", line 448, in launch
self._launch()
File "python/qemu/machine/machine.py", line 497, in _launch
self._post_launch()
File "python/qemu/machine/machine.py", line 381, in _post_launch
self._qmp.connect()
File "python/qemu/qmp/legacy.py", line 153, in connect
self._sync(
File "python/qemu/qmp/legacy.py", line 102, in _sync
return self._aloop.run_until_complete(
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
return await fut
File "python/qemu/qmp/protocol.py", line 382, in connect
await self._session_guard(
File "python/qemu/qmp/protocol.py", line 456, in _session_guard
raise ConnectError(emsg, err) from err
qemu.qmp.protocol.ConnectError: Failed to establish session: [Errno 104] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "tests/functional/test_aarch64_tcg_plugins.py", line 80, in test_aarch64_virt_insn
self.run_vm(kernel_path, kernel_command_line,
File "tests/functional/test_aarch64_tcg_plugins.py", line 52, in run_vm
raise excp
File "tests/functional/test_aarch64_tcg_plugins.py", line 46, in run_vm
vm.launch()
File "python/qemu/machine/machine.py", line 461, in launch
raise VMLaunchFailure(
qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: [Errno 104] Connection reset by peer
Exit code: 1
Command: build/plugins/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=6 -mon chardev=mon,mode=control -machine virt -chardev socket,id=console,fd=11 -serial chardev:console -cpu cortex-a53 -kernel /home/philippe.mathieu-daude/.cache/qemu/download/ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7 -append printk.time=1 panic=-1 console=ttyAMA0 -plugin tests/tcg/plugins/libinsn.so -d plugin -D /tmp/plugini36uailv.log -net none -no-reboot
Output: qemu-system-aarch64: Could not load plugin tests/tcg/plugins/libinsn.so: tests/tcg/plugins/libinsn.so: cannot open shared object file: No such file or directory
make[1]: *** [Makefile.mtest:26: do-meson-check] Error 1

I don't mind much building the plugins manually:

  $ make tests/tcg/plugins/libinsn.so
  [1/2] Compiling C object tests/tcg/plugins/libinsn.so.p/insn.c.o
  [2/2] Linking target tests/tcg/plugins/libinsn.so

Then tests pass.

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

 tests/functional/qemu_test/__init__.py       |  2 +-
 tests/functional/qemu_test/cmd.py            |  6 ++++++
 tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++---
 3 files changed, 14 insertions(+), 4 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/2 tests/functional: Introduce the dso_suffix() helper

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

---
 tests/functional/qemu_test/__init__.py | 2 +-
 tests/functional/qemu_test/cmd.py      | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
tests/functional/qemu_test/__init__.py +1 -1
index 5c972843a6d..e253288ee7f 100644
@@ -8,7 +8,7 @@
 
 from .asset import Asset
 from .config import BUILD_DIR
-from .cmd import is_readable_executable_file, \
+from .cmd import is_readable_executable_file, dso_suffix, \
     interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
     exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
 from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
tests/functional/qemu_test/cmd.py +6 -0
index dc5f422b77d..c4704dfb7bc 100644
@@ -14,6 +14,12 @@
 import logging
 import os
 import os.path
+import platform
+
+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()]
 
 
 def which(tool):
Signature · 1 line
2.47.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] tests/functional: Introduce the dso_suffix() helper

Quoted 30 lines · Philippe Mathieu-Daudé

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

---
  tests/functional/qemu_test/__init__.py | 2 +-
  tests/functional/qemu_test/cmd.py      | 6 ++++++
  2 files changed, 7 insertions(+), 1 deletion(-)
tests/functional/qemu_test/__init__.py +1 -1
index 5c972843a6d..e253288ee7f 100644
@@ -8,7 +8,7 @@
 
  from .asset import Asset
  from .config import BUILD_DIR
-from .cmd import is_readable_executable_file, \
+from .cmd import is_readable_executable_file, dso_suffix, \
      interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
      exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
  from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
tests/functional/qemu_test/cmd.py +0 -0
index dc5f422b77d..c4704dfb7bc 100644
@@ -14,6 +14,12 @@
  import logging
  import os

tests/functional/qemu_test/cmd.py line 25

Quoted 10 lines
tests/functional/qemu_test/cmd.py +6 -0
  import os.path
+import platform
+
+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()]
 
 
  def which(tool):
#3 lore raw

Re: [PATCH 1/2] tests/functional: Introduce the dso_suffix() helper

In reply to Philippe Mathieu-Daudé

tests/functional/qemu_test/cmd.py

Quoted 27 lines · Philippe Mathieu-Daudé

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

---
  tests/functional/qemu_test/__init__.py | 2 +-
  tests/functional/qemu_test/cmd.py      | 6 ++++++
  2 files changed, 7 insertions(+), 1 deletion(-)
tests/functional/qemu_test/__init__.py +1 -1
index 5c972843a6d..e253288ee7f 100644
@@ -8,7 +8,7 @@
 
  from .asset import Asset
  from .config import BUILD_DIR
-from .cmd import is_readable_executable_file, \
+from .cmd import is_readable_executable_file, dso_suffix, \
      interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
      exec_command, exec_command_and_wait_for_pattern, get_qemu_img, which
  from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
tests/functional/qemu_test/cmd.py +0 -0
index dc5f422b77d..c4704dfb7bc 100644

Maybe config.py would be a better place?

Thomas

Quoted 13 lines
tests/functional/qemu_test/cmd.py +6 -0
@@ -14,6 +14,12 @@
  import logging
  import os
  import os.path
+import platform
+
+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()]
 
 
  def which(tool):
#4 lore raw

PATCH 2/2 tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts

In reply to Philippe Mathieu-Daudé

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

---
 tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tests/functional/test_aarch64_tcg_plugins.py +7 -3
index 7e8beacc833..306e46c7972 100755
@@ -16,7 +16,7 @@
 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 +62,10 @@ class PluginKernelNormal(PluginKernelBase):
         ('https://storage.tuxboot.com/20230331/arm64/Image'),
         'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')
 
+    def plugin_file(self, plugin_name):
+        suffix = dso_suffix()
+        return f'tests/tcg/plugins/{plugin_name}.{suffix}'
+
     def test_aarch64_virt_insn(self):
         self.set_machine('virt')
         self.cpu='cortex-a53'
@@ -74,7 +78,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 +104,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'))
 
Signature · 1 line
2.47.1
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts

Quoted 46 lines · Philippe Mathieu-Daudé

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

---
  tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
tests/functional/test_aarch64_tcg_plugins.py +6 -2
index 7e8beacc833..306e46c7972 100755
@@ -16,7 +16,7 @@
  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 +62,10 @@ class PluginKernelNormal(PluginKernelBase):
          ('https://storage.tuxboot.com/20230331/arm64/Image'),
          'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')
 
+    def plugin_file(self, plugin_name):
+        suffix = dso_suffix()
+        return f'tests/tcg/plugins/{plugin_name}.{suffix}'
+
      def test_aarch64_virt_insn(self):
          self.set_machine('virt')
          self.cpu='cortex-a53'
@@ -74,7 +78,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, \

tests/functional/test_aarch64_tcg_plugins.py def test_aarch64_virt_insn_icount(self): · line 110

Quoted 8 lines
tests/functional/test_aarch64_tcg_plugins.py +1 -1
@@ -100,7 +104,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'))
 
#6 lore raw

Re: [PATCH 2/2] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts

In reply to Philippe Mathieu-Daudé
Quoted 26 lines · Philippe Mathieu-Daudé

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

---
  tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
tests/functional/test_aarch64_tcg_plugins.py +1 -1
index 7e8beacc833..306e46c7972 100755
@@ -16,7 +16,7 @@
  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):

tests/functional/test_aarch64_tcg_plugins.py class PluginKernelNormal(PluginKernelBase): · line 67

Quoted 6 lines
tests/functional/test_aarch64_tcg_plugins.py +3 -0
@@ -62,6 +62,10 @@ class PluginKernelNormal(PluginKernelBase):
          ('https://storage.tuxboot.com/20230331/arm64/Image'),
          'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')
 
+    def plugin_file(self, plugin_name):
+        suffix = dso_suffix()
+        return f'tests/tcg/plugins/{plugin_name}.{suffix}'

Since you're adding support for the .DLL suffix on Windows, too: Maybe better to use os.path.join() for Windows that doesn't use the slash as path separator?

Thomas

#7 lore raw

Re: [PATCH 2/2] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts

Am 20.02.25 um 07:02 schrieb Thomas Huth:

Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 6 lines
tests/functional/test_aarch64_tcg_plugins.py +0 -0
@@ -62,6 +62,10 @@ class PluginKernelNormal(PluginKernelBase):
           ('https://storage.tuxboot.com/20230331/arm64/Image'),
 'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')

  +    def plugin_file(self, plugin_name):
+        suffix = dso_suffix()
+        return f'tests/tcg/plugins/{plugin_name}.{suffix}'

Since you're adding support for the .DLL suffix on Windows, too: Maybe better to use os.path.join() for Windows that doesn't use the slash as path separator?

 Thomas

That could be done, but should not be necessary.

Microsoft supports the slash as path separator, too, since its earliest MSDOS, and it is still supported for Windows.

But of course it might be confusing for many people to see a mix of different path separators in debug messages or log files.

Stefan

#8 lore raw

Re: [PATCH 2/2] tests/functional: Allow running TCG plugins tests on non-Linux/BSD hosts

In reply to Philippe Mathieu-Daudé
Quoted 26 lines · Philippe Mathieu-Daudé

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

---
 tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
tests/functional/test_aarch64_tcg_plugins.py +1 -1
index 7e8beacc833..306e46c7972 100755
@@ -16,7 +16,7 @@
 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):

tests/functional/test_aarch64_tcg_plugins.py class PluginKernelNormal(PluginKernelBase): · line 68

Quoted 7 lines
tests/functional/test_aarch64_tcg_plugins.py +4 -0
@@ -62,6 +62,10 @@ class PluginKernelNormal(PluginKernelBase):
         ('https://storage.tuxboot.com/20230331/arm64/Image'),
         'ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7')
 
+    def plugin_file(self, plugin_name):
+        suffix = dso_suffix()
+        return f'tests/tcg/plugins/{plugin_name}.{suffix}'
+

IMHO this should be on the QemuBaseTest class with all the other similar path file helpers, since in the long run plugins are liable to be used for more than just this one test program.

Quoted 24 lines
tests/functional/test_aarch64_tcg_plugins.py +2 -2
     def test_aarch64_virt_insn(self):
         self.set_machine('virt')
         self.cpu='cortex-a53'
@@ -74,7 +78,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 +104,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'))
 
Signature · 1 line
2.47.1

With regards,
Daniel

Signature · 3 lines
|: 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 :|
#9 lore raw
In reply to Philippe Mathieu-Daudé

Hi Philippe,

Quoted 58 lines · Philippe Mathieu-Daudé

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

I'm still having some meson dependency problem, even on Linux:

   $ make check-functional-aarch64
   ...
   Traceback (most recent call last):
     File "python/qemu/qmp/protocol.py", line 834, in _bh_close_stream
       await wait_closed(self._writer)
     File "python/qemu/qmp/util.py", line 130, in wait_closed
       await writer.wait_closed()
     File "/usr/lib/python3.10/asyncio/streams.py", line 343, in wait_closed
       await self._protocol._get_close_waiter(self)
     File "/usr/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
       data = self._sock.recv(self.max_size)
   ConnectionResetError: [Errno 104] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "python/qemu/machine/machine.py", line 448, in launch
self._launch()
File "python/qemu/machine/machine.py", line 497, in _launch
self._post_launch()
File "python/qemu/machine/machine.py", line 381, in _post_launch
self._qmp.connect()
File "python/qemu/qmp/legacy.py", line 153, in connect
self._sync(
File "python/qemu/qmp/legacy.py", line 102, in _sync
return self._aloop.run_until_complete(
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
return await fut
File "python/qemu/qmp/protocol.py", line 382, in connect
await self._session_guard(
File "python/qemu/qmp/protocol.py", line 456, in _session_guard
raise ConnectError(emsg, err) from err
qemu.qmp.protocol.ConnectError: Failed to establish session: [Errno 104] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "tests/functional/test_aarch64_tcg_plugins.py", line 80, in test_aarch64_virt_insn
self.run_vm(kernel_path, kernel_command_line,
File "tests/functional/test_aarch64_tcg_plugins.py", line 52, in run_vm
raise excp
File "tests/functional/test_aarch64_tcg_plugins.py", line 46, in run_vm
vm.launch()
File "python/qemu/machine/machine.py", line 461, in launch
raise VMLaunchFailure(
qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: [Errno 104] Connection reset by peer
Exit code: 1
Command: build/plugins/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=6 -mon chardev=mon,mode=control -machine virt -chardev socket,id=console,fd=11 -serial chardev:console -cpu cortex-a53 -kernel /home/philippe.mathieu-daude/.cache/qemu/download/ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7 -append printk.time=1 panic=-1 console=ttyAMA0 -plugin tests/tcg/plugins/libinsn.so -d plugin -D /tmp/plugini36uailv.log -net none -no-reboot
Output: qemu-system-aarch64: Could not load plugin tests/tcg/plugins/libinsn.so: tests/tcg/plugins/libinsn.so: cannot open shared object file: No such file or directory
make[1]: *** [Makefile.mtest:26: do-meson-check] Error 1

Quoted 6 lines

I don't mind much building the plugins manually:

   $ make tests/tcg/plugins/libinsn.so
   [1/2] Compiling C object tests/tcg/plugins/libinsn.so.p/insn.c.o
   [2/2] Linking target tests/tcg/plugins/libinsn.so

Meson tests dependency is missing for plugins, so we need to add it.

By running: make check-functional-aarch64 V=1, you can see it's only building qemu-img, qemu-system and roms files.

You can integrate this patch in your series:

commit a375e9b560685bf4ccd6332cc23ce6850ec2fbbe

Author: Pierrick Bouvier <[email protected]>
Date:   Wed Feb 19 12:26:53 2025 -0800

plugins: add explicit dependency in functional tests

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

meson.build +1 -0
index 18b40a21a5a..80b9c8edd71 100644
@@ -3658,6 +3658,7 @@ qtest_module_ss = ss.source_set()
 
 modules = {}
 target_modules = {}
+plugin_modules = []
 hw_arch = {}
 target_arch = {}
 target_system_arch = {}
contrib/plugins/meson.build +2 -0
index c4f5061a7b3..327b48c8886 100644
@@ -27,3 +27,5 @@ if t.length() > 0
 else
   run_target('contrib-plugins', command: find_program('true'))
 endif
+
+plugin_modules += t
tests/functional/meson.build +1 -1
index 21c7e2087e9..dcea5d41e10 100644
@@ -364,7 +364,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',
tests/tcg/plugins/meson.build +2 -0
index 7f927357421..0e4d4f5d6af 100644
@@ -19,3 +19,5 @@ if t.length() > 0
 else
   run_target('test-plugins', command: find_program('true'))
 endif
+
+plugin_modules += t
#10 lore raw
Quoted 134 lines · Pierrick Bouvier

Hi Philippe,

Quoted 60 lines · Philippe Mathieu-Daudé

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

I'm still having some meson dependency problem, even on Linux:

   $ make check-functional-aarch64
   ...
   Traceback (most recent call last):
     File "python/qemu/qmp/protocol.py", line 834, in _bh_close_stream
       await wait_closed(self._writer)
     File "python/qemu/qmp/util.py", line 130, in wait_closed
       await writer.wait_closed()
     File "/usr/lib/python3.10/asyncio/streams.py", line 343, in wait_closed
       await self._protocol._get_close_waiter(self)
     File "/usr/lib/python3.10/asyncio/selector_events.py", line 862, in _read_ready__data_received
       data = self._sock.recv(self.max_size)
   ConnectionResetError: [Errno 104] Connection reset by peer

   The above exception was the direct cause of the following exception:

   Traceback (most recent call last):
     File "python/qemu/machine/machine.py", line 448, in launch
       self._launch()
     File "python/qemu/machine/machine.py", line 497, in _launch
       self._post_launch()
     File "python/qemu/machine/machine.py", line 381, in _post_launch self._qmp.connect()
     File "python/qemu/qmp/legacy.py", line 153, in connect
       self._sync(
     File "python/qemu/qmp/legacy.py", line 102, in _sync
       return self._aloop.run_until_complete(
     File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result()
     File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
       return await fut
     File "python/qemu/qmp/protocol.py", line 382, in connect
       await self._session_guard(
     File "python/qemu/qmp/protocol.py", line 456, in _session_guard
       raise ConnectError(emsg, err) from err
   qemu.qmp.protocol.ConnectError: Failed to establish session: [Errno 104] Connection reset by peer

   The above exception was the direct cause of the following exception:

   Traceback (most recent call last):
     File "tests/functional/test_aarch64_tcg_plugins.py", line 80, in test_aarch64_virt_insn
       self.run_vm(kernel_path, kernel_command_line,
     File "tests/functional/test_aarch64_tcg_plugins.py", line 52, in run_vm
       raise excp
     File "tests/functional/test_aarch64_tcg_plugins.py", line 46, in run_vm
       vm.launch()
     File "python/qemu/machine/machine.py", line 461, in launch
       raise VMLaunchFailure(
   qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: [Errno 104] Connection reset by peer
       Exit code: 1
       Command: build/plugins/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=6 -mon chardev=mon,mode=control - machine virt -chardev socket,id=console,fd=11 -serial chardev:console -cpu cortex-a53 -kernel /home/philippe.mathieu-daude/.cache/qemu/
download/ ce95a7101a5fecebe0fe630deee6bd97b32ba41bc8754090e9ad8961ea8674c7 - append printk.time=1 panic=-1 console=ttyAMA0 -plugin tests/tcg/ plugins/libinsn.so -d plugin -D /tmp/plugini36uailv.log -net none -no- reboot
       Output: qemu-system-aarch64: Could not load plugin tests/tcg/ plugins/libinsn.so: tests/tcg/plugins/libinsn.so: cannot open shared object file: No such file or directory make[1]: *** [Makefile.mtest:26: do-meson-check] Error 1

Quoted 6 lines

I don't mind much building the plugins manually:

   $ make tests/tcg/plugins/libinsn.so
   [1/2] Compiling C object tests/tcg/plugins/libinsn.so.p/insn.c.o
   [2/2] Linking target tests/tcg/plugins/libinsn.so

Meson tests dependency is missing for plugins, so we need to add it.

By running: make check-functional-aarch64 V=1, you can see it's only building qemu-img, qemu-system and roms files.

You can integrate this patch in your series:

commit a375e9b560685bf4ccd6332cc23ce6850ec2fbbe
Author: Pierrick Bouvier <[email protected]> Date:   Wed Feb 19 12:26:53 2025 -0800

    plugins: add explicit dependency in functional tests

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

meson.build +1 -0
index 18b40a21a5a..80b9c8edd71 100644
@@ -3658,6 +3658,7 @@ qtest_module_ss = ss.source_set()
 
  modules = {}
  target_modules = {}
+plugin_modules = []
  hw_arch = {}
  target_arch = {}
  target_system_arch = {}
contrib/plugins/meson.build +2 -0
index c4f5061a7b3..327b48c8886 100644
@@ -27,3 +27,5 @@ if t.length() > 0
  else
    run_target('contrib-plugins', command: find_program('true'))
  endif
+
+plugin_modules += t
tests/functional/meson.build +1 -1
index 21c7e2087e9..dcea5d41e10 100644
@@ -364,7 +364,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',

tests/tcg/plugins/meson.build +0 -0
index 7f927357421..0e4d4f5d6af 100644

tests/tcg/plugins/meson.build if t.length() > 0 · line 23

Quoted 5 lines
tests/tcg/plugins/meson.build +2 -0
@@ -19,3 +19,5 @@ if t.length() > 0
  else
    run_target('test-plugins', command: find_program('true'))
  endif
+
+plugin_modules += t

[26/36] Compiling C object tests/tcg/plugins/libbb.so.p/bb.c.o [27/36] Linking target tests/tcg/plugins/libinsn.so
[28/36] Compiling C object tests/tcg/plugins/libinline.so.p/inline.c.o [29/36] Linking target tests/tcg/plugins/libinline.so [30/36] Compiling C object tests/tcg/plugins/libmem.so.p/mem.c.o [31/36] Compiling C object tests/tcg/plugins/libempty.so.p/empty.c.o [32/36] Linking target tests/tcg/plugins/libempty.so
[33/36] Linking target tests/tcg/plugins/libbb.so
[34/36] Linking target tests/tcg/plugins/libmem.so
[35/36] Compiling C object tests/tcg/plugins/libsyscall.so.p/syscall.c.o [36/36] Linking target tests/tcg/plugins/libsyscall.so

Yes this works, thanks!

For your embedded patch:

Quoted 1 line