Files
finit/test
Joachim Wiberg ffb1db7d2d conf: add provides, additional conditions a service supplies
A block title is a service identity, so two variants of one service
gated differently per platform cannot share a title.  They do need to
share the barrier condition downstream services wait for, which until
now was spelled by the identity alone and so could not be shared:

    service syslogd:udev {
        if         = "udevd"
        conditions = { "run/udevadm:5/success" }
        provides   = "pid/syslogd"
        command    = "-syslogd -F"
    }

Any namespace is allowed, since the point is publishing a name that
existing configurations already wait on.  A claim on a condition that
is already owned is dropped with a warning naming the owner, and the
service still registers: the overlap is a configuration bug, and an
init system is more useful degraded than refusing to boot.  A real
identity outranks a claim, pid/<ident> is how Finit tracks its own
services, so it is not up for grabs.

Claims are dropped before each reload re-reads the .conf files.  Doing
it per service as it re-registers is not enough, since services are
read in file order and one re-registering would lose to a claim
another had not dropped yet, flipping the owner on every reload.

initctl cond dump asked who owned a condition only for the pid/
namespace and printed 'static' for usr/, which now hides a provider.
It asks first and falls back to what the namespace implies.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-08-05 17:58:43 +02:00
..
2023-02-05 18:19:23 +01:00
2025-02-11 10:17:33 +01:00
2026-01-01 15:54:06 +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