blob: a4ec079a0743d2f81377b80f3e233b0075475d46 [file] [log] [blame]
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +01001#!/bin/sh
Eric Anholt46daaca2019-06-28 16:35:32 -07002
3set -ex
4
Rob Clarkaee1c082020-08-31 09:04:24 -07005DEQP_WIDTH=${DEQP_WIDTH:-256}
6DEQP_HEIGHT=${DEQP_HEIGHT:-256}
7DEQP_CONFIG=${DEQP_CONFIG:-rgba8888d24s8ms0}
8DEQP_VARIANT=${DEQP_VARIANT:-master}
9
10DEQP_OPTIONS="$DEQP_OPTIONS --deqp-surface-width=$DEQP_WIDTH --deqp-surface-height=$DEQP_HEIGHT"
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +010011DEQP_OPTIONS="$DEQP_OPTIONS --deqp-surface-type=pbuffer"
Rob Clarkaee1c082020-08-31 09:04:24 -070012DEQP_OPTIONS="$DEQP_OPTIONS --deqp-gl-config-name=$DEQP_CONFIG"
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +010013DEQP_OPTIONS="$DEQP_OPTIONS --deqp-visibility=hidden"
Eric Anholt46daaca2019-06-28 16:35:32 -070014
Eric Anholteca02ec2020-05-28 12:37:29 -070015# deqp's shader cache (for vulkan) is not multiprocess safe for a common
16# filename, see:
17# https://gitlab.freedesktop.org/mesa/parallel-deqp-runner/-/merge_requests/13
18DEQP_OPTIONS="$DEQP_OPTIONS --deqp-shadercache=disable"
19
Eric Anholt46daaca2019-06-28 16:35:32 -070020if [ -z "$DEQP_VER" ]; then
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010021 echo 'DEQP_VER must be set to something like "gles2", "gles31" or "vk" for the test run'
Eric Anholt46daaca2019-06-28 16:35:32 -070022 exit 1
23fi
24
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +010025if [ "$DEQP_VER" = "vk" ]; then
Samuel Pitoisetf32bf4f2019-11-14 12:09:44 +010026 if [ -z "$VK_DRIVER" ]; then
27 echo 'VK_DRIVER must be to something like "radeon" or "intel" for the test run'
28 exit 1
29 fi
30fi
31
Eric Anholt46daaca2019-06-28 16:35:32 -070032if [ -z "$DEQP_SKIPS" ]; then
33 echo 'DEQP_SKIPS must be set to something like "deqp-default-skips.txt"'
34 exit 1
35fi
36
Tomeu Vizoso92f3c512020-03-24 12:58:30 +010037INSTALL=`pwd`/install
Eric Anholt46daaca2019-06-28 16:35:32 -070038
39# Set up the driver environment.
40export LD_LIBRARY_PATH=`pwd`/install/lib/
41export EGL_PLATFORM=surfaceless
Eric Anholt6766d512020-05-26 11:18:33 -070042export VK_ICD_FILENAMES=`pwd`/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.`uname -m`.json
Eric Anholt46daaca2019-06-28 16:35:32 -070043
44# the runner was failing to look for libkms in /usr/local/lib for some reason
45# I never figured out.
46export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
47
48RESULTS=`pwd`/results
49mkdir -p $RESULTS
50
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010051# Generate test case list file.
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +010052if [ "$DEQP_VER" = "vk" ]; then
Rob Clarkaee1c082020-08-31 09:04:24 -070053 cp /deqp/mustpass/vk-$DEQP_VARIANT.txt /tmp/case-list.txt
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010054 DEQP=/deqp/external/vulkancts/modules/vulkan/deqp-vk
Tomeu Vizoso287bf5f2020-05-13 09:46:06 +020055elif [ "$DEQP_VER" = "gles2" -o "$DEQP_VER" = "gles3" -o "$DEQP_VER" = "gles31" ]; then
Rob Clarkaee1c082020-08-31 09:04:24 -070056 cp /deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt /tmp/case-list.txt
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010057 DEQP=/deqp/modules/$DEQP_VER/deqp-$DEQP_VER
Tomeu Vizoso287bf5f2020-05-13 09:46:06 +020058 SUITE=dEQP
59else
Rob Clarkaee1c082020-08-31 09:04:24 -070060 cp /deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt /tmp/case-list.txt
Tomeu Vizoso287bf5f2020-05-13 09:46:06 +020061 DEQP=/deqp/external/openglcts/modules/glcts
62 SUITE=KHR
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010063fi
Eric Anholt46daaca2019-06-28 16:35:32 -070064
Eric Anholt46daaca2019-06-28 16:35:32 -070065# If the job is parallel, take the corresponding fraction of the caselist.
66# Note: N~M is a gnu sed extension to match every nth line (first line is #1).
67if [ -n "$CI_NODE_INDEX" ]; then
68 sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /tmp/case-list.txt
69fi
70
Eric Anholt5082ac02020-04-17 12:02:37 -070071if [ -n "$DEQP_CASELIST_FILTER" ]; then
Eric Anholt90cf4942020-05-15 17:18:12 -070072 sed -ni "/$DEQP_CASELIST_FILTER/p" /tmp/case-list.txt
Eric Anholt5082ac02020-04-17 12:02:37 -070073fi
74
Eric Anholt46daaca2019-06-28 16:35:32 -070075if [ ! -s /tmp/case-list.txt ]; then
76 echo "Caselist generation failed"
77 exit 1
78fi
79
Eric Anholtf08c8102019-11-04 10:54:41 -080080if [ -n "$DEQP_EXPECTED_FAILS" ]; then
Tomeu Vizoso92f3c512020-03-24 12:58:30 +010081 XFAIL="--xfail-list $INSTALL/$DEQP_EXPECTED_FAILS"
Eric Anholtf08c8102019-11-04 10:54:41 -080082fi
Eric Anholt46daaca2019-06-28 16:35:32 -070083
Eric Anholtf08c8102019-11-04 10:54:41 -080084set +e
85
Samuel Pitoiset4668a082020-03-05 15:20:34 +010086if [ -n "$DEQP_PARALLEL" ]; then
87 JOB="--job $DEQP_PARALLEL"
Eric Anholtfd24a952020-06-26 10:59:41 -070088elif [ -n "$FDO_CI_CONCURRENT" ]; then
89 JOB="--job $FDO_CI_CONCURRENT"
90else
91 JOB="--job 4"
Samuel Pitoiset4668a082020-03-05 15:20:34 +010092fi
93
Rob Clarkfdaf7772019-11-17 11:33:01 -080094run_cts() {
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010095 deqp=$1
96 caselist=$2
97 output=$3
Rob Clarkfdaf7772019-11-17 11:33:01 -080098 deqp-runner \
Samuel Pitoiset16b999b2019-11-19 08:39:00 +010099 --deqp $deqp \
Rob Clarkfdaf7772019-11-17 11:33:01 -0800100 --output $output \
101 --caselist $caselist \
Tomeu Vizoso92f3c512020-03-24 12:58:30 +0100102 --exclude-list $INSTALL/$DEQP_SKIPS \
Eric Anholta9e6a3e2020-04-17 12:28:58 -0700103 --compact-display false \
Rob Clarkfdaf7772019-11-17 11:33:01 -0800104 $XFAIL \
Samuel Pitoiset4668a082020-03-05 15:20:34 +0100105 $JOB \
Rob Clarkfdaf7772019-11-17 11:33:01 -0800106 --allow-flakes true \
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100107 $DEQP_RUNNER_OPTIONS \
Rob Clarkfdaf7772019-11-17 11:33:01 -0800108 -- \
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100109 $DEQP_OPTIONS
Rob Clarkfdaf7772019-11-17 11:33:01 -0800110}
111
112report_flakes() {
113 if [ -z "$FLAKES_CHANNEL" ]; then
114 return 0
115 fi
116 flakes=$1
Eric Anholt26379612020-05-05 12:17:49 -0700117 # The nick needs to be something unique so that multiple runners
118 # connecting at the same time don't race for one nick and get blocked.
119 # freenode has a 16-char limit on nicks (9 is the IETF standard, but
120 # various servers extend that). So, trim off the common prefixes of the
121 # runner name, and append the job ID so that software runners with more
122 # than one concurrent job (think swrast) don't collide. For freedreno,
123 # that gives us a nick as long as db410c-N-JJJJJJJJ, and it'll be a while
124 # before we make it to 9-digit jobs (we're at 7 so far).
125 runner=`echo $CI_RUNNER_DESCRIPTION | sed 's|mesa-||' | sed 's|google-freedreno-||g'`
126 bot="$runner-$CI_JOB_ID"
Rob Clarkfdaf7772019-11-17 11:33:01 -0800127 channel="$FLAKES_CHANNEL"
128 (
129 echo NICK $bot
130 echo USER $bot unused unused :Gitlab CI Notifier
131 sleep 10
132 echo "JOIN $channel"
133 sleep 1
134 desc="Flakes detected in job: $CI_JOB_URL on $CI_RUNNER_DESCRIPTION"
Eric Anholt2c501762020-05-05 10:44:46 -0700135 if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then
Rob Clarkfdaf7772019-11-17 11:33:01 -0800136 desc="$desc on branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME ($CI_MERGE_REQUEST_TITLE)"
Eric Anholt2c501762020-05-05 10:44:46 -0700137 elif [ -n "$CI_COMMIT_BRANCH" ]; then
138 desc="$desc on branch $CI_COMMIT_BRANCH ($CI_COMMIT_TITLE)"
Rob Clarkfdaf7772019-11-17 11:33:01 -0800139 fi
140 echo "PRIVMSG $channel :$desc"
141 for flake in `cat $flakes`; do
142 echo "PRIVMSG $channel :$flake"
143 done
144 echo "PRIVMSG $channel :See $CI_JOB_URL/artifacts/browse/results/"
145 echo "QUIT"
146 ) | nc irc.freenode.net 6667 > /dev/null
147
148}
149
Rob Clark415d5652019-11-17 11:57:26 -0800150extract_xml_result() {
151 testcase=$1
152 shift 1
153 qpas=$*
154 start="#beginTestCaseResult $testcase"
Eric Anholtf0c102c2020-05-26 13:28:30 -0700155
156 # Pick the first QPA mentioning our testcase
157 qpa=`grep -l "$start" $qpas | head -n 1`
158
159 # If we found one, go extract just that testcase's contents from the QPA
160 # to a new QPA, then do testlog-to-xml on that.
161 if [ -n "$qpa" ]; then
Rob Clark415d5652019-11-17 11:57:26 -0800162 while IFS= read -r line; do
163 if [ "$line" = "$start" ]; then
164 dst="$testcase.qpa"
165 echo "#beginSession" > $dst
Eric Anholt44d28dc2020-06-11 13:19:11 -0700166 echo "$line" >> $dst
Rob Clark415d5652019-11-17 11:57:26 -0800167 while IFS= read -r line; do
168 if [ "$line" = "#endTestCaseResult" ]; then
Eric Anholt44d28dc2020-06-11 13:19:11 -0700169 echo "$line" >> $dst
Rob Clark415d5652019-11-17 11:57:26 -0800170 echo "#endSession" >> $dst
Eric Anholt951e1012020-04-17 12:58:59 -0700171 /deqp/executor/testlog-to-xml $dst "$RESULTS/$testcase$DEQP_RUN_SUFFIX.xml"
Rob Clark415d5652019-11-17 11:57:26 -0800172 # copy the stylesheets here so they only end up in artifacts
173 # if we have one or more result xml in artifacts
Rob Clarkb706a152020-01-15 08:50:55 -0800174 cp /deqp/testlog.css "$RESULTS/"
175 cp /deqp/testlog.xsl "$RESULTS/"
Rob Clark415d5652019-11-17 11:57:26 -0800176 return 0
177 fi
Eric Anholt44d28dc2020-06-11 13:19:11 -0700178 echo "$line" >> $dst
Rob Clark415d5652019-11-17 11:57:26 -0800179 done
180 return 1
181 fi
182 done < $qpa
Eric Anholtf0c102c2020-05-26 13:28:30 -0700183 fi
Rob Clark415d5652019-11-17 11:57:26 -0800184}
185
186extract_xml_results() {
187 qpas=$*
188 while IFS= read -r testcase; do
189 testcase=${testcase%,*}
190 extract_xml_result $testcase $qpas
191 done
192}
193
Rob Clark9f422cb2019-11-17 12:04:50 -0800194# Generate junit results
195generate_junit() {
196 results=$1
197 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
198 echo "<testsuites>"
199 echo "<testsuite name=\"$DEQP_VER-$CI_NODE_INDEX\">"
200 while read line; do
201 testcase=${line%,*}
202 result=${line#*,}
203 # avoid counting Skip's in the # of tests:
204 if [ "$result" = "Skip" ]; then
205 continue;
206 fi
207 echo "<testcase name=\"$testcase\">"
208 if [ "$result" != "Pass" ]; then
209 echo "<failure type=\"$result\">"
210 echo "$result: See $CI_JOB_URL/artifacts/results/$testcase.xml"
211 echo "</failure>"
212 fi
213 echo "</testcase>"
214 done < $results
215 echo "</testsuite>"
216 echo "</testsuites>"
217}
218
Eric Anholtff118362020-03-05 14:35:55 -0800219parse_renderer() {
220 RENDERER=`grep -A1 TestCaseResult.\*info.renderer $RESULTS/deqp-info.qpa | grep '<Text' | sed 's|.*<Text>||g' | sed 's|</Text>||g'`
221 VERSION=`grep -A1 TestCaseResult.\*info.version $RESULTS/deqp-info.qpa | grep '<Text' | sed 's|.*<Text>||g' | sed 's|</Text>||g'`
222 echo "Renderer: $RENDERER"
223 echo "Version: $VERSION "
Eric Anholt8b221e02020-04-17 12:39:32 -0700224
225 if ! echo $RENDERER | grep -q $DEQP_EXPECTED_RENDERER; then
226 echo "Expected GL_RENDERER $DEQP_EXPECTED_RENDERER"
227 exit 1
228 fi
Eric Anholtff118362020-03-05 14:35:55 -0800229}
230
231check_renderer() {
Eric Anholt33e08212020-05-26 10:53:05 -0700232 echo "Capturing renderer info for GLES driver sanity checks"
Eric Anholtff118362020-03-05 14:35:55 -0800233 # If you're having trouble loading your driver, uncommenting this may help
234 # debug.
235 # export EGL_LOG_LEVEL=debug
Tomeu Vizosoad3ef6d2020-04-01 09:17:25 +0200236 VERSION=`echo $DEQP_VER | tr '[a-z]' '[A-Z]'`
Tomeu Vizoso287bf5f2020-05-13 09:46:06 +0200237 $DEQP $DEQP_OPTIONS --deqp-case=$SUITE-$VERSION.info.\* --deqp-log-filename=$RESULTS/deqp-info.qpa
Eric Anholtff118362020-03-05 14:35:55 -0800238 parse_renderer
239}
240
Eric Anholt33e08212020-05-26 10:53:05 -0700241check_vk_device_name() {
242 echo "Capturing device info for VK driver sanity checks"
243 $DEQP $DEQP_OPTIONS --deqp-case=dEQP-VK.info.device --deqp-log-filename=$RESULTS/deqp-info.qpa
244 DEVICENAME=`grep deviceName $RESULTS/deqp-info.qpa | sed 's|deviceName: ||g'`
245 echo "deviceName: $DEVICENAME"
Eric Anholt2d1c6072020-08-13 15:10:18 -0700246 if [ -n "$DEQP_EXPECTED_RENDERER" -a "x$DEVICENAME" != "x$DEQP_EXPECTED_RENDERER" ]; then
Eric Anholt33e08212020-05-26 10:53:05 -0700247 echo "Expected deviceName $DEQP_EXPECTED_RENDERER"
248 exit 1
249 fi
250}
251
Rob Clarkfdaf7772019-11-17 11:33:01 -0800252# wrapper to supress +x to avoid spamming the log
253quiet() {
254 set +x
255 "$@"
256 set -x
257}
258
Tomeu Vizosoad3ef6d2020-04-01 09:17:25 +0200259if [ "$GALLIUM_DRIVER" = "virpipe" ]; then
260 # deqp is to use virpipe, and virgl_test_server llvmpipe
261 export GALLIUM_DRIVER="$GALLIUM_DRIVER"
262
Tomeu Vizoso2102d5e2020-05-12 10:18:48 +0200263 VTEST_ARGS="--use-egl-surfaceless"
264 if [ "$VIRGL_HOST_API" = "GLES" ]; then
265 VTEST_ARGS="$VTEST_ARGS --use-gles"
266 fi
267
Tomeu Vizosoad3ef6d2020-04-01 09:17:25 +0200268 GALLIUM_DRIVER=llvmpipe \
269 GALLIVM_PERF="nopt,no_filter_hacks" \
Tomeu Vizoso2102d5e2020-05-12 10:18:48 +0200270 virgl_test_server $VTEST_ARGS >$RESULTS/vtest-log.txt 2>&1 &
Tomeu Vizosoad3ef6d2020-04-01 09:17:25 +0200271
272 sleep 1
273fi
274
Eric Anholt33e08212020-05-26 10:53:05 -0700275if [ $DEQP_VER = vk ]; then
276 quiet check_vk_device_name
277else
Eric Anholtff118362020-03-05 14:35:55 -0800278 quiet check_renderer
279fi
280
Eric Anholt951e1012020-04-17 12:58:59 -0700281RESULTSFILE=$RESULTS/cts-runner-results$DEQP_RUN_SUFFIX.txt
282UNEXPECTED_RESULTSFILE=$RESULTS/cts-runner-unexpected-results$DEQP_RUN_SUFFIX.txt
283FLAKESFILE=$RESULTS/cts-runner-flakes$DEQP_RUN_SUFFIX.txt
284
285run_cts $DEQP /tmp/case-list.txt $RESULTSFILE
Eric Anholt46daaca2019-06-28 16:35:32 -0700286DEQP_EXITCODE=$?
287
Tomeu Vizoso74554032020-07-28 08:22:34 +0200288echo "System load: $(cut -d' ' -f1-3 < /proc/loadavg)"
289echo "# of CPU cores: $(cat /proc/cpuinfo | grep processor | wc -l)"
290
Eric Anholt7f3f9b22020-02-19 10:29:32 -0800291# junit is disabled, because it overloads gitlab.freedesktop.org to parse it.
Eric Anholt951e1012020-04-17 12:58:59 -0700292#quiet generate_junit $RESULTSFILE > $RESULTS/results.xml
Rob Clark9f422cb2019-11-17 12:04:50 -0800293
Eric Anholt46daaca2019-06-28 16:35:32 -0700294if [ $DEQP_EXITCODE -ne 0 ]; then
Rob Clarkcc6484f2019-11-17 11:28:16 -0800295 # preserve caselist files in case of failures:
Eric Anholt62998f62019-12-17 11:19:07 -0800296 cp /tmp/deqp_runner.*.txt $RESULTS/
Eric Anholtc343d002020-05-26 10:15:19 -0700297 egrep -v ",Pass|,Skip|,ExpectedFail" $RESULTSFILE > $UNEXPECTED_RESULTSFILE
Rob Clarkfdaf7772019-11-17 11:33:01 -0800298
Eric Anholt30da82c2020-08-19 10:30:12 -0700299 # deqp-runner's flake detection won't perfectly detect all flakes, so
300 # allow the driver to list some known flakes that won't intermittently
301 # fail people's pipelines (while still allowing them to run and be
302 # reported to IRC in the usual flake detection path). If we had some
303 # fails listed (so this wasn't a total runner failure), then filter out
304 # the known flakes and see if there are any issues left.
305 if [ -n "$DEQP_FLAKES" -a -s $UNEXPECTED_RESULTSFILE ]; then
306 set +x
307 while read line; do
308 line=`echo $line | sed 's|#.*||g'`
309 if [ -n "$line" ]; then
310 sed -i "/$line/d" $UNEXPECTED_RESULTSFILE
311 fi
312 done < $INSTALL/$DEQP_FLAKES
313 set -x
314
315 if [ ! -s $UNEXPECTED_RESULTSFILE ]; then
316 exit 0
317 fi
318 fi
319
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100320 if [ -z "$DEQP_NO_SAVE_RESULTS" ]; then
Eric Anholt994e2582020-02-13 16:44:04 -0800321 echo "Some unexpected results found (see cts-runner-results.txt in artifacts for full results):"
Eric Anholtc343d002020-05-26 10:15:19 -0700322 head -n 50 $UNEXPECTED_RESULTSFILE
Eric Anholt994e2582020-02-13 16:44:04 -0800323
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100324 # Save the logs for up to the first 50 unexpected results:
Eric Anholtc343d002020-05-26 10:15:19 -0700325 head -n 50 $UNEXPECTED_RESULTSFILE | quiet extract_xml_results /tmp/*.qpa
Eric Anholt994e2582020-02-13 16:44:04 -0800326 else
327 echo "Unexpected results found:"
Eric Anholtc343d002020-05-26 10:15:19 -0700328 cat $UNEXPECTED_RESULTSFILE
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100329 fi
Rob Clarkfdaf7772019-11-17 11:33:01 -0800330else
Eric Anholtb8c66ae2020-04-17 13:01:50 -0700331 grep ",Flake" $RESULTSFILE > $FLAKESFILE
Rob Clarkfdaf7772019-11-17 11:33:01 -0800332
Samuel Pitoisetcc2c3b42020-04-30 11:40:42 +0200333 count=`cat $FLAKESFILE | wc -l`
Rob Clarkfdaf7772019-11-17 11:33:01 -0800334 if [ $count -gt 0 ]; then
335 echo "Some flakes found (see cts-runner-flakes.txt in artifacts for full results):"
Eric Anholt951e1012020-04-17 12:58:59 -0700336 head -n 50 $FLAKESFILE
Rob Clarkfdaf7772019-11-17 11:33:01 -0800337
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100338 if [ -z "$DEQP_NO_SAVE_RESULTS" ]; then
339 # Save the logs for up to the first 50 flakes:
Eric Anholt951e1012020-04-17 12:58:59 -0700340 head -n 50 $FLAKESFILE | quiet extract_xml_results /tmp/*.qpa
Tomeu Vizosod62dd8b2019-12-13 10:20:23 +0100341 fi
Rob Clark8af75512019-11-22 13:30:18 -0800342
Rob Clarkfdaf7772019-11-17 11:33:01 -0800343 # Report the flakes to IRC channel for monitoring (if configured):
Eric Anholt951e1012020-04-17 12:58:59 -0700344 quiet report_flakes $FLAKESFILE
Rob Clarkfdaf7772019-11-17 11:33:01 -0800345 else
346 # no flakes, so clean-up:
Eric Anholt951e1012020-04-17 12:58:59 -0700347 rm $FLAKESFILE
Rob Clarkfdaf7772019-11-17 11:33:01 -0800348 fi
Eric Anholt7859eb12019-09-12 12:34:50 -0700349fi
Rob Clark59ed90f2019-11-17 11:16:09 -0800350
351exit $DEQP_EXITCODE