blob: b651570cf1cb7f2b793bbe766a13887e3c611bbe [file] [log] [blame]
Eric Anholt46daaca2019-06-28 16:35:32 -07001#!/bin/bash
2
3set -ex
4
5DEQP_OPTIONS=(--deqp-surface-width=256 --deqp-surface-height=256)
6DEQP_OPTIONS+=(--deqp-surface-type=pbuffer)
7DEQP_OPTIONS+=(--deqp-gl-config-name=rgba8888d24s8ms0)
8DEQP_OPTIONS+=(--deqp-visibility=hidden)
Eric Anholt46daaca2019-06-28 16:35:32 -07009
Eric Anholt8d4742f2019-09-03 15:52:33 -070010# It would be nice to be able to enable the watchdog, so that hangs in a test
11# don't need to wait the full hour for the run to time out. However, some
12# shaders end up taking long enough to compile
13# (dEQP-GLES31.functional.ubo.random.all_per_block_buffers.20 for example)
14# that they'll sporadically trigger the watchdog.
15#DEQP_OPTIONS+=(--deqp-watchdog=enable)
16
Eric Anholt46daaca2019-06-28 16:35:32 -070017if [ -z "$DEQP_VER" ]; then
18 echo 'DEQP_VER must be set to something like "gles2" or "gles31" for the test run'
19 exit 1
20fi
21
22if [ -z "$DEQP_SKIPS" ]; then
23 echo 'DEQP_SKIPS must be set to something like "deqp-default-skips.txt"'
24 exit 1
25fi
26
Eric Anholtf08c8102019-11-04 10:54:41 -080027ARTIFACTS=`pwd`/artifacts
Eric Anholt46daaca2019-06-28 16:35:32 -070028
29# Set up the driver environment.
30export LD_LIBRARY_PATH=`pwd`/install/lib/
31export EGL_PLATFORM=surfaceless
32
33# the runner was failing to look for libkms in /usr/local/lib for some reason
34# I never figured out.
35export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
36
37RESULTS=`pwd`/results
38mkdir -p $RESULTS
39
Eric Anholt46daaca2019-06-28 16:35:32 -070040# Generate test case list file
41cp /deqp/mustpass/$DEQP_VER-master.txt /tmp/case-list.txt
42
Eric Anholt46daaca2019-06-28 16:35:32 -070043# If the job is parallel, take the corresponding fraction of the caselist.
44# Note: N~M is a gnu sed extension to match every nth line (first line is #1).
45if [ -n "$CI_NODE_INDEX" ]; then
46 sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /tmp/case-list.txt
47fi
48
49if [ ! -s /tmp/case-list.txt ]; then
50 echo "Caselist generation failed"
51 exit 1
52fi
53
Eric Anholtf08c8102019-11-04 10:54:41 -080054if [ -n "$DEQP_EXPECTED_FAILS" ]; then
55 XFAIL="--xfail-list $ARTIFACTS/$DEQP_EXPECTED_FAILS"
56fi
Eric Anholt46daaca2019-06-28 16:35:32 -070057
Eric Anholtf08c8102019-11-04 10:54:41 -080058set +e
59
Rob Clarkfdaf7772019-11-17 11:33:01 -080060run_cts() {
61 caselist=$1
62 output=$2
63 deqp-runner \
64 --deqp /deqp/modules/$DEQP_VER/deqp-$DEQP_VER \
65 --output $output \
66 --caselist $caselist \
67 --exclude-list $ARTIFACTS/$DEQP_SKIPS \
68 $XFAIL \
69 --job ${DEQP_PARALLEL:-1} \
70 --allow-flakes true \
71 -- \
72 "${DEQP_OPTIONS[@]}"
73}
74
75report_flakes() {
76 if [ -z "$FLAKES_CHANNEL" ]; then
77 return 0
78 fi
79 flakes=$1
80 bot="$CI_RUNNER_DESCRIPTION-$CI_PIPELINE_ID"
81 channel="$FLAKES_CHANNEL"
82 (
83 echo NICK $bot
84 echo USER $bot unused unused :Gitlab CI Notifier
85 sleep 10
86 echo "JOIN $channel"
87 sleep 1
88 desc="Flakes detected in job: $CI_JOB_URL on $CI_RUNNER_DESCRIPTION"
89 if [ -n "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then
90 desc="$desc on branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME ($CI_MERGE_REQUEST_TITLE)"
91 fi
92 echo "PRIVMSG $channel :$desc"
93 for flake in `cat $flakes`; do
94 echo "PRIVMSG $channel :$flake"
95 done
96 echo "PRIVMSG $channel :See $CI_JOB_URL/artifacts/browse/results/"
97 echo "QUIT"
98 ) | nc irc.freenode.net 6667 > /dev/null
99
100}
101
102# wrapper to supress +x to avoid spamming the log
103quiet() {
104 set +x
105 "$@"
106 set -x
107}
108
109run_cts /tmp/case-list.txt $RESULTS/cts-runner-results.txt
Eric Anholt46daaca2019-06-28 16:35:32 -0700110DEQP_EXITCODE=$?
111
Eric Anholt46daaca2019-06-28 16:35:32 -0700112if [ $DEQP_EXITCODE -ne 0 ]; then
Rob Clarkcc6484f2019-11-17 11:28:16 -0800113 # preserve caselist files in case of failures:
114 cp /tmp/cts_runner.*.txt $RESULTS/
Eric Anholtf08c8102019-11-04 10:54:41 -0800115 echo "Some unexpected results found (see cts-runner-results.txt in artifacts for full results):"
116 cat $RESULTS/cts-runner-results.txt | \
117 grep -v ",Pass" | \
118 grep -v ",Skip" | \
Rob Clark59ed90f2019-11-17 11:16:09 -0800119 grep -v ",ExpectedFail" > \
120 $RESULTS/cts-runner-unexpected-results.txt
121 head -n 50 $RESULTS/cts-runner-unexpected-results.txt
Rob Clarkfdaf7772019-11-17 11:33:01 -0800122
123 count=`cat $RESULTS/cts-runner-unexpected-results.txt | wc -l`
124
125 # Re-run fails to detect flakes. But use a small threshold, if
126 # something was fundamentally broken, we don't want to re-run
127 # the entire caselist
128else
129 cat $RESULTS/cts-runner-results.txt | \
130 grep ",Flake" > \
131 $RESULTS/cts-runner-flakes.txt
132
133 count=`cat $RESULTS/cts-runner-flakes.txt | wc -l`
134 if [ $count -gt 0 ]; then
135 echo "Some flakes found (see cts-runner-flakes.txt in artifacts for full results):"
136 head -n 50 $RESULTS/cts-runner-flakes.txt
137
Rob Clark8af75512019-11-22 13:30:18 -0800138 # Save the logs for up to the first 50 flakes:
139 head -n 50 $RESULTS/cts-runner-flakes.txt | quiet extract_xml_results /tmp/*.qpa
140
Rob Clarkfdaf7772019-11-17 11:33:01 -0800141 # Report the flakes to IRC channel for monitoring (if configured):
142 quiet report_flakes $RESULTS/cts-runner-flakes.txt
143 else
144 # no flakes, so clean-up:
145 rm $RESULTS/cts-runner-flakes.txt
146 fi
Eric Anholt7859eb12019-09-12 12:34:50 -0700147fi
Rob Clark59ed90f2019-11-17 11:16:09 -0800148
149exit $DEQP_EXITCODE