]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
testing: Add basic atf support to pytest.
authorAlexander V. Chernikov <melifaro@FreeBSD.org>
Sat, 25 Jun 2022 19:01:45 +0000 (19:01 +0000)
committerAlexander V. Chernikov <melifaro@FreeBSD.org>
Fri, 13 Jan 2023 21:24:10 +0000 (21:24 +0000)
commit0a76e8d75beabf5a4274b3335866b6c853f42b00
tree668828cbb6f9122f45c6ccdcb43bdbba96b0a381
parentfc850f4f7d44201210750329eeb5ca35dd04b58c
testing: Add basic atf support to pytest.

Implementation consists of the pytest plugin implementing ATF format and
a simple C++ wrapper, which reorders the provided arguments from ATF format
to the format understandable by pytest. Each test has this wrapper specified
after the shebang. When kyua executes the test, wrapper calls pytest, which
loads atf plugin, does the work and returns the result. Additionally, a
separate python "package", `/usr/tests/atf_python` has been added to collect
code that may be useful across different tests.

Current limitations:
* Opaque metadata passing via X-Name properties. Require some fixtures to write
* `-s srcdir` parameter passed by the runner is ignored.
* No `atf-c-api(3)` or similar - relying on pytest framework & existing python libraries
* No support for `atf_tc_<get|has>_config_var()` & `atf_tc_set_md_var()`.
 Can be probably implemented with env variables & autoload fixtures

Differential Revision: https://reviews.freebsd.org/D31084
Reviewed by: kp, ngie

(cherry picked from commit 8eb2bee6c0f4957c6c1cea826e59cda4d18a2a64)
16 files changed:
share/mk/atf.test.mk
tests/Makefile
tests/__init__.py [new file with mode: 0644]
tests/atf_python/Makefile [new file with mode: 0644]
tests/atf_python/__init__.py [new file with mode: 0644]
tests/atf_python/atf_pytest.py [new file with mode: 0644]
tests/atf_python/sys/Makefile [new file with mode: 0644]
tests/atf_python/sys/__init__.py [new file with mode: 0644]
tests/atf_python/sys/net/Makefile [new file with mode: 0644]
tests/atf_python/sys/net/__init__.py [new file with mode: 0644]
tests/atf_python/sys/net/rtsock.py [new file with mode: 0755]
tests/atf_python/sys/net/tools.py [new file with mode: 0644]
tests/atf_python/sys/net/vnet.py [new file with mode: 0644]
tests/conftest.py [new file with mode: 0644]
tests/freebsd_test_suite/Makefile [new file with mode: 0644]
tests/freebsd_test_suite/atf_pytest_wrapper.cpp [new file with mode: 0644]