mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00

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> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20250220080215.49165-3-philmd@linaro.org> [AJB: dropped whitespace cmd.py damage] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250304222439.2035603-10-alex.bennee@linaro.org>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
# Test class and utilities for functional tests
|
|
#
|
|
# Copyright 2018, 2024 Red Hat, Inc.
|
|
#
|
|
# Original Author (Avocado-based tests):
|
|
# Cleber Rosa <crosa@redhat.com>
|
|
#
|
|
# Adaption for standalone version:
|
|
# Thomas Huth <thuth@redhat.com>
|
|
#
|
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
|
# later. See the COPYING file in the top-level directory.
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import platform
|
|
|
|
|
|
def _source_dir():
|
|
# Determine top-level directory of the QEMU sources
|
|
return Path(__file__).parent.parent.parent.parent
|
|
|
|
def _build_dir():
|
|
root = os.getenv('QEMU_BUILD_ROOT')
|
|
if root is not None:
|
|
return Path(root)
|
|
# Makefile.mtest only exists in build dir, so if it is available, use CWD
|
|
if os.path.exists('Makefile.mtest'):
|
|
return Path(os.getcwd())
|
|
|
|
root = os.path.join(_source_dir(), 'build')
|
|
if os.path.exists(root):
|
|
return Path(root)
|
|
|
|
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'''
|
|
|
|
if platform.system() == "Darwin":
|
|
return "dylib"
|
|
|
|
if platform.system() == "Windows":
|
|
return "dll"
|
|
|
|
return "so"
|