tests: remove file requirement (#48362)
This commit is contained in:
parent
cb37f973d9
commit
0a070512e6
@ -197,14 +197,13 @@ def dummy_prefix(tmpdir):
|
||||
return str(p)
|
||||
|
||||
|
||||
args = ["file"]
|
||||
if sys.platform == "darwin":
|
||||
args.extend(["/usr/bin/clang++", "install_name_tool"])
|
||||
required_executables = ["/usr/bin/clang++", "install_name_tool"]
|
||||
else:
|
||||
args.extend(["/usr/bin/g++", "patchelf"])
|
||||
required_executables = ["/usr/bin/g++", "patchelf"]
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.maybeslow
|
||||
@pytest.mark.usefixtures(
|
||||
"default_config", "cache_directory", "install_dir_default_layout", "temporary_mirror"
|
||||
@ -251,7 +250,7 @@ def test_default_rpaths_create_install_default_layout(temporary_mirror_dir):
|
||||
buildcache_cmd("list", "-l", "-v")
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.maybeslow
|
||||
@pytest.mark.nomockstage
|
||||
@pytest.mark.usefixtures(
|
||||
@ -274,7 +273,7 @@ def test_default_rpaths_install_nondefault_layout(temporary_mirror_dir):
|
||||
buildcache_cmd("install", "-uf", cspec.name)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.maybeslow
|
||||
@pytest.mark.nomockstage
|
||||
@pytest.mark.usefixtures(
|
||||
@ -303,7 +302,7 @@ def test_relative_rpaths_install_default_layout(temporary_mirror_dir):
|
||||
buildcache_cmd("install", "-uf", cspec.name)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.maybeslow
|
||||
@pytest.mark.nomockstage
|
||||
@pytest.mark.usefixtures(
|
||||
@ -354,7 +353,7 @@ def test_push_and_fetch_keys(mock_gnupghome, tmp_path):
|
||||
assert new_keys[0] == fpr
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.maybeslow
|
||||
@pytest.mark.nomockstage
|
||||
@pytest.mark.usefixtures(
|
||||
|
@ -157,7 +157,7 @@ def test_normalize_relative_paths(start_path, relative_paths, expected):
|
||||
assert normalized == expected
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("patchelf", "file", "gcc")
|
||||
@pytest.mark.requires_executables("patchelf", "gcc")
|
||||
@skip_unless_linux
|
||||
def test_relocate_text_bin(binary_with_rpaths, prefix_like):
|
||||
prefix = "/usr/" + prefix_like
|
||||
@ -174,7 +174,7 @@ def test_relocate_text_bin(binary_with_rpaths, prefix_like):
|
||||
assert "%s/lib:%s/lib64" % (new_prefix, new_prefix) in rpaths_for(executable)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("patchelf", "file", "gcc")
|
||||
@pytest.mark.requires_executables("patchelf", "gcc")
|
||||
@skip_unless_linux
|
||||
def test_relocate_elf_binaries_absolute_paths(binary_with_rpaths, copy_binary, prefix_tmpdir):
|
||||
# Create an executable, set some RPATHs, copy it to another location
|
||||
@ -196,7 +196,7 @@ def test_relocate_elf_binaries_absolute_paths(binary_with_rpaths, copy_binary, p
|
||||
assert "/foo/lib:/usr/lib64" in rpaths_for(new_binary)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("patchelf", "file", "gcc")
|
||||
@pytest.mark.requires_executables("patchelf", "gcc")
|
||||
@skip_unless_linux
|
||||
def test_relocate_elf_binaries_relative_paths(binary_with_rpaths, copy_binary):
|
||||
# Create an executable, set some RPATHs, copy it to another location
|
||||
@ -217,7 +217,7 @@ def test_relocate_elf_binaries_relative_paths(binary_with_rpaths, copy_binary):
|
||||
assert "/foo/lib:/foo/lib64:/opt/local/lib" in rpaths_for(new_binary)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("patchelf", "file", "gcc")
|
||||
@pytest.mark.requires_executables("patchelf", "gcc")
|
||||
@skip_unless_linux
|
||||
def test_make_elf_binaries_relative(binary_with_rpaths, copy_binary, prefix_tmpdir):
|
||||
orig_binary = binary_with_rpaths(
|
||||
@ -237,7 +237,7 @@ def test_make_elf_binaries_relative(binary_with_rpaths, copy_binary, prefix_tmpd
|
||||
assert "$ORIGIN/lib:$ORIGIN/lib64:/opt/local/lib" in rpaths_for(new_binary)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("patchelf", "file", "gcc")
|
||||
@pytest.mark.requires_executables("patchelf", "gcc")
|
||||
@skip_unless_linux
|
||||
def test_relocate_text_bin_with_message(binary_with_rpaths, copy_binary, prefix_tmpdir):
|
||||
orig_binary = binary_with_rpaths(
|
||||
@ -276,7 +276,7 @@ def test_relocate_text_bin_raise_if_new_prefix_is_longer(tmpdir):
|
||||
spack.relocate.relocate_text_bin([fpath], {short_prefix: long_prefix})
|
||||
|
||||
|
||||
@pytest.mark.requires_executables("install_name_tool", "file", "cc")
|
||||
@pytest.mark.requires_executables("install_name_tool", "cc")
|
||||
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")
|
||||
|
@ -15,11 +15,10 @@
|
||||
from spack.spec import Spec
|
||||
from spack.test.relocate import text_in_bin
|
||||
|
||||
args = ["file"]
|
||||
if sys.platform == "darwin":
|
||||
args.extend(["/usr/bin/clang++", "install_name_tool"])
|
||||
required_executables = ["/usr/bin/clang++", "install_name_tool"]
|
||||
else:
|
||||
args.extend(["g++", "patchelf"])
|
||||
required_executables = ["g++", "patchelf"]
|
||||
|
||||
|
||||
def check_spliced_spec_prefixes(spliced_spec):
|
||||
@ -34,7 +33,7 @@ def check_spliced_spec_prefixes(spliced_spec):
|
||||
assert modded_spec.prefix in text
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_rewire_db(mock_fetch, install_mockery, transitive):
|
||||
"""Tests basic rewiring without binary executables."""
|
||||
@ -58,7 +57,7 @@ def test_rewire_db(mock_fetch, install_mockery, transitive):
|
||||
check_spliced_spec_prefixes(spliced_spec)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_rewire_bin(mock_fetch, install_mockery, transitive):
|
||||
"""Tests basic rewiring with binary executables."""
|
||||
@ -87,7 +86,7 @@ def test_rewire_bin(mock_fetch, install_mockery, transitive):
|
||||
assert text_in_bin(dep.prefix, bin_file_path)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
def test_rewire_writes_new_metadata(mock_fetch, install_mockery):
|
||||
"""Tests that new metadata was written during a rewire.
|
||||
Accuracy of metadata is left to other tests."""
|
||||
@ -131,7 +130,7 @@ def test_rewire_writes_new_metadata(mock_fetch, install_mockery):
|
||||
assert not filecmp.cmp(orig_specfile_path, specfile_path, shallow=False)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_uninstall_rewired_spec(mock_fetch, install_mockery, transitive):
|
||||
"""Test that rewired packages can be uninstalled as normal."""
|
||||
@ -145,7 +144,7 @@ def test_uninstall_rewired_spec(mock_fetch, install_mockery, transitive):
|
||||
assert not os.path.exists(spliced_spec.prefix)
|
||||
|
||||
|
||||
@pytest.mark.requires_executables(*args)
|
||||
@pytest.mark.requires_executables(*required_executables)
|
||||
def test_rewire_not_installed_fails(mock_fetch, install_mockery):
|
||||
"""Tests error when an attempt is made to rewire a package that was not
|
||||
previously installed."""
|
||||
|
Loading…
Reference in New Issue
Block a user