Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
core = Core(os.path.join(tests_dir,
"capi2_cores",
"misc",
"depends.core"))
flags = {}
result = core.get_depends(flags)
expected = [
Vlnv('unversioned'),
Vlnv('versioned-1.0'),
Vlnv('gt-1.0'),
Vlnv('>=gte-1.0'),
Vlnv('::n'),
Vlnv('::nv:1.0'),
Vlnv(':l:nv:1.0'),
Vlnv('v:l:nv:1.0'),
Vlnv('<::vlnvlt:1.0'),
Vlnv('<=::vlnvlte:1.0'),
Vlnv('=::vlnveq:1.0'),
Vlnv('>::vlnvgt:1.0'),
Vlnv('>=::vlnvgte:1.0'),
]
assert len(result) == len(expected)
for i in range(len(result)):
assert result[i] == expected[i]
Vlnv('unversioned'),
Vlnv('versioned-1.0'),
Vlnv('gt-1.0'),
Vlnv('>=gte-1.0'),
Vlnv('::n'),
Vlnv('::nv:1.0'),
Vlnv(':l:nv:1.0'),
Vlnv('v:l:nv:1.0'),
Vlnv('<::vlnvlt:1.0'),
Vlnv('<=::vlnvlte:1.0'),
Vlnv('=::vlnveq:1.0'),
Vlnv('>::vlnvgt:1.0'),
Vlnv('>=::vlnvgte:1.0'),
]
assert len(result) == len(expected)
for i in range(len(result)):
assert result[i] == expected[i]
def test_name_only_vlnv():
assert vlnv_tuple(Vlnv("::uart16550")) == \
('', '', 'uart16550', '0', 0)
assert vlnv_tuple(Vlnv("::uart16550:")) == \
('', '', 'uart16550', '0', 0)
def test_name_only_legacy():
assert vlnv_tuple(Vlnv("uart16550")) == \
('', '', 'uart16550', '0', 0)
def test_capi2_get_depends():
from fusesoc.core import Core
from fusesoc.vlnv import Vlnv
core = Core(os.path.join(tests_dir,
"capi2_cores",
"misc",
"depends.core"))
flags = {}
result = core.get_depends(flags)
expected = [
Vlnv('unversioned'),
Vlnv('versioned-1.0'),
Vlnv('gt-1.0'),
Vlnv('>=gte-1.0'),
Vlnv('::n'),
Vlnv('::nv:1.0'),
Vlnv(':l:nv:1.0'),
Vlnv('v:l:nv:1.0'),
Vlnv('<::vlnvlt:1.0'),
Vlnv('<=::vlnvlte:1.0'),
Vlnv('=::vlnveq:1.0'),
Vlnv('>::vlnvgt:1.0'),
Vlnv('>=::vlnvgte:1.0'),
]
assert len(result) == len(expected)
for i in range(len(result)):
def test_name_version_legacy():
assert vlnv_tuple(Vlnv("uart16550-1.5")) == \
('', '', 'uart16550', '1.5', 0)
def test_name_with_dash_only_legacy():
assert vlnv_tuple(Vlnv("wb-axi")) == \
('', '', 'wb-axi', '0', 0)
def _get_core(cm, name):
core = None
try:
core = cm.get_core(Vlnv(name))
except RuntimeError as e:
logger.error(str(e))
exit(1)
except DependencyError as e:
logger.error("'" + name + "' or any of its dependencies requires '" + e.value + "', but this core was not found")
exit(1)
return core