diff options
author | Michal Sekletar <msekleta@redhat.com> | 2022-03-23 13:35:44 +0100 |
---|---|---|
committer | Michal Sekletar <msekleta@redhat.com> | 2022-04-08 15:18:29 +0200 |
commit | 2ef0101e0b2813e8c99fc8f137dbaa763ca16057 (patch) | |
tree | eecb1a11b74416a7d9a747e4cf9757877952202b /test/units/testsuite-60.sh | |
parent | core: shorten long unit names that are based on paths and append path hash at... (diff) | |
download | systemd-2ef0101e0b2813e8c99fc8f137dbaa763ca16057.tar.xz systemd-2ef0101e0b2813e8c99fc8f137dbaa763ca16057.zip |
tests: add test case for long unit names
Diffstat (limited to 'test/units/testsuite-60.sh')
-rwxr-xr-x | test/units/testsuite-60.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/units/testsuite-60.sh b/test/units/testsuite-60.sh index eb174f00ed..239d7b0d4c 100755 --- a/test/units/testsuite-60.sh +++ b/test/units/testsuite-60.sh @@ -8,6 +8,25 @@ systemd-analyze log-target journal NUM_DIRS=20 +# make sure we can handle mounts at very long paths such that mount unit name must be hashed to fall within our unit name limit +LONGPATH="$(printf "/$(printf "x%0.s" {1..255})%0.s" {1..7})" +LONGMNT="$(systemd-escape --suffix=mount --path "$LONGPATH")" +TS="$(date '+%H:%M:%S')" + +mkdir -p "$LONGPATH" +mount -t tmpfs tmpfs "$LONGPATH" +systemctl daemon-reload + +# check that unit is active(mounted) +systemctl --no-pager show -p SubState --value "$LONGPATH" | grep -q mounted + +# check that relevant part of journal doesn't contain any errors related to unit +[ "$(journalctl -b --since="$TS" --priority=err | grep -c "$LONGMNT")" = "0" ] + +# check that we can successfully stop the mount unit +systemctl stop "$LONGPATH" +rm -rf "$LONGPATH" + # mount/unmount enough times to trigger the /proc/self/mountinfo parsing rate limiting for ((i = 0; i < NUM_DIRS; i++)); do |