Merge pull request #32439 from CodethinkLabs/simple-mkosi-integration-tests

Enable some simple mkosi integration tests
This commit is contained in:
Daan De Meyer
2024-04-26 20:48:00 +02:00
committed by GitHub
10 changed files with 62 additions and 3 deletions
+5
View File
@@ -4,6 +4,11 @@
set -eux
set -o pipefail
if [[ $(systemctl is-enabled systemd-udev-load-credentials.service) == not-found ]]; then
echo "Missing systemd-udev-load-credentials.service" >>/skipped
exit 0
fi
at_exit() {
rm -f /run/credstore/udev.*
rm -f /run/udev/udev.conf.d/*
+8
View File
@@ -3,6 +3,14 @@
set -eux
set -o pipefail
. /etc/os-release
# FIXME: This test fails on opensuse with the following error and others:
# Apr 25 10:24:04 H (cat)[910]: device-mapper: create ioctl on ... failed: Device or resource busy
if [[ "$ID" =~ "opensuse" ]]; then
echo "Skipping due to known unexpected behaviour in OpenSUSE kernels" >>/skipped
exit 77
fi
# shellcheck source=test/units/test-control.sh
. "$(dirname "$0")"/test-control.sh
+5
View File
@@ -3,6 +3,11 @@
set -eux
set -o pipefail
if ! command -v importctl >/dev/null; then
echo "importctl is not available to be chain-loaded from machinectl, skipping" >>/skipped
exit 77
fi
export SYSTEMD_PAGER=cat
dd if=/dev/urandom of=/var/tmp/testimage.raw bs=$((1024*1024+7)) count=5
+4
View File
@@ -386,6 +386,10 @@ if [[ -x /usr/lib/systemd/system-generators/systemd-sysv-generator ]]; then
# at runtime, so let's just support the two most common paths for now.
[[ -d /etc/rc.d/init.d ]] && SYSVINIT_PATH="/etc/rc.d/init.d" || SYSVINIT_PATH="/etc/init.d"
# OpenSUSE leaves sysvinit-path enabled, which means systemd-sysv-generator is built
# but may not create the directory if there's no services that use it.
mkdir -p "$SYSVINIT_PATH"
# invalid dependency
cat >"${SYSVINIT_PATH:?}/issue-24990" <<\EOF
#!/bin/bash
+1 -1
View File
@@ -29,7 +29,7 @@ testUnitFile="/run/systemd/system/$testUnit"
testUnitNUMAConf="$testUnitFile.d/numa.conf"
# Sleep constants (we should probably figure out something better but nothing comes to mind)
sleepAfterStart=1
sleepAfterStart=3
# Journal cursor for easier navigation
journalCursorFile="jounalCursorFile"
@@ -13,6 +13,7 @@ OUT_DIR="$(mktemp -d /tmp/fstab-generator.XXX)"
FSTAB="$(mktemp)"
at_exit() {
mountpoint -q /proc/cmdline && umount /proc/cmdline
rm -fr "${OUT_DIR:?}" "${FSTAB:?}"
}
@@ -294,6 +295,12 @@ check_fstab_mount_units() {
done
}
# Drop usrhash on the command-line so fstab-generator doesn't add a /dev/mapper
# mount for /usr, add a root= to emulate a more typical environment,
# and remove any systemd.mount-extra=
sed -r -e 's/usrhash=[^[:space:]+]/root=\/dev\/sda2/' -e 's/systemd.mount-extra=[^[:space:]+]//g' /proc/cmdline >/tmp/cmdline.tmp
mount --bind /tmp/cmdline.tmp /proc/cmdline
: "fstab-generator: regular"
printf "%s\n" "${FSTAB_GENERAL_ROOT[@]}" >"$FSTAB"
cat "$FSTAB"