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
Joachim Wiberg
dd6ebc3b65
Drop svc pidfile matching, only match against PID in pidfile
...
With the redesign from <svc/path/to/pidfile> to <pid/name:id> in d1fac6f
we moved to matching svc_t only against their PID, which could pop up in
any *.pid or */pid in /var/run. This patch drops the (hopefully) last
remnants of the old <svc/> legacy.
To ensure we don't try reading the PID value from socket files, like
/var/run/initctl, we add simple fnmatch() of the inotified file. Two
calls to fnmatch(), for portability reasons, not every system has GNU
libc extensions like FNM_EXTMATCH.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-02-23 20:26:57 +01:00
Joachim Wiberg
8dc1ad00d5
plugins: refactor, break out inotify watcher to src/iwatch.[ch]
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-02-23 20:26:38 +01:00
Joachim Wiberg
f72e0a646e
test: fix make warning 'etc' given more than once
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-02-23 15:45:50 +01:00
Joachim Wiberg
47dcd1cb8a
test: silence make in-out directory
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-02-23 15:45:21 +01:00
Magnus Malm
25ffc3192f
test: Add two new tests
...
* test_start_stop_service
Test that we can start/stop (via initctl) a service configured in
finit.conf
* test_start_stop_service_sub_config
Test that we can start/stop (via initctl) a service configured in
finit.d/ files
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 15:30:42 +01:00
Magnus Malm
51fe6a15e9
test: Improve add/remove sub config test
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 15:27:33 +01:00
Joachim Wiberg
8381976f05
plugins: boilerplate for made-easy integration with FRR
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-02-23 15:03:03 +01:00
Magnus Malm
6bcb9e9030
test: Populate/cleanup /etc "manually" via Makefile/tests
...
For now, do not mount /etc as tmpfs, but instead create the dir when
building the rootfs via test/test_root/Makefile.
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:24:54 +01:00
Magnus Malm
b364fd7d6a
test: Add test for dynamically add/remove service in finit.d/ files
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:24:54 +01:00
Magnus Malm
27ad3b5a7f
test: Minor cleanup in lib.sh
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
eda9ae4c3e
test: Rename start/stop service test to add/remove dynamic service
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
bb095bfd5d
test: Minor tweak on test's output
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
8a2cc2aeb8
test: Move service.sh to test/common/
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
6d9374590f
test: Add test start timestamp
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
3ec788a6cf
test: Minor tweaks of how/when to print testenv stuff
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
5e20abef8d
test: Print running test name with log()
...
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Magnus Malm
3d01728d2e
test: Add testenv_enter.sh to ease debugging testenv
...
The script testenv_enter.sh, by default, runs /bin/sh in the environment
currently setup.
A bit easier than copy pasting the old hint text printed before test run.
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 11:19:57 +01:00
Joachim Wiberg
c0bbb0fc51
plugins: pidfile: rename variables and local fns
...
- new namespace before breaking out to shared object
- use inotify naming fd -> wd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-02-23 09:04:53 +01:00
Magnus Malm
4480010d4a
test: Add support for teardown in tests
...
If a test defines a function 'test_teardown(), that function will be
called before the test env teardown is run.
Signed-off-by: Magnus Malm <magnusmalm@gmail.com >
2021-02-23 08:55:11 +01:00
Jacques de Laval
70773105ac
test: Tell Finit to shut down rather than reboot in teardown
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-23 01:09:46 +01:00
Jacques de Laval
17d0835d63
test: Only echo last output of command in retry
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-23 00:32:36 +01:00
Jacques de Laval
cda90fe5ee
Merge branch 'master' into wip-tests
2021-02-22 23:54:18 +01:00
Jacques de Laval
07521e043a
test: Add standard dir for test assets
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-22 22:30:10 +01:00
Jacques de Laval
2c56e20941
test: Name test-lib appropriately
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-22 22:12:34 +01:00
Jacques de Laval
11841ceb5d
test: Clean up Automake integration of tests
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-22 22:07:17 +01:00
Jacques de Laval
e44d348f09
test: Add test suite to Automake
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-22 20:33:30 +01:00
Jacques de Laval
ee31c8551f
test: Remove unnecessary mkdir
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-22 17:21:55 +01:00
Jacques de Laval
c2bb46f18c
test: Run shellcheck on test scripts before running them
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-22 17:16:32 +01:00
Jacques de Laval
df66d1efd8
Merge branch 'wip-tests' of github.com:troglobit/finit into wip-tests
2021-02-22 16:51:31 +01:00