def test_exclude_path_to_top_of_module_tree(self): """ Make sure that modules under the HierarchicalMNS are correct, w.r.t. not including any load statements for modules that build up the path to the top of the module tree. """ self.orig_module_naming_scheme = config.get_module_naming_scheme() test_ecs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs') all_stops = [x[0] for x in EasyBlock.get_steps()] build_options = { 'check_osdeps': False, 'robot_path': [test_ecs_path], 'valid_stops': all_stops, 'validate': False, } os.environ['EASYBUILD_MODULE_NAMING_SCHEME'] = 'HierarchicalMNS' init_config(build_options=build_options) self.setup_hierarchical_modules() modfile_prefix = os.path.join(self.test_installpath, 'modules', 'all') mkdir(os.path.join(modfile_prefix, 'Compiler', 'GCC', '4.8.3'), parents=True) mkdir(os.path.join(modfile_prefix, 'MPI', 'intel', '2013.5.192-GCC-4.8.3', 'impi', '4.1.3.049'), parents=True) impi_modfile_path = os.path.join('Compiler', 'intel', '2013.5.192-GCC-4.8.3', 'impi', '4.1.3.049') imkl_modfile_path = os.path.join('MPI', 'intel', '2013.5.192-GCC-4.8.3', 'impi', '4.1.3.049', 'imkl', '11.1.2.144') if get_module_syntax() == 'Lua': impi_modfile_path += '.lua' imkl_modfile_path += '.lua' # example: for imkl on top of iimpi toolchain with HierarchicalMNS, no module load statements should be included # not for the toolchain or any of the toolchain components, # since both icc/ifort and impi form the path to the top of the module tree tests = [ ('impi-4.1.3.049-iccifort-2013.5.192-GCC-4.8.3.eb', impi_modfile_path, ['icc', 'ifort', 'iccifort']), ('imkl-11.1.2.144-iimpi-5.5.3-GCC-4.8.3.eb', imkl_modfile_path, ['icc', 'ifort', 'impi', 'iccifort', 'iimpi']), ] for ec_file, modfile_path, excluded_deps in tests: ec = EasyConfig(os.path.join(test_ecs_path, ec_file)) eb = EasyBlock(ec) eb.toolchain.prepare() modpath = eb.make_module_step() modfile_path = os.path.join(modpath, modfile_path) modtxt = read_file(modfile_path) for dep in excluded_deps: tup = (dep, modfile_path, modtxt) failmsg = "No 'module load' statement found for '%s' not found in module %s: %s" % tup if get_module_syntax() == 'Tcl': self.assertFalse(re.search('module load %s' % dep, modtxt), failmsg) elif get_module_syntax() == 'Lua': self.assertFalse(re.search('load("%s")' % dep, modtxt), failmsg) else: self.assertTrue(False, "Unknown module syntax: %s" % get_module_syntax()) os.environ['EASYBUILD_MODULE_NAMING_SCHEME'] = self.orig_module_naming_scheme init_config(build_options=build_options)
def test_exclude_path_to_top_of_module_tree(self): """ Make sure that modules under the HierarchicalMNS are correct, w.r.t. not including any load statements for modules that build up the path to the top of the module tree. """ self.orig_module_naming_scheme = config.get_module_naming_scheme() test_ecs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs') all_stops = [x[0] for x in EasyBlock.get_steps()] build_options = { 'check_osdeps': False, 'robot_path': [test_ecs_path], 'valid_stops': all_stops, 'validate': False, } os.environ['EASYBUILD_MODULE_NAMING_SCHEME'] = 'HierarchicalMNS' init_config(build_options=build_options) self.setup_hierarchical_modules() modfile_prefix = os.path.join(self.test_installpath, 'modules', 'all') mkdir(os.path.join(modfile_prefix, 'Compiler', 'GCC', '4.8.3'), parents=True) mkdir(os.path.join(modfile_prefix, 'MPI', 'intel', '2013.5.192-GCC-4.8.3', 'impi', '4.1.3.049'), parents=True) impi_modfile_path = os.path.join('Compiler', 'intel', '2013.5.192-GCC-4.8.3', 'impi', '4.1.3.049') imkl_modfile_path = os.path.join('MPI', 'intel', '2013.5.192-GCC-4.8.3', 'impi', '4.1.3.049', 'imkl', '11.1.2.144') if get_module_syntax() == 'Lua': impi_modfile_path += '.lua' imkl_modfile_path += '.lua' # example: for imkl on top of iimpi toolchain with HierarchicalMNS, no module load statements should be included # not for the toolchain or any of the toolchain components, # since both icc/ifort and impi form the path to the top of the module tree tests = [ ('impi-4.1.3.049-iccifort-2013.5.192-GCC-4.8.3.eb', impi_modfile_path, ['icc', 'ifort', 'iccifort']), ('imkl-11.1.2.144-iimpi-5.5.3-GCC-4.8.3.eb', imkl_modfile_path, ['icc', 'ifort', 'impi', 'iccifort', 'iimpi']), ] for ec_file, modfile_path, excluded_deps in tests: ec = EasyConfig(os.path.join(test_ecs_path, ec_file)) eb = EasyBlock(ec) eb.toolchain.prepare() modpath = eb.make_module_step() modfile_path = os.path.join(modpath, modfile_path) modtxt = read_file(modfile_path) for dep in excluded_deps: tup = (dep, modfile_path, modtxt) failmsg = "No 'module load' statement found for '%s' not found in module %s: %s" % tup if get_module_syntax() == 'Tcl': self.assertFalse(re.search('module load %s' % dep, modtxt), failmsg) elif get_module_syntax() == 'Lua': self.assertFalse(re.search('load("%s")' % dep, modtxt), failmsg) else: self.assertTrue(False, "Unknown module syntax: %s" % get_module_syntax()) os.environ['EASYBUILD_MODULE_NAMING_SCHEME'] = self.orig_module_naming_scheme init_config(build_options=build_options)
def get_custom_module_naming_scheme(): """ Get custom module naming scheme as specified in configuration. """ avail_mnss = avail_module_naming_schemes() _log.debug("List of available module naming schemes: %s" % avail_mnss.keys()) sel_mns = config.get_module_naming_scheme() if sel_mns in avail_mnss: return avail_mnss[sel_mns]() else: _log.error("Selected module naming scheme %s could not be found in %s" % (sel_mns, avail_mnss.keys()))
def test_exclude_path_to_top_of_module_tree(self): """ Make sure that modules under the HierarchicalMNS are correct, w.r.t. not including any load statements for modules that build up the path to the top of the module tree. """ self.orig_module_naming_scheme = config.get_module_naming_scheme() test_ecs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "easyconfigs") all_stops = [x[0] for x in EasyBlock.get_steps()] build_options = { "check_osdeps": False, "robot_path": [test_ecs_path], "valid_stops": all_stops, "validate": False, } os.environ["EASYBUILD_MODULE_NAMING_SCHEME"] = "HierarchicalMNS" init_config(build_options=build_options) self.setup_hierarchical_modules() modtool = modules_tool() modfile_prefix = os.path.join(self.test_installpath, "modules", "all") mkdir(os.path.join(modfile_prefix, "Compiler", "GCC", "4.8.3"), parents=True) mkdir(os.path.join(modfile_prefix, "MPI", "intel", "2013.5.192-GCC-4.8.3", "impi", "4.1.3.049"), parents=True) impi_modfile_path = os.path.join("Compiler", "intel", "2013.5.192-GCC-4.8.3", "impi", "4.1.3.049") imkl_modfile_path = os.path.join( "MPI", "intel", "2013.5.192-GCC-4.8.3", "impi", "4.1.3.049", "imkl", "11.1.2.144" ) # example: for imkl on top of iimpi toolchain with HierarchicalMNS, no module load statements should be included # not for the toolchain or any of the toolchain components, # since both icc/ifort and impi form the path to the top of the module tree tests = [ ("impi-4.1.3.049-iccifort-2013.5.192-GCC-4.8.3.eb", impi_modfile_path, ["icc", "ifort", "iccifort"]), ( "imkl-11.1.2.144-iimpi-5.5.3-GCC-4.8.3.eb", imkl_modfile_path, ["icc", "ifort", "impi", "iccifort", "iimpi"], ), ] for ec_file, modfile_path, excluded_deps in tests: ec = EasyConfig(os.path.join(test_ecs_path, ec_file)) eb = EasyBlock(ec) eb.toolchain.prepare() modpath = eb.make_module_step() modfile_path = os.path.join(modpath, modfile_path) modtxt = read_file(modfile_path) for imkl_dep in excluded_deps: tup = (imkl_dep, modfile_path, modtxt) failmsg = "No 'module load' statement found for '%s' not found in module %s: %s" % tup self.assertFalse(re.search("module load %s" % imkl_dep, modtxt), failmsg) os.environ["EASYBUILD_MODULE_NAMING_SCHEME"] = self.orig_module_naming_scheme init_config(build_options=build_options)
def __init__(self, *args, **kwargs): """Initialize logger.""" self.log = fancylogger.getLogger(self.__class__.__name__, fname=False) # determine active module naming scheme avail_mnss = avail_module_naming_schemes() self.log.debug("List of available module naming schemes: %s" % avail_mnss.keys()) sel_mns = get_module_naming_scheme() if sel_mns in avail_mnss: self.mns = avail_mnss[sel_mns]() else: self.log.error("Selected module naming scheme %s could not be found in %s" % (sel_mns, avail_mnss.keys()))
def setUp(self): """Test setup.""" super(ModuleGeneratorTest, self).setUp() # find .eb file eb_path = os.path.join(os.path.join(os.path.dirname(__file__), 'easyconfigs'), 'gzip-1.4.eb') eb_full_path = find_full_path(eb_path) self.assertTrue(eb_full_path) ec = EasyConfig(eb_full_path) self.eb = EasyBlock(ec) self.modgen = self.MODULE_GENERATOR_CLASS(self.eb) self.modgen.app.installdir = tempfile.mkdtemp(prefix='easybuild-modgen-test-') self.orig_module_naming_scheme = config.get_module_naming_scheme()
def setUp(self): """ initialize ModuleGenerator with test Application """ super(ModuleGeneratorTest, self).setUp() # find .eb file eb_path = os.path.join(os.path.join(os.path.dirname(__file__), 'easyconfigs'), 'gzip-1.4.eb') eb_full_path = find_full_path(eb_path) self.assertTrue(eb_full_path) ec = EasyConfig(eb_full_path) self.eb = EasyBlock(ec) self.modgen = ModuleGenerator(self.eb) self.modgen.app.installdir = tempfile.mkdtemp(prefix='easybuild-modgen-test-') self.orig_module_naming_scheme = config.get_module_naming_scheme()
def get_custom_module_naming_scheme(): """ Get custom module naming scheme as specified in configuration. """ avail_mnss = avail_module_naming_schemes() _log.debug("List of available module naming schemes: %s" % avail_mnss.keys()) sel_mns = config.get_module_naming_scheme() if sel_mns in avail_mnss: return avail_mnss[sel_mns]() else: _log.error( "Selected module naming scheme %s could not be found in %s" % (sel_mns, avail_mnss.keys()))
def setUp(self): """Test setup.""" super(ModuleGeneratorTest, self).setUp() # find .eb file topdir = os.path.dirname(os.path.abspath(__file__)) eb_path = os.path.join(topdir, 'easyconfigs', 'test_ecs', 'g', 'gzip', 'gzip-1.4.eb') eb_full_path = find_full_path(eb_path) self.assertTrue(eb_full_path) ec = EasyConfig(eb_full_path) self.eb = EasyBlock(ec) self.modgen = self.MODULE_GENERATOR_CLASS(self.eb) self.modgen.app.installdir = tempfile.mkdtemp(prefix='easybuild-modgen-test-') self.orig_module_naming_scheme = config.get_module_naming_scheme()
def setUp(self): """ initialize ModuleGenerator with test Application """ super(ModuleGeneratorTest, self).setUp() # find .eb file eb_path = os.path.join( os.path.join(os.path.dirname(__file__), 'easyconfigs'), 'gzip-1.4.eb') eb_full_path = find_full_path(eb_path) self.assertTrue(eb_full_path) ec = EasyConfig(eb_full_path) self.eb = EasyBlock(ec) self.modgen = ModuleGenerator(self.eb) self.modgen.app.installdir = tempfile.mkdtemp( prefix='easybuild-modgen-test-') self.orig_module_naming_scheme = config.get_module_naming_scheme()