コード例 #1
0
ファイル: test_buildsystems.py プロジェクト: vkarak/reframe
def test_spack(environ, tmp_path):
    build_system = bs.Spack()
    build_system.environment = 'spack_env'
    build_system.install_opts = ['-j 10']
    with osext.change_dir(tmp_path):
        assert build_system.emit_build_commands(environ) == [
            f'spack -e {build_system.environment} install -j 10'
        ]
        assert build_system.prepare_cmds() == []
コード例 #2
0
ファイル: test_buildsystems.py プロジェクト: vkarak/reframe
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 env create -d rfm_spack_env',
            f'spack -e rfm_spack_env config add '
            '"config:install_tree:root:opt/spack"',
            f'spack -e rfm_spack_env install'
        ]

    assert build_system.environment == 'rfm_spack_env'
コード例 #3
0
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 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"',
            f'spack install'
        ]

    assert build_system.environment == 'rfm_spack_env'
コード例 #4
0
ファイル: test_buildsystems.py プロジェクト: vkarak/reframe
def test_spack_with_spec(environ, tmp_path):
    build_system = bs.Spack()
    build_system.environment = 'spack_env'
    build_system.specs = ['spec1@version1', 'spec2@version2']
    specs_str = ' '.join(build_system.specs)
    with osext.change_dir(tmp_path):
        assert build_system.emit_build_commands(environ) == [
            f'spack -e {build_system.environment} add {specs_str}',
            f'spack -e {build_system.environment} install'
        ]
        assert build_system.prepare_cmds() == [
            f'eval `spack -e {build_system.environment} load --sh {specs_str}`'
        ]
コード例 #5
0
def test_spack(environ, tmp_path):
    build_system = bs.Spack()
    build_system.environment = 'spack_env'
    build_system.install_opts = ['-j 10']
    with osext.change_dir(tmp_path):
        assert build_system.emit_build_commands(environ) == [
            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 location --spack-root)/share/spack/setup-env.sh"',
            f'spack env activate -V -d {build_system.environment}',
        ]
コード例 #6
0
def test_spack_with_spec(environ, tmp_path):
    build_system = bs.Spack()
    build_system.environment = 'spack_env'
    build_system.specs = ['spec1@version1', 'spec2@version2']
    specs_str = ' '.join(build_system.specs)
    with osext.change_dir(tmp_path):
        assert build_system.emit_build_commands(environ) == [
            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 location --spack-root)/share/spack/setup-env.sh"',
            f'spack env activate -V -d {build_system.environment}',
            f'spack load {specs_str}',
        ]
コード例 #7
0
def test_spack_no_env(environ, tmp_path):
    build_system = bs.Spack()
    with pytest.raises(BuildSystemError):
        build_system.emit_build_commands(environ)