Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use source toolchain version when passing only --try-toolchain #4395

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1735,11 +1735,13 @@ def process_software_build_specs(options):
})

# provide both toolchain and toolchain_name/toolchain_version keys
if 'toolchain_name' in build_specs:
try:
build_specs['toolchain'] = {
'name': build_specs['toolchain_name'],
'version': build_specs.get('toolchain_version', None),
'version': build_specs['toolchain_version'],
}
except KeyError:
pass # Don't set toolchain key if we don't have both keys

# process --amend and --try-amend
if options.amend or options.try_amend:
Expand Down
20 changes: 20 additions & 0 deletions test/framework/easyconfigs/test_ecs/i/iimpi/iimpi-2018a.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This is an easyconfig file for EasyBuild, see http://easybuilders.github.io/easybuild
easyblock = 'Toolchain'

name = 'iimpi'
version = '2018a'

homepage = 'https://software.intel.com/parallel-studio-xe'
description = """Intel C/C++ and Fortran compilers, alongside Intel MPI."""

toolchain = SYSTEM

local_compver = '2016.1.150'
local_suff = '-GCC-4.9.3-2.25'
dependencies = [
('icc', local_compver, local_suff),
('ifort', local_compver, local_suff),
('impi', '5.1.2.150', '', ('iccifort', '%s%s' % (local_compver, local_suff))),
]

moduleclass = 'toolchain'
15 changes: 9 additions & 6 deletions test/framework/easyconfigs/test_ecs/i/intel/intel-2018a.eb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ description = """Intel Cluster Toolkit Compiler Edition provides Intel C/C++ and

toolchain = SYSTEM

local_compver = '2016.1.150'
local_gccver = '4.9.3'
local_binutilsver = '2.25'
local_gccsuff = '-GCC-%s-%s' % (local_gccver, local_binutilsver)
# fake intel toolchain easyconfig, no dependencies (good enough for testing)
local_fake_dependencies = [
('GCCcore', '6.4.0'),
('binutils', '2.28', '-GCCcore-6.4.0'),
('icc', '2018.1.163', '-GCCcore-6.4.0'),
('ifort', '2018.1.163', '-GCCcore-6.4.0'),
('impi', '2018.1.163', '', ('iccifort', '2018.1.163-GCCcore-6.4.0')),
('imkl', '2018.1.163', '', ('iimpi', version)),
('GCCcore', local_gccver),
('binutils', local_binutilsver, '-GCCcore-%s' % local_gccver),
('icc', local_compver, local_gccsuff),
('ifort', local_compver, local_gccsuff),
('impi', '5.1.2.150', '', ('iccifort', '%s%s' % (local_compver, local_gccsuff))),
]

moduleclass = 'toolchain'
2 changes: 1 addition & 1 deletion test/framework/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@ def test_index_functions(self):
# test with specified path with and without trailing '/'s
for path in [test_ecs, test_ecs + '/', test_ecs + '//']:
index = ft.create_index(path)
self.assertEqual(len(index), 91)
self.assertEqual(len(index), 92)

expected = [
os.path.join('b', 'bzip2', 'bzip2-1.0.6-GCC-4.9.2.eb'),
Expand Down
16 changes: 16 additions & 0 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,22 @@ def test_try(self):
allargs = args + ['--software-version=1.2.3', '--toolchain=gompi,2018a']
self.assertErrorRegex(EasyBuildError, "version .* not available", self.eb_main, allargs, raise_error=True)

# Try changing only name or version of toolchain
args.pop(0) # Remove EC filename
foss_toy_ec = os.path.join(self.test_buildpath, 'toy-0.0-foss-2018a.eb')
copy_file(os.path.join(ecs_path, 't', 'toy', 'toy-0.0-gompi-2018a.eb'), foss_toy_ec)
write_file(foss_toy_ec, "toolchain['name'] = 'foss'", append=True)

test_cases = [
(['toy-0.0-gompi-2018a.eb', '--try-toolchain-name=intel'], 'toy/0.0-iimpi-2018a'),
([foss_toy_ec, '--try-toolchain-name=intel'], 'toy/0.0-intel-2018a'),
(['toy-0.0-gompi-2018a.eb', '--try-toolchain-version=2018b'], 'toy/0.0-gompi-2018b'),
]
for extra_args, mod in test_cases:
outtxt = self.eb_main(args + extra_args, verbose=True, raise_error=True)
mod_regex = re.compile(r"\(module: %s\)$" % mod, re.M)
self.assertTrue(mod_regex.search(outtxt), "Pattern %s found in %s" % (mod_regex.pattern, outtxt))

def test_try_with_copy(self):
"""Test whether --try options are taken into account."""
ecs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs')
Expand Down
Loading