• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# shellcheck disable=SC2086 # we want word splitting
3
4# When changing this file, you need to bump the following
5# .gitlab-ci/image-tags.yml tags:
6# DEBIAN_X86_64_TEST_ANDROID_TAG
7# DEBIAN_X86_64_TEST_GL_TAG
8# DEBIAN_X86_64_TEST_VK_TAG
9# KERNEL_ROOTFS_TAG
10
11set -ex -o pipefail
12
13
14DEQP_VERSION=vulkan-cts-1.3.7.0
15
16# Patches to VulkanCTS may come from commits in their repo (listed in
17# cts_commits_to_backport) or patch files stored in our repo (in the patch
18# directory `$OLDPWD/.gitlab-ci/container/patches/` listed in cts_patch_files).
19# Both list variables would have comments explaining the reasons behind the
20# patches.
21
22# shellcheck disable=SC2034
23vk_cts_commits_to_backport=(
24    # Take multiview into account for task shader inv. stats
25    22aa3f4c59f6e1d4daebd5a8c9c05bce6cd3b63b
26
27    # Remove illegal mesh shader query tests
28    2a87f7b25dc27188be0f0a003b2d7aef69d9002e
29
30    # Relax fragment shader invocations result verifications
31    0d8bf6a2715f95907e9cf86a86876ff1f26c66fe
32
33    # Fix several issues in dynamic rendering basic tests
34    c5453824b498c981c6ba42017d119f5de02a3e34
35)
36
37# shellcheck disable=SC2034
38vk_cts_patch_files=(
39  # Android specific patches.
40  build-deqp_Allow-running-on-Android-from-the-command-line.patch
41  build-deqp_Android-prints-to-stdout-instead-of-logcat.patch
42
43  # Change zlib URL because the one from zlib.net requires a human-verification
44  # Forward-port of b61f15f09adb6b7c9eefc7f7c44612c0c390abe5 into modern dEQP codebase
45  build-deqp_Change-zlib-URL-because-the-one-from-zlib.net-requir.patch
46
47  # Derivate subgroup fix
48  # https://github.com/KhronosGroup/VK-GL-CTS/pull/442
49  build-deqp_Use-subgroups-helper-in-derivate-tests.patch
50  build-deqp_Add-missing-subgroup-support-checks-for-linear-derivate-tests.patch
51)
52
53# shellcheck disable=SC2034
54gl_cts_commits_to_backport=(
55)
56
57# shellcheck disable=SC2034
58gl_cts_patch_files=(
59  # Android specific patches.
60  build-deqp_Allow-running-on-Android-from-the-command-line.patch
61  build-deqp_Android-prints-to-stdout-instead-of-logcat.patch
62
63  # Change zlib URL because the one from zlib.net requires a human-verification
64  # Forward-port of b61f15f09adb6b7c9eefc7f7c44612c0c390abe5 into modern dEQP codebase
65  build-deqp_Change-zlib-URL-because-the-one-from-zlib.net-requir.patch
66)
67
68
69### Careful editing anything below this line
70
71
72git config --global user.email "mesa@example.com"
73git config --global user.name "Mesa CI"
74git clone \
75    https://github.com/KhronosGroup/VK-GL-CTS.git \
76    -b $DEQP_VERSION \
77    --depth 1 \
78    /VK-GL-CTS
79pushd /VK-GL-CTS
80
81mkdir -p /deqp
82
83# shellcheck disable=SC2153
84deqp_api=${DEQP_API,,}
85
86cts_commits_to_backport="${deqp_api}_cts_commits_to_backport[@]"
87for commit in "${!cts_commits_to_backport}"
88do
89  PATCH_URL="https://github.com/KhronosGroup/VK-GL-CTS/commit/$commit.patch"
90  echo "Apply patch to ${DEQP_API} CTS from $PATCH_URL"
91  curl -L --retry 4 -f --retry-all-errors --retry-delay 60 $PATCH_URL | \
92    git am -
93done
94
95cts_patch_files="${deqp_api}_cts_patch_files[@]"
96for patch in "${!cts_patch_files}"
97do
98  echo "Apply patch to ${DEQP_API} CTS from $patch"
99  git am < $OLDPWD/.gitlab-ci/container/patches/$patch
100done
101
102{
103  echo "dEQP base version $DEQP_VERSION"
104  echo "The following local patches are applied on top:"
105  git log --reverse --oneline $DEQP_VERSION.. --format=%s | sed 's/^/- /'
106} > /deqp/version-$deqp_api
107
108# --insecure is due to SSL cert failures hitting sourceforge for zlib and
109# libpng (sigh).  The archives get their checksums checked anyway, and git
110# always goes through ssh or https.
111python3 external/fetch_sources.py --insecure
112
113# Save the testlog stylesheets:
114cp doc/testlog-stylesheet/testlog.{css,xsl} /deqp
115popd
116
117pushd /deqp
118
119if [ "${DEQP_API}" = 'GL' ] && [ "${DEQP_TARGET}" != 'android' ]; then
120    # When including EGL/X11 testing, do that build first and save off its
121    # deqp-egl binary.
122    cmake -S /VK-GL-CTS -B . -G Ninja \
123        -DDEQP_TARGET=x11_egl_glx \
124        -DCMAKE_BUILD_TYPE=Release \
125        $EXTRA_CMAKE_ARGS
126    ninja modules/egl/deqp-egl
127    mv /deqp/modules/egl/deqp-egl /deqp/modules/egl/deqp-egl-x11
128
129    cmake -S /VK-GL-CTS -B . -G Ninja \
130        -DDEQP_TARGET=wayland \
131        -DCMAKE_BUILD_TYPE=Release \
132        $EXTRA_CMAKE_ARGS
133    ninja modules/egl/deqp-egl
134    mv /deqp/modules/egl/deqp-egl /deqp/modules/egl/deqp-egl-wayland
135fi
136
137cmake -S /VK-GL-CTS -B . -G Ninja \
138      -DDEQP_TARGET=${DEQP_TARGET} \
139      -DCMAKE_BUILD_TYPE=Release \
140      $EXTRA_CMAKE_ARGS
141
142# Make sure `default` doesn't silently stop detecting one of the platforms we care about
143if [ "${DEQP_TARGET}" = 'default' ]; then
144  grep -q DEQP_SUPPORT_WAYLAND=1 build.ninja
145  grep -q DEQP_SUPPORT_X11=1 build.ninja
146  grep -q DEQP_SUPPORT_XCB=1 build.ninja
147fi
148
149deqp_build_targets=()
150case "${DEQP_API}" in
151  VK)
152    deqp_build_targets+=(deqp-vk)
153    ;;
154  GL)
155    deqp_build_targets+=(glcts)
156    deqp_build_targets+=(deqp-gles{2,3,31})
157    if [ "${DEQP_TARGET}" = 'android' ]; then
158      deqp_build_targets+=(deqp-egl)
159    fi
160    ;;
161esac
162if [ "${DEQP_TARGET}" != 'android' ]; then
163  deqp_build_targets+=(testlog-to-xml)
164  deqp_build_targets+=(testlog-to-csv)
165  deqp_build_targets+=(testlog-to-junit)
166fi
167
168mold --run ninja "${deqp_build_targets[@]}"
169
170if [ "${DEQP_TARGET}" = 'android' ]; then
171    mv /deqp/modules/egl/deqp-egl /deqp/modules/egl/deqp-egl-android
172fi
173
174if [ "${DEQP_TARGET}" != 'android' ]; then
175    # Copy out the mustpass lists we want.
176    mkdir -p /deqp/mustpass
177
178    if [ "${DEQP_API}" = 'VK' ]; then
179        for mustpass in $(< /VK-GL-CTS/external/vulkancts/mustpass/main/vk-default.txt) ; do
180            cat /VK-GL-CTS/external/vulkancts/mustpass/main/$mustpass \
181                >> /deqp/mustpass/vk-master.txt
182        done
183    fi
184
185    if [ "${DEQP_API}" = 'GL' ]; then
186        cp \
187            /deqp/external/openglcts/modules/gl_cts/data/mustpass/gles/aosp_mustpass/3.2.6.x/*.txt \
188            /deqp/mustpass/.
189        cp \
190            /deqp/external/openglcts/modules/gl_cts/data/mustpass/egl/aosp_mustpass/3.2.6.x/egl-master.txt \
191            /deqp/mustpass/.
192        cp \
193            /deqp/external/openglcts/modules/gl_cts/data/mustpass/gles/khronos_mustpass/3.2.6.x/*-master.txt \
194            /deqp/mustpass/.
195        cp \
196            /deqp/external/openglcts/modules/gl_cts/data/mustpass/gl/khronos_mustpass/4.6.1.x/*-master.txt \
197            /deqp/mustpass/.
198        cp \
199            /deqp/external/openglcts/modules/gl_cts/data/mustpass/gl/khronos_mustpass_single/4.6.1.x/*-single.txt \
200            /deqp/mustpass/.
201    fi
202
203    # Save *some* executor utils, but otherwise strip things down
204    # to reduct deqp build size:
205    mkdir /deqp/executor.save
206    cp /deqp/executor/testlog-to-* /deqp/executor.save
207    rm -rf /deqp/executor
208    mv /deqp/executor.save /deqp/executor
209fi
210
211# Remove other mustpass files, since we saved off the ones we wanted to conventient locations above.
212rm -rf /deqp/external/openglcts/modules/gl_cts/data/mustpass
213rm -rf /deqp/external/vulkancts/modules/vulkan/vk-master*
214rm -rf /deqp/external/vulkancts/modules/vulkan/vk-default
215
216rm -rf /deqp/external/openglcts/modules/cts-runner
217rm -rf /deqp/modules/internal
218rm -rf /deqp/execserver
219rm -rf /deqp/framework
220find . -depth \( -iname '*cmake*' -o -name '*ninja*' -o -name '*.o' -o -name '*.a' \) -exec rm -rf {} \;
221if [ "${DEQP_API}" = 'VK' ]; then
222  ${STRIP_CMD:-strip} external/vulkancts/modules/vulkan/deqp-vk
223fi
224if [ "${DEQP_API}" = 'GL' ]; then
225  ${STRIP_CMD:-strip} external/openglcts/modules/glcts
226  ${STRIP_CMD:-strip} modules/*/deqp-*
227fi
228du -sh ./*
229rm -rf /VK-GL-CTS
230popd
231