Compare commits

..

6 commits

Author SHA1 Message Date
Daan De Meyer
531c815646 Explicitly disable usage of tools tree
We want to enable the tools tree by default upstream but the packit
job can't yet run with the tools tree enabled, so explicitly disable
it in the packit CI config for now.
2024-12-20 17:20:49 +01:00
Luca Boccassi
1f9a7c46e7 Ensure a new line is added to dnf repo config
The config file might not have a trailing new line, ensure we are
not appending to the end of an existing line, breaking the config
2024-12-05 15:50:15 +00:00
Luca Boccassi
6cfdcedf18 Add /var/share/test-artifacts to the mkosi sandbox
Part of the dnf repos:

>>> Curl error (37): Could not read a file:// file for file:///var/share/test-ar
>>> Librepo error: Cannot download repomd.xml: Cannot download repodata/repomd.x
2024-12-05 15:49:32 +00:00
Yu Watanabe
7a0007bed1 mkosi: replace PackageManagerTrees= with SandboxTrees=
To suppress the following warnings:
/var/tmp/tmp.pU16C1yBvj/systemd/mkosi.local.conf: Setting PackageManagerTrees should be configured in [Build], not [Distribution].
/var/tmp/tmp.pU16C1yBvj/systemd/mkosi.local.conf: Setting PackageManagerTrees is deprecated, please use SandboxTrees instead.
2024-11-29 22:58:55 +09:00
Luca Boccassi
ac3ce2ba55 Fix Release= parsing and setting 2024-11-27 21:58:17 +00:00
Luca Boccassi
431af61c05 Switch to mkosi based runner for integration tests 2024-11-25 12:09:29 +00:00
2 changed files with 77 additions and 66 deletions

View file

@ -2,67 +2,38 @@ summary: Run the upstream integration test suite
test: ./test.sh
duration: 2h
require:
- acl
- attr
- bind-utils
- coreutils
- cryptsetup
- curl
- dhcp-client
- diffutils
- distribution-gpg-keys
- dnf
- dnsmasq
- dosfstools
- e2fsprogs
- elfutils
- findutils
- gcc
- git-core
- gperf
- integritysetup
- iscsi-initiator-utils
- jq
- knot
- knot-dnssecutils
- libcap-devel
- libmount-devel
- koji
- libarchive-devel
- lvm2
- make
- mdadm
- net-tools
- nmap-ncat
- nvme-cli
- python3-pexpect
- python3-pyparsing
- meson
- python3-jinja2
- python3-pytest
- qemu-kvm
- qemu-system-aarch64
- quota
- rpm-build
- screen
- socat
- squashfs-tools
- strace
- stress
- stress-ng
- swtpm
- systemd
- swtpm-tools
- systemd-container
- systemd-libs
- systemd-pam
- systemd-tests
- systemd-udev
- systemd-ukify
- time
- tpm2-tools
- util-linux
- veritysetup
- wget
- zstd
recommend:
- dnf-plugins-core
- dnf5-plugins
- systemd-boot-unsigned
- systemd-journal-remote
- systemd-networkd
- systemd-oom-defaults
- systemd-resolved
- util-linux-script

View file

@ -3,12 +3,25 @@
set -eux
set -o pipefail
WORKDIR="$(mktemp -d)"
WORKDIR="$(mktemp --directory --tmpdir=/var/tmp)"
pushd "$WORKDIR"
cleanup () {
if [ -f "${WORKDIR}/systemd/build/meson-logs/testlog.txt" ]; then
cp "${WORKDIR}/systemd/build/meson-logs/testlog.txt" "$TMT_TEST_DATA"
fi
if [ -d "${WORKDIR}/systemd/build/test/journal" ]; then
cp -r "${WORKDIR}/systemd/build/test/journal" "$TMT_TEST_DATA"
fi
chmod -R o+rX "$TMT_TEST_DATA"
rm -rf "$WORKDIR"
}
# Workaround for https://gitlab.com/testing-farm/oculus/-/issues/19
# shellcheck disable=SC2064
trap "chmod -R o+rX $TMT_TEST_DATA" EXIT
trap cleanup EXIT
# Switch SELinux to permissive, since the tests don't set proper contexts
setenforce 0
@ -17,7 +30,6 @@ setenforce 0
if [[ -n "${PACKIT_TARGET_URL:-}" ]]; then
# Install systemd's build dependencies, as some of the integration tests setup stuff
# requires pkg-config files
dnf builddep --allowerasing -y systemd
git clone "$PACKIT_TARGET_URL" systemd
cd systemd
git checkout "$PACKIT_TARGET_BRANCH"
@ -28,55 +40,83 @@ if [[ -n "${PACKIT_TARGET_URL:-}" ]]; then
git merge "pr/$PACKIT_SOURCE_BRANCH"
fi
git log --oneline -5
# Now prepare mkosi, possibly at the same version required by the systemd repo
mkosi_tree="${PWD}/../mkosi"
git clone https://github.com/systemd/mkosi.git "$mkosi_tree"
# If we have it, pin the mkosi version to the same one used by Github Actions, to ensure consistency
if [ -f .github/workflows/mkosi.yml ]; then
mkosi_hash="$(grep systemd/mkosi@ .github/workflows/mkosi.yml | sed "s|.*systemd/mkosi@||g")"
git -C "$mkosi_tree" checkout "$mkosi_hash"
fi
export PATH="${mkosi_tree}/bin:$PATH"
else
# If we're running outside of Packit, download SRPM for the currently installed build
if ! dnf download --source "$(rpm -q systemd)"; then
# If the build is recent enough it might not be on the mirrors yet, so try koji as well
koji download-build --arch=src "$(rpm -q systemd --qf "%{sourcerpm}")"
fi
dnf builddep --allowerasing -y ./systemd-*.src.rpm
dnf install --allowerasing -y mkosi
rpmbuild --nodeps --define="_topdir $PWD" -rp ./systemd-*.src.rpm
# Little hack to get to the correct directory without having to figure out
# the exact name
cd BUILD/*/test/../
# NO_BUILD=1 support for Fedora was introduced in v255
if ! grep -q "LOOKS_LIKE_FEDORA" test/test-functions; then
# Try to apply necessary patches before giving up completely
if ! curl -Ls https://github.com/systemd/systemd/commit/b54bc139ae91b417996ddc85585710ebf3324237.patch | git apply ||
! curl -Ls https://github.com/systemd/systemd/commit/8ddbd9e07811e434fb24bc0d04812aae24fa78be.patch | git apply; then
echo "Source tree doesn't support NO_BUILD=1 on Fedora, skipping the tests"
exit 0
fi
fi
fi
# Temporarily build custom initrd with libkmod installed explicitly, as it became
# a dlopen() dep
# See: https://github.com/systemd/systemd/pull/31131
export INITRD="$(mktemp /var/tmp/ci-XXX.initrd)"
cp -fv "/boot/initramfs-$(uname -r).img" "$INITRD"
dracut -f -v -a crypt --install /usr/lib64/libkmod.so.2 --rebuild "$INITRD"
. /etc/os-release || . /usr/lib/os-release
tee mkosi.local.conf <<EOF
[Output]
Format=disk
[Distribution]
Release=${VERSION_ID:-rawhide}
[Build]
ToolsTree=
SandboxTrees=/etc/yum.repos.d/:/etc/yum.repos.d/
SandboxTrees=/var/share/test-artifacts/:/var/share/test-artifacts/
Environment=NO_BUILD=1 ARTIFACT_DIRECTORY="${TMT_TEST_DATA:?}" TEST_SAVE_JOURNAL=fail TEST_SHOW_JOURNAL=warning
Incremental=no
[Host]
RuntimeBuildSources=no
EOF
# Ensure packages built for this test have highest priority
echo -e "\npriority=1" >> /etc/yum.repos.d/copr_build*
# Disable mkosi's own repository logic
touch /etc/yum.repos.d/mkosi.repo
# TODO: drop once BTRFS regression is fixed in kernel 6.13
sed -i "s/Format=btrfs/Format=ext4/" mkosi.repart/10-root.conf
# If we don't have KVM, skip running in qemu, as it's too slow. But try to load the module first.
modprobe kvm || true
if [ ! -e /dev/kvm ]; then
export TEST_NO_KVM=1
export TEST_NO_QEMU=1
fi
export DENY_LIST_MARKERS=fedora-skip
# Skip TEST-64-UDEV-STORAGE for now, as it takes a really long time without KVM
touch test/TEST-64-UDEV-STORAGE/fedora-skip
# FIXME: screen 5.0.0 is FUBAR and break this test, re-enable once the issue is fixed
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2309284
touch test/TEST-69-SHUTDOWN/fedora-skip
export TEST_SKIP="TEST-64-UDEV-STORAGE TEST-69-SHUTDOWN"
export ARTIFACT_DIRECTORY="${TMT_TEST_DATA:?}"
export SPLIT_TEST_LOGS=1
export TEST_SAVE_JOURNAL=fail
export TEST_SHOW_JOURNAL=warning
export TEST_REQUIRE_INSTALL_TESTS=0
export TEST_PREFER_NSPAWN=1
export TEST_NESTED_KVM=1
export NO_BUILD=1
export QEMU_TIMEOUT=1800
export NSPAWN_TIMEOUT=1200
export SYSTEMD_INTEGRATION_TESTS=1
test/run-integration-tests.sh
mkosi summary
meson setup build -Dintegration-tests=true -Dtests=true
mkosi --debug genkey
cp mkosi.key mkosi.crt build
meson compile -C build mkosi
meson test -C build -v --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit
popd
rm -rf "$WORKDIR"