Skip to content

Commit d57a64a

Browse files
committed
Expand test to test if wrappers can be put in place for a toolchain for which the fortran compilers are 'None', such as Clang
1 parent aae2bf4 commit d57a64a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/framework/toolchain.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,26 @@ def test_toolchain_prepare_rpath(self):
26172617
# any other available 'g++' commands should not be a wrapper or our fake g++
26182618
self.assertFalse(any(os.path.samefile(x, fake_gxx) for x in res[2:]))
26192619

2620+
# Check that we can create a wrapper for a toolchain for which self.compilers() returns 'None' for the Fortran
2621+
# compilers (i.e. Clang)
2622+
fake_clang = os.path.join(self.test_prefix, 'fake', 'clang')
2623+
write_file(fake_clang, '#!/bin/bash\necho "$@"')
2624+
adjust_permissions(fake_clang, stat.S_IXUSR)
2625+
tc_clang = self.get_toolchain('clang', version='13.0.1')
2626+
tc_clang.prepare()
2627+
2628+
# Check that the clang wrapper is indeed in place
2629+
res = which('clang', retain_all=True)
2630+
# there should be at least 2 hits: the RPATH wrapper, and our fake 'clang' command (there may be real ones too)
2631+
self.assertTrue(len(res) >= 2)
2632+
self.assertTrue(tc_clang.is_rpath_wrapper(res[0]))
2633+
self.assertEqual(os.path.basename(res[0]), 'clang')
2634+
self.assertEqual(os.path.basename(os.path.dirname(res[0])), 'clang_wrapper')
2635+
self.assertFalse(any(tc_clang.is_rpath_wrapper(x) for x in res[1:]))
2636+
self.assertTrue(os.path.samefile(res[1], fake_clang))
2637+
# any other available 'clang' commands should not be a wrapper or our fake clang
2638+
self.assertFalse(any(os.path.samefile(x, fake_clang) for x in res[2:]))
2639+
26202640
# RPATH wrapper should be robust against Python environment variables & site-packages magic,
26212641
# so we set up a weird environment here to verify that
26222642
# (see https://github.com/easybuilders/easybuild-framework/issues/3421)

0 commit comments

Comments
 (0)