@@ -4302,6 +4302,42 @@ def test_toy_python(self):
43024302 self .assertTrue (ebpythonprefixes_regex .search (toy_mod_txt ),
43034303 f"Pattern '{ ebpythonprefixes_regex .pattern } ' found in: { toy_mod_txt } " )
43044304
4305+ def test_toy_multiple_ecs_module (self ):
4306+ """
4307+ Verify whether module file is correct when multiple easyconfigs are being installed.
4308+ """
4309+ test_ecs = os .path .join (os .path .dirname (os .path .abspath (__file__ )), 'easyconfigs' , 'test_ecs' )
4310+ toy_ec = os .path .join (test_ecs , 't' , 'toy' , 'toy-0.0.eb' )
4311+
4312+ # modify 'toy' easyconfig so toy-headers subdirectory is created,
4313+ # which is taken into account by EB_toy easyblock for $CPATH
4314+ test_toy_ec = os .path .join (self .test_prefix , 'test-toy.eb' )
4315+ toy_ec_txt = read_file (toy_ec )
4316+ toy_ec_txt += "\n postinstallcmds += ['mkdir %(installdir)s/toy-headers']"
4317+ toy_ec_txt += "\n postinstallcmds += ['touch %(installdir)s/toy-headers/toy.h']"
4318+ write_file (test_toy_ec , toy_ec_txt )
4319+
4320+ # modify 'toy-app' easyconfig so toy-headers subdirectory is created,
4321+ # which is consider by EB_toy easyblock for $CPATH,
4322+ # but should *not* be actually used because software name is not 'toy'
4323+ toy_app_ec = os .path .join (test_ecs , 't' , 'toy-app' , 'toy-app-0.0.eb' )
4324+ test_toy_app_ec = os .path .join (self .test_prefix , 'test-toy-app.eb' )
4325+ toy_ec_txt = read_file (toy_app_ec )
4326+ toy_ec_txt += "\n postinstallcmds += ['mkdir %(installdir)s/toy-headers']"
4327+ toy_ec_txt += "\n postinstallcmds += ['touch %(installdir)s/toy-headers/toy.h']"
4328+ write_file (test_toy_app_ec , toy_ec_txt )
4329+
4330+ self .run_test_toy_build_with_output (ec_file = test_toy_ec , extra_args = [test_toy_app_ec ])
4331+
4332+ toy_modtxt = read_file (os .path .join (self .test_installpath , 'modules' , 'all' , 'toy' , '0.0.lua' ))
4333+ regex = re .compile ('prepend[-_]path.*CPATH.*toy-headers' , re .M )
4334+ self .assertTrue (regex .search (toy_modtxt ),
4335+ f"Pattern '{ regex .pattern } ' should be found in: { toy_modtxt } " )
4336+
4337+ toy_app_modtxt = read_file (os .path .join (self .test_installpath , 'modules' , 'all' , 'toy-app' , '0.0.lua' ))
4338+ self .assertFalse (regex .search (toy_app_modtxt ),
4339+ f"Pattern '{ regex .pattern } ' should *not* be found in: { toy_app_modtxt } " )
4340+
43054341
43064342def suite ():
43074343 """ return all the tests in this file """
0 commit comments