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