def run_test(): random.seed(0) # Initialize vunit with command line parameters. vu = config.setup_vunit() # Set up logging. config.setup_logging(vu.log_level) # Get filenames for test import os this_dir = os.path.dirname(os.path.realpath(__file__)) filenames = [ os.path.join(this_dir, 'complex_pkg.vhd'), os.path.join(this_dir, 'complex_mag2.vhd'), ] # Register the test with VUnit. test_output_directory = os.path.join(this_dir, 'generated') test_utils.register_test_with_vunit( vu=vu, directory=test_output_directory, filenames=filenames, top_entity='complex_mag2', all_generics=[{}], test_class=ComplexMag2Test, top_params={}, ) # Run the tests with VUnit vu.set_sim_option('disable_ieee_warnings', True) vu.main()
def test_vunit_simple_integration(): thistestoutput_dir = os.path.join(testoutput_dir, 'integration') if os.path.exists(thistestoutput_dir): shutil.rmtree(thistestoutput_dir) os.makedirs(thistestoutput_dir) entity_filename = os.path.join(vhdl_dir, 'dummy.vhd') package_filenames = [ os.path.join(vhdl_dir, 'vhdl_type_pkg.vhd'), os.path.join(vhdl_dir, 'test_pkg.vhd'), ] filenames = [entity_filename] + package_filenames generation_directory = os.path.join(thistestoutput_dir, 'generated') os.makedirs(generation_directory) vu = config.setup_vunit(argv=[]) test_utils.register_test_with_vunit( vu=vu, directory=generation_directory, filenames=filenames, top_entity='dummy', all_generics=[{ 'length': 4 }, { 'length': 31 }], top_params={}, test_class=DummyChecker, ) all_ok = vu._main() assert all_ok
def test_axi_adder(): tests = axi_adder.get_tests() slvcodec_config.setup_fusesoc(cores_roots=[coresdir]) vu = slvcodec_config.setup_vunit(argv=['--dont-catch-exceptions']) for coretest in tests: test_utils.register_coretest_with_vunit(vu, coretest, testoutput_dir) all_ok = vu._main() assert all_ok
def run_vunit(tests, cores_roots, test_output_directory): ''' Setup vunit, register the tests, and run them. ''' vu = config.setup_vunit() config.setup_logging(vu.log_level) for test in tests: register_coretest_with_vunit(vu, test, test_output_directory) vu.main()
def test_vunit_coretest_integration(): thistestoutput_dir = os.path.join(testoutput_dir, 'coretest_integration') if os.path.exists(thistestoutput_dir): shutil.rmtree(thistestoutput_dir) os.makedirs(thistestoutput_dir) coretest = { 'core_name': 'Dummy', 'entity_name': 'dummy', 'param_sets': [{ 'top_params': {}, 'generic_sets': [{'length': 3}], }], 'generator': DummyChecker, } config.setup_fusesoc(cores_roots=[coresdir]) vu = config.setup_vunit(argv=['--dont-catch-exceptions']) test_utils.register_coretest_with_vunit(vu, coretest, thistestoutput_dir) all_ok = vu._main(post_run=None) assert all_ok
def test_vunit_coretest_integration(): thistestoutput_dir = os.path.join(testoutput_dir, 'coretest_integration') if os.path.exists(thistestoutput_dir): shutil.rmtree(thistestoutput_dir) os.makedirs(thistestoutput_dir) coretest = { 'core_name': 'Dummy', 'entity_name': 'dummy', 'all_generics': [{ 'length': 4 }, { 'length': 12 }], 'generator': DummyChecker, } config.setup_fusesoc(cores_roots=[coresdir]) vu = config.setup_vunit(argv=[]) test_utils.register_coretest_with_vunit(vu, coretest, thistestoutput_dir) all_ok = vu._main() assert all_ok