richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
62b301
From 5226df888c28ede9219d7f018af02cca1d1f6d2a Mon Sep 17 00:00:00 2001
62b301
From: Yu Watanabe <watanabe.yu+github@gmail.com>
62b301
Date: Tue, 11 Sep 2018 14:07:53 +0900
62b301
Subject: [PATCH] test-execute: add tests for $RUNTIME_DIRECTORY= or friends
62b301
62b301
(cherry picked from commit 6088662d57bbd81167bd272d385fdd1044b287ec)
62b301
62b301
Related: #2049788
62b301
---
62b301
 .../test-execute/exec-dynamicuser-statedir-migrate-step1.service | 1 +
62b301
 .../test-execute/exec-dynamicuser-statedir-migrate-step2.service | 1 +
62b301
 test/test-execute/exec-dynamicuser-statedir.service              | 1 +
62b301
 test/test-execute/exec-runtimedirectory-mode.service             | 1 +
62b301
 test/test-execute/exec-runtimedirectory.service                  | 1 +
62b301
 5 files changed, 5 insertions(+)
62b301
62b301
diff --git a/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service b/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service
62b301
index 72e6d7686f..5efc5483b8 100644
62b301
--- a/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service
62b301
+++ b/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service
62b301
@@ -10,6 +10,7 @@ ExecStart=test -d /var/lib/test-dynamicuser-migrate
62b301
 ExecStart=test -d /var/lib/test-dynamicuser-migrate2/hoge
62b301
 ExecStart=touch /var/lib/test-dynamicuser-migrate/yay
62b301
 ExecStart=touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay
62b301
+ExecStart=/bin/sh -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"'
62b301
 
62b301
 Type=oneshot
62b301
 DynamicUser=no
62b301
diff --git a/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service b/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service
62b301
index edb0be7ef8..c72302ffd5 100644
62b301
--- a/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service
62b301
+++ b/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service
62b301
@@ -18,6 +18,7 @@ ExecStart=touch /var/lib/test-dynamicuser-migrate/yay
62b301
 ExecStart=touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay
62b301
 ExecStart=touch /var/lib/private/test-dynamicuser-migrate/yay
62b301
 ExecStart=touch /var/lib/private/test-dynamicuser-migrate2/hoge/yayyay
62b301
+ExecStart=/bin/sh -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"'
62b301
 
62b301
 Type=oneshot
62b301
 DynamicUser=yes
62b301
diff --git a/test/test-execute/exec-dynamicuser-statedir.service b/test/test-execute/exec-dynamicuser-statedir.service
62b301
index f459f3c1eb..2fb7b8660b 100644
62b301
--- a/test/test-execute/exec-dynamicuser-statedir.service
62b301
+++ b/test/test-execute/exec-dynamicuser-statedir.service
62b301
@@ -10,6 +10,7 @@ ExecStart=test -f /var/lib/waldo/yay
62b301
 ExecStart=test -f /var/lib/quux/pief/yayyay
62b301
 ExecStart=test -f /var/lib/private/waldo/yay
62b301
 ExecStart=test -f /var/lib/private/quux/pief/yayyay
62b301
+ExecStart=/bin/sh -x -c 'test "$$STATE_DIRECTORY" = "%S/waldo:%S/quux/pief"'
62b301
 
62b301
 # Make sure that /var/lib/private/waldo is really the only writable directory besides the obvious candidates
62b301
 ExecStart=sh -x -c 'test $$(find / \( -path /var/tmp -o -path /tmp -o -path /proc -o -path /dev/mqueue -o -path /dev/shm -o -path /sys/fs/bpf \) -prune -o -type d -writable -print 2>/dev/null | sort -u | tr -d '\\\\n') = /var/lib/private/quux/pief/var/lib/private/waldo'
62b301
diff --git a/test/test-execute/exec-runtimedirectory-mode.service b/test/test-execute/exec-runtimedirectory-mode.service
62b301
index 480f904155..85ae5161c4 100644
62b301
--- a/test/test-execute/exec-runtimedirectory-mode.service
62b301
+++ b/test/test-execute/exec-runtimedirectory-mode.service
62b301
@@ -3,6 +3,7 @@ Description=Test for RuntimeDirectoryMode
62b301
 
62b301
 [Service]
62b301
 ExecStart=/bin/sh -x -c 'mode=$$(stat -c %%a %t/test-exec_runtimedirectory-mode); test "$$mode" = "750"'
62b301
+ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectory-mode"'
62b301
 Type=oneshot
62b301
 RuntimeDirectory=test-exec_runtimedirectory-mode
62b301
 RuntimeDirectoryMode=0750
62b301
diff --git a/test/test-execute/exec-runtimedirectory.service b/test/test-execute/exec-runtimedirectory.service
62b301
index 6a4383110f..a33044d23c 100644
62b301
--- a/test/test-execute/exec-runtimedirectory.service
62b301
+++ b/test/test-execute/exec-runtimedirectory.service
62b301
@@ -4,6 +4,7 @@ Description=Test for RuntimeDirectory
62b301
 [Service]
62b301
 ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectory'
62b301
 ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectory2/hogehoge'
62b301
+ExecStart=/bin/sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectory:%t/test-exec_runtimedirectory2/hogehoge"'
62b301
 Type=oneshot
62b301
 RuntimeDirectory=test-exec_runtimedirectory
62b301
 RuntimeDirectory=./test-exec_runtimedirectory2///./hogehoge/.