add test for toolchains
Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
parent
019957a225
commit
f27eb55f29
@ -11,6 +11,7 @@
|
|||||||
import spack.binary_distribution
|
import spack.binary_distribution
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
import spack.concretize
|
import spack.concretize
|
||||||
|
import spack.config
|
||||||
import spack.platforms.test
|
import spack.platforms.test
|
||||||
import spack.repo
|
import spack.repo
|
||||||
import spack.solver.asp
|
import spack.solver.asp
|
||||||
@ -894,6 +895,39 @@ def test_cli_spec_roundtrip(args, expected):
|
|||||||
assert expected == output_string
|
assert expected == output_string
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"spec_str,toolchain,expected_roundtrip",
|
||||||
|
[
|
||||||
|
(
|
||||||
|
"foo%my_toolchain",
|
||||||
|
{"my_toolchain": "%[when='%c' virtuals=c]gcc"},
|
||||||
|
"foo ^[when='%c' virtuals=c] gcc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"foo%my_toolchain2",
|
||||||
|
{"my_toolchain2": "%[when='%c' virtuals=c]gcc ^[when='+mpi' virtuals=mpi]mpich"},
|
||||||
|
"foo %[when='%c' virtuals=c] gcc ^[when='+mpi' virtuals=mpi] mpich",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"foo%my_toolchain bar%my_toolchain2",
|
||||||
|
{
|
||||||
|
"my_toolchain": "%[when='%c' virtuals=c]gcc",
|
||||||
|
"my_toolchain2": "%[when='%c' virtuals=c]gcc ^[when='+mpi' virtuals=mpi]mpich",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
"foo ^[when='%c' virtuals=c] gcc",
|
||||||
|
"bar %[when='%c' virtuals=c] gcc ^[when='+mpi' virtuals=mpi] mpich",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_parse_toolchain(spec_str, toolchain, expected_roundtrip, mutable_config):
|
||||||
|
spack.config.CONFIG.set("toolchains", toolchain)
|
||||||
|
parser = SpecParser(spec_str)
|
||||||
|
for expected in expected_roundtrip:
|
||||||
|
assert expected_roundtrip == str(parser.next_spec())
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"text,expected_in_error",
|
"text,expected_in_error",
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user