1#!/bin/sh 2 3set -ex 4 5DEQP_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" 11DEQP_OPTIONS="$DEQP_OPTIONS --deqp-surface-type=pbuffer" 12DEQP_OPTIONS="$DEQP_OPTIONS --deqp-gl-config-name=$DEQP_CONFIG" 13DEQP_OPTIONS="$DEQP_OPTIONS --deqp-visibility=hidden" 14 15if [ -z "$DEQP_VER" ]; then 16 echo 'DEQP_VER must be set to something like "gles2", "gles31" or "vk" for the test run' 17 exit 1 18fi 19 20if [ "$DEQP_VER" = "vk" ]; then 21 if [ -z "$VK_DRIVER" ]; then 22 echo 'VK_DRIVER must be to something like "radeon" or "intel" for the test run' 23 exit 1 24 fi 25fi 26 27if [ -z "$DEQP_SKIPS" ]; then 28 echo 'DEQP_SKIPS must be set to something like "deqp-default-skips.txt"' 29 exit 1 30fi 31 32INSTALL=`pwd`/install 33 34# Set up the driver environment. 35export LD_LIBRARY_PATH=`pwd`/install/lib/ 36export EGL_PLATFORM=surfaceless 37export VK_ICD_FILENAMES=`pwd`/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.`uname -m`.json 38 39# the runner was failing to look for libkms in /usr/local/lib for some reason 40# I never figured out. 41export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib 42 43RESULTS=`pwd`/${DEQP_RESULTS_DIR:-results} 44mkdir -p $RESULTS 45 46# Generate test case list file. 47if [ "$DEQP_VER" = "vk" ]; then 48 cp /deqp/mustpass/vk-$DEQP_VARIANT.txt /tmp/case-list.txt 49 DEQP=/deqp/external/vulkancts/modules/vulkan/deqp-vk 50elif [ "$DEQP_VER" = "gles2" -o "$DEQP_VER" = "gles3" -o "$DEQP_VER" = "gles31" ]; then 51 cp /deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt /tmp/case-list.txt 52 DEQP=/deqp/modules/$DEQP_VER/deqp-$DEQP_VER 53 SUITE=dEQP 54else 55 cp /deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt /tmp/case-list.txt 56 DEQP=/deqp/external/openglcts/modules/glcts 57 SUITE=KHR 58fi 59 60# If the job is parallel, take the corresponding fraction of the caselist. 61# Note: N~M is a gnu sed extension to match every nth line (first line is #1). 62if [ -n "$CI_NODE_INDEX" ]; then 63 sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /tmp/case-list.txt 64fi 65 66if [ -n "$DEQP_CASELIST_FILTER" ]; then 67 sed -ni "/$DEQP_CASELIST_FILTER/p" /tmp/case-list.txt 68fi 69 70if [ ! -s /tmp/case-list.txt ]; then 71 echo "Caselist generation failed" 72 exit 1 73fi 74 75if [ -n "$DEQP_EXPECTED_FAILS" ]; then 76 BASELINE="--baseline $INSTALL/$DEQP_EXPECTED_FAILS" 77fi 78 79if [ -n "$DEQP_FLAKES" ]; then 80 FLAKES="--flakes $INSTALL/$DEQP_FLAKES" 81fi 82 83set +e 84 85if [ -n "$DEQP_PARALLEL" ]; then 86 JOB="--jobs $DEQP_PARALLEL" 87elif [ -n "$FDO_CI_CONCURRENT" ]; then 88 JOB="--jobs $FDO_CI_CONCURRENT" 89else 90 JOB="--jobs 4" 91fi 92 93# If this CI lab lacks artifacts support, print the whole list of failures/flakes. 94if [ -n "$DEQP_NO_SAVE_RESULTS" ]; then 95 SUMMARY_LIMIT="--summary-limit 0" 96fi 97 98# Silence the debug output for apps triggering GL errors, since dEQP will do a lot of that. 99export MESA_DEBUG=silent 100 101run_cts() { 102 deqp=$1 103 caselist=$2 104 output=$3 105 deqp-runner \ 106 run \ 107 --deqp $deqp \ 108 --output $RESULTS \ 109 --caselist $caselist \ 110 --skips $INSTALL/$DEQP_SKIPS \ 111 $BASELINE \ 112 $FLAKES \ 113 $JOB \ 114 $SUMMARY_LIMIT \ 115 $DEQP_RUNNER_OPTIONS \ 116 -- \ 117 $DEQP_OPTIONS 118} 119 120report_flakes() { 121 flakes=`grep ",Flake" $1 | sed 's|,Flake.*||g'` 122 if [ -z "$flakes" ]; then 123 return 0 124 fi 125 126 if [ -z "$FLAKES_CHANNEL" ]; then 127 return 0 128 fi 129 130 # The nick needs to be something unique so that multiple runners 131 # connecting at the same time don't race for one nick and get blocked. 132 # freenode has a 16-char limit on nicks (9 is the IETF standard, but 133 # various servers extend that). So, trim off the common prefixes of the 134 # runner name, and append the job ID so that software runners with more 135 # than one concurrent job (think swrast) don't collide. For freedreno, 136 # that gives us a nick as long as db410c-N-JJJJJJJJ, and it'll be a while 137 # before we make it to 9-digit jobs (we're at 7 so far). 138 runner=`echo $CI_RUNNER_DESCRIPTION | sed 's|mesa-||' | sed 's|google-freedreno-||g'` 139 bot="$runner-$CI_JOB_ID" 140 channel="$FLAKES_CHANNEL" 141 ( 142 echo NICK $bot 143 echo USER $bot unused unused :Gitlab CI Notifier 144 sleep 10 145 echo "JOIN $channel" 146 sleep 1 147 desc="Flakes detected in job: $CI_JOB_URL on $CI_RUNNER_DESCRIPTION" 148 if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then 149 desc="$desc on branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME ($CI_MERGE_REQUEST_TITLE)" 150 elif [ -n "$CI_COMMIT_BRANCH" ]; then 151 desc="$desc on branch $CI_COMMIT_BRANCH ($CI_COMMIT_TITLE)" 152 fi 153 echo "PRIVMSG $channel :$desc" 154 for flake in $flakes; do 155 echo "PRIVMSG $channel :$flake" 156 done 157 echo "PRIVMSG $channel :See $CI_JOB_URL/artifacts/browse/results/" 158 echo "QUIT" 159 ) | nc irc.freenode.net 6667 > /dev/null 160 161} 162 163# Generate junit results 164generate_junit() { 165 results=$1 166 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" 167 echo "<testsuites>" 168 echo "<testsuite name=\"$DEQP_VER-$CI_NODE_INDEX\">" 169 while read line; do 170 testcase=${line%,*} 171 result=${line#*,} 172 # avoid counting Skip's in the # of tests: 173 if [ "$result" = "Skip" ]; then 174 continue; 175 fi 176 echo "<testcase name=\"$testcase\">" 177 if [ "$result" != "Pass" ]; then 178 echo "<failure type=\"$result\">" 179 echo "$result: See $CI_JOB_URL/artifacts/results/$testcase.xml" 180 echo "</failure>" 181 fi 182 echo "</testcase>" 183 done < $results 184 echo "</testsuite>" 185 echo "</testsuites>" 186} 187 188parse_renderer() { 189 RENDERER=`grep -A1 TestCaseResult.\*info.renderer $RESULTS/deqp-info.qpa | grep '<Text' | sed 's|.*<Text>||g' | sed 's|</Text>||g'` 190 VERSION=`grep -A1 TestCaseResult.\*info.version $RESULTS/deqp-info.qpa | grep '<Text' | sed 's|.*<Text>||g' | sed 's|</Text>||g'` 191 echo "Renderer: $RENDERER" 192 echo "Version: $VERSION " 193 194 if ! echo $RENDERER | grep -q $DEQP_EXPECTED_RENDERER; then 195 echo "Expected GL_RENDERER $DEQP_EXPECTED_RENDERER" 196 exit 1 197 fi 198} 199 200check_renderer() { 201 echo "Capturing renderer info for GLES driver sanity checks" 202 # If you're having trouble loading your driver, uncommenting this may help 203 # debug. 204 # export EGL_LOG_LEVEL=debug 205 VERSION=`echo $DEQP_VER | tr '[a-z]' '[A-Z]'` 206 $DEQP $DEQP_OPTIONS --deqp-case=$SUITE-$VERSION.info.\* --deqp-log-filename=$RESULTS/deqp-info.qpa 207 parse_renderer 208} 209 210check_vk_device_name() { 211 echo "Capturing device info for VK driver sanity checks" 212 $DEQP $DEQP_OPTIONS --deqp-case=dEQP-VK.info.device --deqp-log-filename=$RESULTS/deqp-info.qpa 213 DEVICENAME=`grep deviceName $RESULTS/deqp-info.qpa | sed 's|deviceName: ||g'` 214 echo "deviceName: $DEVICENAME" 215 if [ -n "$DEQP_EXPECTED_RENDERER" -a "x$DEVICENAME" != "x$DEQP_EXPECTED_RENDERER" ]; then 216 echo "Expected deviceName $DEQP_EXPECTED_RENDERER" 217 exit 1 218 fi 219} 220 221# wrapper to supress +x to avoid spamming the log 222quiet() { 223 set +x 224 "$@" 225 set -x 226} 227 228if [ "$GALLIUM_DRIVER" = "virpipe" ]; then 229 # deqp is to use virpipe, and virgl_test_server llvmpipe 230 export GALLIUM_DRIVER="$GALLIUM_DRIVER" 231 232 VTEST_ARGS="--use-egl-surfaceless" 233 if [ "$VIRGL_HOST_API" = "GLES" ]; then 234 VTEST_ARGS="$VTEST_ARGS --use-gles" 235 fi 236 237 GALLIUM_DRIVER=llvmpipe \ 238 GALLIVM_PERF="nopt,no_filter_hacks" \ 239 virgl_test_server $VTEST_ARGS >$RESULTS/vtest-log.txt 2>&1 & 240 241 sleep 1 242fi 243 244if [ $DEQP_VER = vk ]; then 245 quiet check_vk_device_name 246else 247 quiet check_renderer 248fi 249 250RESULTS_CSV=$RESULTS/results.csv 251FAILURES_CSV=$RESULTS/failures.csv 252 253run_cts $DEQP /tmp/case-list.txt $RESULTS_CSV 254DEQP_EXITCODE=$? 255 256echo "System load: $(cut -d' ' -f1-3 < /proc/loadavg)" 257echo "# of CPU cores: $(cat /proc/cpuinfo | grep processor | wc -l)" 258 259# Remove the shader cache, no need to include in the artifacts. 260find $RESULTS -name \*.shader_cache | xargs rm -f 261 262# junit is disabled, because it overloads gitlab.freedesktop.org to parse it. 263# quiet generate_junit $RESULTS_CSV > $RESULTS/results.xml 264 265# Turn up to the first 50 individual test QPA files from failures or flakes into 266# XML results you can view from the browser. 267qpas=`find $RESULTS -name \*.qpa -a ! -name deqp-info.qpa` 268if [ -n "$qpas" ]; then 269 shard_qpas=`echo "$qpas" | grep dEQP- | head -n 50` 270 for qpa in $shard_qpas; do 271 xml=`echo $qpa | sed 's|\.qpa|.xml|'` 272 /deqp/executor/testlog-to-xml $qpa $xml 273 done 274 275 cp /deqp/testlog.css "$RESULTS/" 276 cp /deqp/testlog.xsl "$RESULTS/" 277 278 # Remove all the QPA files (extracted or not) now that we have the XML we want. 279 echo $qpas | xargs rm -f 280fi 281 282# Report the flakes to the IRC channel for monitoring (if configured): 283quiet report_flakes $RESULTS_CSV 284 285exit $DEQP_EXITCODE 286