|
3 | 3 |
|
4 | 4 | # System modules
|
5 | 5 | import itertools
|
| 6 | +import json |
6 | 7 | import re
|
7 | 8 | import subprocess
|
8 | 9 | import sys
|
|
16 | 17 | from . import lldbtest_config
|
17 | 18 | import lldbsuite.test.lldbplatform as lldbplatform
|
18 | 19 | from lldbsuite.test.builders import get_builder
|
| 20 | +from lldbsuite.test.lldbutil import is_exe |
19 | 21 |
|
20 | 22 |
|
21 | 23 | def check_first_register_readable(test_case):
|
@@ -333,3 +335,41 @@ def expectedCompiler(compilers):
|
333 | 335 | return True
|
334 | 336 |
|
335 | 337 | return False
|
| 338 | + |
| 339 | + |
| 340 | +# This is a helper function to determine if a specific version of Xcode's linker |
| 341 | +# contains a TLS bug. We want to skip TLS tests if they contain this bug, but |
| 342 | +# adding a linker/linker_version conditions to a decorator is challenging due to |
| 343 | +# the number of ways linkers can enter the build process. |
| 344 | +def darwinLinkerHasTLSBug(): |
| 345 | + """Returns true iff a test is running on a darwin platform and the host linker is between versions 1000 and 1109.""" |
| 346 | + darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all) |
| 347 | + if getPlatform() not in darwin_platforms: |
| 348 | + return False |
| 349 | + |
| 350 | + linker_path = ( |
| 351 | + subprocess.check_output(["xcrun", "--find", "ld"]).rstrip().decode("utf-8") |
| 352 | + ) |
| 353 | + if not is_exe(linker_path): |
| 354 | + return False |
| 355 | + |
| 356 | + raw_linker_info = ( |
| 357 | + subprocess.check_output([linker_path, "-version_details"]) |
| 358 | + .rstrip() |
| 359 | + .decode("utf-8") |
| 360 | + ) |
| 361 | + parsed_linker_info = json.loads(raw_linker_info) |
| 362 | + if "version" not in parsed_linker_info: |
| 363 | + return False |
| 364 | + |
| 365 | + raw_version = parsed_linker_info["version"] |
| 366 | + version = None |
| 367 | + try: |
| 368 | + version = int(raw_version) |
| 369 | + except: |
| 370 | + return False |
| 371 | + |
| 372 | + if version is None: |
| 373 | + return False |
| 374 | + |
| 375 | + return 1000 <= version and version <= 1109 |
0 commit comments