summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-09 13:45:16 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-10 18:08:07 +0200
commit1fd5ec5697680e2ec6277431bd74cabf48dbc94f (patch)
tree1ab4c985f91268a8b3693be809f307989dc9cd5c /test
parente57b7020d2ee89d9c906bcefa091d31b067dedcc (diff)
downloadsystemd-1fd5ec5697680e2ec6277431bd74cabf48dbc94f.tar.gz
tmpfiles: Add merge support for copy files action
If '+' is specified with 'C', let's merge the tree with any existing tree.
Diffstat (limited to 'test')
-rwxr-xr-xtest/units/testsuite-22.02.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/units/testsuite-22.02.sh b/test/units/testsuite-22.02.sh
index de28fa7044..b883a9672e 100755
--- a/test/units/testsuite-22.02.sh
+++ b/test/units/testsuite-22.02.sh
@@ -122,6 +122,22 @@ EOF
test "$(stat -c %U:%G:%a /tmp/C/3/f1)" = "root:root:644"
test ! -e /tmp/C/4
+touch /tmp/C/3-origin/f{2,3,4}
+echo -n ABC > /tmp/C/3/f1
+
+systemd-tmpfiles --create - <<EOF
+C+ /tmp/C/3 0755 daemon daemon - /tmp/C/3-origin
+EOF
+
+# Test that the trees got merged, even though /tmp/C/3 already exists.
+test -e /tmp/C/3/f1
+test -e /tmp/C/3/f2
+test -e /tmp/C/3/f3
+test -e /tmp/C/3/f4
+
+# Test that /tmp/C/3/f1 did not get overwritten.
+test "$(cat /tmp/C/3/f1)" = "ABC"
+
# Check that %U expands to 0, both in the path and in the argument.
home='/tmp/C'
systemd-tmpfiles --create - <<EOF