-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Bug/tests: three relocate.py tests fail with additional gcc libs #16636
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingtestsGeneral test capability(ies)General test capability(ies)
Description
I ran spack test on an LLNL LC machine and three relocate tests fail. I confirmed this is the case with commit c50b586. The bug appears to be related to a too-specific check of the RPATHs.
Error Message
___________________________ test_replace_prefix_bin ____________________________
hello_world = <function hello_world.<locals>._factory at 0x2aaab7813d08>
@pytest.mark.requires_executables('patchelf', 'strings', 'file', 'gcc')
def test_replace_prefix_bin(hello_world):
# Compile an "Hello world!" executable and set RPATHs
executable = hello_world(rpaths=['/usr/lib', '/usr/lib64'])
# Relocate the RPATHs
spack.relocate._replace_prefix_bin(str(executable), '/usr', '/foo')
# Check that the RPATHs changed
patchelf = spack.util.executable.which('patchelf')
output = patchelf('--print-rpath', str(executable), output=str)
> assert output.strip() == '/foo/lib:/foo/lib64'
E AssertionError: assert '/foo/tce/pac...ib:/foo/lib64' == '/foo/lib:/foo/lib64'
E - /foo/tce/packages/gcc/gcc-4.9.3/lib:/foo/tce/packages/gcc/gcc-4.9.3/lib64:/foo/lib:/foo/lib64
E + /foo/lib:/foo/lib64
lib/spack/spack/test/relocate.py:256: AssertionError
__________________ test_relocate_elf_binaries_absolute_paths ___________________
hello_world = <function hello_world.<locals>._factory at 0x2aaab7813950>
tmpdir = local('/tmp/$USER/pytest-of-$USER/pytest-7/test_relocate_elf_binaries_abs0')
@pytest.mark.requires_executables('patchelf', 'strings', 'file', 'gcc')
def test_relocate_elf_binaries_absolute_paths(hello_world, tmpdir):
# Create an executable, set some RPATHs, copy it to another location
orig_binary = hello_world(rpaths=[str(tmpdir.mkdir('lib')), '/usr/lib64'])
new_root = tmpdir.mkdir('another_dir')
shutil.copy(str(orig_binary), str(new_root))
# Relocate the binary
new_binary = new_root.join('main.x')
spack.relocate.relocate_elf_binaries(
binaries=[str(new_binary)],
orig_root=str(orig_binary.dirpath()),
new_root=None, # Not needed when relocating absolute paths
new_prefixes={
str(tmpdir): '/foo'
},
rel=False,
# Not needed when relocating absolute paths
orig_prefix=None, new_prefix=None
)
# Check that the RPATHs changed
patchelf = spack.util.executable.which('patchelf')
output = patchelf('--print-rpath', str(new_binary), output=str)
> assert output.strip() == '/foo/lib:/usr/lib64'
E AssertionError: assert '/usr/tce/pac...ib:/usr/lib64' == '/foo/lib:/usr/lib64'
E - /usr/tce/packages/gcc/gcc-4.9.3/lib:/usr/tce/packages/gcc/gcc-4.9.3/lib64:/foo/lib:/usr/lib64
E + /foo/lib:/usr/lib64
lib/spack/spack/test/relocate.py:283: AssertionError
__________________ test_relocate_elf_binaries_relative_paths ___________________
hello_world = <function hello_world.<locals>._factory at 0x2aaab77b3158>
tmpdir = local('/tmp/$USER/pytest-of-$USER/pytest-7/test_relocate_elf_binaries_rel0')
@pytest.mark.requires_executables('patchelf', 'strings', 'file', 'gcc')
def test_relocate_elf_binaries_relative_paths(hello_world, tmpdir):
# Create an executable, set some RPATHs, copy it to another location
orig_binary = hello_world(
rpaths=['$ORIGIN/lib', '$ORIGIN/lib64', '/opt/local/lib']
)
new_root = tmpdir.mkdir('another_dir')
shutil.copy(str(orig_binary), str(new_root))
# Relocate the binary
new_binary = new_root.join('main.x')
spack.relocate.relocate_elf_binaries(
binaries=[str(new_binary)],
orig_root=str(orig_binary.dirpath()),
new_root=str(new_root),
new_prefixes={str(tmpdir): '/foo'},
rel=True,
orig_prefix=str(orig_binary.dirpath()),
new_prefix=str(new_root)
)
# Check that the RPATHs changed
patchelf = spack.util.executable.which('patchelf')
output = patchelf('--print-rpath', str(new_binary), output=str)
> assert output.strip() == '/foo/lib:/foo/lib64:/opt/local/lib'
E AssertionError: assert '/usr/tce/pac...opt/local/lib' == '/foo/lib:/foo...opt/local/lib'
E - /usr/tce/packages/gcc/gcc-4.9.3/lib:/usr/tce/packages/gcc/gcc-4.9.3/lib64:/foo/lib:/foo/lib64:/opt/local/lib
E + /foo/lib:/foo/lib64:/opt/local/lib
lib/spack/spack/test/relocate.py:310: AssertionError
Information on your system
- Spack: 0.14.2-1095-8d73ca3
- Python: 3.7.2
- Platform: linux-rhel7-zen
Additional information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtestsGeneral test capability(ies)General test capability(ies)