diff --git a/integration/upstream-tests/main.fmf b/integration/upstream-tests/main.fmf index 488a4f7..92e3ef4 100644 --- a/integration/upstream-tests/main.fmf +++ b/integration/upstream-tests/main.fmf @@ -2,38 +2,67 @@ summary: Run the upstream integration test suite test: ./test.sh duration: 2h require: + - acl + - attr + - bind-utils - coreutils - - distribution-gpg-keys + - cryptsetup + - curl + - dhcp-client + - diffutils - dnf - dnsmasq - dosfstools - e2fsprogs - elfutils - findutils - - gcc - git-core - - gperf - integritysetup - - libcap-devel - - libmount-devel + - iscsi-initiator-utils + - jq + - knot + - knot-dnssecutils - koji - - meson - - python3-jinja2 + - libarchive-devel + - lvm2 + - make + - mdadm + - net-tools + - nmap-ncat + - nvme-cli + - python3-pexpect + - python3-pyparsing - python3-pytest - qemu-kvm - qemu-system-aarch64 + - quota - rpm-build + - screen + - socat - squashfs-tools - strace + - stress + - stress-ng - swtpm - - swtpm-tools + - systemd - 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 diff --git a/integration/upstream-tests/test.sh b/integration/upstream-tests/test.sh index e439b85..1c6655c 100755 --- a/integration/upstream-tests/test.sh +++ b/integration/upstream-tests/test.sh @@ -3,25 +3,12 @@ set -eux set -o pipefail -WORKDIR="$(mktemp --directory --tmpdir=/var/tmp)" +WORKDIR="$(mktemp -d)" 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 cleanup EXIT +trap "chmod -R o+rX $TMT_TEST_DATA" EXIT # Switch SELinux to permissive, since the tests don't set proper contexts setenforce 0 @@ -30,6 +17,7 @@ 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" @@ -40,83 +28,55 @@ 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 install --allowerasing -y mkosi + dnf builddep --allowerasing -y ./systemd-*.src.rpm 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 -. /etc/os-release || . /usr/lib/os-release - -tee mkosi.local.conf <> /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 +# 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" +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 -export TEST_SKIP="TEST-64-UDEV-STORAGE TEST-69-SHUTDOWN" +touch test/TEST-69-SHUTDOWN/fedora-skip + 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 -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 +test/run-integration-tests.sh popd +rm -rf "$WORKDIR"