Skip to content
Snippets Groups Projects
Commit 29d49692 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

Merge branch 'force-checking-of-error-code' into 'split-installation-tests'

# Conflicts:
#   mpsd-software-environment.py
parents 721c546e 38fa0d2c
No related branches found
No related tags found
3 merge requests!19Move linux-debian11 into main,!17split one test into three,!9force `subprocess.run` to check return code is 0
Pipeline #368569 failed
This commit is part of merge request !17. Comments created here will be created in the context of that merge request.
......@@ -258,14 +258,15 @@ def create_dir_structure(mpsd_release: str, script_dir: Path) -> None:
with os_chdir("spack-environments"):
# Git fetch and checkout the release branch and git pull
# to be sure that the resulting repo is up to date
run(["git", "fetch", "--all"])
checkout_result = run(["git", "checkout", mpsd_release])
run(["git", "fetch", "--all"], check=True)
checkout_result = run(["git", "checkout", mpsd_release], check=True)
if checkout_result.returncode != 0:
raise Exception(
"Release branch does not exist in spack-environment repo \n."
"Check for typos."
)
run(["git", "pull"])
run(["git", "pull"], check=True)
def get_release_info(mpsd_release: str, script_dir: Path) -> Tuple[str, str, List[str]]:
......@@ -306,13 +307,15 @@ def get_release_info(mpsd_release: str, script_dir: Path) -> Tuple[str, str, Lis
with os_chdir("spack-environments"):
# Get the branch and commit hash of the spack-environments repo
spe_commit_hash = (
run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE)
run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, check=True)
.stdout.decode()
.strip()
)
spe_branch = (
run(
["git", "rev-parse", "--abbrev-ref", "HEAD"], stdout=subprocess.PIPE
["git", "rev-parse", "--abbrev-ref", "HEAD"],
stdout=subprocess.PIPE,
check=True,
)
.stdout.decode()
.strip()
......
......@@ -65,13 +65,13 @@ def test_os_chdir(tmp_path):
def test_prepare_environment(tmp_path):
"""Simulate running preparation of environment.
Simulate running ./install-software-environment.py --release dev-23a \
--target-directory /tmp/test_prepare_env
prepare_env is run when cmd is not specified, we can test cmd='prepare'
and cmd=None to check both cases
"""
script_dir = tmp_path / "test_prepare_env"
script_dir = tmp_path / "mpsd_opt" / "linux_debian_11"
spack_environments = "spack-environments"
mpsd_release_to_test = "dev-23a"
release_base_dir = script_dir / mpsd_release_to_test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment