From 981d23f799f8c6028f4482c0a2666af087871e2b Mon Sep 17 00:00:00 2001
From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de>
Date: Fri, 12 May 2023 16:29:59 +0200
Subject: [PATCH] abstract testing of buildlog

---
 tests.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests.py b/tests.py
index 78e92f6..2736a93 100644
--- a/tests.py
+++ b/tests.py
@@ -122,6 +122,7 @@ def test_install_environment(tmp_path):
     script_dir.mkdir(exist_ok=True, parents=True)
     spack_environments = "spack-environments"
     mpsd_release_to_test = "dev-23a"
+    toolchain_to_test = "global_generic"
     mpsd_microarch=os.getenv("MPSD_MICROARCH",'UNKNOWN_MICROARCH')
     release_base_dir = script_dir / mpsd_release_to_test
     prepare_result = mod.prepare_environment(
@@ -156,8 +157,8 @@ def test_install_environment(tmp_path):
         f.write(lines)
     # install global_generic toolchain
     install_result = mod.install_environment(
-            mpsd_release="dev-23a",
-            toolchains=["global_generic"],
+            mpsd_release=mpsd_release_to_test,
+            toolchains=[toolchain_to_test],
             script_dir=script_dir,
             enable_build_cache=False
         )
@@ -172,7 +173,7 @@ def test_install_environment(tmp_path):
     
     # test that the build log is created correctly
     # check that a file with glob build_globale_generic_dev-23a*.log exists at release_base_dir/mpsd_microarch
-    build_log = list((release_base_dir/mpsd_microarch).glob('build_global_generic_dev-23a*.log'))
+    build_log = list((release_base_dir/mpsd_microarch).glob(f'build_{toolchain_to_test}_{mpsd_release_to_test}*.log'))
     assert len(build_log) > 0
     # take the most recent build log
     build_log = sorted(build_log)[0]
-- 
GitLab