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
commit 4c36bbdfd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 62 additions and 3 deletions

View file

@ -43,7 +43,7 @@ Packages=
group(root)
gzip
iputils
kernel-kvmsmall
kernel-default
kmod
libasan8
libkmod2

View file

@ -5,6 +5,6 @@ Distribution=ubuntu
[Content]
Packages=
linux-image-virtual
linux-image-generic
linux-tools-common
linux-tools-virtual

View file

@ -102,6 +102,7 @@ def main():
),
'--credential',
f"systemd.unit-dropin.{test_unit}={shlex.quote(dropin)}",
'--runtime-network=none',
'--append',
'--kernel-command-line-extra',
' '.join([

View file

@ -338,9 +338,38 @@ integration_test_wrapper = find_program('integration-test-wrapper.py')
integration_tests = {
'01': 'TEST-01-BASIC',
'02': 'TEST-02-UNITTESTS',
'03': 'TEST-03-JOBS',
'05': 'TEST-05-RLIMITS',
'16': 'TEST-16-EXTEND-TIMEOUT',
'17': 'TEST-17-UDEV', # Can be flaky when overloaded if timeout abort test is slow
'19': 'TEST-19-CGROUP',
'25': 'TEST-25-IMPORT',
'26': 'TEST-26-SYSTEMCTL',
'29': 'TEST-29-PORTABLE',
'30': 'TEST-30-ONCLOCKCHANGE',
'32': 'TEST-32-OOMPOLICY',
'34': 'TEST-34-DYNAMICUSERMIGRATE',
'36': 'TEST-36-NUMAPOLICY',
'38': 'TEST-38-FREEZER',
'43': 'TEST-43-PRIVATEUSER-UNPRIV',
'44': 'TEST-44-LOG-NAMESPACE',
'45': 'TEST-45-TIMEDATE',
'50': 'TEST-50-DISSECT',
# Can be flaky when overloaded if daemon-reload is too slow to be rate-limited
'59': 'TEST-59-RELOADING-RESTART',
'60': 'TEST-60-MOUNT-RATELIMIT',
'62': 'TEST-62-RESTRICT-IFACES',
'63': 'TEST-63-PATH',
'66': 'TEST-66-DEVICE-ISOLATION',
'67': 'TEST-67-INTEGRITY',
'68': 'TEST-68-PROPAGATE-EXIT-STATUS',
'72': 'TEST-72-SYSUPDATE',
'76': 'TEST-76-SYSCTL',
'78': 'TEST-78-SIGQUEUE',
'79': 'TEST-79-MEMPRESS',
'80': 'TEST-80-NOTIFYACCESS',
'81': 'TEST-81-GENERATORS',
'84': 'TEST-84-STORAGETM',
}
foreach test_number, dirname : integration_tests
test_params = {

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/*

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

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

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

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"

View file

@ -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"