|
57 | 57 | from easybuild.framework.easyconfig.parser import EasyConfigParser, fetch_parameters_from_easyconfig |
58 | 58 | from easybuild.framework.easyconfig.templates import template_constant_dict, to_template_str |
59 | 59 | from easybuild.framework.easyconfig.style import check_easyconfigs_style |
60 | | -from easybuild.framework.easyconfig.tools import categorize_files_by_type, check_sha256_checksums, dep_graph |
61 | | -from easybuild.framework.easyconfig.tools import det_copy_ec_specs, find_related_easyconfigs, get_paths_for |
| 60 | +from easybuild.framework.easyconfig.tools import alt_easyconfig_paths, categorize_files_by_type, check_sha256_checksums |
| 61 | +from easybuild.framework.easyconfig.tools import dep_graph, det_copy_ec_specs, find_related_easyconfigs, get_paths_for |
62 | 62 | from easybuild.framework.easyconfig.tools import parse_easyconfigs |
63 | | -from easybuild.framework.easyconfig.tweak import obtain_ec_for, tweak_one |
| 63 | +from easybuild.framework.easyconfig.tweak import obtain_ec_for, tweak, tweak_one |
64 | 64 | from easybuild.framework.extension import resolve_exts_filter_template |
65 | 65 | from easybuild.toolchains.system import SystemToolchain |
66 | 66 | from easybuild.tools.build_log import EasyBuildError |
|
73 | 73 | from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version |
74 | 74 | from easybuild.tools.options import parse_external_modules_metadata |
75 | 75 | from easybuild.tools.py2vs3 import OrderedDict, reload |
76 | | -from easybuild.tools.robot import resolve_dependencies |
| 76 | +from easybuild.tools.robot import det_robot_path, resolve_dependencies |
77 | 77 | from easybuild.tools.systemtools import AARCH64, KNOWN_ARCH_CONSTANTS, POWER, X86_64 |
78 | 78 | from easybuild.tools.systemtools import get_cpu_architecture, get_shared_lib_ext, get_os_name, get_os_version |
79 | 79 |
|
@@ -728,6 +728,38 @@ def test_tweaking(self): |
728 | 728 | # cleanup |
729 | 729 | os.remove(tweaked_fn) |
730 | 730 |
|
| 731 | + def test_tweak_multiple_tcs(self): |
| 732 | + """Test that tweaking variables of ECs from multiple toolchains works""" |
| 733 | + test_easyconfigs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') |
| 734 | + |
| 735 | + # Create directories to store the tweaked easyconfigs |
| 736 | + tweaked_ecs_paths, pr_path = alt_easyconfig_paths(self.test_prefix, tweaked_ecs=True) |
| 737 | + robot_path = det_robot_path([test_easyconfigs], tweaked_ecs_paths, pr_path, auto_robot=True) |
| 738 | + |
| 739 | + init_config(build_options={ |
| 740 | + 'valid_module_classes': module_classes(), |
| 741 | + 'robot_path': robot_path, |
| 742 | + 'check_osdeps': False, |
| 743 | + }) |
| 744 | + |
| 745 | + # Allow tweaking of non-toolchain values for multiple ECs of different toolchains |
| 746 | + untweaked_openmpi_1 = os.path.join(test_easyconfigs, 'o', 'OpenMPI', 'OpenMPI-2.1.2-GCC-4.6.4.eb') |
| 747 | + untweaked_openmpi_2 = os.path.join(test_easyconfigs, 'o', 'OpenMPI', 'OpenMPI-3.1.1-GCC-7.3.0-2.30.eb') |
| 748 | + easyconfigs, _ = parse_easyconfigs([(untweaked_openmpi_1, False), (untweaked_openmpi_2, False)]) |
| 749 | + tweak_specs = {'moduleclass': 'debugger'} |
| 750 | + easyconfigs = tweak(easyconfigs, tweak_specs, self.modtool, targetdirs=tweaked_ecs_paths) |
| 751 | + # Check that all expected tweaked easyconfigs exists |
| 752 | + tweaked_openmpi_1 = os.path.join(tweaked_ecs_paths[0], os.path.basename(untweaked_openmpi_1)) |
| 753 | + tweaked_openmpi_2 = os.path.join(tweaked_ecs_paths[0], os.path.basename(untweaked_openmpi_2)) |
| 754 | + self.assertTrue(os.path.isfile(tweaked_openmpi_1)) |
| 755 | + self.assertTrue(os.path.isfile(tweaked_openmpi_2)) |
| 756 | + tweaked_openmpi_content_1 = read_file(tweaked_openmpi_1) |
| 757 | + tweaked_openmpi_content_2 = read_file(tweaked_openmpi_2) |
| 758 | + self.assertTrue('moduleclass = "debugger"' in tweaked_openmpi_content_1, |
| 759 | + "Tweaked value not found in " + tweaked_openmpi_content_1) |
| 760 | + self.assertTrue('moduleclass = "debugger"' in tweaked_openmpi_content_2, |
| 761 | + "Tweaked value not found in " + tweaked_openmpi_content_2) |
| 762 | + |
731 | 763 | def test_installversion(self): |
732 | 764 | """Test generation of install version.""" |
733 | 765 |
|
|
0 commit comments