Commit Graph
271 Commits
Author SHA1 Message Date
Joachim Wiberg 477bc064d5 test: more debug azure 3/N
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 14:28:57 +02:00
Joachim Wiberg 96376126b3 test: debug azure 2/N
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 14:21:58 +02:00
Joachim Wiberg 1c150928cb test: debug cond test in azure
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 14:14:35 +02:00
Joachim Wiberg 7a8d4e2c6b test: wait for Finit to reach runlevel 2 before starting tests
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 13:19:10 +02:00
Joachim Wiberg fb956fd2f5 test: silence Hint:, does not work anymore, need to debug it
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 13:18:41 +02:00
Joachim Wiberg e6e4d814f3 test: extend initial wait for azure env.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 12:55:37 +02:00
Joachim Wiberg 544d44886a test: let Finit start up properly before starting tests
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-24 11:36:30 +02:00
Joachim Wiberg cec2d5a4db test: add missing sbin/task.sh to skeleton dist.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-22 18:21:19 +02:00
Joachim Wiberg 539d215d0e test: add missing finit.d to skeleton rootfs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-22 17:51:04 +02:00
Joachim Wiberg 05e6b3e752 test: new test, verify task behavior with conditions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-21 20:52:34 +02:00
Joachim Wiberg e2a8803f7a test: minor, extend log message a bit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-10 22:46:45 +02:00
Joachim Wiberg 209e140ddd test: let Finit's bootmisc plugin create the /var/run symlink
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-10 22:46:15 +02:00
Joachim Wiberg 377c8bce8c test: fix dist and tenv-root/ regression from refactor
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-09 17:52:48 +02:00
Joachim Wiberg 7f8a96a73e test: refactor test framework to use a rootfs skeleton
Instead of having to create files, and copying them in place for each
test, we move all static test files to a skeleton rootfs.  This makes
it a lot easier to get an overview of how things and how they work.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-08 07:22:33 +02:00
Joachim Wiberg 5c2577214d test: ask BusyBox its tools and recommended paths
Note: we need to add /usr/bin and /usr/sbin to the standard PATH
      for tests and the test environment itself.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-06 22:42:49 +02:00
Joachim Wiberg c926160853 Issue #223: add type:forking service option, with updated docs
- Add `type:forking` service option to trigger guessing pidfile to
   watch for, instead of `pid:!foo` option, which is not intuitive.
   This option may likely also survive into the new file format :)
 - Update docs and add examples
 - Update start-stop-serv.sh test case with this new variant

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-04 19:13:28 +02:00
Joachim Wiberg aeb48ef04b test: add support for caching busybox-x86_64 binary in ~/.cache
While without a working Internet connection today I ran into the issue
of not being able to run the tests.  This adds a basic caching mechanism
to setup-root.sh which saves busybox-x86_64 in ~/.cache, if available.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-04 08:20:48 +02:00
Joachim Wiberg 27ba3b27f5 test: extend start-stop-serv test w/ all supported combinations
serv: add support for foregrounding, running with and without PID file,
      including custom PID filename.

test: verify Finit can start & monitor services that:
      1) Fork and creates a PID file in a known location
      2) Don't fork and don't create a PID file, but Finit does
      3) Don't fork but create a PID file
      4) Don't fork and create custom named PID file

Note: Finit cannot support a service that forks and doesn't create a PID
      file.  This combination is impossible to support without tracking
      all processes created in /proc -- which Finit does not do atm.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-03 11:56:42 +02:00
Joachim Wiberg b4af86255d test: rename fserv -> serv, more features to be added
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-03 11:55:11 +02:00
Joachim Wiberg 0e28741dcb test: fserv is built in another directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-02 12:38:20 +02:00
Joachim Wiberg ec17f0aa23 test: add new test to dist, fixes CI build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-02 12:14:32 +02:00
Joachim Wiberg 6baf2990e8 test: new test to verify support for forking services
Issue #223

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-02 12:08:10 +02:00
Joachim Wiberg 6416e2a1a4 test: minor refactor in build system
Add Makefile.am in tenv and common for EXTRA_DIST.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-02 12:07:34 +02:00
Joachim Wiberg 6f802a7ff1 test: whitespace changes only
Coding style for shell scripts:

  - Tabs for indent (change in Emacs needed)
  - Braces on their own line, like C functions

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-02 10:45:30 +02:00
Joachim Wiberg 879721839e test: slight formatting change in log() output
Encase (stripped) test name in [] and use decreased intensity ANSI coloring.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-02 10:26:07 +02:00
Joachim Wiberg 4a90a3e8ef test: drop plugins we don't need in test
E.g., a failing urandom.so does no good for ppl reading test results.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-27 16:22:20 +02:00
Joachim Wiberg 6d14ff84d3 test: add missing script helpers to dist archive
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-27 15:41:24 +02:00
Joachim Wiberg 2018cac050 test: at first run, oldpid doesn't exist
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-27 13:47:11 +02:00
Joachim Wiberg f9090f535d test: drop cat $tty, seems to not be needed
I'll have to ask Jacques what this was for, because it doesn't seem to
be needed to run and monitor the test.  Also, it lingers at shutdown,
causing some unintended side effects in Finit.

Commenting out for now, as a reminder to myself.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-27 13:46:54 +02:00
Joachim Wiberg 4755e5206b test: new test, verify SysV start/stop daemon support
Install start-stop-daemon in test root.  Add S01-service.sh, which uses
start-stop-daemon to start service.sh.  Modify service.sh to respect
signals, and not exit immediately when sleep exits due to SIGTERM.
Remove PID file in signal callback and make sure to exit OK

The test itself is basically a copy of the start-stop-service.sh test.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-24 22:11:24 +01:00
Joachim Wiberg 094e00d405 test: update test to use kill(1) replacement slay.sh
The slay script checks for common errors and gives some logs and status
of Finit when something goes wrong.  Helps detect issue #226 when the
start-kill-service.sh test runs at 100000 laps.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-23 07:02:10 +01:00
Joachim Wiberg d16f7e0c88 test: help finit know its under test
This trick can also be used by others who want to run Finit in an
unshare.  Set the container environment variable to 'unshare',
like lxc and docker do for their products.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-23 06:27:33 +01:00
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