Commit Graph
2243 Commits
Author SHA1 Message Date
Jacques de Laval d258dcecd2 test: ci: Print test log if tests fail
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-26 16:19:03 +01:00
Jacques de Laval 2e0c658160 test: Utilize distcheck in CI; it tests pretty much everything we want to test
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-26 15:59:55 +01:00
Jacques de Laval 2f439194e5 test: Fix testenv-root lingering in build dir
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-26 15:35:07 +01:00
Jacques de Laval 6b7ae50fbb test: Let Make generate shellcheck test from the list of test sources
Not very readable yet, so it needs clean up!

Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-26 11:24:12 +01:00
Joachim Wiberg 4e035f77f6 Fix regression introduced in 7ef25ab, global rlimits not initialized
Services that are instantiated by plugins, and thus don't have a .conf
file, tried to use uninitialized rlimits.  This caused the kernel to
immediately kill those services for violating their own rlimits.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg 9df5e7664d flog: new helper function for debugging to file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg 41092095f5 configure: allow custom directory for --with-sysconfig
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg a758d3dddc contrib: alpine: update to use env: files for service arguments
- Check for env in /etc/conf.d on Alpine
- Update all services with their respective env: file
- Disable default modules, noew modprobe plugin should handle this
- Add watchdog service
- Rename syslogd -> syslog, in case we want to integrate sysklogd

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg e228174eb5 contrib: debian: update to use env: files for service arguments
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg a1f79e263a Refactor, add new helper fn paste() to concat directory compoents
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg 6f06c432ec Minor, insert '/' only if pasting components require it
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:54 +01:00
Joachim Wiberg 3ae609c341 configure: minor refactor, simplify to reduce duplication
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:32:41 +01:00
Joachim Wiberg 435211765c Follow-up to f4a0b99: track modifications of service env: files
Add support for monitoring environment files for services declared with
the `env:[-]/path/to/file` option.  The default path to such files has
been chosen to follow Debian and Buildroot /etc/default/*

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:23:24 +01:00
Joachim Wiberg 92c6de2c09 test: tests use .sh extension, for .log/.trs transformation
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-26 10:13:44 +01:00
Jacques de Laval 0e0b2773eb Merge branch 'master' into wip-tests 2021-02-25 17:40:23 +01:00
Jacques de Laval ea4fe2045d test: Add sane default for TESTENV_ROOT; enable easier independent test runs
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-25 17:38:56 +01:00
Jacques de Laval 48b732e53d test: Let Autoconf generate env vars for tests
This simplifies the setup script a lot, and also makes it easier to
run tests independently.

Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-25 17:37:24 +01:00
Joachim Wiberg 7ef25abecf Refactor, use new iwatch module for inotify of Finit *.conf files
- Use iwatch, modeled after pidfile plugin
- Use one .conf watcher for all *.conf paths/files
- Use full path of conf file for changes, from realpath().
  This fixes a long-standing limitation on unique filenames
  for services, that absolutely nobody knew about

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 14:28:03 +01:00
Joachim Wiberg ea278a6370 plugins: pidfile: simplify, use constructs from src/conf.c
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 14:27:28 +01:00
Joachim Wiberg 8790fcabf3 iwatch: minor, check if file/dir exists before trying to add
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 14:27:01 +01:00
Joachim Wiberg 3d9ee49759 Follow-up to 6cdcacf, fix minor regression, premature clear of pid
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 14:23:45 +01:00
Jacques de Laval cde580ffce test: Unify setup-root.sh for make check and make distcheck
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-25 11:18:12 +01:00
Jacques de Laval 3c32cbfd9e test: Make /var/lock readable in test teardown, so that it can be removed later
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-25 11:14:49 +01:00
Jacques de Laval 691bc58f0e test: Add support for starting Finit in debug mode
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-25 00:53:30 +01:00
Joachim Wiberg cafbb18626 plugins: hotplug: log output from udevd/systemd-udevd to syslog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 00:27:29 +01:00
Joachim Wiberg 939c6f2f67 Fix regression in displaying progress at runtime
We don't want to show progress (starting/stopping/restaring) at
runtime, since Finit v3.  Many systems hooked up to a console
get confused by sudden output, or even ansi escape sequences.

This patch drops code added recently which caused a regression
in this policy.  The resulting code is even more readable.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-25 00:22:01 +01:00
Joachim Wiberg 477b50b7a6 Check return value from kill(pid, SIGHUP), maybe lost pid
This patch handles a corner case when Finit may not have detected a
supervised process has died.  When a user calls `initctl restart foo`
we now send such lost PIDs to the service_monitor() for restart.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 23:58:25 +01:00
Joachim Wiberg 6cdcacf20b Refactor, shared cleanup fn for service_kill() and service_monitor()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 23:45:14 +01:00
Joachim Wiberg d37c20f467 Terminate children in the same process group when monitored PID dies
Really kill them, our monitored process may be about to restart, so we
don't want any unintended side effects from lingering children in prior
instances.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 23:43:03 +01:00
Jacques de Laval 70964ccb35 test: Only mess with PATH inside test environment 2021-02-24 23:28:47 +01:00
Joachim Wiberg 3ebac3dece Merge branch 'master' into wip-tests 2021-02-24 22:53:08 +01:00
Joachim Wiberg 14f0443bd7 Allow services to be added *and removed* from /etc/finit.conf
This patch fixes a long standing issue where removing a service from
/etc/finit.conf does not stop and unregister it.  The issue was caused
by the Finit support for "protected" services, e.g. services created
by plugins like hotplug.so

To reproduce issue before this fix:

    cat /etc/finit.d/available/ntpd.conf >> /etc/finit.conf
    initctl reload

The NTP service now runs smoothly, as expected.  Later on, we decide to
drop it from our system:

    sed -i 1,2d /etc/finit.conf
    initctl reload

... and the NTP service continues to run unaffected.  Not what most sane
users expect.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 22:12:05 +01:00
Joachim Wiberg 81d8f3cccc Drop unnecessary service_step() in cond_reload()
The cond_reload() fn is called on `initctl reload`, thus we don't need
to call service_step(), since we call service_step_all() later in that
cycle.  So we can drop cond_update(NULL), which calls service_step().

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 22:12:05 +01:00
Joachim Wiberg d27b3948af Drop unnecessary and confusing debug message in mkcond()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 22:12:05 +01:00
Joachim Wiberg f906bb357a plugins: pidfile: only scan directory if watch added successfully
Also, update condition example in comment.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 22:12:05 +01:00
Joachim Wiberg e0d3aa8e06 iwatch: handle watching paths for same inode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 22:12:05 +01:00
Jacques de Laval 91ffda154d Merge branch 'master' into wip-tests 2021-02-24 22:03:20 +01:00
Joachim Wiberg 84248e1c56 Merge pull request #156 from troglobit/fix-hard-coded-rcsd
Use FINIT_RCSD instead of hard coded value
2021-02-24 21:09:12 +01:00
Jacques de Laval 51fe974ee5 Use FINIT_RCSD instead of hard coded value
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-24 18:58:05 +01:00
Jacques de Laval 1efdbeda16 Merge branch 'wip-tests' into wip-tests-build-refactor
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-24 18:48:26 +01:00
Jacques de Laval 827f826201 test: Remove commented code
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-24 16:34:00 +01:00
Jacques de Laval a5ef5f3104 test: Fix make check
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-24 16:01:43 +01:00
Magnus Malm 76b2a846a2 test: Slightly improve names of test directories
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
2021-02-24 14:54:45 +01:00
Magnus Malm e77f3f4d74 test: Use initctl in favor of kill -SIGHUP when reloading finit
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
2021-02-24 14:31:18 +01:00
Magnus Malm 2c055cb954 test: Minor adjustments to improve consistency between test code structure
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
2021-02-24 13:20:13 +01:00
Magnus Malm f214098560 test: Minor refactor to reduce test code duplication
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
2021-02-24 13:13:38 +01:00
Magnus Malm 6027e94c65 Merge remote-tracking branch 'upstream/master' into wip-tests 2021-02-24 10:22:57 +01:00
Joachim Wiberg bc4d4b7f35 plugins: pidfile: set up I/O callback on successful iwatch_init()
In case of trouble, make sure we don't have a callback set up w/o
a valid file descriptor.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 09:52:34 +01:00
Joachim Wiberg e067f23ef2 iwatch: add license+copyright header and initialized guard
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-02-24 09:49:39 +01:00
Jacques de Laval 05901a90aa test: Fix distcheck
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
2021-02-23 23:20:39 +01:00