• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# shellcheck disable=SC2086 # we want word splitting
3
4section_start test_setup "deqp: preparing test setup"
5
6set -ex
7
8# Needed so configuration files can contain paths to files in /install
9ln -sf "$CI_PROJECT_DIR"/install /install
10
11if [ -z "$GPU_VERSION" ]; then
12   echo 'GPU_VERSION must be set to something like "llvmpipe" or "freedreno-a630" (the name used in .gitlab-ci/gpu-version-*.txt)'
13   exit 1
14fi
15
16INSTALL=$(realpath -s "$PWD"/install)
17
18# Set up the driver environment.
19export LD_LIBRARY_PATH="$INSTALL"/lib/:$LD_LIBRARY_PATH
20export EGL_PLATFORM=surfaceless
21export VK_ICD_FILENAMES="$PWD"/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.${VK_CPU:-$(uname -m)}.json
22export OCL_ICD_VENDORS="$PWD"/install/etc/OpenCL/vendors/
23
24if [ -n "$USE_ANGLE" ]; then
25  export LD_LIBRARY_PATH=/angle:$LD_LIBRARY_PATH
26fi
27
28RESULTS="$PWD/${DEQP_RESULTS_DIR:-results}"
29mkdir -p "$RESULTS"
30
31# Ensure Mesa Shader Cache resides on tmpfs.
32SHADER_CACHE_HOME=${XDG_CACHE_HOME:-${HOME}/.cache}
33SHADER_CACHE_DIR=${MESA_SHADER_CACHE_DIR:-${SHADER_CACHE_HOME}/mesa_shader_cache}
34
35findmnt -n tmpfs ${SHADER_CACHE_HOME} || findmnt -n tmpfs ${SHADER_CACHE_DIR} || {
36    mkdir -p ${SHADER_CACHE_DIR}
37    mount -t tmpfs -o nosuid,nodev,size=2G,mode=1755 tmpfs ${SHADER_CACHE_DIR}
38}
39
40if [ -z "$DEQP_SUITE" ]; then
41    if [ -z "$DEQP_VER" ]; then
42        echo 'DEQP_SUITE must be set to the name of your deqp-gpu_version.toml, or DEQP_VER must be set to something like "gles2", "gles31-khr" or "vk" for the test run'
43        exit 1
44    fi
45
46    DEQP_WIDTH=${DEQP_WIDTH:-256}
47    DEQP_HEIGHT=${DEQP_HEIGHT:-256}
48    DEQP_CONFIG=${DEQP_CONFIG:-rgba8888d24s8ms0}
49    DEQP_VARIANT=${DEQP_VARIANT:-master}
50
51    DEQP_OPTIONS="$DEQP_OPTIONS --deqp-surface-width=$DEQP_WIDTH --deqp-surface-height=$DEQP_HEIGHT"
52    DEQP_OPTIONS="$DEQP_OPTIONS --deqp-surface-type=${DEQP_SURFACE_TYPE:-pbuffer}"
53    DEQP_OPTIONS="$DEQP_OPTIONS --deqp-gl-config-name=$DEQP_CONFIG"
54    DEQP_OPTIONS="$DEQP_OPTIONS --deqp-visibility=hidden"
55
56    if [ "$DEQP_VER" = "vk" ] && [ -z "$VK_DRIVER" ]; then
57        echo 'VK_DRIVER must be to something like "radeon" or "intel" for the test run'
58        exit 1
59    fi
60
61    # Generate test case list file.
62    if [ "$DEQP_VER" = "vk" ]; then
63       MUSTPASS=/deqp/mustpass/vk-$DEQP_VARIANT.txt
64       DEQP=/deqp/external/vulkancts/modules/vulkan/deqp-vk
65    elif [ "$DEQP_VER" = "gles2" ] || [ "$DEQP_VER" = "gles3" ] || [ "$DEQP_VER" = "gles31" ] || [ "$DEQP_VER" = "egl" ]; then
66       MUSTPASS=/deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt
67       DEQP=/deqp/modules/$DEQP_VER/deqp-$DEQP_VER
68    elif [ "$DEQP_VER" = "gles2-khr" ] || [ "$DEQP_VER" = "gles3-khr" ] || [ "$DEQP_VER" = "gles31-khr" ] || [ "$DEQP_VER" = "gles32-khr" ]; then
69       MUSTPASS=/deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt
70       DEQP=/deqp/external/openglcts/modules/glcts
71    else
72       MUSTPASS=/deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt
73       DEQP=/deqp/external/openglcts/modules/glcts
74    fi
75
76    cp $MUSTPASS /tmp/case-list.txt
77
78    # If the caselist is too long to run in a reasonable amount of time, let the job
79    # specify what fraction (1/n) of the caselist we should run.  Note: N~M is a gnu
80    # sed extension to match every nth line (first line is #1).
81    if [ -n "$DEQP_FRACTION" ]; then
82       sed -ni 1~$DEQP_FRACTION"p" /tmp/case-list.txt
83    fi
84
85    # If the job is parallel at the gitab job level, take the corresponding fraction
86    # of the caselist.
87    if [ -n "$CI_NODE_INDEX" ]; then
88       sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /tmp/case-list.txt
89    fi
90
91    if [ ! -s /tmp/case-list.txt ]; then
92        echo "Caselist generation failed"
93        exit 1
94    fi
95fi
96
97if [ -e "$INSTALL/$GPU_VERSION-fails.txt" ]; then
98    DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --baseline $INSTALL/$GPU_VERSION-fails.txt"
99fi
100
101# Default to an empty known flakes file if it doesn't exist.
102touch $INSTALL/$GPU_VERSION-flakes.txt
103
104
105if [ -n "$VK_DRIVER" ] && [ -e "$INSTALL/$VK_DRIVER-skips.txt" ]; then
106    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$VK_DRIVER-skips.txt"
107fi
108
109if [ -n "$GALLIUM_DRIVER" ] && [ -e "$INSTALL/$GALLIUM_DRIVER-skips.txt" ]; then
110    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$GALLIUM_DRIVER-skips.txt"
111fi
112
113if [ -n "$DRIVER_NAME" ] && [ -e "$INSTALL/$DRIVER_NAME-skips.txt" ]; then
114    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$DRIVER_NAME-skips.txt"
115fi
116
117if [ -e "$INSTALL/$GPU_VERSION-skips.txt" ]; then
118    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/$GPU_VERSION-skips.txt"
119fi
120
121if [ "$PIGLIT_PLATFORM" != "gbm" ] ; then
122    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/x11-skips.txt"
123fi
124
125if [ "$PIGLIT_PLATFORM" = "gbm" ]; then
126    DEQP_SKIPS="$DEQP_SKIPS $INSTALL/gbm-skips.txt"
127fi
128
129if [ -n "$VK_DRIVER" ] && [ -z "$DEQP_SUITE" ]; then
130    # Bump the number of tests per group to reduce the startup time of VKCTS.
131    DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --tests-per-group ${DEQP_RUNNER_TESTS_PER_GROUP:-5000}"
132fi
133
134# Set the path to VK validation layer settings (in case it ends up getting loaded)
135# Note: If you change the format of this filename, look through the rest of the
136# tree for other places that need to be kept in sync (e.g.
137# src/gallium/drivers/zink/ci/gitlab-ci-inc.yml)
138export VK_LAYER_SETTINGS_PATH=$INSTALL/$GPU_VERSION-validation-settings.txt
139
140report_load() {
141    echo "System load: $(cut -d' ' -f1-3 < /proc/loadavg)"
142    echo "# of CPU cores: $(grep -c processor /proc/cpuinfo)"
143}
144
145if [ "$GALLIUM_DRIVER" = "virpipe" ]; then
146    # deqp is to use virpipe, and virgl_test_server llvmpipe
147    export GALLIUM_DRIVER="$GALLIUM_DRIVER"
148
149    VTEST_ARGS="--use-egl-surfaceless"
150    if [ "$VIRGL_HOST_API" = "GLES" ]; then
151        VTEST_ARGS="$VTEST_ARGS --use-gles"
152    fi
153
154    GALLIUM_DRIVER=llvmpipe \
155    virgl_test_server $VTEST_ARGS >$RESULTS/vtest-log.txt 2>&1 &
156
157    sleep 1
158fi
159
160if [ -z "$DEQP_SUITE" ]; then
161    if [ -n "$DEQP_EXPECTED_RENDERER" ]; then
162        export DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --renderer-check $DEQP_EXPECTED_RENDERER"
163    fi
164    if [ $DEQP_VER != vk ] && [ $DEQP_VER != egl ]; then
165        VER=$(sed 's/[() ]/./g' "$INSTALL/VERSION")
166        export DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --version-check $VER"
167    fi
168fi
169
170uncollapsed_section_switch deqp "deqp: deqp-runner"
171
172# Print the detailed version with the list of backports and local patches
173for api in vk gl; do
174  deqp_version_log=/deqp/version-$api
175  if [ -r "$deqp_version_log" ]; then
176    cat "$deqp_version_log"
177  fi
178done
179
180set +e
181if [ -z "$DEQP_SUITE" ]; then
182    deqp-runner \
183        run \
184        --deqp $DEQP \
185        --output $RESULTS \
186        --caselist /tmp/case-list.txt \
187        --skips $INSTALL/all-skips.txt $DEQP_SKIPS \
188        --flakes $INSTALL/$GPU_VERSION-flakes.txt \
189        --testlog-to-xml /deqp/executor/testlog-to-xml \
190        --jobs ${FDO_CI_CONCURRENT:-4} \
191        $DEQP_RUNNER_OPTIONS \
192        -- \
193        $DEQP_OPTIONS
194else
195    # If you change the format of the suite toml filenames or the
196    # $GPU_VERSION-{fails,flakes,skips}.txt filenames, look through the rest
197    # of the tree for other places that need to be kept in sync (e.g.
198    # src/**/ci/gitlab-ci*.yml)
199    deqp-runner \
200        suite \
201        --suite $INSTALL/deqp-$DEQP_SUITE.toml \
202        --output $RESULTS \
203        --skips $INSTALL/all-skips.txt $DEQP_SKIPS \
204        --flakes $INSTALL/$GPU_VERSION-flakes.txt \
205        --testlog-to-xml /deqp/executor/testlog-to-xml \
206        --fraction-start $CI_NODE_INDEX \
207        --fraction $((CI_NODE_TOTAL * ${DEQP_FRACTION:-1})) \
208        --jobs ${FDO_CI_CONCURRENT:-4} \
209        $DEQP_RUNNER_OPTIONS
210fi
211
212DEQP_EXITCODE=$?
213set -e
214
215set +x
216
217report_load
218
219section_switch test_post_process "deqp: post-processing test results"
220set -x
221
222# Remove all but the first 50 individual XML files uploaded as artifacts, to
223# save fd.o space when you break everything.
224find $RESULTS -name \*.xml | \
225    sort -n |
226    sed -n '1,+49!p' | \
227    xargs rm -f
228
229# If any QPA XMLs are there, then include the XSL/CSS in our artifacts.
230find $RESULTS -name \*.xml \
231    -exec cp /deqp/testlog.css /deqp/testlog.xsl "$RESULTS/" ";" \
232    -quit
233
234deqp-runner junit \
235   --testsuite dEQP \
236   --results $RESULTS/failures.csv \
237   --output $RESULTS/junit.xml \
238   --limit 50 \
239   --template "See $ARTIFACTS_BASE_URL/results/{{testcase}}.xml"
240
241# Report the flakes to the IRC channel for monitoring (if configured):
242if [ -n "$FLAKES_CHANNEL" ]; then
243  python3 $INSTALL/report-flakes.py \
244         --host irc.oftc.net \
245         --port 6667 \
246         --results $RESULTS/results.csv \
247         --known-flakes $INSTALL/$GPU_VERSION-flakes.txt \
248         --channel "$FLAKES_CHANNEL" \
249         --runner "$CI_RUNNER_DESCRIPTION" \
250         --job "$CI_JOB_ID" \
251         --url "$CI_JOB_URL" \
252         --branch "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_BRANCH}" \
253         --branch-title "${CI_MERGE_REQUEST_TITLE:-$CI_COMMIT_TITLE}" || true
254fi
255
256# Compress results.csv to save on bandwidth during the upload of artifacts to
257# GitLab. This reduces the size in a VKCTS run from 135 to 7.6MB, and takes
258# 0.17s on a Ryzen 5950X (16 threads, 0.95s when limited to 1 thread).
259zstd --rm -T0 -8q "$RESULTS/results.csv" -o "$RESULTS/results.csv.zst"
260
261section_end test_post_process
262
263exit $DEQP_EXITCODE
264