@@ -4265,54 +4265,128 @@ def test_list_prs(self):
42654265
42664266 def test_list_software (self ):
42674267 """Test --list-software and --list-installed-software."""
4268- test_ecs = os .path .join (os .path .dirname (os .path .abspath (__file__ )), 'easyconfigs' , 'v1.0' )
4269- args = [
4270- '--list-software' ,
4271- '--robot-paths=%s' % test_ecs ,
4272- ]
4273- txt , _ = self ._run_mock_eb (args , do_build = True , raise_error = True , testing = False )
4274- expected = '\n ' .join ([
4275- "== Processed 5/5 easyconfigs..." ,
4276- "== Found 2 different software packages" ,
4277- '' ,
4278- "* GCC" ,
4279- "* gzip" ,
4280- '' ,
4268+
4269+ # copy selected test easyconfigs for testing --list-*software options with;
4270+ # full test is a nuisance, because all dependencies must be available and toolchains like intel must have
4271+ # all expected components when testing with HierarchicalMNS (which the test easyconfigs don't always have)
4272+ topdir = os .path .dirname (os .path .abspath (__file__ ))
4273+
4274+ cray_ec = os .path .join (topdir , 'easyconfigs' , 'test_ecs' , 'c' , 'CrayCCE' , 'CrayCCE-5.1.29.eb' )
4275+ gcc_ec = os .path .join (topdir , 'easyconfigs' , 'test_ecs' , 'g' , 'GCC' , 'GCC-4.6.3.eb' )
4276+ gzip_ec = os .path .join (topdir , 'easyconfigs' , 'v1.0' , 'g' , 'gzip' , 'gzip-1.4-GCC-4.6.3.eb' )
4277+ gzip_system_ec = os .path .join (topdir , 'easyconfigs' , 'v1.0' , 'g' , 'gzip' , 'gzip-1.4.eb' )
4278+
4279+ test_ecs = os .path .join (self .test_prefix , 'test_ecs' )
4280+ for ec in [cray_ec , gcc_ec , gzip_ec , gzip_system_ec ]:
4281+ subdirs = os .path .dirname (ec ).split (os .path .sep )[- 2 :]
4282+ target_dir = os .path .join (test_ecs , * subdirs )
4283+ mkdir (target_dir , parents = True )
4284+ copy_file (ec , target_dir )
4285+
4286+ # add (fake) HPL easyconfig using CrayCCE toolchain
4287+ # (required to trigger bug reported in https://github.com/easybuilders/easybuild-framework/issues/3265)
4288+ hpl_cray_ec_txt = '\n ' .join ([
4289+ 'easyblock = "ConfigureMake"' ,
4290+ 'name = "HPL"' ,
4291+ 'version = "2.3"' ,
4292+ "homepage = 'http://www.netlib.org/benchmark/hpl/'" ,
4293+ 'description = "HPL"' ,
4294+ 'toolchain = {"name": "CrayCCE", "version": "5.1.29"}' ,
42814295 ])
4282- self .assertTrue (txt .endswith (expected ))
4296+ hpl_cray_ec = os .path .join (self .test_prefix , 'test_ecs' , 'h' , 'HPL' , 'HPL-2.3-CrayCCE-5.1.29.eb' )
4297+ write_file (hpl_cray_ec , hpl_cray_ec_txt )
42834298
4284- args = [
4285- '--list-software=detailed' ,
4286- '--output-format=rst' ,
4287- '--robot-paths=%s' % test_ecs ,
4288- ]
4289- txt , _ = self ._run_mock_eb (args , testing = False )
4290- self .assertTrue (re .search (r'^\*GCC\*' , txt , re .M ))
4291- self .assertTrue (re .search (r'^``4.6.3``\s+``system``' , txt , re .M ))
4292- self .assertTrue (re .search (r'^\*gzip\*' , txt , re .M ))
4293- self .assertTrue (re .search (r'^``1.5``\s+``foss/2018a``,\s+``intel/2018a``' , txt , re .M ))
4299+ # put dummy Core/GCC/4.6.3 in place
4300+ modpath = os .path .join (self .test_prefix , 'modules' )
4301+ write_file (os .path .join (modpath , 'Core' , 'GCC' , '4.6.3' ), '#%Module' )
4302+ self .modtool .use (modpath )
42944303
4295- args = [
4296- '--list-installed-software' ,
4297- '--output-format=rst' ,
4298- '--robot-paths=%s' % test_ecs ,
4299- ]
4300- txt , _ = self ._run_mock_eb (args , testing = False , raise_error = True )
4301- self .assertTrue (re .search (r'== Processed 5/5 easyconfigs...' , txt , re .M ))
4302- self .assertTrue (re .search (r'== Found 2 different software packages' , txt , re .M ))
4303- self .assertTrue (re .search (r'== Retained 1 installed software packages' , txt , re .M ))
4304- self .assertTrue (re .search (r'^\* GCC' , txt , re .M ))
4305- self .assertFalse (re .search (r'gzip' , txt , re .M ))
4304+ # test with different module naming scheme active
4305+ # (see https://github.com/easybuilders/easybuild-framework/issues/3265)
4306+ for mns in ['EasyBuildMNS' , 'HierarchicalMNS' ]:
43064307
4307- args = [
4308- '--list-installed-software=detailed' ,
4309- '--robot-paths=%s' % test_ecs ,
4310- ]
4311- txt , _ = self ._run_mock_eb (args , testing = False )
4312- self .assertTrue (re .search (r'^== Retained 1 installed software packages' , txt , re .M ))
4313- self .assertTrue (re .search (r'^\* GCC' , txt , re .M ))
4314- self .assertTrue (re .search (r'^\s+\* GCC v4.6.3: system' , txt , re .M ))
4315- self .assertFalse (re .search (r'gzip' , txt , re .M ))
4308+ args = [
4309+ '--list-software' ,
4310+ '--robot-paths=%s' % test_ecs ,
4311+ '--module-naming-scheme=%s' % mns ,
4312+ ]
4313+ txt , _ = self ._run_mock_eb (args , do_build = True , raise_error = True , testing = False , verbose = True )
4314+
4315+ patterns = [
4316+ r"^.*\s*== Processed 5/5 easyconfigs..." ,
4317+ r"^== Found 4 different software packages" ,
4318+ r"^\* CrayCCE" ,
4319+ r"^\* GCC" ,
4320+ r"^\* gzip" ,
4321+ r"^\* HPL" ,
4322+ ]
4323+ for pattern in patterns :
4324+ regex = re .compile (pattern , re .M )
4325+ self .assertTrue (regex .search (txt ), "Pattern '%s' found in: %s" % (regex .pattern , txt ))
4326+
4327+ args = [
4328+ '--list-software=detailed' ,
4329+ '--output-format=rst' ,
4330+ '--robot-paths=%s' % test_ecs ,
4331+ '--module-naming-scheme=%s' % mns ,
4332+ ]
4333+ txt , _ = self ._run_mock_eb (args , testing = False , raise_error = True , verbose = True )
4334+
4335+ patterns = [
4336+ r"^.*\s*== Processed 5/5 easyconfigs..." ,
4337+ r"^== Found 4 different software packages" ,
4338+ r'^\*CrayCCE\*' ,
4339+ r'^``5.1.29``\s+``system``' ,
4340+ r'^\*GCC\*' ,
4341+ r'^``4.6.3``\s+``system``' ,
4342+ r'^\*gzip\*' ,
4343+ r'^``1.4`` ``GCC/4.6.3``, ``system``' ,
4344+ ]
4345+ for pattern in patterns :
4346+ regex = re .compile (pattern , re .M )
4347+ self .assertTrue (regex .search (txt ), "Pattern '%s' found in: %s" % (regex .pattern , txt ))
4348+
4349+ args = [
4350+ '--list-installed-software' ,
4351+ '--output-format=rst' ,
4352+ '--robot-paths=%s' % test_ecs ,
4353+ '--module-naming-scheme=%s' % mns ,
4354+ ]
4355+ txt , _ = self ._run_mock_eb (args , testing = False , raise_error = True , verbose = True )
4356+
4357+ patterns = [
4358+ r"^.*\s*== Processed 5/5 easyconfigs..." ,
4359+ r"^== Found 4 different software packages" ,
4360+ r"^== Retained 1 installed software packages" ,
4361+ r'^\* GCC' ,
4362+ ]
4363+ for pattern in patterns :
4364+ regex = re .compile (pattern , re .M )
4365+ self .assertTrue (regex .search (txt ), "Pattern '%s' found in: %s" % (regex .pattern , txt ))
4366+
4367+ self .assertFalse (re .search (r'gzip' , txt , re .M ))
4368+ self .assertFalse (re .search (r'CrayCCE' , txt , re .M ))
4369+
4370+ args = [
4371+ '--list-installed-software=detailed' ,
4372+ '--robot-paths=%s' % test_ecs ,
4373+ '--module-naming-scheme=%s' % mns ,
4374+ ]
4375+ txt , _ = self ._run_mock_eb (args , testing = False , raise_error = True , verbose = True )
4376+
4377+ patterns = [
4378+ r"^.*\s*== Processed 5/5 easyconfigs..." ,
4379+ r"^== Found 4 different software packages" ,
4380+ r"^== Retained 1 installed software packages" ,
4381+ r'^\* GCC' ,
4382+ r'^\s+\* GCC v4.6.3: system' ,
4383+ ]
4384+ for pattern in patterns :
4385+ regex = re .compile (pattern , re .M )
4386+ self .assertTrue (regex .search (txt ), "Pattern '%s' found in: %s" % (regex .pattern , txt ))
4387+
4388+ self .assertFalse (re .search (r'gzip' , txt , re .M ))
4389+ self .assertFalse (re .search (r'CrayCCE' , txt , re .M ))
43164390
43174391 def test_parse_optarch (self ):
43184392 """Test correct parsing of optarch option."""
0 commit comments