[cross-project-tests][lit] Account for Apple LLDB version in compatibility check
The LLVM release version and Apple LLDB version follow slightly different numbering scheme. Make sure we set the minimum required LLDB version appropriately. Also refactors the `apple-lldb-pre-1000` feature check to use the same `get_lldb_version_string` method. Currently this was causing the LLDB LLVM formatters to be skipped on our public macOS CI.
This commit is contained in:
parent
90b8a481e4
commit
e471478bad
@ -241,16 +241,6 @@ llvm_config.add_tool_substitutions(tools, tool_dirs)
|
||||
|
||||
lit.util.usePlatformSdkOnDarwin(config, lit_config)
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
xcode_lldb_vers = subprocess.check_output(["xcrun", "lldb", "--version"]).decode(
|
||||
"utf-8"
|
||||
)
|
||||
match = re.search(r"lldb-(\d+)", xcode_lldb_vers)
|
||||
if match:
|
||||
apple_lldb_vers = int(match.group(1))
|
||||
if apple_lldb_vers < 1000:
|
||||
config.available_features.add("apple-lldb-pre-1000")
|
||||
|
||||
|
||||
def get_gdb_version_string():
|
||||
"""Return gdb's version string, or None if gdb cannot be found or the
|
||||
@ -295,9 +285,11 @@ def get_lldb_version_string():
|
||||
--version output is formatted unexpectedly.
|
||||
"""
|
||||
try:
|
||||
lldb_vers_lines = (
|
||||
subprocess.check_output(["lldb", "--version"]).decode().splitlines()
|
||||
)
|
||||
cmd = ["lldb", "--version"]
|
||||
if platform.system() == "Darwin":
|
||||
cmd = ["xcrun"] + cmd
|
||||
|
||||
lldb_vers_lines = subprocess.check_output(cmd).decode().splitlines()
|
||||
except:
|
||||
return None
|
||||
if len(lldb_vers_lines) < 1:
|
||||
@ -311,21 +303,43 @@ def get_lldb_version_string():
|
||||
|
||||
|
||||
def set_lldb_formatters_compatibility_feature():
|
||||
lldb_version_string = get_lldb_version_string()
|
||||
if lldb_version_string is None:
|
||||
return False
|
||||
current_lldb_version = get_lldb_version_string()
|
||||
if not current_lldb_version:
|
||||
return
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
# The Apple LLDB version doesn't follow the LLVM release versioning.
|
||||
min_required_lldb_version = "1700"
|
||||
else:
|
||||
min_required_lldb_version = "1900"
|
||||
|
||||
try:
|
||||
from packaging import version
|
||||
except:
|
||||
lit_config.fatal("Running lldb tests requires the packaging package")
|
||||
return False
|
||||
return
|
||||
|
||||
if version.parse(lldb_version_string) < version.parse("1900.0"):
|
||||
return False
|
||||
if version.parse(current_lldb_version) < version.parse(min_required_lldb_version):
|
||||
raise ValueError(
|
||||
f"using version {current_lldb_version} whereas a version >= {min_required_lldb_version} is required"
|
||||
)
|
||||
|
||||
config.available_features.add("lldb-formatters-compatibility")
|
||||
return True
|
||||
|
||||
|
||||
def set_apple_lldb_pre_1000_feature():
|
||||
apple_lldb_vers = get_lldb_version_string()
|
||||
if not apple_lldb_vers:
|
||||
return
|
||||
|
||||
try:
|
||||
from packaging import version
|
||||
except:
|
||||
lit_config.fatal("Running lldb tests requires the packaging package")
|
||||
return
|
||||
|
||||
if version.parse(apple_lldb_vers) < version.parse("1000"):
|
||||
config.available_features.add("apple-lldb-pre-1000")
|
||||
|
||||
|
||||
# Some cross-project-tests use gdb, but not all versions of gdb are compatible
|
||||
@ -349,12 +363,17 @@ if dwarf_version_string and gdb_version_string:
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
if not set_lldb_formatters_compatibility_feature():
|
||||
try:
|
||||
set_lldb_formatters_compatibility_feature()
|
||||
except ValueError as e:
|
||||
print(
|
||||
f"Marking some LLDB LLVM data-formatter tests as unsupported: using version {get_lldb_version_string()} whereas a version >= 1900.0 is required",
|
||||
f"Marking some LLDB LLVM data-formatter tests as unsupported: {e}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
if platform.system() == "Darwin":
|
||||
set_apple_lldb_pre_1000_feature()
|
||||
|
||||
llvm_config.feature_config([("--build-mode", {"Debug|RelWithDebInfo": "debug-info"})])
|
||||
|
||||
# Allow 'REQUIRES: XXX-registered-target' in tests.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user