ci: Run KVM tests

This commit makes the KVM tests run in special VM runners tagged with
the 'kvm' tag. In order to avoid building the kernel image used for
running the tests each pipeline, it's built as part of the CI image
building.

For now, KVM tests are only run on the x86_64 architecture. The reasons
for this are two that the kernel image building script doesn't yet handle
any other architecture than x86_64 due to differences in how the image
is built and handled, as well as the fact that there only exists a kvm
tagged runner for x86_64.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
This commit is contained in:
Jonas Ådahl 2022-02-09 10:58:52 +01:00 committed by Marge Bot
parent 7a7fb863a2
commit 5c5e30638d

View File

@ -17,7 +17,7 @@ variables:
.mutter.fedora:35@common: .mutter.fedora:35@common:
variables: variables:
FDO_DISTRIBUTION_VERSION: 35 FDO_DISTRIBUTION_VERSION: 35
BASE_TAG: '2022-03-04.1' BASE_TAG: '2022-03-05.0'
FDO_DISTRIBUTION_PACKAGES: FDO_DISTRIBUTION_PACKAGES:
asciidoc asciidoc
clang clang
@ -31,6 +31,8 @@ variables:
xorg-x11-server-Xvfb xorg-x11-server-Xvfb
mesa-dri-drivers mesa-dri-drivers
xorg-x11-proto-devel xorg-x11-proto-devel
qemu-system-x86-core
busybox
FDO_DISTRIBUTION_EXEC: | FDO_DISTRIBUTION_EXEC: |
dnf install -y 'dnf-command(builddep)' && dnf install -y 'dnf-command(builddep)' &&
@ -41,6 +43,7 @@ variables:
dnf builddep -y libinput --setopt=install_weak_deps=False && dnf builddep -y libinput --setopt=install_weak_deps=False &&
dnf builddep -y wayland --setopt=install_weak_deps=False && dnf builddep -y wayland --setopt=install_weak_deps=False &&
dnf builddep -y wayland-protocols --setopt=install_weak_deps=False && dnf builddep -y wayland-protocols --setopt=install_weak_deps=False &&
dnf builddep -y kernel --setopt=install_weak_deps=False &&
# For Xwayland # For Xwayland
dnf builddep -y xorg-x11-server-Xwayland --setopt=install_weak_deps=False && dnf builddep -y xorg-x11-server-Xwayland --setopt=install_weak_deps=False &&
@ -86,7 +89,21 @@ variables:
mutter mutter-devel \ mutter mutter-devel \
gnome-shell && gnome-shell &&
dnf clean all dnf clean all &&
if [[ x"$(uname -m )" = "xx86_64" ]] ; then
meson build -Dkvm_tests=true &&
ninja -C build src/tests/kvm/bzImage &&
mkdir -p /opt/mutter &&
cp build/src/tests/kvm/bzImage /opt/mutter/bzImage &&
git clone https://github.com/jadahl/virtme.git &&
cd virtme &&
git checkout e7ee481efa10098ed0d62c9e033d61b2379b9b95 &&
./setup.py install --prefix=/usr &&
cd .. &&
rm -rf virtme
fi
default: default:
# Cancel jobs if newer commits are pushed to the branch # Cancel jobs if newer commits are pushed to the branch
@ -209,9 +226,16 @@ check-code-style:
fi fi
allow_failure: true allow_failure: true
.build-mutter-base:
variables:
BASE_MESON_OPTIONS:
-Degl_device=true
-Dwayland_eglstream=true
.build-mutter: .build-mutter:
extends: extends:
- .fdo.distribution-image@fedora - .fdo.distribution-image@fedora
- .build-mutter-base
stage: build stage: build
script: script:
- meson . build - meson . build
@ -221,8 +245,8 @@ check-code-style:
--warnlevel 2 --warnlevel 2
-Dbuildtype=debugoptimized -Dbuildtype=debugoptimized
-Db_coverage=true -Db_coverage=true
-Degl_device=true $BASE_MESON_OPTIONS
-Dwayland_eglstream=true $EXTRA_MESON_OPTIONS
- meson compile -C build - meson compile -C build
- meson install -C build - meson install -C build
artifacts: artifacts:
@ -231,6 +255,10 @@ check-code-style:
- build - build
build-mutter@x86_64: build-mutter@x86_64:
variables:
EXTRA_MESON_OPTIONS:
-Dkvm_tests=true
-Dkvm_kernel_image=/opt/mutter/bzImage
extends: extends:
- .build-mutter - .build-mutter
- .mutter.fedora:35@x86_64 - .mutter.fedora:35@x86_64
@ -297,19 +325,15 @@ build-without-native-backend-and-wayland@x86_64:
MALLOC_CHECK_: "3" MALLOC_CHECK_: "3"
NO_AT_BRIDGE: "1" NO_AT_BRIDGE: "1"
before_script: before_script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
# Disable e.g. audio support to not dead lock screen cast tests # Disable e.g. audio support to not dead lock screen cast tests
- mkdir -m 700 $XDG_RUNTIME_DIR - mkdir -m 700 $XDG_RUNTIME_DIR
- pipewire & sleep 2 - pipewire & sleep 2
.test-mutter: .test-mutter-base:
extends: extends:
- .fdo.distribution-image@fedora - .fdo.distribution-image@fedora
<<: *test-setup <<: *test-setup
stage: test stage: test
script:
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh test -C build --no-rebuild -t 10
after_script: after_script:
- pushd build - pushd build
- gcovr --root=.. - gcovr --root=..
@ -319,14 +343,27 @@ build-without-native-backend-and-wayland@x86_64:
- popd - popd
artifacts: artifacts:
expire_in: 1 day expire_in: 1 day
reports:
junit: "build/meson-logs/testlog.junit.xml"
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always when: always
paths: paths:
- build - build
- coverage-*.json - coverage-*.json
.test-mutter:
extends:
- .fdo.distribution-image@fedora
- .test-mutter-base
script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh test -C build
--no-suite 'mutter/kvm'
--no-rebuild
--timeout-multiplier 10
artifacts:
reports:
junit: "build/meson-logs/testlog.junit.xml"
test-mutter@x86_64: test-mutter@x86_64:
extends: extends:
- .test-mutter - .test-mutter
@ -334,6 +371,24 @@ test-mutter@x86_64:
needs: needs:
- build-mutter@x86_64 - build-mutter@x86_64
test-mutter-kvm@x86_64:
extends:
- .test-mutter-base
- .mutter.fedora:35@x86_64
tags:
- kvm
script:
meson test -C build
--no-rebuild
--timeout-multiplier 10
--setup plain
--suite 'mutter/kvm'
needs:
- build-mutter@x86_64
artifacts:
reports:
junit: "build/meson-logs/testlog-plain.junit.xml"
test-mutter@aarch64: test-mutter@aarch64:
extends: extends:
- .test-mutter - .test-mutter
@ -357,6 +412,7 @@ coverage:
needs: needs:
- test-mutter@x86_64 - test-mutter@x86_64
- test-mutter@aarch64 - test-mutter@aarch64
- test-mutter-kvm@x86_64
can-build-gnome-shell@x86_64: can-build-gnome-shell@x86_64:
extends: extends:
@ -402,11 +458,17 @@ dist-mutter:
extends: extends:
- .fdo.distribution-image@fedora - .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64 - .mutter.fedora:35@x86_64
- .build-mutter-base
<<: *test-setup <<: *test-setup
stage: deploy stage: deploy
needs: needs:
- build-mutter@x86_64 - build-fedora-container@x86_64
script: script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
$BASE_MESON_OPTIONS
-Dkvm_tests=false
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS" - dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh dist -C build ./.gitlab-ci/run-meson.sh dist -C build
rules: rules: