Example #1
0
def test_failed_translate_compiler_name():
    unknown_compiler = JsonCompilerEntry(name='unknown', version='1.0')

    with pytest.raises(spack.compilers.UnknownCompilerError):
        compiler_from_entry(unknown_compiler.compiler_json())

    spec_json = JsonSpecEntry(name='packagey',
                              hash='hash-of-y',
                              prefix='/path/to/packagey-install/',
                              version='1.0',
                              arch=_common_arch,
                              compiler=unknown_compiler.spec_json(),
                              dependencies={},
                              parameters={}).to_dict()

    with pytest.raises(spack.compilers.UnknownCompilerError):
        entries_to_specs([spec_json])
Example #2
0
def test_translate_compiler_name():
    nvidia_compiler = JsonCompilerEntry(name='nvidia',
                                        version='19.1',
                                        executables={
                                            "cc": "/path/to/compiler/nvc",
                                            "cxx": "/path/to/compiler/nvc++",
                                        })

    compiler = compiler_from_entry(nvidia_compiler.compiler_json())
    assert compiler.name == 'nvhpc'

    spec_json = JsonSpecEntry(name='hwloc',
                              hash='hwlocfakehashaaa',
                              prefix='/path/to/hwloc-install/',
                              version='2.0.3',
                              arch=_common_arch,
                              compiler=nvidia_compiler.spec_json(),
                              dependencies={},
                              parameters={}).to_dict()

    spec, = entries_to_specs([spec_json]).values()
    assert spec.compiler.name == 'nvhpc'
Example #3
0
def test_compiler_from_entry():
    compiler_data = json.loads(example_compiler_entry)
    compiler_from_entry(compiler_data)