From 4c99da7c402e1ecee64f30b9d2dc1b55ddda0323 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sat, 5 Oct 2024 21:06:04 +0000 Subject: [PATCH] Add tests for tweak_map return value of tweak() function --- test/framework/easyconfig.py | 4 +++- test/framework/robot.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py index 827e01f1e0..d7ebcad706 100644 --- a/test/framework/easyconfig.py +++ b/test/framework/easyconfig.py @@ -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)) @@ -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.""" diff --git a/test/framework/robot.py b/test/framework/robot.py index 62350bfae4..8cf930ceb8 100644 --- a/test/framework/robot.py +++ b/test/framework/robot.py @@ -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') @@ -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."""