Joachim Wiberg
4811f76294
test: refactor service kill/respawn test
...
- Allow service to be respawned immediately (hidden option)
- Stress test by killing 1000 times
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-03-07 15:50:23 +01:00
Joachim Wiberg
0aba704312
test: install awk, grep, and tail busybox tools as well
...
We may need them in test scripts.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-03-07 15:49:45 +01:00
Joachim Wiberg
f7a1514131
test: update with info on running a single/few tests
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-03-07 11:26:17 +01:00
Jörgen Sigvardsson
beec0ee590
Test case for initctl signal
...
This commit implements a test for the signal feature of initctl. The
existing service used in tests (`common/service.sh`) has been extended
with a signal trap handler. When SIGUSR1 is received, it will write the
string `'USR1'` to `/tmp/usr1.log`. The test will run `initctl signal
service.sh SIGUSR1` and assert that the contents of the file
`/tmp/usr1.log` really is `USR1`.
2022-02-15 12:43:07 +01:00
Jörgen Sigvardsson
71b07ce2bd
Remove test code that may break tests
...
In the test framework for finit, a set of shell scripts are used to
setup a test harness, run tests, and finalize tests. In the setup, a
file system is created for the virtualized/containerized environment in
which all tests are run, located at `$FINIT_SRC/test/tenv-root`. In the
tear down phase of each test, the file `/var/lock` is made readable
using `chmod +r`. It is not clear _why_ the teardown code does this, as
there are no references in the test framework to this path anywhere
else. It is conceivable that the teardown phase attempted to "reset the
state" for next test.
The code that that this commit removes does not always work. When
`/var/lock` is a symlink, and resolves to an absolute path, the test
framework does not function properly. The teardown code is run in the
context of the host computer, and touching files outside of the
virtualized environment is not ok.
The removal of the offending code does not seem to affect tests: all
tests pass without it, so its existence is questionable.
Signed-off-by: Jörgen Sigvardsson <jorgen.sigvardsson@gmail.com >
2022-02-15 10:30:04 +01:00
Joachim Wiberg
ebea3d273e
test: mention need for proper configure first
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-02-13 22:45:47 +01:00
Joachim Wiberg
c8e1bd0e9a
test: add new kill test to dist
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-02-12 13:37:55 +01:00
Joachim Wiberg
e9c8d3d740
test: verify finit restarts crashing services & registers new PID
...
We extend the service.sh to emulate a well behaving service that creates
and removes its own PID file.
The new test emulates a crash by sending SIGKILL to service.sh. We then
verify that Finit restarts it, and eventually registers the new PID when
the services recreates the PID file.
Issue #226
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-02-12 13:30:05 +01:00
Joachim Wiberg
f567b866a0
test: drop plugins we don't want in tests
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-02-12 13:29:27 +01:00
Joachim Wiberg
3471d3ee2d
test: add service descriptions
...
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-02-12 12:51:28 +01:00
Joachim Wiberg
6e197f5751
test: add /var and /run to rootfs, add empty fstab
...
- We need a working /var and /run for some features, e.g. PID
monitoring and status files for urandom.so
- Add empty fstab to silence mount errors from finit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2022-02-12 12:49:34 +01:00
yangfl
fa14ed1649
Fix typo
...
with the love from codespell
2021-06-25 13:08:14 +08:00
Joachim Wiberg
3b5cfc5ecf
test: drop checksef.sh from EXTRA_DIST, generated now
...
Also, silence generation of checkself.sh
Signed-off-by: Joachim Wiberg <troglobit@gmail.com >
2021-04-09 18:05:02 +02:00
Jacques de Laval
e06e4175d3
test: Add license and copyright to test framework
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 23:23:03 +01:00
Jacques de Laval
aa096cde19
test: Only copy /tmp contents if there are any
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 18:27:26 +01:00
Jacques de Laval
7c45fd451e
test: Remove some redundant exports
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 18:27:02 +01:00
Jacques de Laval
acf886f483
test: Document how to run the test suite
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 18:03:00 +01:00
Jacques de Laval
7fe1189f7b
test: Move test support files to separate dir and keep tests in /test
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 14:50:49 +01:00
Jacques de Laval
4aa17a84ab
test: Minor clean up
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 13:53:55 +01:00
Jacques de Laval
255d90cee9
test: Mount /tmp as tmpfs again, but copy any existing files in /tmp back into it
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-27 13:45:05 +01:00
Jacques de Laval
8b680b1b14
test: ci: Add debug output for debugging Travis
...
Signed-off-by: Jacques de Laval <jacques@de-laval.se >
2021-02-26 16:55:20 +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
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
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
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
Jacques de Laval
70964ccb35
test: Only mess with PATH inside test environment
2021-02-24 23:28:47 +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
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
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
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