From 94dc25ecfadfdd300e191c944e3b42752ec6cbb8 Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Thu, 23 May 2024 17:14:00 -0700 Subject: [PATCH] add test --- lib/spack/spack/test/config.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py index 64fe403daa5..6eeb69fb81d 100644 --- a/lib/spack/spack/test/config.py +++ b/lib/spack/spack/test/config.py @@ -1492,3 +1492,26 @@ def test_config_path_dsl(path, it_should_work, expected_parsed): else: with pytest.raises(ValueError): spack.config.ConfigPath._validate(path) + + +def test_compiler_parsing_errors(tmpdir): + content = """\ +packages: + gcc: + externals: + - spec: gcc@8.5.0 languages='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc + cxx: /usr/bin/g++ + fortran: /usr/bin/gfortran +""" + + testscope = join_path(tmpdir.strpath, "packages.yaml") + with open(testscope, "w") as f: + f.write(content) + + with spack.config.use_configuration(tmpdir.strpath): + compilers = spack.compilers.get_compiler_config_from_packages(spack.config.CONFIG) + assert spack.spec.Spec(compilers[0]['compiler']['spec']).satisfies("gcc@8.5.0")