diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-16 19:56:30 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-16 23:07:45 +0200 |
commit | ab1b2f22fd37ab2c8dfa2c308aba71204880fb9f (patch) | |
tree | ffabc2b508c5f04411fa704c68269ae7e0635edc /test | |
parent | test: merge TEST-28-PERCENTJ-WANTEDBY into TEST-23-UNIT-FILE (diff) | |
download | systemd-ab1b2f22fd37ab2c8dfa2c308aba71204880fb9f.tar.xz systemd-ab1b2f22fd37ab2c8dfa2c308aba71204880fb9f.zip |
test: clean up test artifacts
So we don't run into unexpected fails when two tests use the same paths.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-23.RuntimeDirectoryPreserve.sh | 8 | ||||
-rwxr-xr-x | test/units/testsuite-23.clean-unit.sh | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/units/testsuite-23.RuntimeDirectoryPreserve.sh b/test/units/testsuite-23.RuntimeDirectoryPreserve.sh index b60b612d82..ca57702cf1 100755 --- a/test/units/testsuite-23.RuntimeDirectoryPreserve.sh +++ b/test/units/testsuite-23.RuntimeDirectoryPreserve.sh @@ -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 diff --git a/test/units/testsuite-23.clean-unit.sh b/test/units/testsuite-23.clean-unit.sh index 81f180a1e2..a82b54fe9e 100755 --- a/test/units/testsuite-23.clean-unit.sh +++ b/test/units/testsuite-23.clean-unit.sh @@ -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 |