Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/tutorial_build_automation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Here is what ReFrame generates as a build script in this example:

.. code:: bash

. $SPACK_ROOT/share/spack/setup-env.sh
. "$(spack location --spack-root)/share/spack/setup-env.sh"
spack env activate -V -d myenv
spack install

Expand Down Expand Up @@ -171,7 +171,7 @@ Finally, here is the generated run script that ReFrame uses to run the test, onc
.. code-block:: bash

#!/bin/bash
. $SPACK_ROOT/share/spack/setup-env.sh
. "$(spack location --spack-root)/share/spack/setup-env.sh"
spack env activate -V -d myenv
bzip2 --help

Expand Down
2 changes: 1 addition & 1 deletion reframe/core/buildsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ def emit_build_commands(self, environ):
return ret

def _env_activate_cmds(self):
cmds = ['. $SPACK_ROOT/share/spack/setup-env.sh']
cmds = ['. "$(spack location --spack-root)/share/spack/setup-env.sh"']
if self.environment:
environment = self.environment
else:
Expand Down
10 changes: 5 additions & 5 deletions unittests/test_buildsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ def test_spack(environ, tmp_path):
build_system.install_opts = ['-j 10']
with osext.change_dir(tmp_path):
assert build_system.emit_build_commands(environ) == [
f'. $SPACK_ROOT/share/spack/setup-env.sh',
f'. "$(spack location --spack-root)/share/spack/setup-env.sh"',
f'spack env activate -V -d {build_system.environment}',
f'spack install -j 10'
]
assert build_system.prepare_cmds() == [
f'. $SPACK_ROOT/share/spack/setup-env.sh',
f'. "$(spack location --spack-root)/share/spack/setup-env.sh"',
f'spack env activate -V -d {build_system.environment}',
]

Expand All @@ -266,13 +266,13 @@ def test_spack_with_spec(environ, tmp_path):
specs_str = ' '.join(build_system.specs)
with osext.change_dir(tmp_path):
assert build_system.emit_build_commands(environ) == [
f'. $SPACK_ROOT/share/spack/setup-env.sh',
f'. "$(spack location --spack-root)/share/spack/setup-env.sh"',
f'spack env activate -V -d {build_system.environment}',
f'spack add {specs_str}',
f'spack install'
]
assert build_system.prepare_cmds() == [
f'. $SPACK_ROOT/share/spack/setup-env.sh',
f'. "$(spack location --spack-root)/share/spack/setup-env.sh"',
f'spack env activate -V -d {build_system.environment}',
f'spack load {specs_str}',
]
Expand All @@ -282,7 +282,7 @@ def test_spack_no_env(environ, tmp_path):
build_system = bs.Spack()
with osext.change_dir(tmp_path):
assert build_system.emit_build_commands(environ) == [
f'. $SPACK_ROOT/share/spack/setup-env.sh',
f'. "$(spack location --spack-root)/share/spack/setup-env.sh"',
f'spack env create -d rfm_spack_env',
f'spack env activate -V -d rfm_spack_env',
f'spack config add "config:install_tree:root:opt/spack"',
Expand Down