From fb17352af66ddbd8da1334307316c2ac55388d08 Mon Sep 17 00:00:00 2001 From: Lara Ramona Peeters <49882639+laraPPr@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:51:19 +0200 Subject: [PATCH 1/3] find and report on duplicate modules --- eessi/testsuite/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eessi/testsuite/utils.py b/eessi/testsuite/utils.py index ee679295..ecd9e197 100644 --- a/eessi/testsuite/utils.py +++ b/eessi/testsuite/utils.py @@ -94,6 +94,8 @@ def find_modules(regex: str, name_only=True) -> Iterator[str]: ms = rt.runtime().modules_system # Returns e.g. ['Bison/', 'Bison/3.7.6-GCCcore-10.3.0', 'BLIS/', 'BLIS/0.8.1-GCC-10.3.0'] modules = ms.available_modules('') + seen = set() + dupes = [] for mod in modules: # Exclude anything without version, i.e. ending with / (e.g. Bison/) if re.search('.*/$', mod): @@ -109,8 +111,17 @@ def find_modules(regex: str, name_only=True) -> Iterator[str]: log(f"Matching module {mod} with regex {regex}") if re.search(regex, mod): log("Match!") + if orig_mod in seen: + dupes.append(orig_mod) + else: + seen.add(orig_mod) yield orig_mod + if dupes != []: + err_msg = "EESSI test-suite cannot handle duplicate modules." + err_msg += "Please make sure that only one is available on your system." + err_msg += f"The following modules have a duplicate on your system: {dupes}" + raise ValueError(err_msg) def check_proc_attribute_defined(test: rfm.RegressionTest, attribute) -> bool: """ From a54a4d2d5e86c6c7a24ff2f30d99834f04d150c1 Mon Sep 17 00:00:00 2001 From: Lara Ramona Peeters <49882639+laraPPr@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:54:44 +0200 Subject: [PATCH 2/3] make flake8 happy --- eessi/testsuite/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eessi/testsuite/utils.py b/eessi/testsuite/utils.py index ecd9e197..5fde4b4b 100644 --- a/eessi/testsuite/utils.py +++ b/eessi/testsuite/utils.py @@ -118,11 +118,12 @@ def find_modules(regex: str, name_only=True) -> Iterator[str]: yield orig_mod if dupes != []: - err_msg = "EESSI test-suite cannot handle duplicate modules." + err_msg = "EESSI test-suite cannot handle duplicate modules." err_msg += "Please make sure that only one is available on your system." err_msg += f"The following modules have a duplicate on your system: {dupes}" raise ValueError(err_msg) + def check_proc_attribute_defined(test: rfm.RegressionTest, attribute) -> bool: """ Checks if a processor feature is defined (i.e. if test.current_partition.processor. is defined) From 1b7acbdf85b5e653ea3ca54601ae8e321b02a774 Mon Sep 17 00:00:00 2001 From: Lara Ramona Peeters <49882639+laraPPr@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:33:08 +0200 Subject: [PATCH 3/3] Update eessi/testsuite/utils.py Co-authored-by: Sam Moors --- eessi/testsuite/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eessi/testsuite/utils.py b/eessi/testsuite/utils.py index 5fde4b4b..c68a7ec8 100644 --- a/eessi/testsuite/utils.py +++ b/eessi/testsuite/utils.py @@ -117,9 +117,9 @@ def find_modules(regex: str, name_only=True) -> Iterator[str]: seen.add(orig_mod) yield orig_mod - if dupes != []: - err_msg = "EESSI test-suite cannot handle duplicate modules." - err_msg += "Please make sure that only one is available on your system." + if dupes: + err_msg = "EESSI test-suite cannot handle duplicate modules. " + err_msg += "Please make sure that only one is available on your system. " err_msg += f"The following modules have a duplicate on your system: {dupes}" raise ValueError(err_msg)