1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

test: set ReadWritePaths= only for units from TEST-20

as setting it system-wide has some undesirable side-effects.

Follow-up to b6fc524.
This commit is contained in:
Frantisek Sumsal 2022-02-16 15:55:09 +01:00
parent 48c08560f4
commit 93c3b6989b

View 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