diff --git a/.packit.yml b/.packit.yml index 37bf55a0cb..5c3af67505 100644 --- a/.packit.yml +++ b/.packit.yml @@ -19,6 +19,7 @@ actions: post-upstream-clone: # Use the Fedora Rawhide specfile - git clone https://src.fedoraproject.org/rpms/systemd .packit_rpm --depth=1 + - bash -c 'git -C .packit_rpm checkout "$(grep GIT_COMMIT= mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf | cut -d= -f2)"' - bash -c 'echo "%bcond upstream 1" > .packit_rpm/systemd.spec.new' - bash -c 'echo "%define meson_extra_configure_options --werror" >> .packit_rpm/systemd.spec.new' - bash -c 'cat .packit_rpm/systemd.spec >> .packit_rpm/systemd.spec.new' @@ -38,5 +39,6 @@ jobs: trigger: pull_request fmf_path: test/fmf tmt_plan: ci + use_target_repo_for_fmf_url: true targets: - fedora-rawhide-x86_64 diff --git a/test/fmf/integration-tests/main.fmf b/test/fmf/integration-tests/main.fmf index a1686c09c3..e7a38d3c00 100644 --- a/test/fmf/integration-tests/main.fmf +++ b/test/fmf/integration-tests/main.fmf @@ -8,3 +8,6 @@ require: - distribution-gpg-keys - dnf - git-core + - koji + - centos-packager + - copr-cli diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index 5c9f03c960..447ab30bf9 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -17,46 +17,25 @@ echo "Clock source: $(cat /sys/devices/system/clocksource/clocksource0/current_c sysctl fs.inotify.max_user_watches=65536 || true sysctl fs.inotify.max_user_instances=1024 || true -# Allow running the integration tests downstream in dist-git with something like -# the following snippet which makes the dist-git sources available in $TMT_SOURCE_DIR: -# -# summary: systemd Fedora test suite -# discover: -# how: fmf -# dist-git-source: true -# dist-git-install-builddeps: false -# prepare: -# - name: systemd -# how: install -# exclude: -# - systemd-standalone-.* -# execute: -# how: tmt - -shopt -s extglob - -if [[ -n "${TMT_SOURCE_DIR:-}" ]]; then - # Match either directories ending with branch names (e.g. systemd-fmf) or releases (e.g systemd-257.1). - pushd "$TMT_SOURCE_DIR"/systemd-+([0-9a-z.~])/ -elif [[ -n "${PACKIT_TARGET_URL:-}" ]]; then - # Prepare systemd source tree - git clone "$PACKIT_TARGET_URL" systemd --branch "$PACKIT_TARGET_BRANCH" - pushd systemd - - # If we're running in a pull request job, merge the remote branch into the current main - if [[ -n "${PACKIT_SOURCE_URL:-}" ]]; then - git remote add pr "${PACKIT_SOURCE_URL:?}" - git fetch pr "${PACKIT_SOURCE_BRANCH:?}" - git merge "pr/$PACKIT_SOURCE_BRANCH" - fi - - git log --oneline -5 +if [[ -n "${KOJI_TASK_ID:-}" ]]; then + koji download-task --noprogress --arch="src,noarch,$(rpm --eval '%{_arch}')" "$KOJI_TASK_ID" +elif [[ -n "${CBS_TASK_ID:-}" ]]; then + cbs download-task --noprogress --arch="src,noarch,$(rpm --eval '%{_arch}')" "$CBS_TASK_ID" +elif [[ -n "${PACKIT_SRPM_URL:-}" ]]; then + COPR_BUILD_ID="$(basename "$(dirname "$PACKIT_SRPM_URL")")" + COPR_CHROOT="$(basename "$(dirname "$(dirname "$PACKIT_BUILD_LOG_URL")")")" + copr download-build --rpms --chroot "$COPR_CHROOT" "$COPR_BUILD_ID" + mv "$COPR_CHROOT"/* . else - echo "Not running within packit or Fedora CI" + echo "Not running within packit and no CBS/koji task ID provided" exit 1 fi -# Now prepare mkosi, possibly at the same version required by the systemd repo +mkdir systemd +rpm2cpio ./systemd-*.src.rpm | cpio --to-stdout --extract './systemd-*.tar.gz' | tar xz --strip-components=1 -C systemd +pushd systemd + +# Now prepare mkosi at the same version required by the systemd repo. git clone https://github.com/systemd/mkosi mkosi_hash="$(grep systemd/mkosi@ .github/workflows/mkosi.yml | sed "s|.*systemd/mkosi@||g")" git -C mkosi checkout "$mkosi_hash" @@ -68,11 +47,19 @@ export PATH="$PWD/mkosi/bin:$PATH" tee mkosi.local.conf <> /etc/yum.repos.d/copr_build* - - # Disable mkosi's own repository logic - touch /etc/yum.repos.d/mkosi.repo -fi - -# 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 @@ -129,15 +87,12 @@ fi # for now. export TEST_SKIP="TEST-21-DFUZZER" -# Create missing mountpoint for mkosi sandbox. -mkdir -p /etc/pacman.d/gnupg - mkosi summary mkosi -f sandbox -- true -mkosi -f sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build +mkosi sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build mkosi genkey -mkosi -f sandbox -- meson compile -C build mkosi -mkosi -f sandbox -- \ +mkosi -f +mkosi sandbox -- \ meson test \ -C build \ --no-rebuild \