+}
+
+extract_xml_results() {
+ qpas=$*
+ while IFS= read -r testcase; do
+ testcase=${testcase%,*}
+ extract_xml_result $testcase $qpas
+ done
+}
+
+# Generate junit results
+generate_junit() {
+ results=$1
+ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ echo "<testsuites>"
+ echo "<testsuite name=\"$DEQP_VER-$CI_NODE_INDEX\">"
+ while read line; do
+ testcase=${line%,*}
+ result=${line#*,}
+ # avoid counting Skip's in the # of tests:
+ if [ "$result" = "Skip" ]; then
+ continue;
+ fi
+ echo "<testcase name=\"$testcase\">"
+ if [ "$result" != "Pass" ]; then
+ echo "<failure type=\"$result\">"
+ echo "$result: See $CI_JOB_URL/artifacts/results/$testcase.xml"
+ echo "</failure>"
+ fi
+ echo "</testcase>"
+ done < $results
+ echo "</testsuite>"
+ echo "</testsuites>"
+}
+
+parse_renderer() {
+ RENDERER=`grep -A1 TestCaseResult.\*info.renderer $RESULTS/deqp-info.qpa | grep '<Text' | sed 's|.*<Text>||g' | sed 's|</Text>||g'`
+ VERSION=`grep -A1 TestCaseResult.\*info.version $RESULTS/deqp-info.qpa | grep '<Text' | sed 's|.*<Text>||g' | sed 's|</Text>||g'`
+ echo "Renderer: $RENDERER"
+ echo "Version: $VERSION "
+
+ if ! echo $RENDERER | grep -q $DEQP_EXPECTED_RENDERER; then
+ echo "Expected GL_RENDERER $DEQP_EXPECTED_RENDERER"
+ exit 1
+ fi
+}
+
+check_renderer() {
+ echo "Capturing renderer info for GLES driver sanity checks"
+ # If you're having trouble loading your driver, uncommenting this may help
+ # debug.
+ # export EGL_LOG_LEVEL=debug
+ VERSION=`echo $DEQP_VER | tr '[a-z]' '[A-Z]'`
+ $DEQP $DEQP_OPTIONS --deqp-case=$SUITE-$VERSION.info.\* --deqp-log-filename=$RESULTS/deqp-info.qpa
+ parse_renderer
+}
+
+check_vk_device_name() {
+ echo "Capturing device info for VK driver sanity checks"
+ $DEQP $DEQP_OPTIONS --deqp-case=dEQP-VK.info.device --deqp-log-filename=$RESULTS/deqp-info.qpa
+ DEVICENAME=`grep deviceName $RESULTS/deqp-info.qpa | sed 's|deviceName: ||g'`
+ echo "deviceName: $DEVICENAME"
+ if [ -n "$DEQP_EXPECTED_RENDERER" -a $DEVICENAME != "$DEQP_EXPECTED_RENDERER" ]; then
+ echo "Expected deviceName $DEQP_EXPECTED_RENDERER"
+ exit 1
+ fi
+}
+
+# wrapper to supress +x to avoid spamming the log
+quiet() {
+ set +x
+ "$@"
+ set -x
+}
+
+if [ "$GALLIUM_DRIVER" = "virpipe" ]; then
+ # deqp is to use virpipe, and virgl_test_server llvmpipe
+ export GALLIUM_DRIVER="$GALLIUM_DRIVER"
+
+ VTEST_ARGS="--use-egl-surfaceless"
+ if [ "$VIRGL_HOST_API" = "GLES" ]; then
+ VTEST_ARGS="$VTEST_ARGS --use-gles"
+ fi
+
+ GALLIUM_DRIVER=llvmpipe \
+ GALLIVM_PERF="nopt,no_filter_hacks" \
+ virgl_test_server $VTEST_ARGS >$RESULTS/vtest-log.txt 2>&1 &
+
+ sleep 1