Skip to content

Commit badc27c

Browse files
authored
Merge pull request #4395 from Flamefire/fix-try-toolchain
use source toolchain version when passing only `--try-toolchain`
2 parents ea8433d + 9613d9f commit badc27c

File tree

5 files changed

+50
-9
lines changed

5 files changed

+50
-9
lines changed

easybuild/tools/options.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,11 +1735,13 @@ def process_software_build_specs(options):
17351735
})
17361736

17371737
# provide both toolchain and toolchain_name/toolchain_version keys
1738-
if 'toolchain_name' in build_specs:
1738+
try:
17391739
build_specs['toolchain'] = {
17401740
'name': build_specs['toolchain_name'],
1741-
'version': build_specs.get('toolchain_version', None),
1741+
'version': build_specs['toolchain_version'],
17421742
}
1743+
except KeyError:
1744+
pass # Don't set toolchain key if we don't have both keys
17431745

17441746
# process --amend and --try-amend
17451747
if options.amend or options.try_amend:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This is an easyconfig file for EasyBuild, see http://easybuilders.github.io/easybuild
2+
easyblock = 'Toolchain'
3+
4+
name = 'iimpi'
5+
version = '2018a'
6+
7+
homepage = 'https://software.intel.com/parallel-studio-xe'
8+
description = """Intel C/C++ and Fortran compilers, alongside Intel MPI."""
9+
10+
toolchain = SYSTEM
11+
12+
local_compver = '2016.1.150'
13+
local_suff = '-GCC-4.9.3-2.25'
14+
dependencies = [
15+
('icc', local_compver, local_suff),
16+
('ifort', local_compver, local_suff),
17+
('impi', '5.1.2.150', '', ('iccifort', '%s%s' % (local_compver, local_suff))),
18+
]
19+
20+
moduleclass = 'toolchain'

test/framework/easyconfigs/test_ecs/i/intel/intel-2018a.eb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ description = """Intel Cluster Toolkit Compiler Edition provides Intel C/C++ and
88

99
toolchain = SYSTEM
1010

11+
local_compver = '2016.1.150'
12+
local_gccver = '4.9.3'
13+
local_binutilsver = '2.25'
14+
local_gccsuff = '-GCC-%s-%s' % (local_gccver, local_binutilsver)
1115
# fake intel toolchain easyconfig, no dependencies (good enough for testing)
1216
local_fake_dependencies = [
13-
('GCCcore', '6.4.0'),
14-
('binutils', '2.28', '-GCCcore-6.4.0'),
15-
('icc', '2018.1.163', '-GCCcore-6.4.0'),
16-
('ifort', '2018.1.163', '-GCCcore-6.4.0'),
17-
('impi', '2018.1.163', '', ('iccifort', '2018.1.163-GCCcore-6.4.0')),
18-
('imkl', '2018.1.163', '', ('iimpi', version)),
17+
('GCCcore', local_gccver),
18+
('binutils', local_binutilsver, '-GCCcore-%s' % local_gccver),
19+
('icc', local_compver, local_gccsuff),
20+
('ifort', local_compver, local_gccsuff),
21+
('impi', '5.1.2.150', '', ('iccifort', '%s%s' % (local_compver, local_gccsuff))),
1922
]
2023

2124
moduleclass = 'toolchain'

test/framework/filetools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ def test_index_functions(self):
24012401
# test with specified path with and without trailing '/'s
24022402
for path in [test_ecs, test_ecs + '/', test_ecs + '//']:
24032403
index = ft.create_index(path)
2404-
self.assertEqual(len(index), 91)
2404+
self.assertEqual(len(index), 92)
24052405

24062406
expected = [
24072407
os.path.join('b', 'bzip2', 'bzip2-1.0.6-GCC-4.9.2.eb'),

test/framework/options.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,22 @@ def test_try(self):
24202420
allargs = args + ['--software-version=1.2.3', '--toolchain=gompi,2018a']
24212421
self.assertErrorRegex(EasyBuildError, "version .* not available", self.eb_main, allargs, raise_error=True)
24222422

2423+
# Try changing only name or version of toolchain
2424+
args.pop(0) # Remove EC filename
2425+
foss_toy_ec = os.path.join(self.test_buildpath, 'toy-0.0-foss-2018a.eb')
2426+
copy_file(os.path.join(ecs_path, 't', 'toy', 'toy-0.0-gompi-2018a.eb'), foss_toy_ec)
2427+
write_file(foss_toy_ec, "toolchain['name'] = 'foss'", append=True)
2428+
2429+
test_cases = [
2430+
(['toy-0.0-gompi-2018a.eb', '--try-toolchain-name=intel'], 'toy/0.0-iimpi-2018a'),
2431+
([foss_toy_ec, '--try-toolchain-name=intel'], 'toy/0.0-intel-2018a'),
2432+
(['toy-0.0-gompi-2018a.eb', '--try-toolchain-version=2018b'], 'toy/0.0-gompi-2018b'),
2433+
]
2434+
for extra_args, mod in test_cases:
2435+
outtxt = self.eb_main(args + extra_args, verbose=True, raise_error=True)
2436+
mod_regex = re.compile(r"\(module: %s\)$" % mod, re.M)
2437+
self.assertTrue(mod_regex.search(outtxt), "Pattern %s found in %s" % (mod_regex.pattern, outtxt))
2438+
24232439
def test_try_with_copy(self):
24242440
"""Test whether --try options are taken into account."""
24252441
ecs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs')

0 commit comments

Comments
 (0)