Skip to content

Commit b3dafa0

Browse files
author
Alan O'Cais
committed
Add tests for new kwarg
1 parent b69c068 commit b3dafa0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/framework/tweak.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,39 @@ def test_find_potential_version_mappings(self):
382382
}
383383
self.assertEqual(potential_versions[0], expected)
384384

385+
# Test that we can override respecting the versionsuffix
386+
387+
# Create toolchain mapping for OpenBLAS
388+
gcc_4_tc = {'name': 'GCC', 'version': '4.8.2'}
389+
gcc_6_tc = {'name': 'GCC', 'version': '6.4.0-2.28'}
390+
tc_mapping = map_toolchain_hierarchies(gcc_4_tc, gcc_6_tc, self.modtool)
391+
# Create a dep with the necessary params (including versionsuffix)
392+
openblas_dep = {
393+
'toolchain': {'version': '4.8.2', 'name': 'GCC'},
394+
'name': 'OpenBLAS',
395+
'system': False,
396+
'versionsuffix': '-LAPACK-3.4.2',
397+
'version': '0.2.8'
398+
}
399+
400+
self.mock_stderr(True)
401+
potential_versions = find_potential_version_mappings(openblas_dep, tc_mapping)
402+
errtxt = self.get_stderr()
403+
warning_stub = "\nWARNING: There may be newer version(s) of dep 'OpenBLAS' available with a different " \
404+
"versionsuffix to '-LAPACK-3.4.2'"
405+
self.mock_stderr(False)
406+
self.assertTrue(errtxt.startswith(warning_stub))
407+
self.assertEqual(len(potential_versions), 0)
408+
potential_versions = find_potential_version_mappings(openblas_dep, tc_mapping, ignore_versionsuffix=True)
409+
self.assertEqual(len(potential_versions), 1)
410+
expected = {
411+
'path': os.path.join(test_easyconfigs, 'o', 'OpenBLAS', 'OpenBLAS-0.2.20-GCC-6.4.0-2.28.eb'),
412+
'toolchain': {'version': '6.4.0-2.28', 'name': 'GCC'},
413+
'version': '0.2.20',
414+
'versionsuffix': '',
415+
}
416+
self.assertEqual(potential_versions[0], expected)
417+
385418
def test_map_easyconfig_to_target_tc_hierarchy(self):
386419
"""Test mapping of easyconfig to target hierarchy"""
387420
test_easyconfigs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs')

0 commit comments

Comments
 (0)