# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2014-2020, Lars Asplund [email protected] """ Public VUnit interface """ from pathlib import Path import vunit.version_check from vunit.ui import VUnit from vunit.vunit_cli import VUnitCLI from vunit.about import version, doc # Repository root ROOT = str(Path(__file__).parent.parent.resolve()) __version__ = version() __doc__ = doc() # pylint: disable=redefined-builtin
ending = os.path.splitext(filename)[-1] if endings is None or ending in endings: result.append(os.path.join(root, filename)) return result DATA_FILES = [] DATA_FILES += find_all_files(os.path.join("vunit"), endings=[".tcl"]) DATA_FILES += find_all_files(os.path.join("vunit", "vhdl")) DATA_FILES += find_all_files(os.path.join("vunit", "verilog"), endings=[".v", ".sv", ".svh"]) DATA_FILES = [os.path.relpath(file_name, "vunit") for file_name in DATA_FILES] setup( name="vunit_hdl", version=version(), packages=[ "vunit", "vunit.com", "vunit.parsing", "vunit.parsing.verilog", "vunit.test", "vunit.test.lint", "vunit.test.unit", "vunit.test.acceptance", "vunit.ui", "vunit.vivado", ], package_data={"vunit": DATA_FILES}, zip_safe=False, url="https://github.com/VUnit/vunit",
def _create_argument_parser(description=None, for_documentation=False): """ Create the argument parser :param description: A custom short description of the command line tool :param for_documentation: When used for user guide documentation :returns: The created :mod:`argparse` parser object """ if description is None: description = 'VUnit command line tool version %s' % version() if for_documentation: default_output_path = "./vunit_out" else: default_output_path = join(abspath(os.getcwd()), "vunit_out") parser = argparse.ArgumentParser(description=description) parser.add_argument('test_patterns', metavar='tests', nargs='*', default='*', help='Tests to run') parser.add_argument('-l', '--list', action='store_true', default=False, help='Only list all test cases') parser.add_argument('-f', '--files', action='store_true', default=False, help='Only list all files in compile order') parser.add_argument('--compile', action='store_true', default=False, help='Only compile project without running tests') parser.add_argument( '-k', '--keep-compiling', action='store_true', default=False, help= 'Continue compiling even after errors only skipping files that depend on failed files' ) parser.add_argument('--fail-fast', action='store_true', default=False, help='Stop immediately on first failing test') parser.add_argument('--elaborate', action='store_true', default=False, help='Only elaborate test benches without running') parser.add_argument('--clean', action='store_true', default=False, help='Remove output path first') parser.add_argument( '-o', '--output-path', default=default_output_path, help='Output path for compilation and simulation artifacts') parser.add_argument('-x', '--xunit-xml', default=None, help='Xunit test report .xml file') parser.add_argument( '--exit-0', default=False, action="store_true", help= ('Exit with code 0 even if a test failed. ' 'Still exits with code 1 on fatal errors such as compilation failure' )) parser.add_argument('--dont-catch-exceptions', default=False, action="store_true", help=('Let exceptions bubble up all the way. ' 'Useful when running with "python -m pdb".')) parser.add_argument( '-v', '--verbose', action="store_true", default=False, help='Print test output immediately and not only when failure') parser.add_argument( '-q', '--quiet', action="store_true", default=False, help='Do not print test output even in the case of failure') parser.add_argument('--no-color', action='store_true', default=False, help='Do not color output') parser.add_argument('--log-level', default="warning", choices=["info", "error", "warning", "debug"], help=("Log level of VUnit internal python logging. " "Used for debugging")) parser.add_argument( '-p', '--num-threads', type=positive_int, default=1, help=( 'Number of tests to run in parallel. ' 'Test output is not continuously written in verbose mode with p > 1' )) parser.add_argument( "-u", "--unique-sim", action="store_true", default=False, help= "Do not re-use the same simulator process for running different test cases (slower)" ) parser.add_argument( "--coverage", default=None, nargs="?", help="Enable code coverage. Works with ModelSim and RivieraPRO.") parser.add_argument('--version', action='version', version=version()) SIMULATOR_FACTORY.add_arguments(parser) return parser
def _create_argument_parser(description=None, for_documentation=False): """ Create the argument parser :param description: A custom short description of the command line tool :param for_documentation: When used for user guide documentation :returns: The created :mod:`argparse` parser object """ if description is None: description = "VUnit command line tool version %s" % version() if for_documentation: default_output_path = "./vunit_out" else: default_output_path = str(Path(os.getcwd()).resolve() / "vunit_out") parser = argparse.ArgumentParser(description=description) parser.add_argument( "test_patterns", metavar="tests", nargs="*", default="*", help="Tests to run" ) parser.add_argument( "--with-attributes", default=None, action="append", help="Only select tests with these attributes set", ) parser.add_argument( "--without-attributes", default=None, action="append", help="Only select tests without these attributes set", ) parser.add_argument( "-l", "--list", action="store_true", default=False, help="Only list all test cases", ) parser.add_argument( "-f", "--files", action="store_true", default=False, help="Only list all files in compile order", ) parser.add_argument( "--compile", action="store_true", default=False, help="Only compile project without running tests", ) parser.add_argument( "-m", "--minimal", action="store_true", default=False, help="Only compile files required for the (filtered) test benches", ) parser.add_argument( "-k", "--keep-compiling", action="store_true", default=False, help="Continue compiling even after errors only skipping files that depend on failed files", ) parser.add_argument( "--fail-fast", action="store_true", default=False, help="Stop immediately on first failing test", ) parser.add_argument( "--elaborate", action="store_true", default=False, help="Only elaborate test benches without running", ) parser.add_argument( "--clean", action="store_true", default=False, help="Remove output path first" ) parser.add_argument( "-o", "--output-path", default=default_output_path, help="Output path for compilation and simulation artifacts", ) parser.add_argument( "-x", "--xunit-xml", default=None, help="Xunit test report .xml file" ) parser.add_argument( "--xunit-xml-format", choices=["jenkins", "bamboo"], default="jenkins", help=( "Only valid with --xunit-xml argument. " "Defines where in the XML file the simulator output is stored on a failure. " '"jenkins" = Output stored in <system-out>, ' '"bamboo" = Output stored in <failure>.' ), ) parser.add_argument( "--exit-0", default=False, action="store_true", help=( "Exit with code 0 even if a test failed. " "Still exits with code 1 on fatal errors such as compilation failure" ), ) parser.add_argument( "--dont-catch-exceptions", default=False, action="store_true", help=( "Let exceptions bubble up all the way. " 'Useful when running with "python -m pdb".' ), ) parser.add_argument( "-v", "--verbose", action="store_true", default=False, help="Print test output immediately and not only when failure", ) parser.add_argument( "-q", "--quiet", action="store_true", default=False, help="Do not print test output even in the case of failure", ) parser.add_argument( "--no-color", action="store_true", default=False, help="Do not color output" ) parser.add_argument( "--log-level", default="warning", choices=["info", "error", "warning", "debug"], help=("Log level of VUnit internal python logging. " "Used for debugging"), ) parser.add_argument( "-p", "--num-threads", type=positive_int, default=1, help=( "Number of tests to run in parallel. " "Test output is not continuously written in verbose mode with p > 1" ), ) parser.add_argument( "-u", "--unique-sim", action="store_true", default=False, help="Do not re-use the same simulator process for running different test cases (slower)", ) parser.add_argument( "--export-json", default=None, help="Export project information to a JSON file." ) parser.add_argument("--version", action="version", version=version()) SIMULATOR_FACTORY.add_arguments(parser) return parser
def _create_argument_parser(description=None, for_documentation=False): """ Create the argument parser :param description: A custom short description of the command line tool :param for_documentation: When used for user guide documentation :returns: The created :mod:`argparse` parser object """ if description is None: description = 'VUnit command line tool version %s' % version() if for_documentation: default_output_path = "./vunit_out" else: default_output_path = join(abspath(os.getcwd()), "vunit_out") parser = argparse.ArgumentParser(description=description) parser.add_argument('test_patterns', metavar='tests', nargs='*', default='*', help='Tests to run') parser.add_argument("--with-attributes", default=None, action="append", help="Only select tests with these attributes set") parser.add_argument("--without-attributes", default=None, action="append", help="Only select tests without these attributes set") parser.add_argument('-l', '--list', action='store_true', default=False, help='Only list all test cases') parser.add_argument('-f', '--files', action='store_true', default=False, help='Only list all files in compile order') parser.add_argument('--compile', action='store_true', default=False, help='Only compile project without running tests') parser.add_argument('-k', '--keep-compiling', action='store_true', default=False, help='Continue compiling even after errors only skipping files that depend on failed files') parser.add_argument('--fail-fast', action='store_true', default=False, help='Stop immediately on first failing test') parser.add_argument('--elaborate', action='store_true', default=False, help='Only elaborate test benches without running') parser.add_argument('--clean', action='store_true', default=False, help='Remove output path first') parser.add_argument('-o', '--output-path', default=default_output_path, help='Output path for compilation and simulation artifacts') parser.add_argument('-x', '--xunit-xml', default=None, help='Xunit test report .xml file') parser.add_argument('--xunit-xml-format', choices=['jenkins', 'bamboo'], default='jenkins', help=('Only valid with --xunit-xml argument. ' 'Defines where in the XML file the simulator output is stored on a failure. ' '"jenkins" = Output stored in <system-out>, ' '"bamboo" = Output stored in <failure>.')) parser.add_argument('--exit-0', default=False, action="store_true", help=('Exit with code 0 even if a test failed. ' 'Still exits with code 1 on fatal errors such as compilation failure')) parser.add_argument('--dont-catch-exceptions', default=False, action="store_true", help=('Let exceptions bubble up all the way. ' 'Useful when running with "python -m pdb".')) parser.add_argument('-v', '--verbose', action="store_true", default=False, help='Print test output immediately and not only when failure') parser.add_argument('-q', '--quiet', action="store_true", default=False, help='Do not print test output even in the case of failure') parser.add_argument('--no-color', action='store_true', default=False, help='Do not color output') parser.add_argument('--log-level', default="warning", choices=["info", "error", "warning", "debug"], help=("Log level of VUnit internal python logging. " "Used for debugging")) parser.add_argument('-p', '--num-threads', type=positive_int, default=1, help=('Number of tests to run in parallel. ' 'Test output is not continuously written in verbose mode with p > 1')) parser.add_argument("-u", "--unique-sim", action="store_true", default=False, help="Do not re-use the same simulator process for running different test cases (slower)") parser.add_argument("--export-json", default=None, help="Export project information to a JSON file.") parser.add_argument('--version', action='version', version=version()) SIMULATOR_FACTORY.add_arguments(parser) return parser
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2014-2018, Lars Asplund [email protected] """ Public VUnit interface """ from os.path import dirname, join, abspath import vunit.version_check from vunit.ui import VUnit from vunit.vunit_cli import VUnitCLI from vunit.about import version, doc from vunit.json4vhdl import read_json, encode_json # Repository root ROOT = abspath(join(dirname(__file__), "..")) __version__ = version() __doc__ = doc() # pylint: disable=redefined-builtin
ending = os.path.splitext(filename)[-1] if endings is None or ending in endings: result.append(os.path.join(root, filename)) else: print("Ignoring %s" % filename) return result data_files = [] data_files += find_all_files(os.path.join('vunit', 'vhdl')) data_files += find_all_files(os.path.join('vunit', 'verilog'), endings=[".v", ".sv", ".svh"]) data_files = [os.path.relpath(file_name, 'vunit') for file_name in data_files] setup( name='vunit_hdl', version=version(), packages=['vunit', 'vunit.com', 'vunit.test', 'vunit.parsing', 'vunit.parsing.verilog', 'vunit.test.lint', 'vunit.test.unit', 'vunit.test.acceptance'], package_data={'vunit': data_files}, zip_safe=False, url='https://github.com/VUnit/vunit', classifiers=['Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', 'Natural Language :: English', 'Intended Audience :: Developers',