gitlab-ci: Run the GLES2 CTS on llvmpipe.
[mesa.git] / .gitlab-ci / deqp-runner.sh
1 #!/bin/bash
2
3 set -ex
4
5 DEQP_OPTIONS=(--deqp-surface-width=256 --deqp-surface-height=256)
6 DEQP_OPTIONS+=(--deqp-surface-type=pbuffer)
7 DEQP_OPTIONS+=(--deqp-gl-config-name=rgba8888d24s8ms0)
8 DEQP_OPTIONS+=(--deqp-visibility=hidden)
9 DEQP_OPTIONS+=(--deqp-log-images=disable)
10 DEQP_OPTIONS+=(--deqp-watchdog=enable)
11 DEQP_OPTIONS+=(--deqp-crashhandler=enable)
12
13 if [ -z "$DEQP_VER" ]; then
14 echo 'DEQP_VER must be set to something like "gles2" or "gles31" for the test run'
15 exit 1
16 fi
17
18 if [ -z "$DEQP_SKIPS" ]; then
19 echo 'DEQP_SKIPS must be set to something like "deqp-default-skips.txt"'
20 exit 1
21 fi
22
23 # Prep the expected failure list
24 if [ -n "$DEQP_EXPECTED_FAILS" ]; then
25 export DEQP_EXPECTED_FAILS=`pwd`/artifacts/$DEQP_EXPECTED_FAILS
26 else
27 export DEQP_EXPECTED_FAILS=/tmp/expect-no-failures.txt
28 touch $DEQP_EXPECTED_FAILS
29 fi
30 sort < $DEQP_EXPECTED_FAILS > /tmp/expected-fails.txt
31
32 # Fix relative paths on inputs.
33 export DEQP_SKIPS=`pwd`/artifacts/$DEQP_SKIPS
34
35 # Be a good citizen on the shared runners.
36 export LP_NUM_THREADS=4
37
38 # Set up the driver environment.
39 export LD_LIBRARY_PATH=`pwd`/install/lib/
40 export EGL_PLATFORM=surfaceless
41
42 # the runner was failing to look for libkms in /usr/local/lib for some reason
43 # I never figured out.
44 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
45
46 RESULTS=`pwd`/results
47 mkdir -p $RESULTS
48
49 cd /deqp/modules/$DEQP_VER
50
51 # Generate test case list file
52 cp /deqp/mustpass/$DEQP_VER-master.txt /tmp/case-list.txt
53
54 # Note: not using sorted input and comm, becuase I want to run the tests in
55 # the same order that dEQP would.
56 while read -r line; do
57 if echo "$line" | grep -q '^[^#]'; then
58 sed -i "/$line/d" /tmp/case-list.txt
59 fi
60 done < $DEQP_SKIPS
61
62 # If the job is parallel, take the corresponding fraction of the caselist.
63 # Note: N~M is a gnu sed extension to match every nth line (first line is #1).
64 if [ -n "$CI_NODE_INDEX" ]; then
65 sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /tmp/case-list.txt
66 fi
67
68 if [ ! -s /tmp/case-list.txt ]; then
69 echo "Caselist generation failed"
70 exit 1
71 fi
72
73 # Cannot use tee because dash doesn't have pipefail
74 touch /tmp/result.txt
75 tail -f /tmp/result.txt &
76
77 ./deqp-$DEQP_VER "${DEQP_OPTIONS[@]}" --deqp-log-filename=$RESULTS/results.qpa --deqp-caselist-file=/tmp/case-list.txt >> /tmp/result.txt
78 DEQP_EXITCODE=$?
79
80 sed -ne \
81 '/StatusCode="Fail"/{x;p}; s/#beginTestCaseResult //; T; h' \
82 $RESULTS/results.qpa \
83 > /tmp/unsorted-fails.txt
84
85 # Scrape out the renderer that the test run used, so we can validate that the
86 # right driver was used.
87 if grep -q "dEQP-.*.info.renderer" /tmp/case-list.txt; then
88 # This is an ugly dependency on the .qpa format: Print 3 lines after the
89 # match, which happens to contain the result.
90 RENDERER=`sed -n '/#beginTestCaseResult dEQP-.*.info.renderer/{n;n;n;p}' $RESULTS/results.qpa | sed -n -E "s|<Text>(.*)</Text>|\1|p"`
91
92 echo "GL_RENDERER for this test run: $RENDERER"
93
94 if [ -n "$DEQP_RENDERER_MATCH" ]; then
95 echo $RENDERER | grep -q $DEQP_RENDERER_MATCH > /dev/null
96 fi
97 fi
98
99 if [ $DEQP_EXITCODE -ne 0 ]; then
100 exit $DEQP_EXITCODE
101 fi
102
103 sort < /tmp/unsorted-fails.txt > $RESULTS/fails.txt
104
105 comm -23 $RESULTS/fails.txt /tmp/expected-fails.txt > /tmp/new-fails.txt
106 if [ -s /tmp/new-fails.txt ]; then
107 echo "Unexpected failures:"
108 cat /tmp/new-fails.txt
109 exit 1
110 else
111 echo "No new failures"
112 fi