Improve fixup macos rpath unit test (#43392)
Starting from XCode version 15 the linker ignores duplicate rpaths, so the libraries don't need fixing in those cases
This commit is contained in:
parent
8f76f1b0d8
commit
66345e7185
@ -9,8 +9,6 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
import spack.concretize
|
||||
import spack.paths
|
||||
import spack.platforms
|
||||
@ -284,8 +282,15 @@ def test_relocate_text_bin_raise_if_new_prefix_is_longer(tmpdir):
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("install_name_tool", "file", "cc")
|
||||
@pytest.mark.skipif(str(archspec.cpu.host().family) != "x86_64", reason="failing on Apple M1/M2")
|
||||
def test_fixup_macos_rpaths(make_dylib, make_object_file):
|
||||
compiler_cls = spack.repo.PATH.get_pkg_class("apple-clang")
|
||||
compiler_version = compiler_cls.determine_version("cc")
|
||||
try:
|
||||
# See https://forums.swift.org/t/xcode-ships-llvm-15-but-swift-builds-llvm-16/67377
|
||||
xcode_major_version = int(compiler_version.split(".")[0])
|
||||
except IndexError:
|
||||
pytest.xfail("cannot determine the major version of XCode")
|
||||
|
||||
# For each of these tests except for the "correct" case, the first fixup
|
||||
# should make changes, and the second fixup should be a null-op.
|
||||
fixup_rpath = spack.relocate.fixup_macos_rpath
|
||||
@ -296,6 +301,8 @@ def test_fixup_macos_rpaths(make_dylib, make_object_file):
|
||||
|
||||
# Non-relocatable library id and duplicate rpaths
|
||||
(root, filename) = make_dylib("abs", duplicate_rpaths)
|
||||
# XCode 15 ships a new linker that takes care of deduplication
|
||||
if xcode_major_version < 15:
|
||||
assert fixup_rpath(root, filename)
|
||||
assert not fixup_rpath(root, filename)
|
||||
|
||||
@ -305,6 +312,8 @@ def test_fixup_macos_rpaths(make_dylib, make_object_file):
|
||||
|
||||
# Library id uses rpath but there are extra duplicate rpaths
|
||||
(root, filename) = make_dylib("rpath", duplicate_rpaths)
|
||||
# XCode 15 ships a new linker that takes care of deduplication
|
||||
if xcode_major_version < 15:
|
||||
assert fixup_rpath(root, filename)
|
||||
assert not fixup_rpath(root, filename)
|
||||
|
||||
@ -328,6 +337,8 @@ def test_fixup_macos_rpaths(make_dylib, make_object_file):
|
||||
# Duplicate nonexistent rpath will need *two* passes
|
||||
(root, filename) = make_dylib("rpath", bad_rpath * 2)
|
||||
assert fixup_rpath(root, filename)
|
||||
# XCode 15 ships a new linker that takes care of deduplication
|
||||
if xcode_major_version < 15:
|
||||
assert fixup_rpath(root, filename)
|
||||
assert not fixup_rpath(root, filename)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user