Skip to content

Commit a9484c8

Browse files
authored
Merge pull request #8 from boegel/fix-lib-dual-symlink
add extra test case for make_module_req
2 parents cf06d01 + 3884c02 commit a9484c8

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

test/framework/easyblock.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from easybuild.tools.config import get_module_syntax, update_build_option
5353
from easybuild.tools.environment import modify_env
5454
from easybuild.tools.filetools import change_dir, copy_dir, copy_file, mkdir, read_file, remove_dir, remove_file
55-
from easybuild.tools.filetools import verify_checksum, write_file
55+
from easybuild.tools.filetools import symlink, verify_checksum, write_file
5656
from easybuild.tools.module_generator import module_generator
5757
from easybuild.tools.modules import EnvironmentModules, Lmod, ModEnvVarType, reset_module_caches
5858
from easybuild.tools.version import get_git_revision, this_is_easybuild
@@ -627,6 +627,43 @@ def test_make_module_req(self):
627627
logtxt = read_file(eb.logfile)
628628
self.assertTrue(re.search(r"WARNING Non-path variables found in module load env.*NONPATH", logtxt, re.M))
629629

630+
delattr(eb.module_load_environment, 'NONPATH')
631+
632+
# make sure that entries that symlink to another directory are retained;
633+
# the test case inspired by the directory structure for old imkl versions (like 2020.4)
634+
remove_dir(eb.installdir)
635+
636+
# lib/ symlinked to libraries/
637+
real_libdir = os.path.join(eb.installdir, 'libraries')
638+
mkdir(real_libdir, parents=True)
639+
symlink(real_libdir, os.path.join(eb.installdir, 'lib'))
640+
641+
# lib/intel64/ symlinked to lib/intel64_lin/
642+
mkdir(os.path.join(eb.installdir, 'lib', 'intel64_lin'), parents=True)
643+
symlink(os.path.join(eb.installdir, 'lib', 'intel64_lin'), os.path.join(eb.installdir, 'lib', 'intel64'))
644+
645+
# library file present in lib/intel64
646+
write_file(os.path.join(eb.installdir, 'lib', 'intel64', 'libfoo.so'), 'libfoo.so')
647+
648+
# lib64/ symlinked to lib/
649+
symlink(os.path.join(eb.installdir, 'lib'), os.path.join(eb.installdir, 'lib64'))
650+
651+
eb.module_load_environment.LD_LIBRARY_PATH = [os.path.join('lib', 'intel64')]
652+
eb.module_load_environment.LIBRARY_PATH = eb.module_load_environment.LD_LIBRARY_PATH
653+
with eb.module_generator.start_module_creation():
654+
txt = eb.make_module_req()
655+
656+
if get_module_syntax() == 'Tcl':
657+
self.assertTrue(re.search(r"^prepend-path\s+LD_LIBRARY_PATH\s+\$root/lib/intel64$", txt, re.M))
658+
self.assertTrue(re.search(r"^prepend-path\s+LIBRARY_PATH\s+\$root/lib/intel64\n$", txt, re.M))
659+
elif get_module_syntax() == 'Lua':
660+
self.assertTrue(re.search(r'^prepend_path\("LD_LIBRARY_PATH", pathJoin\(root, "lib/intel64"\)\)$',
661+
txt, re.M))
662+
self.assertTrue(re.search(r'^prepend_path\("LIBRARY_PATH", pathJoin\(root, "lib/intel64"\)\)$',
663+
txt, re.M))
664+
else:
665+
self.fail("Unknown module syntax: %s" % get_module_syntax())
666+
630667
# cleanup
631668
eb.close_log()
632669
os.remove(eb.logfile)

0 commit comments

Comments
 (0)