Skip to content

Commit 1b1a729

Browse files
committed
fix broken test_toy_filter_rpath_sanity_libs by using --strict-rpath-sanity-check + also verify behaviour without --strict-rpath-sanity-check
1 parent ee91fd0 commit 1b1a729

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

test/framework/toy_build.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,9 +2861,9 @@ def test_toy_filter_rpath_sanity_libs(self):
28612861
toy_ec = os.path.join(test_ecs, 't', 'toy-app', 'toy-app-0.0.eb')
28622862

28632863
# This should just build succesfully
2864-
args = ['--rpath']
2864+
rpath_args = ['--rpath', '--strict-rpath-sanity-check']
28652865
with self.mocked_stdout_stderr():
2866-
self._test_toy_build(ec_file=toy_ec, name='toy-app', extra_args=args, raise_error=True)
2866+
self._test_toy_build(ec_file=toy_ec, name='toy-app', extra_args=rpath_args, raise_error=True)
28672867

28682868
libtoy_libdir = os.path.join(self.test_installpath, 'software', 'libtoy', '0.0', 'lib')
28692869
toyapp_bin = os.path.join(self.test_installpath, 'software', 'toy-app', '0.0', 'bin', 'toy-app')
@@ -2884,16 +2884,16 @@ def test_toy_filter_rpath_sanity_libs(self):
28842884
# test sanity error when --rpath-filter is used to filter a required library
28852885
# In this test, libtoy.so will be linked, but not RPATH-ed due to the --rpath-filter
28862886
# Thus, the RPATH sanity check is expected to fail with libtoy.so not being found
2887+
args = rpath_args + ['--rpath-filter=.*libtoy.*']
28872888
error_pattern = r"Sanity check failed\: Library libtoy\.so not found"
28882889
with self.mocked_stdout_stderr():
28892890
self.assertErrorRegex(EasyBuildError, error_pattern, self._test_toy_build, ec_file=toy_ec,
2890-
extra_args=['--rpath', '--rpath-filter=.*libtoy.*'],
2891-
name='toy-app', raise_error=True, verbose=False)
2891+
extra_args=args, name='toy-app', raise_error=True, verbose=False)
28922892

28932893
# test use of --filter-rpath-sanity-libs option. In this test, we use --rpath-filter to make sure libtoy.so is
28942894
# not rpath-ed. Then, we use --filter-rpath-sanity-libs to make sure the RPATH sanity checks ignores
28952895
# the fact that libtoy.so is not found. Thus, this build should complete succesfully
2896-
args = ['--rpath', '--rpath-filter=.*libtoy.*', '--filter-rpath-sanity-libs=libtoy.so']
2896+
args = rpath_args + ['--rpath-filter=.*libtoy.*', '--filter-rpath-sanity-libs=libtoy.so']
28972897
with self.mocked_stdout_stderr():
28982898
self._test_toy_build(ec_file=toy_ec, name='toy-app', extra_args=args, raise_error=True)
28992899

@@ -2910,7 +2910,7 @@ def test_toy_filter_rpath_sanity_libs(self):
29102910
f"Pattern '{notfound.pattern}' should be found in: {res.output}")
29112911

29122912
# test again with list of library names passed to --filter-rpath-sanity-libs
2913-
args = ['--rpath', '--rpath-filter=.*libtoy.*', '--filter-rpath-sanity-libs=libfoo.so,libtoy.so,libbar.so']
2913+
args = rpath_args + ['--rpath-filter=.*libtoy.*', '--filter-rpath-sanity-libs=libfoo.so,libtoy.so,libbar.so']
29142914
with self.mocked_stdout_stderr():
29152915
self._test_toy_build(ec_file=toy_ec, name='toy-app', extra_args=args, raise_error=True)
29162916

@@ -2926,6 +2926,19 @@ def test_toy_filter_rpath_sanity_libs(self):
29262926
self.assertTrue(notfound.search(res.output),
29272927
f"Pattern '{notfound.pattern}' should be found in: {res.output}")
29282928

2929+
# by default, without using --strict-rpath-sanity-check, there's no failure since RPATH sanity check
2930+
# doesn't check for missing libraries with $LD_LIBRARY_PATH unset
2931+
args = ['--rpath', '--rpath-filter=.*libtoy.*']
2932+
with self.mocked_stdout_stderr():
2933+
self._test_toy_build(ec_file=toy_ec, name='toy-app', extra_args=args, raise_error=True, verbose=False)
2934+
2935+
# trouble again when $LD_LIBRARY_PATH is not used in generated module file
2936+
args = ['libtoy-0.0.eb', '--rebuild', '--rpath', '--rpath-filter=.*libtoy.*',
2937+
'--filter-env-vars=LD_LIBRARY_PATH']
2938+
with self.mocked_stdout_stderr():
2939+
self.assertErrorRegex(EasyBuildError, error_pattern, self._test_toy_build, ec_file=toy_ec,
2940+
extra_args=args, name='toy-app', raise_error=True, verbose=False)
2941+
29292942
def test_toy_modaltsoftname(self):
29302943
"""Build two dependent toys as in test_toy_toy but using modaltsoftname"""
29312944
topdir = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)