diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-14 08:15:33 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-05-14 19:32:07 +0200 |
commit | ceea144ed8b21bbad6a8db6658874d147416cbfa (patch) | |
tree | a4819f15564b1e5865c89c4c79bfb191509de804 /test | |
parent | f339240ad03443b480126c1ce1acac56bee3fcc3 (diff) | |
download | systemd-ceea144ed8b21bbad6a8db6658874d147416cbfa.tar.gz |
test: use dropins to override system configuration
Instead of touching the configuration files directly.
Diffstat (limited to 'test')
-rw-r--r-- | test/test-functions | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/test/test-functions b/test/test-functions index 1f9fa6bb57..b7c21a9d13 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1220,35 +1220,37 @@ install_systemd() { install_compiled_systemd fi - # remove unneeded documentation + # Remove unneeded documentation rm -fr "${initdir:?}"/usr/share/{man,doc} - # enable debug logging in PID1 - echo LogLevel=debug >>"$initdir/etc/systemd/system.conf" + # Enable debug logging in PID1 + mkdir -p "$initdir/etc/systemd/system.conf.d/" + echo -ne "[Manager]\nLogLevel=debug\n" >"$initdir/etc/systemd/system.conf.d/10-log-level.conf" if [[ -n "$TEST_SYSTEMD_LOG_LEVEL" ]]; then - echo DefaultEnvironment=SYSTEMD_LOG_LEVEL="$TEST_SYSTEMD_LOG_LEVEL" >>"$initdir/etc/systemd/system.conf" + echo DefaultEnvironment=SYSTEMD_LOG_LEVEL="$TEST_SYSTEMD_LOG_LEVEL" >>"$initdir/etc/systemd/system.conf.d/99-log-level.conf" fi - # store coredumps in journal - echo Storage=journal >>"$initdir/etc/systemd/coredump.conf" + # Store coredumps in journal + mkdir -p "$initdir/etc/systemd/coredump.conf.d/" + echo -ne "[Coredump]\nStorage=journal\n" >"$initdir/etc/systemd/coredump.conf.d/10-storage-journal.conf" # Propagate SYSTEMD_UNIT_PATH to user systemd managers - mkdir "$initdir/etc/systemd/system/user@.service.d/" - echo -e "[Service]\nPassEnvironment=SYSTEMD_UNIT_PATH\n" >"$initdir/etc/systemd/system/user@.service.d/override.conf" + mkdir -p "$initdir/etc/systemd/system/user@.service.d/" + echo -ne "[Service]\nPassEnvironment=SYSTEMD_UNIT_PATH\n" >"$initdir/etc/systemd/system/user@.service.d/99-SYSTEMD_UNIT_PATH.conf" # When built with gcov, disable ProtectSystem= and ProtectHome= in the test # images, since it prevents gcov to write the coverage reports (*.gcda # files) if get_bool "$IS_BUILT_WITH_COVERAGE"; then mkdir -p "$initdir/etc/systemd/system/service.d/" - echo -e "[Service]\nProtectSystem=no\nProtectHome=no\n" >"$initdir/etc/systemd/system/service.d/99-gcov-override.conf" + echo -ne "[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 using DynamicUser=yes. Do this # only for services with test- prefix, as setting this system-wide # has many undesirable side-effects, as it creates its own namespace. mkdir -p "$initdir/etc/systemd/system/test-.service.d/" - echo -e "[Service]\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/system/test-.service.d/99-gcov-rwpaths-override.conf" + echo -ne "[Service]\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/system/test-.service.d/99-gcov-rwpaths-override.conf" # Ditto, but for the user daemon mkdir -p "$initdir/etc/systemd/user/test-.service.d/" - echo -e "[Service]\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/user/test-.service.d/99-gcov-rwpaths-override.conf" + echo -ne "[Service]\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/user/test-.service.d/99-gcov-rwpaths-override.conf" fi # If we're built with -Dportabled=false, tests with systemd-analyze |