From 7d7091c7e811aa7e166c7bfaf5867876c6da89e6 Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Tue, 23 Apr 2024 14:38:10 +0100 Subject: [PATCH] Reinstate testing farm tests Signed-off-by: Alberto Faria --- .fmf/version | 1 + .packit.yaml | 22 ++++++++++++++++++- plans/tests.fmf | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/env.sh | 17 ++++++++++++--- 4 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/tests.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.packit.yaml b/.packit.yaml index c110485..283d1a7 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -28,7 +28,6 @@ jobs: - "copr://rhcontainerbot/podman-next" enable_net: true - # Run on commit to main branch - job: copr_build trigger: commit notifications: @@ -38,3 +37,24 @@ jobs: owner: rhcontainerbot project: podman-next enable_net: true + + - &tests + job: tests + trigger: pull_request + skip_build: true + enable_net: true + targets: + # - fedora-all-x86_64 + # - fedora-all-aarch64 + - fedora-40-x86_64 + - fedora-40-aarch64 + identifier: docker + tmt_plan: /tests/docker + + # - <<: *tests + # identifier: podman + # tmt_plan: /tests/podman + + # - <<: *tests + # identifier: rootful-podman + # tmt_plan: /tests/rootful-podman diff --git a/plans/tests.fmf b/plans/tests.fmf new file mode 100644 index 0000000..2035594 --- /dev/null +++ b/plans/tests.fmf @@ -0,0 +1,58 @@ +provision: + hardware: + virtualization: + is-supported: true + +prepare: + - name: Install dependencies + how: install + package: + - bash + - cargo + - coreutils + - crun + - crun-krun + - docker + - genisoimage + - grep + - guestfs-tools + - libselinux-devel + - libvirt-client + - libvirt-daemon-driver-qemu + - openssh + - openssh-clients + - passt + - podman + - qemu-img + - qemu-system-aarch64-core + - qemu-system-x86-core + - sed + - util-linux + - virtiofsd + +execute: + how: tmt + script: | + set -ex + export PATH=$PATH:/root/.cargo/bin + export LIBGUESTFS_BACKEND=direct + tag=$( awk -F= '/^VERSION_ID=/ {print tolower($2)}' /etc/os-release ) + export CRUN_VM_TEST_ENV_BASE_IMAGE=quay.io/containerdisks/fedora:$tag + tests/env.sh build + tests/env.sh start + tests/env.sh run "$ENGINE" all + +/docker: + summary: Run all tests under Docker + environment: + ENGINE: docker + +/podman: + summary: Run all tests under Podman + environment: + ENGINE: podman + +/rootful-podman: + summary: Run all tests under Rootful Podman + environment: + ENGINE: rootful-podman diff --git a/tests/env.sh b/tests/env.sh index e3d730b..a49ff6f 100755 --- a/tests/env.sh +++ b/tests/env.sh @@ -5,7 +5,7 @@ set -o errexit -o pipefail -o nounset start_time="$( date +%s%N )" -env_image_base=quay.io/containerdisks/fedora:40 +env_image_base=${CRUN_VM_TEST_ENV_BASE_IMAGE:-"quay.io/containerdisks/fedora:40"} env_image=quay.io/crun-vm/test-env:latest container_name=crun-vm-test-env @@ -155,6 +155,12 @@ build) ;; aarch64) root_part=/dev/sda3 + + # enable nested virt + virt-customize \ + --add "$temp_dir/image" \ + --append-line '/etc/default/grub:GRUB_CMDLINE_LINUX_DEFAULT="kvm-arm.mode=nested"' \ + --run-command 'grub2-mkconfig -o /boot/grub2/grub.cfg' ;; esac @@ -173,9 +179,14 @@ build) --name "$container_name-build" \ --runtime "$runtime" \ --memory 8g \ - --rm -dit \ + --rm -it \ --rootfs "$temp_dir" \ - --persistent + --persistent & + + sleep 120 + kill %1 + wait + exit 42 # shellcheck disable=SC2317 __extra_cleanup() {