Skip to content

Commit

Permalink
Add tests for tweak_map return value of tweak() function
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoldeman committed Oct 5, 2024
1 parent 7fc9d09 commit 4c99da7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ def test_tweak_multiple_tcs(self):
untweaked_openmpi_2 = os.path.join(test_easyconfigs, 'o', 'OpenMPI', 'OpenMPI-3.1.1-GCC-7.3.0-2.30.eb')
easyconfigs, _ = parse_easyconfigs([(untweaked_openmpi_1, False), (untweaked_openmpi_2, False)])
tweak_specs = {'moduleclass': 'debugger'}
easyconfigs = tweak(easyconfigs, tweak_specs, self.modtool, targetdirs=tweaked_ecs_paths)
easyconfigs, tweak_map = tweak(easyconfigs, tweak_specs, self.modtool, targetdirs=tweaked_ecs_paths,
return_map=True)
# Check that all expected tweaked easyconfigs exists
tweaked_openmpi_1 = os.path.join(tweaked_ecs_paths[0], os.path.basename(untweaked_openmpi_1))
tweaked_openmpi_2 = os.path.join(tweaked_ecs_paths[0], os.path.basename(untweaked_openmpi_2))
Expand All @@ -813,6 +814,7 @@ def test_tweak_multiple_tcs(self):
"Tweaked value not found in " + tweaked_openmpi_content_1)
self.assertTrue('moduleclass = "debugger"' in tweaked_openmpi_content_2,
"Tweaked value not found in " + tweaked_openmpi_content_2)
self.assertEqual(tweak_map, {tweaked_openmpi_1: untweaked_openmpi_1, tweaked_openmpi_2: untweaked_openmpi_2})

def test_installversion(self):
"""Test generation of install version."""
Expand Down
5 changes: 4 additions & 1 deletion test/framework/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,8 @@ def test_tweak_robotpath(self):

# Tweak the toolchain version of the easyconfig
tweak_specs = {'toolchain_version': '6.4.0-2.28'}
easyconfigs = tweak(easyconfigs, tweak_specs, self.modtool, targetdirs=tweaked_ecs_paths)
easyconfigs, tweak_map = tweak(easyconfigs, tweak_specs, self.modtool, targetdirs=tweaked_ecs_paths,
return_map=True)

# Check that all expected tweaked easyconfigs exists
tweaked_openmpi = os.path.join(tweaked_ecs_paths[0], 'OpenMPI-2.1.2-GCC-6.4.0-2.28.eb')
Expand All @@ -1155,6 +1156,8 @@ def test_tweak_robotpath(self):
# Check it picks up the untweaked dependency of the tweaked OpenMPI
untweaked_hwloc = os.path.join(test_easyconfigs, 'h', 'hwloc', 'hwloc-1.11.8-GCC-6.4.0-2.28.eb')
self.assertIn(untweaked_hwloc, specs)
# Check correctness of tweak_map
self.assertEqual(tweak_map, {tweaked_openmpi: untweaked_openmpi, tweaked_hwloc: untweaked_hwloc})

def test_robot_find_subtoolchain_for_dep(self):
"""Test robot_find_subtoolchain_for_dep."""
Expand Down

0 comments on commit 4c99da7

Please sign in to comment.