Ejemplo n.º 1
0
def test_cachable():
    cache_root = tempfile.mkdtemp("opencores_")
    core = Core(os.path.join(cores_root, "misc", "opencorescore.core"),
                cache_root)
    assert core.cache_status() == "empty"
    core.setup()
    assert core.cache_status() == "downloaded"
Ejemplo n.º 2
0
def test_cachable():
    cache_root = tempfile.mkdtemp('opencores_')
    core = Core(os.path.join(cores_root, 'misc', 'opencorescore.core'),
                cache_root)
    assert (core.cache_status() == 'empty')
    core.setup()
    assert (core.cache_status() == 'downloaded')
Ejemplo n.º 3
0
def test_url_provider():
    cores_root = os.path.join(tests_dir, "capi2_cores", "providers")

    for corename in ["url_simple", "url_simple_with_user_agent", "url_tar", "url_zip"]:
        cache_root = tempfile.mkdtemp(prefix="url_")
        core = Core(os.path.join(cores_root, corename + ".core"), cache_root)
        core.setup()
        assert os.path.isfile(os.path.join(core.files_root, "file.v"))
Ejemplo n.º 4
0
def test_opencores_provider():
    cache_root = tempfile.mkdtemp('opencores_')
    core = Core(os.path.join(cores_root, 'misc', 'opencorescore.core'), cache_root)

    core.setup()

    assert(os.path.isfile(os.path.join(core.files_root, 'tap_defines.v')))
    assert(os.path.isfile(os.path.join(core.files_root, 'tap_top.v')))
Ejemplo n.º 5
0
def test_url_provider():
    cache_root = tempfile.mkdtemp('url_')
    core = Core(os.path.join(cores_root, 'mmuart', 'mmuart.core'), cache_root)

    core.setup()

    assert (os.path.isfile(os.path.join(core.files_root,
                                        'uart_transceiver.v')))
Ejemplo n.º 6
0
def test_opencores_provider():
    cache_root = tempfile.mkdtemp("opencores_")
    core = Core(os.path.join(cores_root, "misc", "opencorescore.core"), cache_root)

    core.setup()

    assert os.path.isfile(os.path.join(core.files_root, "tap_defines.v"))
    assert os.path.isfile(os.path.join(core.files_root, "tap_top.v"))
Ejemplo n.º 7
0
def test_opencores_provider():
    cache_root = tempfile.mkdtemp('opencores_')
    core = Core(os.path.join(cores_root, 'misc', 'opencorescore.core'),
                cache_root)

    core.setup()

    assert (os.path.isfile(os.path.join(core.files_root, 'tap_defines.v')))
    assert (os.path.isfile(os.path.join(core.files_root, 'tap_top.v')))
Ejemplo n.º 8
0
def test_url_provider():
    cores_root = os.path.join(tests_dir, 'capi2_cores', 'providers')

    for corename in [
            'url_simple', 'url_simple_with_user_agent', 'url_tar', 'url_zip'
    ]:
        cache_root = tempfile.mkdtemp(prefix='url_')
        core = Core(os.path.join(cores_root, corename + '.core'), cache_root)
        core.setup()
        assert (os.path.isfile(os.path.join(core.files_root, 'file.v')))
Ejemplo n.º 9
0
def test_git_provider():
    cache_root = tempfile.mkdtemp('git_')
    core = Core(os.path.join(cores_root, 'misc', 'gitcore.core'), cache_root)

    core.setup()

    for f in [
            'LICENSE', 'README.md', 'wb_common.core', 'wb_common.v',
            'wb_common_params.v'
    ]:
        assert (os.path.isfile(os.path.join(core.files_root, f)))
Ejemplo n.º 10
0
def test_url_provider():
    cores_root = os.path.join(tests_dir, 'capi2_cores', 'providers')

    for corename in ['url_simple',
                     'url_simple_with_user_agent',
                     'url_tar',
                     'url_zip']:
        cache_root = tempfile.mkdtemp(prefix='url_')
        core = Core(os.path.join(cores_root, corename+'.core'), cache_root)
        core.setup()
        assert(os.path.isfile(os.path.join(core.files_root, 'file.v')))
Ejemplo n.º 11
0
def test_git_provider():
    cache_root = tempfile.mkdtemp('git_')
    core = Core(os.path.join(cores_root, 'misc', 'gitcore.core'), cache_root)
    
    core.setup()

    for f in ['LICENSE',
	      'README.md',
	      'wb_common.core',
	      'wb_common.v',
	      'wb_common_params.v']:
        assert(os.path.isfile(os.path.join(core.files_root, f)))
Ejemplo n.º 12
0
def test_git_provider():
    cache_root = tempfile.mkdtemp("git_")
    core = Core(os.path.join(cores_root, "misc", "gitcore.core"), cache_root)

    core.setup()

    for f in [
            "LICENSE",
            "README.md",
            "wb_common.core",
            "wb_common.v",
            "wb_common_params.v",
    ]:
        assert os.path.isfile(os.path.join(core.files_root, f))
Ejemplo n.º 13
0
def test_coregen_provider():

    cache_root = tempfile.mkdtemp("coregen_")
    core = Core(os.path.join(cores_root, "misc", "coregencore.core"),
                cache_root)

    os.environ["PATH"] = (os.path.join(tests_dir, "mock_commands") + ":" +
                          os.environ["PATH"])
    core.setup()

    for f in ["dummy.cgp", "dummy.xco", os.path.join("subdir", "dummy.extra")]:
        assert os.path.isfile(os.path.join(core.files_root, f))

    with open(os.path.join(core.files_root, "run.cmd")) as f:
        assert f.read() == "-r -b dummy.xco -p dummy.cgp\n"
Ejemplo n.º 14
0
def test_coregen_provider():

    cache_root = tempfile.mkdtemp('coregen_')
    core = Core(os.path.join(cores_root, 'misc', 'coregencore.core'),
                cache_root)

    os.environ['PATH'] = os.path.join(
        tests_dir, 'mock_commands') + ':' + os.environ['PATH']
    core.setup()

    for f in ['dummy.cgp', 'dummy.xco', os.path.join('subdir', 'dummy.extra')]:
        assert (os.path.isfile(os.path.join(core.files_root, f)))

    with open(os.path.join(core.files_root, 'run.cmd')) as f:
        assert (f.read() == '-r -b dummy.xco -p dummy.cgp\n')
Ejemplo n.º 15
0
def test_logicore_provider():

    cache_root = tempfile.mkdtemp('logicore_')
    core = Core(os.path.join(cores_root, 'misc', 'logicorecore.core'), cache_root)

    os.environ['PATH'] = os.path.join(tests_dir, 'mock_commands')+':'+os.environ['PATH']
    core.setup()

    for f in ['dummy.tcl',
	      'dummy.xci',
	      os.path.join('subdir', 'dummy.extra')]:
        assert(os.path.isfile(os.path.join(core.files_root, f)))

    with open(os.path.join(core.files_root, 'vivado.cmd')) as f:
        assert(f.read() == '-mode batch -source dummy.tcl\n')
Ejemplo n.º 16
0
def test_coregen_provider():

    cache_root = tempfile.mkdtemp('coregen_')
    core = Core(os.path.join(cores_root, 'misc', 'coregencore.core'), cache_root)

    os.environ['PATH'] = os.path.join(tests_dir, 'mock_commands')+':'+os.environ['PATH']
    core.setup()

    for f in ['dummy.cgp',
	      'dummy.xco',
	      os.path.join('subdir', 'dummy.extra')]:
        assert(os.path.isfile(os.path.join(core.files_root, f)))

    with open(os.path.join(core.files_root, 'run.cmd')) as f:
        assert(f.read() == '-r -b dummy.xco -p dummy.cgp\n')
Ejemplo n.º 17
0
def test_logicore_provider():

    cache_root = tempfile.mkdtemp("logicore_")
    core = Core(os.path.join(cores_root, "misc", "logicorecore.core"),
                cache_root)

    os.environ["PATH"] = (os.path.join(tests_dir, "mock_commands") + ":" +
                          os.environ["PATH"])
    core.setup()

    for f in ["dummy.tcl", "dummy.xci", os.path.join("subdir", "dummy.extra")]:
        assert os.path.isfile(os.path.join(core.files_root, f))

    with open(os.path.join(core.files_root, "vivado.cmd")) as f:
        assert f.read() == "-mode batch -source dummy.tcl\n"
Ejemplo n.º 18
0
def test_logicore_provider():

    cache_root = tempfile.mkdtemp('logicore_')
    core = Core(os.path.join(cores_root, 'misc', 'logicorecore.core'),
                cache_root)

    os.environ['PATH'] = os.path.join(
        tests_dir, 'mock_commands') + ':' + os.environ['PATH']
    core.setup()

    for f in ['dummy.tcl', 'dummy.xci', os.path.join('subdir', 'dummy.extra')]:
        assert (os.path.isfile(os.path.join(core.files_root, f)))

    with open(os.path.join(core.files_root, 'vivado.cmd')) as f:
        assert (f.read() == '-mode batch -source dummy.tcl\n')
Ejemplo n.º 19
0
def test_github_provider():
    cache_root = tempfile.mkdtemp('github_')
    core = Core(os.path.join(cores_root, 'vlog_tb_utils', 'vlog_tb_utils-1.1.core'), cache_root)
    
    core.setup()
    
    for f in ['LICENSE',
              'vlog_functions.v',
              'vlog_tap_generator.v',
              'vlog_tb_utils.core',
              'vlog_tb_utils.v']:
        assert(os.path.isfile(os.path.join(core.files_root, f)))
        ref_dir   = os.path.join(os.path.dirname(__file__),  __name__)
        f = 'vlog_functions.v'
    with open(os.path.join(ref_dir, f)) as fref, open(os.path.join(core.files_root, f)) as fgen:
            assert fref.read() == fgen.read(), f
Ejemplo n.º 20
0
def test_github_provider():
    cache_root = tempfile.mkdtemp('github_')
    core = Core(
        os.path.join(cores_root, 'vlog_tb_utils', 'vlog_tb_utils-1.1.core'),
        cache_root)

    core.setup()

    for f in [
            'LICENSE', 'vlog_functions.v', 'vlog_tap_generator.v',
            'vlog_tb_utils.core', 'vlog_tb_utils.v'
    ]:
        assert (os.path.isfile(os.path.join(core.files_root, f)))
        ref_dir = os.path.join(os.path.dirname(__file__), __name__)
        f = 'vlog_functions.v'
    with open(os.path.join(ref_dir,
                           f)) as fref, open(os.path.join(core.files_root,
                                                          f)) as fgen:
        assert fref.read() == fgen.read(), f
Ejemplo n.º 21
0
def test_github_provider():
    cache_root = tempfile.mkdtemp("github_")
    core = Core(
        os.path.join(cores_root, "vlog_tb_utils", "vlog_tb_utils-1.1.core"),
        cache_root)

    core.setup()

    for f in [
            "LICENSE",
            "vlog_functions.v",
            "vlog_tap_generator.v",
            "vlog_tb_utils.core",
            "vlog_tb_utils.v",
    ]:
        assert os.path.isfile(os.path.join(core.files_root, f))
        ref_dir = os.path.join(os.path.dirname(__file__), __name__)
        f = "vlog_functions.v"
    with open(os.path.join(ref_dir,
                           f)) as fref, open(os.path.join(core.files_root,
                                                          f)) as fgen:
        assert fref.read() == fgen.read(), f
Ejemplo n.º 22
0
def test_cachable():
    cache_root = tempfile.mkdtemp('opencores_')
    core = Core(os.path.join(cores_root, 'misc', 'opencorescore.core'), cache_root)
    assert(core.cache_status() == 'empty')
    core.setup()
    assert(core.cache_status() == 'downloaded')