tests: use fewer default paths (#44432)
Set config:install_tree:root and modules:default:roots to something sensible.
This commit is contained in:
parent
39ace5fc45
commit
f44f5b0db0
@ -492,7 +492,7 @@ def test_substitute_date(mock_low_high_config):
|
||||
],
|
||||
)
|
||||
def test_parse_install_tree(config_settings, expected, mutable_config):
|
||||
expected_root = expected[0] or spack.store.DEFAULT_INSTALL_TREE_ROOT
|
||||
expected_root = expected[0] or mutable_config.get("config:install_tree:root")
|
||||
expected_unpadded_root = expected[1] or expected_root
|
||||
expected_proj = expected[2] or spack.directory_layout.default_projections
|
||||
|
||||
@ -575,7 +575,7 @@ def change_fn(self, section):
|
||||
],
|
||||
)
|
||||
def test_parse_install_tree_padded(config_settings, expected, mutable_config):
|
||||
expected_root = expected[0] or spack.store.DEFAULT_INSTALL_TREE_ROOT
|
||||
expected_root = expected[0] or mutable_config.get("config:install_tree:root")
|
||||
expected_unpadded_root = expected[1] or expected_root
|
||||
expected_proj = expected[2] or spack.directory_layout.default_projections
|
||||
|
||||
@ -761,25 +761,20 @@ def test_internal_config_from_data():
|
||||
assert config.get("config:checksum", scope="higher") is True
|
||||
|
||||
|
||||
def test_keys_are_ordered():
|
||||
def test_keys_are_ordered(configuration_dir):
|
||||
"""Test that keys in Spack YAML files retain their order from the file."""
|
||||
expected_order = (
|
||||
"bin",
|
||||
"man",
|
||||
"share/man",
|
||||
"share/aclocal",
|
||||
"lib",
|
||||
"lib64",
|
||||
"include",
|
||||
"lib/pkgconfig",
|
||||
"lib64/pkgconfig",
|
||||
"share/pkgconfig",
|
||||
"",
|
||||
"./bin",
|
||||
"./man",
|
||||
"./share/man",
|
||||
"./share/aclocal",
|
||||
"./lib/pkgconfig",
|
||||
"./lib64/pkgconfig",
|
||||
"./share/pkgconfig",
|
||||
"./",
|
||||
)
|
||||
|
||||
config_scope = spack.config.ConfigScope(
|
||||
"modules", os.path.join(spack.paths.test_path, "data", "config")
|
||||
)
|
||||
config_scope = spack.config.ConfigScope("modules", configuration_dir.join("site"))
|
||||
|
||||
data = config_scope.get_section("modules")
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
import json
|
||||
import os
|
||||
import os.path
|
||||
import pathlib
|
||||
import re
|
||||
import shutil
|
||||
import stat
|
||||
@ -32,6 +33,7 @@
|
||||
from llnl.util.filesystem import copy_tree, mkdirp, remove_linked_tree, touchp, working_dir
|
||||
|
||||
import spack.binary_distribution
|
||||
import spack.bootstrap.core
|
||||
import spack.caches
|
||||
import spack.cmd.buildcache
|
||||
import spack.compiler
|
||||
@ -682,36 +684,34 @@ def configuration_dir(tmpdir_factory, linux_os):
|
||||
directory path.
|
||||
"""
|
||||
tmpdir = tmpdir_factory.mktemp("configurations")
|
||||
install_tree_root = tmpdir_factory.mktemp("opt")
|
||||
modules_root = tmpdir_factory.mktemp("share")
|
||||
tcl_root = modules_root.ensure("modules", dir=True)
|
||||
lmod_root = modules_root.ensure("lmod", dir=True)
|
||||
|
||||
# <test_path>/data/config has mock config yaml files in it
|
||||
# copy these to the site config.
|
||||
test_config = py.path.local(spack.paths.test_path).join("data", "config")
|
||||
test_config.copy(tmpdir.join("site"))
|
||||
test_config = pathlib.Path(spack.paths.test_path) / "data" / "config"
|
||||
shutil.copytree(test_config, tmpdir.join("site"))
|
||||
|
||||
# Create temporary 'defaults', 'site' and 'user' folders
|
||||
tmpdir.ensure("user", dir=True)
|
||||
|
||||
# Slightly modify config.yaml and compilers.yaml
|
||||
if sys.platform == "win32":
|
||||
locks = False
|
||||
else:
|
||||
locks = True
|
||||
|
||||
# Fill out config.yaml, compilers.yaml and modules.yaml templates.
|
||||
solver = os.environ.get("SPACK_TEST_SOLVER", "clingo")
|
||||
config_yaml = test_config.join("config.yaml")
|
||||
modules_root = tmpdir_factory.mktemp("share")
|
||||
tcl_root = modules_root.ensure("modules", dir=True)
|
||||
lmod_root = modules_root.ensure("lmod", dir=True)
|
||||
content = "".join(config_yaml.read()).format(solver, locks, str(tcl_root), str(lmod_root))
|
||||
t = tmpdir.join("site", "config.yaml")
|
||||
t.write(content)
|
||||
locks = sys.platform != "win32"
|
||||
config = tmpdir.join("site", "config.yaml")
|
||||
config_template = test_config / "config.yaml"
|
||||
config.write(config_template.read_text().format(install_tree_root, solver, locks))
|
||||
|
||||
compilers_yaml = test_config.join("compilers.yaml")
|
||||
content = "".join(compilers_yaml.read()).format(
|
||||
linux_os=linux_os, target=str(archspec.cpu.host().family)
|
||||
)
|
||||
t = tmpdir.join("site", "compilers.yaml")
|
||||
t.write(content)
|
||||
target = str(archspec.cpu.host().family)
|
||||
compilers = tmpdir.join("site", "compilers.yaml")
|
||||
compilers_template = test_config / "compilers.yaml"
|
||||
compilers.write(compilers_template.read_text().format(linux_os=linux_os, target=target))
|
||||
|
||||
modules = tmpdir.join("site", "modules.yaml")
|
||||
modules_template = test_config / "modules.yaml"
|
||||
modules.write(modules_template.read_text().format(tcl_root, lmod_root))
|
||||
yield tmpdir
|
||||
|
||||
|
||||
@ -1702,7 +1702,7 @@ def _factory(name, output, subdir=("bin",)):
|
||||
executable_path = executable_dir / name
|
||||
if sys.platform == "win32":
|
||||
executable_path = executable_dir / (name + ".bat")
|
||||
executable_path.write_text(f"{ shebang }{ output }\n")
|
||||
executable_path.write_text(f"{shebang}{output}\n")
|
||||
executable_path.chmod(0o755)
|
||||
return executable_path
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
concretizer:
|
||||
reuse: True
|
||||
reuse: true
|
||||
targets:
|
||||
granularity: microarchitectures
|
||||
host_compatible: false
|
||||
|
@ -1,6 +1,6 @@
|
||||
config:
|
||||
install_tree:
|
||||
root: $spack/opt/spack
|
||||
root: {0}
|
||||
template_dirs:
|
||||
- $spack/share/spack/templates
|
||||
- $spack/lib/spack/spack/test/data/templates
|
||||
@ -13,5 +13,5 @@ config:
|
||||
ssl_certs: $SSL_CERT_FILE
|
||||
checksum: true
|
||||
dirty: false
|
||||
concretizer: {0}
|
||||
locks: {1}
|
||||
concretizer: {1}
|
||||
locks: {2}
|
||||
|
@ -14,29 +14,25 @@
|
||||
# ~/.spack/modules.yaml
|
||||
# -------------------------------------------------------------------------
|
||||
modules:
|
||||
default: {}
|
||||
prefix_inspections:
|
||||
bin:
|
||||
- PATH
|
||||
man:
|
||||
- MANPATH
|
||||
share/man:
|
||||
- MANPATH
|
||||
share/aclocal:
|
||||
- ACLOCAL_PATH
|
||||
lib:
|
||||
- LIBRARY_PATH
|
||||
- LD_LIBRARY_PATH
|
||||
lib64:
|
||||
- LIBRARY_PATH
|
||||
- LD_LIBRARY_PATH
|
||||
include:
|
||||
- CPATH
|
||||
lib/pkgconfig:
|
||||
- PKG_CONFIG_PATH
|
||||
lib64/pkgconfig:
|
||||
- PKG_CONFIG_PATH
|
||||
share/pkgconfig:
|
||||
- PKG_CONFIG_PATH
|
||||
'':
|
||||
- CMAKE_PREFIX_PATH
|
||||
./bin: [PATH]
|
||||
./man: [MANPATH]
|
||||
./share/man: [MANPATH]
|
||||
./share/aclocal: [ACLOCAL_PATH]
|
||||
./lib/pkgconfig: [PKG_CONFIG_PATH]
|
||||
./lib64/pkgconfig: [PKG_CONFIG_PATH]
|
||||
./share/pkgconfig: [PKG_CONFIG_PATH]
|
||||
./: [CMAKE_PREFIX_PATH]
|
||||
default:
|
||||
roots:
|
||||
tcl: {0}
|
||||
lmod: {1}
|
||||
enable: []
|
||||
tcl:
|
||||
all:
|
||||
autoload: direct
|
||||
lmod:
|
||||
all:
|
||||
autoload: direct
|
||||
hierarchy:
|
||||
- mpi
|
||||
|
Loading…
Reference in New Issue
Block a user