tests: add functional test

Also switches the CI to using rawhide for now to avoid building gtk4 ourselves
until fedora 39 is released

Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
This commit is contained in:
Sandro Bonazzola 2023-08-24 14:43:29 +02:00 committed by Bilal Elmoussaoui
parent fd2cc3b19a
commit 0b9e08a798
2 changed files with 64 additions and 4 deletions

View File

@ -7,6 +7,30 @@ stages:
- docs - docs
- deploy - deploy
tests:
image: fedora:rawhide
stage: test
variables:
MESON_FLAGS: "-Db_coverage=true -Ddocs=false -Dvapi=false -Dintrospection=disabled"
before_script:
- sudo dnf install -y git gtk4-devel libepoxy-devel meson gcc lcov wget
qemu-system-x86 qemu-ui-dbus qemu-ui-opengl
dbus-x11 xorg-x11-server-Xvfb
script:
- meson setup _build
- meson configure ${MESON_FLAGS} _build
- meson compile -C _build
- meson test -C _build --suit "libmks"
- cd tests
- BUILDDIR=_build xvfb-run ./functional.sh
- cd ..
- rm -rf _build/subprojects
- ninja coverage-html -C _build
artifacts:
paths:
- _build/meson-logs/coveragereport
flatpak: flatpak:
variables: variables:
BUNDLE: "mks-test-widget-dev.flatpak" BUNDLE: "mks-test-widget-dev.flatpak"
@ -17,13 +41,13 @@ flatpak:
extends: ".flatpak" extends: ".flatpak"
reference: reference:
image: fedora:38 image: fedora:rawhide
stage: docs stage: docs
needs: []
variables: variables:
MESON_FLAGS: "--buildtype=release -Dgtk:gtk_doc=false -Dgtk:introspection=disabled -Dgtk:build-examples=false -Dgtk:build-tests=false -Dgtk:demos=false -Dgtk:media-gstreamer=disabled -Dlibepoxy:tests=false" MESON_FLAGS: "--buildtype=release -Ddocs=true -Dintrospection=enabled"
before_script: before_script:
- sudo dnf install -y git gtk4-devel meson gcc gcc-c++ gi-docgen gobject-introspection-devel vala - sudo dnf install -y git gtk4-devel libepoxy-devel meson gcc
gi-docgen gobject-introspection-devel vala
script: script:
- mkdir -p pfx/ - mkdir -p pfx/
- meson ${MESON_FLAGS} --prefix=${PWD}/pfx -Ddocs=true _build - meson ${MESON_FLAGS} --prefix=${PWD}/pfx -Ddocs=true _build

36
tests/functional.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/bash
test -e 512-byte-vm.raw || wget https://github.com/oVirt/512-byte-vm/releases/download/2.0.0/512-byte-vm.raw
QEMU=""
ARCH="$(uname -m)"
test -x "/usr/bin/qemu-system-$ARCH" && QEMU="/usr/bin/qemu-system-$ARCH"
test -x /usr/libexec/qemu-kvm && QEMU=/usr/libexec/qemu-kvm
if [ -z "$QEMU" ]
then
echo "Missing QEMU executable"
exit 1
fi
echo -e "Using $QEMU\n"
${QEMU} \
-drive file=512-byte-vm.raw,format=raw \
-display dbus -device virtio-vga \
-serial mon:stdio \
-enable-kvm &
QEMUPID=$!
sleep 1
BUILDDIR=${BUILDDIR:="builddir"}
"../${BUILDDIR}/tools/mks-connect"
"../${BUILDDIR}/tools/mks" &
MKSPID=$!
sleep 1
kill -SIGTERM $QEMUPID
kill -SIGTERM $MKSPID