Skip to content

Commit 86a44be

Browse files
committed
fixup incomplete porting of spack_running to spack v1.0 syntax
Signed-off-by: Bob <robertbird@google.com>
1 parent b218d27 commit 86a44be

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

  • var/ramble/repos/builtin/package_managers/spack-lightweight/test

var/ramble/repos/builtin/package_managers/spack-lightweight/test/spack_runner.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ def test_config_compiler_find_attribute(
556556

557557
import os
558558

559+
# compilers.yaml is written to support older spack versions.
560+
# The compiler information was changed to exist in the packages.yaml file around v1.0.0
559561
compilers_config = """
560562
compilers::
561563
- compiler:
@@ -573,9 +575,29 @@ def test_config_compiler_find_attribute(
573575
extra_rpaths: []
574576
"""
575577

578+
packages_config = """
579+
packages::
580+
gcc:
581+
externals:
582+
- spec: gcc@12.1.0 languages=c,fortran
583+
prefix: /path/to
584+
extra_attributes:
585+
compilers:
586+
c: /path/to/gcc
587+
cxx: /path/to/g++
588+
fortran: /path/to/gfortran
589+
buildable: false
590+
"""
591+
576592
with tmpdir.as_cwd():
593+
env_path = os.path.join(os.getcwd(), "test_env")
594+
os.mkdir(env_path)
595+
packages_path = os.path.join(os.getcwd(), "packages.yaml")
577596
compilers_path = os.path.join(os.getcwd(), "compilers.yaml")
578597
# Write spack_configs
598+
with open(packages_path, "w+", encoding="utf-8") as f:
599+
f.write(packages_config)
600+
579601
with open(compilers_path, "w+", encoding="utf-8") as f:
580602
f.write(compilers_config)
581603

@@ -590,9 +612,12 @@ def test_config_compiler_find_attribute(
590612
pkg_spec = "gcc@12.2.0 +binutils"
591613
compiler_spec = "gcc@12.2.0"
592614
sr = SpackRunner(dry_run=True)
593-
sr.create_env(os.getcwd())
615+
sr.create_env(env_path)
594616
sr.activate()
617+
sr.add_include_file(packages_path)
595618
sr.add_include_file(compilers_path)
619+
stage_env_path = sr.create_stage_env()
620+
sr.migrate_stage_env(stage_env_path, env_path)
596621
sr.install_compiler(pkg_spec, compiler_spec)
597622
captured = capsys.readouterr()
598623

0 commit comments

Comments
 (0)