|
56 | 56 | from easybuild.tools.toolchain.mpi import get_mpi_cmd_template |
57 | 57 | from easybuild.tools.toolchain.toolchain import env_vars_external_module |
58 | 58 | from easybuild.tools.toolchain.utilities import get_toolchain, search_toolchain |
| 59 | +from easybuild.toolchains.compiler.clang import Clang |
59 | 60 |
|
60 | 61 | easybuild.tools.toolchain.compiler.systemtools.get_compiler_family = lambda: st.POWER |
61 | 62 |
|
@@ -2617,6 +2618,26 @@ def test_toolchain_prepare_rpath(self): |
2617 | 2618 | # any other available 'g++' commands should not be a wrapper or our fake g++ |
2618 | 2619 | self.assertFalse(any(os.path.samefile(x, fake_gxx) for x in res[2:])) |
2619 | 2620 |
|
| 2621 | + # Check that we can create a wrapper for a toolchain for which self.compilers() returns 'None' for the Fortran |
| 2622 | + # compilers (i.e. Clang) |
| 2623 | + fake_clang = os.path.join(self.test_prefix, 'fake', 'clang') |
| 2624 | + write_file(fake_clang, '#!/bin/bash\necho "$@"') |
| 2625 | + adjust_permissions(fake_clang, stat.S_IXUSR) |
| 2626 | + tc_clang = Clang(name='Clang', version='1') |
| 2627 | + tc_clang.prepare_rpath_wrappers() |
| 2628 | + |
| 2629 | + # Check that the clang wrapper is indeed in place |
| 2630 | + res = which('clang', retain_all=True) |
| 2631 | + # there should be at least 2 hits: the RPATH wrapper, and our fake 'clang' command (there may be real ones too) |
| 2632 | + self.assertTrue(len(res) >= 2) |
| 2633 | + self.assertTrue(tc_clang.is_rpath_wrapper(res[0])) |
| 2634 | + self.assertEqual(os.path.basename(res[0]), 'clang') |
| 2635 | + self.assertEqual(os.path.basename(os.path.dirname(res[0])), 'clang_wrapper') |
| 2636 | + self.assertFalse(any(tc_clang.is_rpath_wrapper(x) for x in res[1:])) |
| 2637 | + self.assertTrue(os.path.samefile(res[1], fake_clang)) |
| 2638 | + # any other available 'clang' commands should not be a wrapper or our fake clang |
| 2639 | + self.assertFalse(any(os.path.samefile(x, fake_clang) for x in res[2:])) |
| 2640 | + |
2620 | 2641 | # RPATH wrapper should be robust against Python environment variables & site-packages magic, |
2621 | 2642 | # so we set up a weird environment here to verify that |
2622 | 2643 | # (see https://github.com/easybuilders/easybuild-framework/issues/3421) |
|
0 commit comments