]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: set `ReadWritePaths=` only for units from TEST-20
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 16 Feb 2022 14:55:09 +0000 (15:55 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 17 Feb 2022 14:45:21 +0000 (14:45 +0000)
as setting it system-wide has some undesirable side-effects.

Follow-up to b6fc524.

test/test-functions

index c8bf96d65a250e68a110202e76bdc46c53fe10d5..e815ce1c585c6f0780805fbb2abaed99ec9d66e3 100644 (file)
@@ -1168,11 +1168,16 @@ install_systemd() {
 
     # When built with gcov, disable ProtectSystem= and ProtectHome= in the test
     # images, since it prevents gcov to write the coverage reports (*.gcda
-    # files). Similarly, set ReadWritePaths= to the $BUIL_DIR in the test image
-    # to make the coverage work with units utilizing DynamicUser=yes.
+    # files)
     if get_bool "$IS_BUILT_WITH_COVERAGE"; then
         mkdir -p "$initdir/etc/systemd/system/service.d/"
-        echo -e "[Service]\nProtectSystem=no\nProtectHome=no\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/system/service.d/gcov-override.conf"
+        echo -e "[Service]\nProtectSystem=no\nProtectHome=no\n" >"$initdir/etc/systemd/system/service.d/99-gcov-override.conf"
+        # Similarly, set ReadWritePaths= to the $BUILD_DIR in the test image
+        # to make the coverage work with units utilizing DynamicUser=yes. Do
+        # this only for services from TEST-20, as setting this system-wide
+        # has many undesirable side-effects
+        mkdir -p "$initdir/etc/systemd/system/test20-.service.d/"
+        echo -e "[Service]\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/system/test20-.service.d/99-gcov-rwpaths-override.conf"
     fi
 
     # If we're built with -Dportabled=false, tests with systemd-analyze