Files
mesa/.gitlab-ci/lava/lava.yml.jinja2
Daniel Stone d0e5203855 ci/lava: Use per-job rootfs overlay for environment
Trying to get arbitrary strings suitably quoted for shell, embedded in a
YAML file, processed by Python templating, is like seven bad ideas all
embedded into one big can of bees.

Reuse the same script we use for bare-metal to generate the environment,
tar that up into a per-job overlay which is added to the
inter-pipeline-reusable rootfs built by the container jobs and the
intra-pipeline-reusable overlay built by the build jobs.

@anholt wrote a chunk of this - replacing the $ENV_VARS GitLab CI
variable with a Python loop across the POSIX job environment - in
!11192, but this still had YAML quoting nightmares, and was more
needless duplication between LAVA and bare-metal.

The diff is large and annoying, but is mostly a sed job to get
ENV_VARS="FOO=bar BAZ=quux" into FOO: bar\nBAZ: quux.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11309>
2021-06-11 12:13:00 +00:00

147 lines
4.6 KiB
Django/Jinja

job_name: mesa-{{ test_suite }}-{{ deqp_version }}-{{ gpu_version }} {{ pipeline_info }}
device_type: {{ device_type }}
context:
extra_nfsroot_args: " init=/init rootwait"
timeouts:
job:
minutes: 30
priority: 75
visibility:
group:
- "Collabora+fdo"
{% if tags %}
{% set lavatags = tags.split(',') %}
tags:
{% for tag in lavatags %}
- {{ tag }}
{% endfor %}
{% endif %}
actions:
- deploy:
timeout:
minutes: 10
to: tftp
kernel:
url: {{ base_system_url_prefix }}/{{ kernel_image_name }}
{% if kernel_image_type %}
{{ kernel_image_type }}
{% endif %}
nfsrootfs:
url: {{ base_system_url_prefix }}/lava-rootfs.tgz
compression: gz
{% if dtb %}
dtb:
url: {{ base_system_url_prefix }}/{{ dtb }}.dtb
{% endif %}
os: oe
- boot:
timeout:
minutes: 25
method: {{ boot_method }}
{% if boot_method == "fastboot" %}
{#
For fastboot, LAVA doesn't know how to unpack the rootfs/apply overlay/repack,
so we transfer the overlay over the network after boot.
#}
transfer_overlay:
download_command: wget -S --progress=dot:giga
unpack_command: tar -C / -xzf
{% else %}
commands: nfs
{% endif %}
prompts:
- 'lava-shell:'
- test:
timeout:
minutes: 30
failure_retry: 1
definitions:
- repository:
metadata:
format: Lava-Test Test Definition 1.0
name: mesa
description: "Mesa test plan"
os:
- oe
scope:
- functional
run:
steps:
# A bunch of setup we have to do before we can pull anything
- cd /
- mount -t proc none /proc
- mount -t sysfs none /sys
- mount -t devtmpfs none /dev || echo possibly already mounted
- mkdir -p /dev/pts
- mount -t devpts devpts /dev/pts
- mkdir -p /dev/shm
- mount -t tmpfs tmpfs /dev/shm
- mount -t tmpfs tmpfs /tmp
- echo "nameserver 8.8.8.8" > /etc/resolv.conf
- echo "$NFS_SERVER_IP caching-proxy" >> /etc/hosts
- for i in 1 2 3; do sntp -sS pool.ntp.org && break || sleep 2; done
- wget -S --progress=dot:giga -O- {{ mesa_build_url }} | tar -xz
- mkdir -p /job-overlay
- wget -S --progress=dot:giga -O- {{ job_rootfs_overlay_url }} | tar -xz -C /job-overlay/
- . /job-overlay/environment.sh
- mkdir -p $CI_PROJECT_DIR
- ln -sf /install $CI_PROJECT_DIR/install
# Set up our devices
- modprobe amdgpu || true
# Disable GPU frequency scaling
- DEVFREQ_GOVERNOR=`find /sys/devices -name governor | grep gpu || true`
- echo performance > $DEVFREQ_GOVERNOR || true
# Disable CPU frequency scaling
- echo performance | tee -a /sys/devices/system/cpu/cpufreq/policy*/scaling_governor || true
# Disable GPU runtime PM
- GPU_AUTOSUSPEND=`find /sys/devices -name autosuspend_delay_ms | grep gpu | head -1`
- echo -1 > $GPU_AUTOSUSPEND || true
- export CI_JOB_JWT="{{ jwt }}"
# Store Mesa's disk cache under /tmp, rather than sending it out over NFS.
- export XDG_CACHE_HOME=/tmp
- export PYTHONPATH=$(python3 -c "import sys;print(\":\".join(sys.path))")
- export LIBGL_DRIVERS_PATH=/install/lib/dri
# If we want Xorg to be running for the test, then we start it up before the
# LAVA_TEST_SCRIPT because we need to use xinit to start X (otherwise
# without using -displayfd you can race with Xorg's startup), but xinit will eat
# your client's return code
- "if [ -n $LAVA_START_XORG ]; then
echo 'touch /xorg-started; sleep 100000' > /xorg-script;
env LD_LIBRARY_PATH=/install/lib/ xinit /bin/sh /xorg-script -- /usr/bin/Xorg -noreset -dpms -logfile /Xorg.0.log &
for i in 1 2 3 4 5; do
if [ -e /xorg-started ]; then
break;
fi;
sleep 5;
done;
export DISPLAY=:0;
fi"
- "if sh $LAVA_TEST_SCRIPT; then
export RESULT=pass;
else
export RESULT=fail;
fi"
- "if [ -d results ]; then
tar -czf results.tar.gz results/;
ci-fairy minio login $CI_JOB_JWT;
ci-fairy minio cp results.tar.gz minio://${JOB_ARTIFACTS_BASE}/results.tar.gz;
fi"
- "echo mesa: $RESULT"
parse:
pattern: '(?P<test_case_id>\S*):\s+(?P<result>(pass|fail))'
from: inline
name: mesa
path: inline/mesa.yaml