add tests with pytest

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-03-18 04:09:00 +01:00
parent 636da72d32
commit 9d169a44af
3 changed files with 49 additions and 5 deletions

View File

@ -214,8 +214,5 @@ jobs:
run: | run: |
. ./.github/scripts/activate.sh . ./.github/scripts/activate.sh
for tool in place route synth write-fasm; do pip3 install -r ./test/requirements.txt
echo "::group::Test f4pga-$tool" pytest -vsrA --color=yes test/wrappers.py
"f4pga-$tool" || echo "Failing?"
echo "::endgroup::"
done;

1
test/requirements.txt Normal file
View File

@ -0,0 +1 @@
pytest

46
test/wrappers.py Normal file
View File

@ -0,0 +1,46 @@
from pytest import mark
from sys import stdout, stderr
from subprocess import check_call
@mark.xfail
@mark.parametrize("wrapper", ['place', 'route', 'synth', 'write-fasm'])
def test_wrapper(wrapper):
print(f"\n::group::Test {wrapper}")
stdout.flush()
stderr.flush()
try:
check_call(f"f4pga-{wrapper}")
finally:
print("\n::endgroup::")
@mark.xfail
@mark.parametrize(
"wrapper",
[
'symbiflow_generate_constraints',
'symbiflow_pack',
'symbiflow_place',
'symbiflow_route',
'symbiflow_synth',
'symbiflow_write_bitstream',
'symbiflow_write_fasm',
'symbiflow_write_xml_rr_graph',
'vpr_common',
'symbiflow_analysis',
'symbiflow_repack',
'symbiflow_generate_bitstream',
'symbiflow_generate_libfile',
'ql_symbiflow'
]
)
def test_shell_wrapper(wrapper):
print(f"\n::group::Test {wrapper}")
stdout.flush()
stderr.flush()
try:
check_call(f"{wrapper}")
finally:
print("\n::endgroup::")