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:
- 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:
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
pkg-config \
python3-pip \
python3-setuptools \
+ qemu-system \
+ sysvinit-core \
xwayland \
$MESA_RUNTIME_PKGS
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
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
\ No newline at end of file
--- /dev/null
+#!/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