Merge pull request #30464 from CodethinkLabs/misc-integration-test-fixes
Misc integration test fixes
This commit is contained in:
@@ -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:?}"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
if journalctl -b -t systemd --grep '\.device: Changed plugged -> dead'; then
|
||||
if journalctl -b -t systemd --grep '(?<!loop.|diskseq-.)\.device: Changed plugged -> dead'; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ systemd-analyze security --json=short | jq
|
||||
if [[ ! -v ASAN_OPTIONS ]]; then
|
||||
# check that systemd-analyze cat-config paths work in a chroot
|
||||
mkdir -p /tmp/root
|
||||
mount --bind / /tmp/root
|
||||
mount --rbind / /tmp/root
|
||||
systemd-analyze cat-config systemd/system-preset >/tmp/out1
|
||||
chroot /tmp/root systemd-analyze cat-config systemd/system-preset >/tmp/out2
|
||||
diff /tmp/out{1,2}
|
||||
|
||||
@@ -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 <<EOF
|
||||
|
||||
@@ -216,3 +216,19 @@ kernel_supports_lsm() {
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
MOUNTED_USR_OVERLAY=false
|
||||
|
||||
maybe_mount_usr_overlay() {
|
||||
if [[ ! -w /usr ]]; then
|
||||
mkdir -p /tmp/usr-overlay/{upperdir,workdir}
|
||||
mount -t overlay -o lowerdir=/usr,upperdir=/tmp/usr-overlay/upperdir,workdir=/tmp/usr-overlay/workdir overlay /usr
|
||||
MOUNTED_USR_OVERLAY=true
|
||||
fi
|
||||
}
|
||||
|
||||
maybe_umount_usr_overlay() {
|
||||
if "$MOUNTED_USR_OVERLAY"; then
|
||||
umount -l /usr
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user