Testing Yosys¶
Running the included test suite¶
The Yosys source comes with a test suite to avoid regressions and keep
everything working as expected. Tests can be run by calling make test from
the root Yosys directory.
Functional tests¶
Testing functional backends (see Writing a new backend using FunctionalIR) has a few requirements in addition to those listed in Build prerequisites:
sudo apt-get install racket
raco pkg install rosette
pip install pytest-xdist pytest-xdist-gnumake
brew install racket
raco pkg install rosette
pip install pytest-xdist pytest-xdist-gnumake
If you don’t have one of the CAD suite(s) installed, you should also install Z3 following their instructions.
Then, set the ENABLE_FUNCTIONAL_TESTS make variable when calling
make test and the functional tests will be run as well.
Unit tests¶
Running the unit tests requires the following additional packages:
sudo apt-get install libgtest-dev
No additional requirements.
Unit tests can be run with make unit-test.
Docs tests¶
There are some additional tests for checking examples included in the
documentation, which can be run by calling make test from the
yosys/docs sub-directory (or make -C docs test from the root). This
also includes checking some macro commands to ensure that descriptions of them
are kept up to date, and is mostly intended for CI.
Automatic testing¶
The Yosys Git repo has automatic testing of builds and running of the included test suite on both Ubuntu and macOS, as well as across range of compiler versions. For up to date information, including OS versions, refer to the git actions page.