def test_quartus(): tests_dir = os.path.dirname(__file__) params = vlogparams + vlogdefines core = get_core("sockit") backend = get_synth('quartus', core) backend.configure(params) tcl_file = core.name.sanitized_name + '.tcl' ref_dir = os.path.join(tests_dir, __name__) assert '' == compare_file(ref_dir, backend.work_root, tcl_file)
def test_ise(): tests_dir = os.path.dirname(__file__) params = vlogparams + vlogdefines core = get_core("atlys") backend = get_synth('ise', core) backend.configure(params) tcl_file = core.name.sanitized_name + '.tcl' reference_tcl = os.path.join(tests_dir, __name__, tcl_file) generated_tcl = os.path.join(backend.work_root, tcl_file) assert os.path.exists(generated_tcl) with open(reference_tcl) as f1, open(generated_tcl) as f2: assert f1.read() == f2.read()
def test_ise(): tests_dir = os.path.dirname(__file__) params = '--vlogparam_bool --vlogparam_int=42 --vlogparam_str=hello' params += ' --vlogdefine_bool --vlogdefine_int=42 --vlogdefine_str=hello' core = get_core("atlys") backend = get_synth('ise', core) backend.configure(params.split()) tcl_file = core.name.sanitized_name + '.tcl' reference_tcl = os.path.join(tests_dir, __name__, tcl_file) generated_tcl = os.path.join(backend.work_root, tcl_file) assert os.path.exists(generated_tcl) with open(reference_tcl) as f1, open(generated_tcl) as f2: diff = ''.join(difflib.unified_diff(f1.readlines(), f2.readlines())) assert diff == ''
import difflib import os import pytest from test_common import compare_files, get_core, get_synth, vlogdefines, vlogparams tests_dir = os.path.dirname(__file__) params = vlogparams + vlogdefines core = get_core("mor1kx-arty") backend = get_synth('vivado', core) ref_dir = os.path.join(tests_dir, __name__) work_root = backend.work_root def test_vivado_configure(): backend.configure(params) tcl_file = core.name.sanitized_name + '.tcl' compare_files(ref_dir, work_root, [tcl_file]) def test_vivado_build(): os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] backend.build() compare_files(ref_dir, work_root, ['run.cmd'])
import difflib import os import pytest from test_common import compare_file, get_core, get_synth, vlogdefines, vlogparams tests_dir = os.path.dirname(__file__) params = vlogparams + vlogdefines core = get_core("c3demo") backend = get_synth('icestorm', core) ref_dir = os.path.join(tests_dir, __name__) work_root = backend.work_root def test_icestorm_configure(): backend.configure(params) ys_file = core.name.sanitized_name + '.ys' assert '' == compare_file(ref_dir, work_root, "Makefile") assert '' == compare_file(ref_dir, work_root, "config.mk") assert '' == compare_file(ref_dir, work_root, ys_file) def test_icestorm_build(): os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] backend.build(params) assert '' == compare_file(ref_dir, work_root, 'run.cmd')
import difflib import os import pytest from test_common import get_core, get_synth, vlogdefines, vlogparams tests_dir = os.path.dirname(__file__) core = get_core("sockit") backend = get_synth('quartus', core) work_root = backend.work_root def test_quartus_configure(): params = vlogparams + vlogdefines backend.configure(params) tcl_file = core.name.sanitized_name + '.tcl' ref_dir = os.path.join(tests_dir, __name__) for f in ['config.mk', 'Makefile', 'sockit_0.tcl']: with open(os.path.join(ref_dir, f)) as fref, open(os.path.join(work_root, f)) as fgen: assert fref.read() == fgen.read(), f def test_quartus_build(): os.environ['PATH'] = os.path.join( tests_dir, 'mock_commands') + ':' + os.environ['PATH'] backend.build()