Message ID | 20250219192340.92240-3-philmd@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | tests/functional: Allow running TCG plugins tests on macOS | expand |
On 2/19/25 11:23, 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> > --- > tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tests/functional/test_aarch64_tcg_plugins.py b/tests/functional/test_aarch64_tcg_plugins.py > index 7e8beacc833..306e46c7972 100755 > --- a/tests/functional/test_aarch64_tcg_plugins.py > +++ b/tests/functional/test_aarch64_tcg_plugins.py > @@ -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')) > Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
On 19/02/2025 20.23, 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> > --- > tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tests/functional/test_aarch64_tcg_plugins.py b/tests/functional/test_aarch64_tcg_plugins.py > index 7e8beacc833..306e46c7972 100755 > --- a/tests/functional/test_aarch64_tcg_plugins.py > +++ b/tests/functional/test_aarch64_tcg_plugins.py > @@ -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}' 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
Am 20.02.25 um 07:02 schrieb Thomas Huth: > On 19/02/2025 20.23, Philippe Mathieu-Daudé wrote: >> @@ -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
diff --git a/tests/functional/test_aarch64_tcg_plugins.py b/tests/functional/test_aarch64_tcg_plugins.py index 7e8beacc833..306e46c7972 100755 --- a/tests/functional/test_aarch64_tcg_plugins.py +++ b/tests/functional/test_aarch64_tcg_plugins.py @@ -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'))
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> --- tests/functional/test_aarch64_tcg_plugins.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)