forked from VUnit/vunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
308 changed files
with
1,012 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ VUnit | |
VUnit except for OSVVM (see below) is released under the terms of | ||
Mozilla Public License, v. 2.0. | ||
|
||
Copyright (c) 2014-2017, Lars Asplund [email protected] | ||
Copyright (c) 2014-2018, Lars Asplund [email protected] | ||
|
||
OSVVM | ||
----- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,34 @@ Contributing in the form of code, feedback, ideas or bug reports are | |
welcome. Code contributions are expected to pass all tests and style | ||
checks. If there are any problems let us know. | ||
|
||
Before doing any major changes we recommend creating an issue or | ||
chatting with us on gitter to discuss first. In this way you do not | ||
get started on the wrong track and wasting time. | ||
|
||
Being a testing framework we value automated testing and all | ||
contributions in both the Python and VHDL/SystemVerilog domain are | ||
expected to add new tests along with the new functionality. | ||
|
||
Copyright | ||
--------- | ||
Any contribution must give the copyright to Lars Asplund. | ||
This is necessary to manage the project freely. | ||
Copyright is given by adding the copyright notice to the beginning of each file. | ||
|
||
.. code-block:: python | ||
# 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] | ||
Python related | ||
-------------- | ||
|
||
Running the tests | ||
----------------- | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
The test suite is divided into three parts: | ||
|
||
|
@@ -22,44 +48,17 @@ The test suite is divided into three parts: | |
The test suites must pass with both Python 2.7 and Python 3.x as well | ||
as with all supported simulators. | ||
|
||
Testing with Tox | ||
~~~~~~~~~~~~~~~~ | ||
VUnit uses the Python `tox <http://tox.readthedocs.org/>`__ tool. Tox | ||
makes it easier to automatically test VUnit in various | ||
configurations. Tox automates creation of virtual environments and | ||
installation of dependencies needed for testing. In fact, all of the | ||
tests can be run in a single command: | ||
|
||
.. code-block:: console | ||
vunit/ > tox | ||
For running the test locally we recommend using `pytest <https://pypi.python.org/pypi/pytest>`__. | ||
|
||
If tox is not available in your Python environment, it can be installed from | ||
PyPI with pip: | ||
Example | ||
''''''' | ||
.. code-block:: shell | ||
:caption: Example of running all unit tests | ||
.. code-block:: console | ||
vunit/ > pip install tox | ||
For most developers, running the full testsuite will likely lead to failed test | ||
cases because not all Python interpreters or HDL simulators are installed in | ||
their environment. More focused testing is possible by specifying which tox | ||
"environments" should be tested. For example, assume a developer uses Python 2.7 | ||
and Modelsim and would like to test changes using tools available in his | ||
environment: | ||
|
||
.. code-block:: console | ||
vunit/ > tox -e py27-unit,py27-acceptance-modelsim | ||
A full list of test environments can be seen by issuing the following command: | ||
|
||
.. code-block:: console | ||
vunit/ > tox -l | ||
pytest vunit/test/unit/ | ||
Dependencies | ||
------------ | ||
~~~~~~~~~~~~ | ||
|
||
Other than the dependencies required to use VUnit as a user the | ||
following are also required for developers to run the test suite manually: | ||
|
@@ -74,7 +73,7 @@ following are also required for developers to run the test suite manually: | |
Code analysis. | ||
|
||
Code coverage | ||
------------- | ||
~~~~~~~~~~~~~ | ||
|
||
Code coverage can be measured using the | ||
`coverage <https://pypi.python.org/pypi/coverage>`__ tool. The following | ||
|
@@ -91,9 +90,101 @@ this paragraph the total coverage was 92%. Missing coverage can be | |
analyzed by opening the generated *htmlcov/index.html* produced by the | ||
above commands. | ||
|
||
VHDL related | ||
------------ | ||
|
||
Running the tests | ||
~~~~~~~~~~~~~~~~~ | ||
Each part of the VUnit VHDL code base has tests with a corresponding ``run.py`` file. | ||
For example :vunit_file:`vunit/vhdl/verification_components/run.py`. | ||
|
||
Example | ||
''''''' | ||
.. code-block:: shell | ||
:caption: Example of running all verification component tests | ||
python vunit/vhdl/verification_components/run.py | ||
Coding Style | ||
~~~~~~~~~~~~ | ||
Contributions of VHDL code should blend in with the VUnit code style. | ||
|
||
- Use lower case and ``snake_case`` for all identifiers and keywords. | ||
- Do not use prefixes or suffixes like ``_c`` or ``_g`` for constants. | ||
- Use ``_t`` suffix for type like ``<typename>_t``. | ||
- Never use the fact that VHDL is case-insensitive; Do not use ``Foo`` | ||
and ``foo`` to refer to the same identifier. | ||
- Name array types ``<base_type_name>_vec_t`` | ||
- Name packages with suffix ``_pkg`` | ||
- Name files the same as the package or entity they contain such as ``<entity_name>.vhd`` | ||
- Never put more than one entity/package in the same file. | ||
- Keep the architecture in the same file as the entity unless there | ||
are several architectures. When there are several architectures put | ||
them all in separate files named | ||
``<entity_name>_<architecture_name>.vhd``. | ||
- Put comments documenting functions and procedures above the | ||
declaration in the package header rather than the definition in the | ||
package body. | ||
|
||
Regarding formatting use look at other VHDL files and follow that | ||
style. For example :vunit_file:`examples/vhdl/uart/src/uart_tx.vhd` | ||
|
||
|
||
Continous Integration | ||
--------------------- | ||
VUnit runs all test and lint checks on both Windows using AppVeyor and | ||
Linux using Travis CI with several versions of Python. GHDL is used to | ||
run the VHDL tests of all our libraries and examples. | ||
|
||
All tests will be automatically run on any pull request and they are | ||
expected to pass for us to approve the merge. | ||
|
||
Any commit on master that has a successful CI run will automatically | ||
update the `VUnit website <https://vunit.github.io>`__ | ||
|
||
Testing with Tox | ||
~~~~~~~~~~~~~~~~ | ||
VUnit uses the Python `tox <http://tox.readthedocs.org/>`__ tool in | ||
the CI flow. Typically developers do not need to run this on their | ||
local machine. | ||
|
||
Tox makes it easier to automatically test VUnit in various | ||
configurations. Tox automates creation of virtual environments and | ||
installation of dependencies needed for testing. In fact, all of the | ||
tests can be run in a single command: | ||
|
||
.. code-block:: console | ||
vunit/ > tox | ||
If tox is not available in your Python environment, it can be installed from | ||
PyPI with pip: | ||
|
||
.. code-block:: console | ||
vunit/ > pip install tox | ||
For most developers, running the full testsuite will likely lead to failed test | ||
cases because not all Python interpreters or HDL simulators are installed in | ||
their environment. More focused testing is possible by specifying which tox | ||
"environments" should be tested. For example, assume a developer uses Python 2.7 | ||
and Modelsim and would like to test changes using tools available in his | ||
environment: | ||
|
||
.. code-block:: console | ||
vunit/ > tox -e py27-unit,py27-acceptance-modelsim | ||
A full list of test environments can be seen by issuing the following command: | ||
|
||
.. code-block:: console | ||
vunit/ > tox -l | ||
Making releases | ||
--------------- | ||
~~~~~~~~~~~~~~~ | ||
|
||
Releases are automatically made by Travic CI on any ``master`` commit | ||
that has a new version set in ``vunit/about.py`` together with a | ||
|
Oops, something went wrong.