diff --git a/.packit.yml b/.packit.yml index 1646c906..e7509c15 100644 --- a/.packit.yml +++ b/.packit.yml @@ -1,5 +1,5 @@ --- -# vi:ts=2 sw=2 et: +# vi: set ts=2 sw=2 et: # # Docs: https://packit.dev/docs/ @@ -35,8 +35,20 @@ jobs: - job: copr_build trigger: pull_request targets: - - fedora-all-aarch64 - - fedora-all-i386 - - fedora-all-ppc64le - - fedora-all-s390x - - fedora-all-x86_64 + - fedora-all-aarch64 + - fedora-all-i386 + - fedora-all-ppc64le + - fedora-all-s390x + - fedora-all-x86_64 + +- job: tests + trigger: pull_request + fmf_path: test/integration/ + tmt_plan: upstream_ci + targets: + # Limit the Testing Farm jobs to the latest stable and rawhide releases to conserve resources + # See: https://packit.dev/docs/configuration#aliases + - fedora-latest-stable-aarch64 + - fedora-latest-stable-x86_64 + - fedora-rawhide-aarch64 + - fedora-rawhide-x86_64 diff --git a/test/integration/.fmf/version b/test/integration/.fmf/version new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/test/integration/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/test/integration/README b/test/integration/README new file mode 100644 index 00000000..68255344 --- /dev/null +++ b/test/integration/README @@ -0,0 +1,54 @@ +# dbus-broker integration test suite + +dbus-broker's integration test suite uses tmt (Test Management Tool [0]) to organize and run tests. Since tmt +offers a _lot_ of features, this document pinpoints the most _interesting_ ones to get stuff up and running +quickly. + +## How to contribute + +Creating a new test case is pretty simple: + +``` +$ cd test/integration +$ tmt test create --template=shell test/name +Test directory '/home/.../dbus-broker/test/integration/test/name' created. +Test metadata '/home/.../dbus-broker/test/integration/test/name/main.fmf' created. +Test script '/home/.../dbus-broker/test/integration/test/name/test.sh' created. +``` + +The newly created `test.sh` will be the actual test case, and `main.fmf` contains the test metadata, including +test summary & description, test dependencies, runtime, and so on. See [1] for more details. + +After tweaking the test metadata it's usually a good idea to run `tmt lint test/name` to make sure that the +configuration is still valid: + +``` +$ tmt lint test/name +/test/name +pass C000 fmf node passes schema validation +pass C001 summary key is set and is reasonably long +... +``` + +To check if the test itself works as expected you can use `tmt run`: + +``` +$ cd test/name +$ tmt run -vvv --all provision --how local tests --name . +... +total: 1 test passed +``` + +The `tmt run` command is _very_ customizable (as is the rest of `tmt`). In this particular example we tell it +to run all steps (`--all`) and override the `provision` and `tests` steps to run just one particular test on +the local machine. As in previous cases, check the `tmt` documentation [0] and examples [2] for more details. + +## Links + +[0] https://tmt.readthedocs.io/en/stable/overview.html + +[1] https://tmt.readthedocs.io/en/stable/spec/tests.html + +[2] https://tmt.readthedocs.io/en/stable/examples.html#run + + diff --git a/test/integration/fuzz/dfuzzer/main.fmf b/test/integration/fuzz/dfuzzer/main.fmf new file mode 100644 index 00000000..c53b659d --- /dev/null +++ b/test/integration/fuzz/dfuzzer/main.fmf @@ -0,0 +1,7 @@ +summary: Run dfuzzer on a couple of D-Bus interfaces +test: ./test.sh +recommend: + - dfuzzer + - systemd + - util-linux +duration: 30m diff --git a/test/integration/fuzz/dfuzzer/test.sh b/test/integration/fuzz/dfuzzer/test.sh new file mode 100755 index 00000000..2e21a681 --- /dev/null +++ b/test/integration/fuzz/dfuzzer/test.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# vi: set sw=4 ts=4 et tw=110: + +set -eux +set -o pipefail + +TEST_USER="dfuzzer$SRANDOM" + +at_exit() { + userdel -rf "$TEST_USER" +} + +trap at_exit EXIT +useradd "$TEST_USER" + +dbus-broker --version +systemctl status --no-pager dbus-broker.service + +# Run dfuzzer on the PID 1's D-Bus interface. Drop privileges while doing so, since here we're interested in +# the actual message broking instead of breaking systemd. +# +# org.freedesktop.systemd1 was picked here because its interface is very rich when it comes to function +# signatures. Also, it's fuzzed in upstream by dfuzzer as well, which should make the test less prone to fails +# due to issues on systemd's side. +setpriv --reuid="$TEST_USER" --init-group -- dfuzzer -v --buffer-limit=10240 --bus org.freedesktop.systemd1 diff --git a/test/integration/plans/upstream_ci.fmf b/test/integration/plans/upstream_ci.fmf new file mode 100644 index 00000000..d98e95f1 --- /dev/null +++ b/test/integration/plans/upstream_ci.fmf @@ -0,0 +1,9 @@ +# vi: set sw=2 ts=2 et ft=yaml tw=80: + +# This plan discovers and executes all (enabled) integration tests it finds + +summary: Upstream integration test suite +discover: + how: fmf +execute: + how: tmt