diff mbox series

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

Message ID 20250219192340.92240-2-philmd@linaro.org (mailing list archive)
State New
Headers show
Series tests/functional: Allow running TCG plugins tests on macOS | expand

Commit Message

Philippe Mathieu-Daudé Feb. 19, 2025, 7:23 p.m. UTC
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>
---
 tests/functional/qemu_test/__init__.py | 2 +-
 tests/functional/qemu_test/cmd.py      | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Pierrick Bouvier Feb. 19, 2025, 7:28 p.m. UTC | #1
On 2/19/25 11:23, 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>
> ---
>   tests/functional/qemu_test/__init__.py | 2 +-
>   tests/functional/qemu_test/cmd.py      | 6 ++++++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> index 5c972843a6d..e253288ee7f 100644
> --- a/tests/functional/qemu_test/__init__.py
> +++ b/tests/functional/qemu_test/__init__.py
> @@ -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
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77d..c4704dfb7bc 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py
> @@ -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):

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Thomas Huth Feb. 20, 2025, 5:59 a.m. UTC | #2
On 19/02/2025 20.23, 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>
> ---
>   tests/functional/qemu_test/__init__.py | 2 +-
>   tests/functional/qemu_test/cmd.py      | 6 ++++++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> index 5c972843a6d..e253288ee7f 100644
> --- a/tests/functional/qemu_test/__init__.py
> +++ b/tests/functional/qemu_test/__init__.py
> @@ -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
> diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
> index dc5f422b77d..c4704dfb7bc 100644
> --- a/tests/functional/qemu_test/cmd.py
> +++ b/tests/functional/qemu_test/cmd.py

Maybe config.py would be a better place?

  Thomas


> @@ -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):
diff mbox series

Patch

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
index 5c972843a6d..e253288ee7f 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -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
diff --git a/tests/functional/qemu_test/cmd.py b/tests/functional/qemu_test/cmd.py
index dc5f422b77d..c4704dfb7bc 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -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):