test: clean up test artifacts

So we don't run into unexpected fails when two tests use the same paths.
This commit is contained in:
Frantisek Sumsal
2023-05-16 19:56:30 +02:00
parent 23cb7362f1
commit ab1b2f22fd
2 changed files with 19 additions and 0 deletions

View File

@@ -7,6 +7,14 @@ set -o pipefail
# Test RuntimeDirectoryPreserve=yes
at_exit() {
set +e
rm -fr /run/hoge /tmp/aaa
}
trap at_exit EXIT
systemd-mount -p RuntimeDirectory=hoge -p RuntimeDirectoryPreserve=yes -t tmpfs tmpfs /tmp/aaa
touch /run/hoge/foo

View File

@@ -7,6 +7,17 @@ set -o pipefail
# Test unit configuration/state/cache/log/runtime data cleanup
at_exit() {
set +e
rm -fr /{etc,run,var/lib,var/cache,var/log}/test-service
rm -fr /{etc,run,var/lib,var/cache,var/log}/private/test-service
rm -fr /{etc,run,var/lib,var/cache,var/log}/hoge
rm -fr /{etc,run,var/lib,var/cache,var/log}/test-socket
}
trap at_exit EXIT
cat >/run/systemd/system/test-service.service <<EOF
[Service]
ConfigurationDirectory=test-service