Files
finit/test
Joachim Wiberg 127049d925 test: Finit against a real dbus-daemon
The other dbus-*.sh tests drive libink's own client, so the wire format
was only ever checked against the implementation that wrote it, and the
broker path had no coverage at all.  Every bug found in it so far was
found by hand on a target.

Let the dbus plugin bring up a real dbus-daemon, wait for Finit to
claim org.finit, then talk to Finit with dbus-send, which shares no
code with us.  The privileged call is the interesting one: it can only
be answered by parking the call and asking the broker who sent it.
The bus reads the policy Finit installs, so a malformed org.finit.conf
fails here rather than on a target.

Tests no longer build --with-libsystemd.  Our replacement carries the
real soname but only the sd_notify() symbols, so in the test root it
shadowed the libsystemd the host's libdbus-1 wants and dbus-daemon
died on a missing sd_is_socket.  Nothing under test needs the shared
library: serv is the only consumer and it compiles sd-daemon.c
straight in, which it now does regardless of the flag so notify.sh
keeps testing notify:systemd either way.

Staged from the host by lib/sysroot.mk like any other binary, and
skipped when the host has neither program.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-08-13 10:15:19 +02:00
..
2023-02-05 18:19:23 +01:00
2025-02-11 10:17:33 +01:00

Finit Test Suite

Finit comes with a set of tests and a small framework for running them. Contributors are encouraged to write new tests when implementing features, or fixing bugs.

Each test is run in isolation, in it's own namespace. Finit will therefore be able to be launched as PID 1. Since it's also running with it's own root directory it will be able to function properly without having any super user privileges in the host environment.

Running tests

To run the test suite, first build Finit, e.g:

./configure --prefix=/usr --exec-prefix= --sysconfdir=/etc --localstatedir=/var --enable-testserv-plugin
make -j9 clean all

Then run (parallel does not work atm):

make check

make check will set up the required assets for the test environment, and then run the full set of tests. The environment is not removed afterwards so at this point individual tests can be executed without having to run the entire test suite, which is handy when developing new tests or debugging existing test. To execute an individual test, simply invoke the script containing it:

./test/name-of-the-test.sh

Another way to run a single (or more) test(s) is to define the TESTS environment variable:

TESTS="start-kill-service" make check