|
|
8d419f |
From 1121def1f02c847df894611e171a1025f859fb3d Mon Sep 17 00:00:00 2001
|
|
|
8d419f |
From: Michal Sekletar <msekleta@redhat.com>
|
|
|
8d419f |
Date: Wed, 23 Mar 2022 13:35:44 +0100
|
|
|
8d419f |
Subject: [PATCH] tests: add test case for long unit names
|
|
|
8d419f |
|
|
|
8d419f |
(cherry picked from commit 2ef0101e0b2813e8c99fc8f137dbaa763ca16057)
|
|
|
8d419f |
|
|
|
8d419f |
Related: #2083493
|
|
|
8d419f |
---
|
|
|
8d419f |
test/units/testsuite-60.sh | 19 +++++++++++++++++++
|
|
|
8d419f |
1 file changed, 19 insertions(+)
|
|
|
8d419f |
|
|
|
8d419f |
diff --git a/test/units/testsuite-60.sh b/test/units/testsuite-60.sh
|
|
|
8d419f |
index eb174f00ed..239d7b0d4c 100755
|
|
|
8d419f |
--- a/test/units/testsuite-60.sh
|
|
|
8d419f |
+++ b/test/units/testsuite-60.sh
|
|
|
8d419f |
@@ -8,6 +8,25 @@ systemd-analyze log-target journal
|
|
|
8d419f |
|
|
|
8d419f |
NUM_DIRS=20
|
|
|
8d419f |
|
|
|
8d419f |
+# 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
|
|
|
8d419f |
+LONGPATH="$(printf "/$(printf "x%0.s" {1..255})%0.s" {1..7})"
|
|
|
8d419f |
+LONGMNT="$(systemd-escape --suffix=mount --path "$LONGPATH")"
|
|
|
8d419f |
+TS="$(date '+%H:%M:%S')"
|
|
|
8d419f |
+
|
|
|
8d419f |
+mkdir -p "$LONGPATH"
|
|
|
8d419f |
+mount -t tmpfs tmpfs "$LONGPATH"
|
|
|
8d419f |
+systemctl daemon-reload
|
|
|
8d419f |
+
|
|
|
8d419f |
+# check that unit is active(mounted)
|
|
|
8d419f |
+systemctl --no-pager show -p SubState --value "$LONGPATH" | grep -q mounted
|
|
|
8d419f |
+
|
|
|
8d419f |
+# check that relevant part of journal doesn't contain any errors related to unit
|
|
|
8d419f |
+[ "$(journalctl -b --since="$TS" --priority=err | grep -c "$LONGMNT")" = "0" ]
|
|
|
8d419f |
+
|
|
|
8d419f |
+# check that we can successfully stop the mount unit
|
|
|
8d419f |
+systemctl stop "$LONGPATH"
|
|
|
8d419f |
+rm -rf "$LONGPATH"
|
|
|
8d419f |
+
|
|
|
8d419f |
# mount/unmount enough times to trigger the /proc/self/mountinfo parsing rate limiting
|
|
|
8d419f |
|
|
|
8d419f |
for ((i = 0; i < NUM_DIRS; i++)); do
|