def test_capi2_get_work_root():
    from fusesoc.core import Core

    core_file = os.path.join(tests_dir, "capi2_cores", "misc", "targets.core")
    core = Core(core_file)

    with pytest.raises(SyntaxError):
        core.get_work_root({})
    assert "default-icarus" == core.get_work_root({"tool": "icarus"})
    assert "default-vivado" == core.get_work_root({"tool": "vivado"})
    assert "default-icarus" == core.get_work_root({"tool": "icarus", "target": None})
    with pytest.raises(SyntaxError):
        core.get_work_root({"tool": "icarus", "target": "invalid_target"})
    assert "empty_target-icarus" == core.get_work_root(
        {"tool": "icarus", "target": "empty_target"}
    )
Exemple #2
0
def test_capi2_get_work_root():
    from fusesoc.core import Core

    core_file = os.path.join(tests_dir,
                             "capi2_cores",
                             "misc",
                             "targets.core")
    core = Core(core_file)

    with pytest.raises(SyntaxError):
        core.get_work_root({})
    assert 'default-icarus'      == core.get_work_root({'tool' : 'icarus'})
    assert 'default-vivado'      == core.get_work_root({'tool' : 'vivado'})
    assert 'default-icarus'      == core.get_work_root({'tool' : 'icarus',
                                                        'target' : None})
    with pytest.raises(SyntaxError):
        core.get_work_root({'tool' : 'icarus', 'target' : 'invalid_target'})
    assert 'empty_target-icarus' == core.get_work_root({'tool' : 'icarus', 'target' : 'empty_target'})
Exemple #3
0
def test_capi2_get_work_root():
    from fusesoc.core import Core

    core_file = os.path.join(tests_dir,
                             "capi2_cores",
                             "misc",
                             "targets.core")
    core = Core(core_file)

    with pytest.raises(SyntaxError):
        core.get_work_root({})
    assert 'default-icarus'      == core.get_work_root({'tool' : 'icarus'})
    assert 'default-vivado'      == core.get_work_root({'tool' : 'vivado'})
    assert 'default-icarus'      == core.get_work_root({'tool' : 'icarus',
                                                        'target' : None})
    with pytest.raises(SyntaxError):
        core.get_work_root({'tool' : 'icarus', 'target' : 'invalid_target'})
    assert 'empty_target-icarus' == core.get_work_root({'tool' : 'icarus', 'target' : 'empty_target'})