File: run_tests.sh

package info (click to toggle)
virglrenderer 0.8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 58,348 kB
  • sloc: ansic: 46,856; sh: 1,062; python: 460; makefile: 274
file content (262 lines) | stat: -rwxr-xr-x 5,664 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/bin/bash

run_setup()
{
   set -x

   use_meson=$1

   if [ "x$2" = "xfuzzer" ]; then
      use_clang_fuzzer=1
   fi

   # Let .gitlab-ci or local ci runner set
   # desired thread count
   NUM_THREADS=${NUM_THREADS:-$(expr $(expr $(nproc) / 8) + 1)}
   export NUM_THREADS
   echo "Using $NUM_THREADS threads"

   export CCACHE_BASEDIR=/virglrenderer
   export CCACHE_DIR=/virglrenderer/ccache
   export PATH="/usr/lib/ccache:$PATH"
   mkdir -p $CCACHE_DIR
   ccache -s

   # To prevent hitting assertions such as the below:
   # sb/sb_sched.cpp:1207:schedule_alu: Assertion '!"unscheduled pending instructions"' failed.
   export R600_DEBUG=nosb

   # If render node, like /dev/dri/renderD128, has not been set
   # or exists use softpipe instead of HW GPU.
   if [[ ! -c $RENDER_DEVICE ]]; then
      export SOFTWARE_ONLY=1
   fi

   set +x

   if [[ $LOCAL_MESA ]]; then
      cd $LOCAL_MESA && \
      mkdir -p build  && \
      meson build/ && \
      meson configure build/ -Dprefix=/usr/local -Dplatforms=drm,x11,wayland,surfaceless -Ddri-drivers=i965 -Dgallium-drivers=swrast,virgl,radeonsi,r600 -Dbuildtype=debugoptimized -Dllvm=true -Dglx=dri -Dgallium-vdpau=false -Dgallium-va=false -Dvulkan-drivers=[] -Dlibdir=lib && \
      ninja -C build/ install -j $NUM_THREADS
      if [ $? -ne 0 ]; then
        meson setup --wipe build/
        ninja -C build/ install -j $NUM_THREADS || exit 1
      fi
   fi

   VIRGL_PATH="/virglrenderer"
   rm -rf $VIRGL_PATH/results/
   mkdir -p $VIRGL_PATH/results/

   if [ "x$use_meson" = "x" ]; then
      if [ -d "$VIRGL_PATH" ]; then
          cd $VIRGL_PATH
          ./autogen.sh --prefix=/usr/local --enable-debug --enable-tests --enable-autotools
          make -j$NUM_THREADS install
      fi
   else
      if [ -d "$VIRGL_PATH" ]; then
          cd $VIRGL_PATH
          mkdir build
          if [ "x$use_clang_fuzzer" = "x1" ]; then
             CC=clang-8
             FUZZER=-Dfuzzer=true
          fi

          meson build/ -Dprefix=/usr/local -Ddebug=true -Dtests=true --fatal-meson-warnings $FUZZER
          ninja -C build -j$NUM_THREADS install
      fi
   fi

   CI_DIR=$(dirname $(readlink -f "$0"))
   cd $CI_DIR
}

run_make_check()
{
   run_setup
   (
      cd /virglrenderer
      mkdir -p /virglrenderer/results/make_check
      VRENDTEST_USE_EGL_SURFACELESS=1 make -j$NUM_THREADS check --no-print-directory
      RET=$?
      cp tests/test*.log /virglrenderer/results/make_check/
      return $RET
   )
}

run_make_check_meson()
{
   run_setup meson
   (
      cd /virglrenderer/build
      mkdir -p /virglrenderer/results/make_check_meson
      VRENDTEST_USE_EGL_SURFACELESS=1 ninja -j$NUM_THREADS test
      RET=$?
      cp /virglrenderer/build/meson-logs/testlog.txt /virglrenderer/results/make_check_meson/
      return $RET
   )
}

run_make_check_clang_fuzzer()
{
   run_setup meson fuzzer
   (
      cd /virglrenderer/build
      mkdir -p /virglrenderer/results/make_check_clang_fuzzer
      VRENDTEST_USE_EGL_SURFACELESS=1 ninja -j$NUM_THREADS test
      RET=$?
      cp /virglrenderer/build/meson-logs/testlog.txt /virglrenderer/results/make_check_clang_fuzzer/
      return $RET
   )
}

run_deqp()
{
   run_setup meson
   OGL_BACKEND="$1"
   SUITE="$2"

   if [ "$SUITE" = "gl" ]; then
      TEST_SUITE="--gl30 --gl31 --gl32"
   fi

   if [ "$SUITE" = "gles" ]; then
      TEST_SUITE="--gles2 --gles3 --gles31"
   fi

   if [ "$SUITE" = "gles2" ]; then
      TEST_SUITE="--gles2"
   fi

   if [ "$SUITE" = "gles3" ]; then
      TEST_SUITE="--gles3"
   fi

   if [ "$SUITE" = "gles31" ]; then
      TEST_SUITE="--gles31"
   fi
   
   BACKENDS=""
   if [[ -z "$HARDWARE_ONLY" ]]; then
      BACKENDS="${BACKENDS} --backend vtest-softpipe"
   fi

   if [[ -z "$SOFTWARE_ONLY" ]]; then
      BACKENDS="${BACKENDS} --backend vtest-gpu"
   fi

   ./run_test_suite.sh --deqp ${TEST_SUITE} \
      --host-${OGL_BACKEND} \
      ${BACKENDS}

   return $?
}

run_piglit()
{
   run_setup meson

   OGL_BACKEND="$1"

   BACKENDS=""
   if [[ -z "$HARDWARE_ONLY" ]]; then
      BACKENDS="${BACKENDS} --backend vtest-softpipe"
   fi
   
   if [[ -z "$SOFTWARE_ONLY" ]]; then
      BACKENDS="${BACKENDS} --backend vtest-gpu"
   fi

   ./run_test_suite.sh --piglit --gles2 --gles3 \
      --host-${OGL_BACKEND} \
      ${BACKENDS}

   return $?
}

parse_input()
{
   RET=0
   while  [ -n "$1" ]; do
      echo ""

      case $1 in
         --make-check)
         run_make_check
         ;;

         --make-check-meson)
         run_make_check_meson
         ;;

         --make-check-clang-fuzzer)
         run_make_check_clang_fuzzer
         ;;

         --deqp-gl-gl-tests)
         run_deqp gl gl
         ;;

         --deqp-gl-gles-tests)
         run_deqp gl gles
         ;;

         --deqp-gl-gles2-tests)
         run_deqp gl gles2
         ;;

         --deqp-gl-gles3-tests)
         run_deqp gl gles3
         ;;

         --deqp-gl-gles31-tests)
         run_deqp gl gles31
         ;;
         
         --deqp-gles-gl-tests)
         run_deqp gles gl
         ;;

         --deqp-gles-gles-tests)
         run_deqp gles gles
         ;;

         --deqp-gles-gles2-tests)
         run_deqp gles gles2
         ;;

         --deqp-gles-gles3-tests)
         run_deqp gles gles3
         ;;

         --deqp-gles-gles31-tests)
         run_deqp gles gles31
         ;;
         
         --piglit-gl)
         run_piglit gl
         ;;

         --piglit-gles)
         run_piglit gles
         ;;

         *)
         echo "Unknown test option $1"
         exit 1
      esac

      if [ $? -ne 0 ]; then
         RET=1
      fi

      shift
   done

   exit $RET
}

parse_input $@