|
52 | 52 | from easybuild.tools.config import get_module_syntax, update_build_option
|
53 | 53 | from easybuild.tools.environment import modify_env
|
54 | 54 | 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 |
56 | 56 | from easybuild.tools.module_generator import module_generator
|
57 | 57 | from easybuild.tools.modules import EnvironmentModules, Lmod, ModEnvVarType, reset_module_caches
|
58 | 58 | from easybuild.tools.version import get_git_revision, this_is_easybuild
|
@@ -627,6 +627,43 @@ def test_make_module_req(self):
|
627 | 627 | logtxt = read_file(eb.logfile)
|
628 | 628 | self.assertTrue(re.search(r"WARNING Non-path variables found in module load env.*NONPATH", logtxt, re.M))
|
629 | 629 |
|
| 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 | + |
630 | 667 | # cleanup
|
631 | 668 | eb.close_log()
|
632 | 669 | os.remove(eb.logfile)
|
|
0 commit comments