summaryrefslogtreecommitdiff
path: root/test/meson.build
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-09-20 16:34:14 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-09-24 15:42:50 +0200
commit3762f8e316e9cc5fed0ca0dc810bec0db1cb0632 (patch)
tree5ad4b7e3f7a4242b838dade5baf3839331a1bbfd /test/meson.build
parent465815aaa7e49998e6b71dd56e4b4efc846fe823 (diff)
downloadsystemd-3762f8e316e9cc5fed0ca0dc810bec0db1cb0632.tar.gz
tests: add a runner for installed tests
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.
Diffstat (limited to 'test/meson.build')
-rw-r--r--test/meson.build8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build
index 9750ff22b9..13896aee50 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -229,6 +229,14 @@ endif
############################################################
+if install_tests
+ install_data('run-unit-tests.py',
+ install_mode : 'rwxr-xr-x',
+ install_dir : testsdir)
+endif
+
+############################################################
+
# prepare test/sys tree
sys_script_py = find_program('sys-script.py')
custom_target(