summaryrefslogtreecommitdiff
path: root/test/run-unit-tests.py
Commit message (Collapse)AuthorAgeFilesLines
* licensing: add forgotten spdx headersZbigniew Jędrzejewski-Szmek2021-10-011-0/+1
| | | | | Those are all "our" files, but we forgot to add the headers, most likely because of non-standard file extensions.
* test/run-unit-tests: make script compatible with python3.6Zbigniew Jędrzejewski-Szmek2021-05-181-8/+6
| | | | | | | dataclasses were added in python3.7, but bionic has python3.6. Yes, the new code is a travesty, but it does the job. Fixes #19640.
* test: combine stdout/stderr from failed testDan Streetman2021-05-151-7/+24
| | | | | | | | Printing stdout and stderr from a failed test makes it harder to interpret what the specific problem was; instead let's print out the lines in order as we got them when the test was run Also save failed test output to file if ARTIFACT_DIRECTORY is defined
* run-unit-tests: add option to run unsafe tests tooZbigniew Jędrzejewski-Szmek2018-09-241-0/+12
|
* tests: add a runner for installed testsZbigniew Jędrzejewski-Szmek2018-09-241-0/+49
We have "installed tests", but don't provide an easy way to run them. The protocol is very simple: each test must return 0 for success, 77 means "skipped", anything else is an error. In addition, we want to print test output only if the test failed. I wrote this simple script. It is pretty basic, but implements the functions listed above. Since it is written in python it should be easy to add option parsing (like running only specific tests, or running unsafe tests, etc.) I looked at the following alternatives: - Ubuntu root-unittests: this works, but just dumps all output to the terminal, has no coloring. - @ssahani's test runner [2] It uses the unittest library and the test suite was implented as a class, and doesn't implement any of the functions listed above. - cram [3,4] cram runs our tests, but does not understand the "ignore the output" part, has not support for our magic skip code (it uses hardcoded 80 instead), and seems dead upstream. - meson test Here the idea would be to provide an almost-empty meson.build file under /usr/lib/systemd/tests/ that would just define all the tests. This would allow us to reuse the test runner we use normally. Unfortunately meson requires a build directory and configuration to be done before running tests. This would be possible, but seems a lot of effort to just run a few binaries. [1] https://salsa.debian.org/systemd-team/systemd/blob/242c96addb06480ec9cd75248a5660f37a17b4b9/debian/tests/root-unittests [2] https://github.com/systemd/systemd-fedora-ci/blob/master/upstream/systemd-upstream-tests.py [3] https://bitheap.org/cram/ [4] https://pypi.org/project/pytest-cram/ Fixes #10069.