summaryrefslogtreecommitdiffstats
path: root/test/test-path
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:18 +0000
commitb750101eb236130cf056c675997decbac904cc49 (patch)
treea5df1a06754bdd014cb975c051c83b01c9a97532 /test/test-path
parentInitial commit. (diff)
downloadsystemd-b750101eb236130cf056c675997decbac904cc49.tar.xz
systemd-b750101eb236130cf056c675997decbac904cc49.zip
Adding upstream version 252.22.upstream/252.22upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtest/test-path-util/script.sh7
-rw-r--r--test/test-path/basic.target15
-rw-r--r--test/test-path/path-changed.path10
-rw-r--r--test/test-path/path-changed.service9
-rw-r--r--test/test-path/path-directorynotempty.path10
-rw-r--r--test/test-path/path-directorynotempty.service9
-rw-r--r--test/test-path/path-exists.path10
-rw-r--r--test/test-path/path-exists.service9
-rw-r--r--test/test-path/path-existsglob.path10
-rw-r--r--test/test-path/path-existsglob.service9
-rw-r--r--test/test-path/path-makedirectory.path12
-rw-r--r--test/test-path/path-makedirectory.service9
-rw-r--r--test/test-path/path-modified.path10
-rw-r--r--test/test-path/path-modified.service9
-rw-r--r--test/test-path/path-mycustomunit.service9
-rw-r--r--test/test-path/path-unit.path11
-rw-r--r--test/test-path/paths.target5
-rw-r--r--test/test-path/sysinit.target8
18 files changed, 171 insertions, 0 deletions
diff --git a/test/test-path-util/script.sh b/test/test-path-util/script.sh
new file mode 100755
index 0000000..d13b363
--- /dev/null
+++ b/test/test-path-util/script.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+echo "$0 $*"
+test "$(basename "$0")" = "script.sh" || exit 1
+test "$1" = "--version" || exit 2
+echo "Life is good"
diff --git a/test/test-path/basic.target b/test/test-path/basic.target
new file mode 100644
index 0000000..45f71aa
--- /dev/null
+++ b/test/test-path/basic.target
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Basic System
+Documentation=man:systemd.special(7)
+Requires=sysinit.target
+Wants=sockets.target timers.target paths.target slices.target
+After=sysinit.target sockets.target paths.target slices.target tmp.mount
+
+# We support /var, /tmp, /var/tmp, being on NFS, but we don't pull in
+# remote-fs.target by default, hence pull them in explicitly here. Note that we
+# require /var and /var/tmp, but only add a Wants= type dependency on /tmp, as
+# we support that unit being masked, and this should not be considered an error.
+RequiresMountsFor=/var /var/tmp
+Wants=tmp.mount
diff --git a/test/test-path/path-changed.path b/test/test-path/path-changed.path
new file mode 100644
index 0000000..fbdd8f6
--- /dev/null
+++ b/test/test-path/path-changed.path
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test PathChanged
+
+[Path]
+PathChanged=/tmp/test-path_changed
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/path-changed.service b/test/test-path/path-changed.service
new file mode 100644
index 0000000..c7e6b48
--- /dev/null
+++ b/test/test-path/path-changed.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-directorynotempty.path b/test/test-path/path-directorynotempty.path
new file mode 100644
index 0000000..cce0899
--- /dev/null
+++ b/test/test-path/path-directorynotempty.path
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test DirectoryNotEmpty
+
+[Path]
+DirectoryNotEmpty=/tmp/test-path_directorynotempty/
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/path-directorynotempty.service b/test/test-path/path-directorynotempty.service
new file mode 100644
index 0000000..c7e6b48
--- /dev/null
+++ b/test/test-path/path-directorynotempty.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-exists.path b/test/test-path/path-exists.path
new file mode 100644
index 0000000..b18bbc8
--- /dev/null
+++ b/test/test-path/path-exists.path
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test PathExists
+
+[Path]
+PathExists=/tmp/test-path_exists
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/path-exists.service b/test/test-path/path-exists.service
new file mode 100644
index 0000000..c7e6b48
--- /dev/null
+++ b/test/test-path/path-exists.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-existsglob.path b/test/test-path/path-existsglob.path
new file mode 100644
index 0000000..7c0d897
--- /dev/null
+++ b/test/test-path/path-existsglob.path
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test PathExistsGlob
+
+[Path]
+PathExistsGlob=/tmp/test-path_existsglob*
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/path-existsglob.service b/test/test-path/path-existsglob.service
new file mode 100644
index 0000000..c7e6b48
--- /dev/null
+++ b/test/test-path/path-existsglob.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-makedirectory.path b/test/test-path/path-makedirectory.path
new file mode 100644
index 0000000..24ff187
--- /dev/null
+++ b/test/test-path/path-makedirectory.path
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test MakeDirectory & DirectoryMode
+
+[Path]
+DirectoryNotEmpty=/tmp/test-path_makedirectory/
+MakeDirectory=yes
+DirectoryMode=0744
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/path-makedirectory.service b/test/test-path/path-makedirectory.service
new file mode 100644
index 0000000..c7e6b48
--- /dev/null
+++ b/test/test-path/path-makedirectory.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-modified.path b/test/test-path/path-modified.path
new file mode 100644
index 0000000..20207fb
--- /dev/null
+++ b/test/test-path/path-modified.path
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test PathModified
+
+[Path]
+PathModified=/tmp/test-path_modified
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/path-modified.service b/test/test-path/path-modified.service
new file mode 100644
index 0000000..c7e6b48
--- /dev/null
+++ b/test/test-path/path-modified.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test for Path units
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-mycustomunit.service b/test/test-path/path-mycustomunit.service
new file mode 100644
index 0000000..b3924fe
--- /dev/null
+++ b/test/test-path/path-mycustomunit.service
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Service Test Path Unit
+
+[Service]
+ExecStart=sleep infinity
+Type=exec
+RemainAfterExit=true
diff --git a/test/test-path/path-unit.path b/test/test-path/path-unit.path
new file mode 100644
index 0000000..c79fa8e
--- /dev/null
+++ b/test/test-path/path-unit.path
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Test Path Unit=
+
+[Path]
+PathExists=/tmp/test-path_unit
+Unit=path-mycustomunit.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/test/test-path/paths.target b/test/test-path/paths.target
new file mode 100644
index 0000000..e2549a7
--- /dev/null
+++ b/test/test-path/paths.target
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=Paths
+Documentation=man:systemd.special(7)
diff --git a/test/test-path/sysinit.target b/test/test-path/sysinit.target
new file mode 100644
index 0000000..566f7b9
--- /dev/null
+++ b/test/test-path/sysinit.target
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Unit]
+Description=System Initialization
+Documentation=man:systemd.special(7)
+Conflicts=emergency.service emergency.target
+Wants=local-fs.target swap.target
+After=local-fs.target swap.target emergency.service emergency.target