Skip to content

Increase coverage of spack.relocate#16475

Merged
tgamblin merged 12 commits intospack:developfrom
alalazo:refactor/elf_relocation
May 9, 2020
Merged

Increase coverage of spack.relocate#16475
tgamblin merged 12 commits intospack:developfrom
alalazo:refactor/elf_relocation

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented May 5, 2020

This PR:

  • Adds docstrings to a few functions involved in ELF relocation
  • Adds unit test to them
  • Adds patchelf to Travis to trigger tests depending on it

Continuation of #15610

Comment on lines +414 to +416
# TODO: revisit the use of --force-rpath as it might be conditional
# TODO: if we want to support setting RUNPATH from binary packages
patchelf_args = ['--force-rpath', '--set-rpath', rpaths_str, target]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gartung If I understand the code correctly this function will always set RPATHs and never set RUNPATHs regardless of what is in config.yaml? Is it correct?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know patchelf only handles rpaths.

Copy link
Copy Markdown
Member Author

@alalazo alalazo May 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll experiment with that. I think if we don't give the --force-rpath option then the relocation will be done on RUNPATH.

@alalazo alalazo force-pushed the refactor/elf_relocation branch 3 times, most recently from 1997b78 to 38f4cb2 Compare May 6, 2020 19:41
@alalazo alalazo marked this pull request as ready for review May 6, 2020 20:35
@alalazo alalazo requested review from gartung and scheibelp May 6, 2020 20:35


@pytest.mark.requires_executables('patchelf', 'strings', 'file', 'gcc')
def test_relocate_elf_binaries_relative_paths(hello_world, tmpdir):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test and the one above can probably be factored better (maybe in a later PR). As a side note I think the fixture hello_world might be useful to add further relocation tests.

@alalazo alalazo force-pushed the refactor/elf_relocation branch from 38f4cb2 to fbcf9b6 Compare May 9, 2020 09:27
Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alalazo: this looks great -- I think the fixture will be really useful going forward for other relocation tests.

It would be good to have a follow-on PR that tests the same logic with otool on macOS.

@tgamblin tgamblin merged commit b06bc31 into spack:develop May 9, 2020
@alalazo alalazo deleted the refactor/elf_relocation branch May 9, 2020 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants