Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deqp-runner.sh 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #!/bin/bash
  2. set -ex
  3. DEQP_OPTIONS=(--deqp-surface-width=256 --deqp-surface-height=256)
  4. DEQP_OPTIONS+=(--deqp-surface-type=pbuffer)
  5. DEQP_OPTIONS+=(--deqp-gl-config-name=rgba8888d24s8ms0)
  6. DEQP_OPTIONS+=(--deqp-visibility=hidden)
  7. # It would be nice to be able to enable the watchdog, so that hangs in a test
  8. # don't need to wait the full hour for the run to time out. However, some
  9. # shaders end up taking long enough to compile
  10. # (dEQP-GLES31.functional.ubo.random.all_per_block_buffers.20 for example)
  11. # that they'll sporadically trigger the watchdog.
  12. #DEQP_OPTIONS+=(--deqp-watchdog=enable)
  13. if [ -z "$DEQP_VER" ]; then
  14. echo 'DEQP_VER must be set to something like "gles2", "gles31" or "vk" for the test run'
  15. exit 1
  16. fi
  17. if [ "$DEQP_VER" == "vk" ]; then
  18. if [ -z "$VK_DRIVER" ]; then
  19. echo 'VK_DRIVER must be to something like "radeon" or "intel" for the test run'
  20. exit 1
  21. fi
  22. fi
  23. if [ -z "$DEQP_SKIPS" ]; then
  24. echo 'DEQP_SKIPS must be set to something like "deqp-default-skips.txt"'
  25. exit 1
  26. fi
  27. ARTIFACTS=`pwd`/artifacts
  28. # Set up the driver environment.
  29. export LD_LIBRARY_PATH=`pwd`/install/lib/
  30. export EGL_PLATFORM=surfaceless
  31. export VK_ICD_FILENAMES=`pwd`/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.x86_64.json
  32. # the runner was failing to look for libkms in /usr/local/lib for some reason
  33. # I never figured out.
  34. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
  35. RESULTS=`pwd`/results
  36. mkdir -p $RESULTS
  37. # Generate test case list file.
  38. if [ "$DEQP_VER" == "vk" ]; then
  39. cp /deqp/mustpass/vk-master.txt /tmp/case-list.txt
  40. DEQP=/deqp/external/vulkancts/modules/vulkan/deqp-vk
  41. else
  42. cp /deqp/mustpass/$DEQP_VER-master.txt /tmp/case-list.txt
  43. DEQP=/deqp/modules/$DEQP_VER/deqp-$DEQP_VER
  44. fi
  45. # If the job is parallel, take the corresponding fraction of the caselist.
  46. # Note: N~M is a gnu sed extension to match every nth line (first line is #1).
  47. if [ -n "$CI_NODE_INDEX" ]; then
  48. sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /tmp/case-list.txt
  49. fi
  50. if [ ! -s /tmp/case-list.txt ]; then
  51. echo "Caselist generation failed"
  52. exit 1
  53. fi
  54. if [ -n "$DEQP_EXPECTED_FAILS" ]; then
  55. XFAIL="--xfail-list $ARTIFACTS/$DEQP_EXPECTED_FAILS"
  56. fi
  57. set +e
  58. run_cts() {
  59. deqp=$1
  60. caselist=$2
  61. output=$3
  62. deqp-runner \
  63. --deqp $deqp \
  64. --output $output \
  65. --caselist $caselist \
  66. --exclude-list $ARTIFACTS/$DEQP_SKIPS \
  67. $XFAIL \
  68. --job ${DEQP_PARALLEL:-1} \
  69. --allow-flakes true \
  70. -- \
  71. "${DEQP_OPTIONS[@]}"
  72. }
  73. report_flakes() {
  74. if [ -z "$FLAKES_CHANNEL" ]; then
  75. return 0
  76. fi
  77. flakes=$1
  78. bot="$CI_RUNNER_DESCRIPTION-$CI_PIPELINE_ID"
  79. channel="$FLAKES_CHANNEL"
  80. (
  81. echo NICK $bot
  82. echo USER $bot unused unused :Gitlab CI Notifier
  83. sleep 10
  84. echo "JOIN $channel"
  85. sleep 1
  86. desc="Flakes detected in job: $CI_JOB_URL on $CI_RUNNER_DESCRIPTION"
  87. if [ -n "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then
  88. desc="$desc on branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME ($CI_MERGE_REQUEST_TITLE)"
  89. fi
  90. echo "PRIVMSG $channel :$desc"
  91. for flake in `cat $flakes`; do
  92. echo "PRIVMSG $channel :$flake"
  93. done
  94. echo "PRIVMSG $channel :See $CI_JOB_URL/artifacts/browse/results/"
  95. echo "QUIT"
  96. ) | nc irc.freenode.net 6667 > /dev/null
  97. }
  98. extract_xml_result() {
  99. testcase=$1
  100. shift 1
  101. qpas=$*
  102. start="#beginTestCaseResult $testcase"
  103. for qpa in $qpas; do
  104. while IFS= read -r line; do
  105. if [ "$line" = "$start" ]; then
  106. dst="$testcase.qpa"
  107. echo "#beginSession" > $dst
  108. echo $line >> $dst
  109. while IFS= read -r line; do
  110. if [ "$line" = "#endTestCaseResult" ]; then
  111. echo $line >> $dst
  112. echo "#endSession" >> $dst
  113. /deqp/executor/testlog-to-xml $dst "$RESULTS/$testcase.xml"
  114. # copy the stylesheets here so they only end up in artifacts
  115. # if we have one or more result xml in artifacts
  116. cp /deqp/testlog.{css,xsl} "$RESULTS/"
  117. return 0
  118. fi
  119. echo $line >> $dst
  120. done
  121. return 1
  122. fi
  123. done < $qpa
  124. done
  125. }
  126. extract_xml_results() {
  127. qpas=$*
  128. while IFS= read -r testcase; do
  129. testcase=${testcase%,*}
  130. extract_xml_result $testcase $qpas
  131. done
  132. }
  133. # Generate junit results
  134. generate_junit() {
  135. results=$1
  136. echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
  137. echo "<testsuites>"
  138. echo "<testsuite name=\"$DEQP_VER-$CI_NODE_INDEX\">"
  139. while read line; do
  140. testcase=${line%,*}
  141. result=${line#*,}
  142. # avoid counting Skip's in the # of tests:
  143. if [ "$result" = "Skip" ]; then
  144. continue;
  145. fi
  146. echo "<testcase name=\"$testcase\">"
  147. if [ "$result" != "Pass" ]; then
  148. echo "<failure type=\"$result\">"
  149. echo "$result: See $CI_JOB_URL/artifacts/results/$testcase.xml"
  150. echo "</failure>"
  151. fi
  152. echo "</testcase>"
  153. done < $results
  154. echo "</testsuite>"
  155. echo "</testsuites>"
  156. }
  157. # wrapper to supress +x to avoid spamming the log
  158. quiet() {
  159. set +x
  160. "$@"
  161. set -x
  162. }
  163. run_cts $DEQP /tmp/case-list.txt $RESULTS/cts-runner-results.txt
  164. DEQP_EXITCODE=$?
  165. quiet generate_junit $RESULTS/cts-runner-results.txt > $RESULTS/results.xml
  166. if [ $DEQP_EXITCODE -ne 0 ]; then
  167. # preserve caselist files in case of failures:
  168. cp /tmp/deqp_runner.*.txt $RESULTS/
  169. echo "Some unexpected results found (see cts-runner-results.txt in artifacts for full results):"
  170. cat $RESULTS/cts-runner-results.txt | \
  171. grep -v ",Pass" | \
  172. grep -v ",Skip" | \
  173. grep -v ",ExpectedFail" > \
  174. $RESULTS/cts-runner-unexpected-results.txt
  175. head -n 50 $RESULTS/cts-runner-unexpected-results.txt
  176. # Save the logs for up to the first 50 unexpected results:
  177. head -n 50 $RESULTS/cts-runner-unexpected-results.txt | quiet extract_xml_results /tmp/*.qpa
  178. count=`cat $RESULTS/cts-runner-unexpected-results.txt | wc -l`
  179. # Re-run fails to detect flakes. But use a small threshold, if
  180. # something was fundamentally broken, we don't want to re-run
  181. # the entire caselist
  182. else
  183. cat $RESULTS/cts-runner-results.txt | \
  184. grep ",Flake" > \
  185. $RESULTS/cts-runner-flakes.txt
  186. count=`cat $RESULTS/cts-runner-flakes.txt | wc -l`
  187. if [ $count -gt 0 ]; then
  188. echo "Some flakes found (see cts-runner-flakes.txt in artifacts for full results):"
  189. head -n 50 $RESULTS/cts-runner-flakes.txt
  190. # Save the logs for up to the first 50 flakes:
  191. head -n 50 $RESULTS/cts-runner-flakes.txt | quiet extract_xml_results /tmp/*.qpa
  192. # Report the flakes to IRC channel for monitoring (if configured):
  193. quiet report_flakes $RESULTS/cts-runner-flakes.txt
  194. else
  195. # no flakes, so clean-up:
  196. rm $RESULTS/cts-runner-flakes.txt
  197. fi
  198. fi
  199. exit $DEQP_EXITCODE