From: Richard Maw Date: Fri, 8 Dec 2023 18:56:25 +0000 (+0000) Subject: test: mount overlayfs over /usr in some tests X-Git-Tag: v256-rc1~1467^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8799346862285903a2348dad5e0a0cf513f8317e;p=thirdparty%2Fsystemd.git test: mount overlayfs over /usr in some tests Most of the integration tests have been made to not write to /usr but some genuinely need to do so. Because mkosi creates images with a read-only /usr it is not normally writeable. By mounting an overlayfs with /usr as the lower dir and upper and working dirs in /var tests may write to /usr. --- diff --git a/test/units/testsuite-15.sh b/test/units/testsuite-15.sh index e790b37c70d..0266f6266fb 100755 --- a/test/units/testsuite-15.sh +++ b/test/units/testsuite-15.sh @@ -5,6 +5,11 @@ set -o pipefail # shellcheck source=test/units/test-control.sh . "$(dirname "$0")"/test-control.sh +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + +maybe_mount_usr_overlay +trap 'maybe_umount_usr_overlay' EXIT clear_unit() { local unit_name="${1:?}" diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh index 5aaac099f45..9f672c738a3 100755 --- a/test/units/testsuite-26.sh +++ b/test/units/testsuite-26.sh @@ -12,10 +12,13 @@ at_exit() { rm -fvr "/usr/lib/systemd/system/$UNIT_NAME" "/etc/systemd/system/$UNIT_NAME.d" "+4" fi + maybe_umount_usr_overlay + rm -f /etc/init.d/issue-24990 return 0 } +maybe_mount_usr_overlay trap at_exit EXIT # Create a simple unit file for testing diff --git a/test/units/testsuite-60.sh b/test/units/testsuite-60.sh index e800a7a12c2..3d0723e7dcc 100755 --- a/test/units/testsuite-60.sh +++ b/test/units/testsuite-60.sh @@ -6,6 +6,9 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +maybe_mount_usr_overlay +trap 'maybe_umount_usr_overlay' EXIT + teardown_test_dependencies() ( set +eux diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh index df5af4ba873..3e5b78879ad 100755 --- a/test/units/testsuite-73.sh +++ b/test/units/testsuite-73.sh @@ -9,6 +9,9 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +maybe_mount_usr_overlay +trap 'maybe_umount_usr_overlay' EXIT + enable_debug() { mkdir -p /run/systemd/system/systemd-localed.service.d cat >>/run/systemd/system/systemd-localed.service.d/override.conf <