Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hmenke/mpsd-software-manager
  • mpsd-cs/mpsd-software-manager
2 results
Show changes
Commits on Source (7)
......@@ -32,17 +32,19 @@ for given system architecture and MPSD software stack version.\n
The toolchains
are built using the bash script spack_setup.sh, and the results are logged. """
call_date_iso = datetime.datetime.now().replace(microsecond=0).isoformat()
call_date_iso = (
datetime.datetime.now().replace(microsecond=0).isoformat().replace(":", "-")
)
config_vars = {
# kept inside the mpsd_release folder
"cmd_log_file": "install.log",
"cmd_log_file": "script_execution_summary.log",
# Placeholder installer log file name, placed at mpsd_microarch/logs
"installer_log_template": Template(
"${mpsd_release}_${mpsd_microarch}_${date}_${action}.log"
"${mpsd_release}_${mpsd_microarch}_${date}_APEX_${action}.log"
),
# Placeholder build log file name, placed at mpsd_microarch/logs
"build_log_template": Template(
"${mpsd_release}_${mpsd_microarch}_${date}_${toolchain}_${action}.log"
"${mpsd_release}_${mpsd_microarch}_${date}_BUILD_${toolchain}_${action}.log"
),
"metadata_tag_open": "!<meta>",
"metadata_tag_close": "</meta>!",
......
......@@ -164,13 +164,13 @@ def test_setup_log_cmd(tmp_path):
Check that logs/install-software-environment.log is updated when the module is run
"""
log_file = "install.log"
cmd_log_file = mod.config_vars["cmd_log_file"]
script_dir = tmp_path / "test_prepare_env"
mpsd_release_to_test = "dev-23a"
release_base_dir = script_dir / mpsd_release_to_test
if os.path.exists(release_base_dir / log_file):
initial_bytes = os.path.getsize(log_file)
if os.path.exists(release_base_dir / cmd_log_file):
initial_bytes = os.path.getsize(cmd_log_file)
else:
initial_bytes = 0
......@@ -179,11 +179,11 @@ def test_setup_log_cmd(tmp_path):
mod.prepare_environment(mpsd_release=mpsd_release_to_test, script_dir=(script_dir))
# check that logs/install-software-environment.log is updated
assert os.path.exists(release_base_dir / log_file)
assert os.path.getsize(release_base_dir / log_file) > initial_bytes
assert os.path.exists(release_base_dir / cmd_log_file)
assert os.path.getsize(release_base_dir / cmd_log_file) > initial_bytes
# Check that the log file has "Spack environments branch: dev-23a " in the last line
with open(release_base_dir / log_file, "r") as f:
with open(release_base_dir / cmd_log_file, "r") as f:
last_line = f.readlines()[-1]
assert "Spack environments branch: dev-23a " in last_line
......@@ -227,6 +227,7 @@ def test_install_environment_zlib():
script_dir.mkdir(exist_ok=True, parents=True)
mpsd_release_to_test = "dev-23a"
toolchain_to_test = "global_generic"
cmd_log_file = mod.config_vars["cmd_log_file"]
mpsd_microarch = mod.get_native_microarchitecture()
release_base_dir = script_dir / mpsd_release_to_test
create_mock_git_repository(target_directory=script_dir, create_directory=False)
......@@ -293,7 +294,7 @@ def test_install_environment_zlib():
)
assert len(build_log) == 2
# take the most recent build log
build_log = sorted(build_log)[0]
build_log = sorted(build_log)[1]
# check that the build log contains statement ##### Installation finished
with open(build_log, "r") as f:
lines = f.read()
......@@ -301,11 +302,11 @@ def test_install_environment_zlib():
os.path.basename(build_log)
# assert that install log files exists
assert os.path.exists(release_base_dir / "install.log")
assert os.path.exists(release_base_dir / cmd_log_file)
# assert that the build log is written to the install log file
os.path.basename(build_log)
with open(release_base_dir / "install.log", "r") as f:
with open(release_base_dir / cmd_log_file, "r") as f:
lines = f.read()
assert (
f"installing {toolchain_to_test} and logging at {str(build_log)}" in lines
......@@ -382,8 +383,12 @@ def test_metadata_logging(tmp_path):
assert len(read_dict) == len(keys)
@pytest.mark.skip(
reason="This function is redundant in the next version of the script."
)
def test_create_log_file_names():
"""Test that the log file names are created correctly."""
pass
create_log_file_names = mod.create_log_file_names
mpsd_release = "dev-23a"
mpsd_microarch = "sandybridge"
......