• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# shellcheck disable=SC2086 # we want word splitting
3# shellcheck disable=SC1091 # paths only become valid at runtime
4
5. "${SCRIPTS_DIR}/setup-test-env.sh"
6
7section_start test_setup "deqp: preparing test setup"
8
9set -ex
10
11# Needed so configuration files can contain paths to files in /install
12ln -sf "$CI_PROJECT_DIR"/install /install
13
14if [ -z "$GPU_VERSION" ]; then
15   echo 'GPU_VERSION must be set to something like "llvmpipe" or "freedreno-a630" (the name used in .gitlab-ci/gpu-version-*.txt)'
16   exit 1
17fi
18
19INSTALL=$(realpath -s "$PWD"/install)
20
21# Set up the driver environment.
22export LD_LIBRARY_PATH="$INSTALL"/lib/:$LD_LIBRARY_PATH
23export EGL_PLATFORM=surfaceless
24ARCH=$(uname -m)
25export VK_DRIVER_FILES="$PWD"/install/share/vulkan/icd.d/"$VK_DRIVER"_icd."$ARCH".json
26export OCL_ICD_VENDORS="$PWD"/install/etc/OpenCL/vendors/
27
28if [ -n "$USE_ANGLE" ]; then
29  export LD_LIBRARY_PATH=/angle:$LD_LIBRARY_PATH
30fi
31
32# Ensure Mesa Shader Cache resides on tmpfs.
33SHADER_CACHE_HOME=${XDG_CACHE_HOME:-${HOME}/.cache}
34SHADER_CACHE_DIR=${MESA_SHADER_CACHE_DIR:-${SHADER_CACHE_HOME}/mesa_shader_cache}
35
36findmnt -n tmpfs ${SHADER_CACHE_HOME} || findmnt -n tmpfs ${SHADER_CACHE_DIR} || {
37    mkdir -p ${SHADER_CACHE_DIR}
38    mount -t tmpfs -o nosuid,nodev,size=2G,mode=1755 tmpfs ${SHADER_CACHE_DIR}
39}
40
41BASELINE=""
42if [ -e "$INSTALL/$GPU_VERSION-fails.txt" ]; then
43    BASELINE="--baseline $INSTALL/$GPU_VERSION-fails.txt"
44fi
45
46# Default to an empty known flakes file if it doesn't exist.
47touch $INSTALL/$GPU_VERSION-flakes.txt
48
49
50if [ -n "$VK_DRIVER" ] && [ -e "$INSTALL/$VK_DRIVER-skips.txt" ]; then
51    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$VK_DRIVER-skips.txt"
52fi
53
54if [ -n "$GALLIUM_DRIVER" ] && [ -e "$INSTALL/$GALLIUM_DRIVER-skips.txt" ]; then
55    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$GALLIUM_DRIVER-skips.txt"
56fi
57
58if [ -n "$DRIVER_NAME" ] && [ -e "$INSTALL/$DRIVER_NAME-skips.txt" ]; then
59    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$DRIVER_NAME-skips.txt"
60fi
61
62if [ -e "$INSTALL/$GPU_VERSION-skips.txt" ]; then
63    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$GPU_VERSION-skips.txt"
64fi
65
66if [ -e "$INSTALL/$GPU_VERSION-slow-skips.txt" ] && [[ $CI_JOB_NAME != *full* ]]; then
67    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$GPU_VERSION-slow-skips.txt"
68fi
69
70if [ "$PIGLIT_PLATFORM" != "gbm" ] ; then
71    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/x11-skips.txt"
72fi
73
74if [ "$PIGLIT_PLATFORM" = "gbm" ]; then
75    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/gbm-skips.txt"
76fi
77
78if [ -n "$USE_ANGLE" ]; then
79    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/angle-skips.txt"
80fi
81
82# Set the path to VK validation layer settings (in case it ends up getting loaded)
83# Note: If you change the format of this filename, look through the rest of the
84# tree for other places that need to be kept in sync (e.g.
85# src/gallium/drivers/zink/ci/gitlab-ci-inc.yml)
86export VK_LAYER_SETTINGS_PATH=$INSTALL/$GPU_VERSION-validation-settings.txt
87
88report_load() {
89    echo "System load: $(cut -d' ' -f1-3 < /proc/loadavg)"
90    echo "# of CPU cores: $(grep -c processor /proc/cpuinfo)"
91}
92
93if [ "$GALLIUM_DRIVER" = "virpipe" ]; then
94    # deqp is to use virpipe, and virgl_test_server llvmpipe
95    export GALLIUM_DRIVER="$GALLIUM_DRIVER"
96
97    VTEST_ARGS="--use-egl-surfaceless"
98    if [ "$VIRGL_HOST_API" = "GLES" ]; then
99        VTEST_ARGS="$VTEST_ARGS --use-gles"
100    fi
101
102    GALLIUM_DRIVER=llvmpipe \
103    virgl_test_server $VTEST_ARGS >$RESULTS_DIR/vtest-log.txt 2>&1 &
104
105    sleep 1
106fi
107
108uncollapsed_section_switch deqp "deqp: deqp-runner"
109
110# Print the detailed version with the list of backports and local patches
111{ set +x; } 2>/dev/null
112for api in vk-main vk gl gles; do
113  deqp_version_log=/deqp-$api/deqp-$api-version
114  if [ -r "$deqp_version_log" ]; then
115    cat "$deqp_version_log"
116  fi
117done
118set -x
119
120# If you change the format of the suite toml filenames or the
121# $GPU_VERSION-{fails,flakes,skips}.txt filenames, look through the rest
122# of the tree for other places that need to be kept in sync (e.g.
123# src/**/ci/gitlab-ci*.yml)
124set +e
125deqp-runner -V
126deqp-runner \
127    suite \
128    --suite $INSTALL/deqp-$DEQP_SUITE.toml \
129    --output $RESULTS_DIR \
130    --skips $INSTALL/all-skips.txt $DEQP_SKIPS \
131    --flakes $INSTALL/$GPU_VERSION-flakes.txt \
132    --testlog-to-xml /deqp-tools/testlog-to-xml \
133    --fraction-start ${CI_NODE_INDEX:-1} \
134    --fraction $((CI_NODE_TOTAL * ${DEQP_FRACTION:-1})) \
135    --jobs ${FDO_CI_CONCURRENT:-4} \
136    $BASELINE \
137    ${DEQP_RUNNER_MAX_FAILS:+--max-fails "$DEQP_RUNNER_MAX_FAILS"} \
138    ${DEQP_FORCE_ASAN:+--env LD_PRELOAD=libasan.so.8:/install/lib/libdlclose-skip.so}; DEQP_EXITCODE=$?
139
140{ set +x; } 2>/dev/null
141
142set -e
143
144section_switch test_post_process "deqp: post-processing test results"
145set -x
146
147report_load
148
149# Remove all but the first 50 individual XML files uploaded as artifacts, to
150# save fd.o space when you break everything.
151find $RESULTS_DIR -name \*.xml | \
152    sort -n |
153    sed -n '1,+49!p' | \
154    xargs rm -f
155
156# If any QPA XMLs are there, then include the XSL/CSS in our artifacts.
157find $RESULTS_DIR -name \*.xml \
158    -exec cp /deqp-tools/testlog.css /deqp-tools/testlog.xsl "$RESULTS_DIR/" ";" \
159    -quit
160
161deqp-runner junit \
162   --testsuite dEQP \
163   --results $RESULTS_DIR/failures.csv \
164   --output $RESULTS_DIR/junit.xml \
165   --limit 50 \
166   --template "See $ARTIFACTS_BASE_URL/results/{{testcase}}.xml"
167
168# Report the flakes to the IRC channel for monitoring (if configured):
169if [ -n "$FLAKES_CHANNEL" ]; then
170  python3 $INSTALL/report-flakes.py \
171         --host irc.oftc.net \
172         --port 6667 \
173         --results $RESULTS_DIR/results.csv \
174         --known-flakes $INSTALL/$GPU_VERSION-flakes.txt \
175         --channel "$FLAKES_CHANNEL" \
176         --runner "$CI_RUNNER_DESCRIPTION" \
177         --job "$CI_JOB_ID" \
178         --url "$CI_JOB_URL" \
179         --branch "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_BRANCH}" \
180         --branch-title "${CI_MERGE_REQUEST_TITLE:-$CI_COMMIT_TITLE}" || true
181fi
182
183# Compress results.csv to save on bandwidth during the upload of artifacts to
184# GitLab. This reduces the size in a VKCTS run from 135 to 7.6MB, and takes
185# 0.17s on a Ryzen 5950X (16 threads, 0.95s when limited to 1 thread).
186zstd --quiet --rm --threads ${FDO_CI_CONCURRENT:-0} -8 "$RESULTS_DIR/results.csv" -o "$RESULTS_DIR/results.csv.zst"
187
188set +x
189section_end test_post_process
190
191exit $DEQP_EXITCODE
192