mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 04:58:16 +02:00
gitlab CI: add support for DRM-backend tests
In order to run DRM-backend tests, a DRM-device is needed. As we do not necessarily have control of the hardware that is going to run our tests in GitLab CI, DRM-backend tests were being skipped. This patch add support to run the tests using VKMS (virtual KMS). To achieve this, virtualization is needed, as we need to run a custom kernel during the CI job. We've decided to go with virtme, as it is simpler to setup and works good for our use case. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
parent
887a7e5717
commit
a12ba0b30a
3 changed files with 84 additions and 5 deletions
|
|
@ -20,7 +20,7 @@ stages:
|
|||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: buster
|
||||
FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh'
|
||||
FDO_DISTRIBUTION_TAG: '2020-05-08.0'
|
||||
FDO_DISTRIBUTION_TAG: '2020-06-24.0'
|
||||
|
||||
|
||||
container_prep:
|
||||
|
|
@ -51,23 +51,32 @@ container_prep:
|
|||
- export BUILD_ID="weston-$CI_JOB_NAME"
|
||||
- export PREFIX="$(pwd)/prefix-$BUILD_ID"
|
||||
- export BUILDDIR="$(pwd)/build-$BUILD_ID"
|
||||
- export TESTS_RES_PATH="$BUILDDIR/tests-res.txt"
|
||||
- mkdir "$BUILDDIR" "$PREFIX"
|
||||
|
||||
.build-native-meson:
|
||||
extends: .build-native
|
||||
tags:
|
||||
- kvm
|
||||
script:
|
||||
- export PATH=~/.local/bin:$PATH
|
||||
- cd "$BUILDDIR"
|
||||
- meson --prefix="$PREFIX" ${MESON_OPTIONS} ..
|
||||
- ninja -k0
|
||||
- ninja install
|
||||
- ninja test
|
||||
- virtme-run --rw --pwd --kimg /weston-virtme/bzImage --script-dir ../.gitlab-ci/virtme-scripts
|
||||
- TEST_RES=$(cat $TESTS_RES_PATH)
|
||||
- rm $TESTS_RES_PATH
|
||||
- ninja clean
|
||||
- cp -R /weston-virtme ./
|
||||
- rm weston-virtme/bzImage
|
||||
- exit $TEST_RES
|
||||
artifacts:
|
||||
name: weston-$CI_COMMIT_SHA
|
||||
when: always
|
||||
paths:
|
||||
- build-*/meson-logs
|
||||
- build-*/weston-virtme
|
||||
- prefix-*
|
||||
|
||||
build-native-meson-default-options:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
set -o xtrace -o errexit
|
||||
|
||||
# These get temporary installed for building Linux and then force-removed.
|
||||
LINUX_DEV_PKGS="
|
||||
bc
|
||||
bison
|
||||
flex
|
||||
libelf-dev
|
||||
"
|
||||
|
||||
# These get temporary installed for building Mesa and then force-removed.
|
||||
MESA_DEV_PKGS="
|
||||
bison
|
||||
|
|
@ -74,6 +82,8 @@ apt-get -y --no-install-recommends install \
|
|||
pkg-config \
|
||||
python3-pip \
|
||||
python3-setuptools \
|
||||
qemu-system \
|
||||
sysvinit-core \
|
||||
xwayland \
|
||||
$MESA_RUNTIME_PKGS
|
||||
|
||||
|
|
@ -85,6 +95,37 @@ pip3 install sphinx==2.1.0 --user
|
|||
pip3 install breathe==4.13.0.post0 --user
|
||||
pip3 install sphinx_rtd_theme==0.4.3 --user
|
||||
|
||||
apt-get -y --no-install-recommends install $LINUX_DEV_PKGS
|
||||
git clone --depth=1 --branch=drm-next-2020-06-11-1 https://anongit.freedesktop.org/git/drm/drm.git linux
|
||||
cd linux
|
||||
make x86_64_defconfig
|
||||
make kvmconfig
|
||||
./scripts/config --enable CONFIG_DRM_VKMS
|
||||
make oldconfig
|
||||
make -j8
|
||||
cd ..
|
||||
mkdir /weston-virtme
|
||||
mv linux/arch/x86/boot/bzImage /weston-virtme/bzImage
|
||||
mv linux/.config /weston-virtme/.config
|
||||
rm -rf linux
|
||||
|
||||
# Link to upstream virtme: https://github.com/amluto/virtme
|
||||
#
|
||||
# The reason why we are using a fork here is that it adds a patch to have the
|
||||
# --script-dir command line option. With that we can run scripts that are in a
|
||||
# certain folder when virtme starts, which is necessary in our use case.
|
||||
#
|
||||
# The upstream also has some commands that could help us to reach the same
|
||||
# results: --script-sh and --script-exec. Unfornutately they are not completely
|
||||
# implemented yet, so we had some trouble to use them and it was becoming
|
||||
# hackery.
|
||||
#
|
||||
git clone https://github.com/ezequielgarcia/virtme
|
||||
cd virtme
|
||||
git checkout -b snapshot 69e3cb83b3405edc99fcf9611f50012a4f210f78
|
||||
./setup.py install
|
||||
cd ..
|
||||
|
||||
git clone --branch 1.17.0 --depth=1 https://gitlab.freedesktop.org/wayland/wayland
|
||||
export MAKEFLAGS="-j4"
|
||||
cd wayland
|
||||
|
|
@ -104,7 +145,6 @@ meson build -Dauto_features=disabled \
|
|||
ninja -C build install
|
||||
cd ..
|
||||
rm -rf mesa
|
||||
apt-get -y --autoremove purge $MESA_DEV_PKGS
|
||||
|
||||
mkdir -p /tmp/.X11-unix
|
||||
chmod 777 /tmp/.X11-unix
|
||||
apt-get -y --autoremove purge $LINUX_DEV_PKGS
|
||||
apt-get -y --autoremove purge $MESA_DEV_PKGS
|
||||
30
.gitlab-ci/virtme-scripts/run-weston-tests.sh
Executable file
30
.gitlab-ci/virtme-scripts/run-weston-tests.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# folders that are necessary to run Weston tests
|
||||
mkdir -p /tmp/tests
|
||||
mkdir -p /tmp/.X11-unix
|
||||
chmod -R 0700 /tmp
|
||||
|
||||
# set environment variables to run Weston tests
|
||||
export XDG_RUNTIME_DIR=/tmp/tests
|
||||
export WESTON_TEST_SUITE_DRM_DEVICE=card0
|
||||
|
||||
# ninja test depends on meson, and meson itself looks for its modules on folder
|
||||
# $HOME/.local/lib/pythonX.Y/site-packages (the Python version may differ).
|
||||
# virtme starts with HOME=/tmp/roothome, but as we installed meson on user root,
|
||||
# meson can not find its modules. So we change the HOME env var to fix that.
|
||||
export HOME=/root
|
||||
|
||||
# run the tests and save the exit status
|
||||
ninja test
|
||||
TEST_RES=$?
|
||||
|
||||
# create a file to keep the result of this script:
|
||||
# - 0 means the script succeeded
|
||||
# - 1 means the tests failed, so the job itself should fail
|
||||
TESTS_RES_PATH=$(pwd)/tests-res.txt
|
||||
echo $TEST_RES > $TESTS_RES_PATH
|
||||
|
||||
# shutdown virtme
|
||||
sync
|
||||
poweroff -f
|
||||
Loading…
Add table
Reference in a new issue