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>
This commit is contained in:
Joachim Wiberg committed 2022-04-08 07:22:33 +02:00
1 parent 5c2577214d
commit 7f8a96a73e
49 files changed
+96 -70

No files matched your search

+2 -6
View File
@@ -15,17 +15,13 @@ test_teardown()
say "Running test teardown."
texec rm -f "$FINIT_CONF"
texec rm -f /test_assets/service.sh
}
say "Test start $(date)"
cp "$TEST_DIR"/common/slay.sh "$TENV_ROOT"/test_assets/
cp "$TEST_DIR"/common/service.sh "$TENV_ROOT"/test_assets/
rm -f "$TENV_ROOT"/oldpid
say "Add service stanza in $FINIT_CONF"
texec sh -c "echo 'service [2345] respawn log /test_assets/service.sh -- Test service' > $FINIT_CONF"
texec sh -c "echo 'service [2345] respawn log service.sh -- Test service' > $FINIT_CONF"
say 'Reload Finit'
texec sh -c "initctl reload"
@@ -40,7 +36,7 @@ laps=1000
while [ $i -lt $laps ]; do
i=$((i + 1))
say "Lap $i/$laps, killing service ..." # we have this, no sleep needed
texec sh -c "/test_assets/slay.sh service.sh"
texec sh -c "slay service.sh"
done
retry 'assert_new_pid service.sh /run/service.pid'