tests: Preliminary patchelf smoke tests (#14551)

* Initial patchelf smoke tests
This commit is contained in:
Tamara Dahlgren
2020-01-21 11:42:18 -08:00
committed by Tamara Dahlgren
parent 966fc427a9
commit 59e885bd4f
2 changed files with 26 additions and 0 deletions

View File

@@ -5,6 +5,12 @@
from spack import *
import os
import shutil
import tempfile
import llnl.util.tty as tty
class Patchelf(AutotoolsPackage):
"""PatchELF is a small utility to modify the dynamic linker and RPATH of
@@ -18,3 +24,23 @@ class Patchelf(AutotoolsPackage):
version('0.10', sha256='b2deabce05c34ce98558c0efb965f209de592197b2c88e930298d740ead09019')
version('0.9', sha256='f2aa40a6148cb3b0ca807a1bf836b081793e55ec9e5540a5356d800132be7e0a')
version('0.8', sha256='14af06a2da688d577d64ff8dac065bb8903bbffbe01d30c62df7af9bf4ce72fe')
def test(self):
patchelf = which('patchelf')
assert patchelf is not None
tty.msg('test: Ensuring use of the installed executable')
patchelf_dir = os.path.dirname(patchelf.path)
assert patchelf_dir == self.prefix.bin
tty.msg('test: Checking version')
output = patchelf('--version', output=str.split, error=str.split)
assert output.strip() == 'patchelf {0}'.format(self.spec.version)
tty.msg('test: Ensuring the rpath is changed')
currdir = os.getcwd()
hello_fn = os.path.join(currdir, 'data', 'hello')
patchelf('--set-rpath', currdir, hello_fn)
output = patchelf('--print-rpath', hello_fn,
output=str.split, error=str.split)
assert output.strip() == currdir

Binary file not shown.