ci: add VKD3D-Proton testsuite runner
authorAndres Gomez <agomez@igalia.com>
Tue, 18 May 2021 13:54:54 +0000 (16:54 +0300)
committerMarge Bot <eric+marge@anholt.net>
Tue, 25 May 2021 17:03:25 +0000 (17:03 +0000)
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10870>

.gitlab-ci.yml
.gitlab-ci/prepare-artifacts.sh
.gitlab-ci/vkd3d-proton/run.sh [new file with mode: 0755]

index cdf0c09..0e167c3 100644 (file)
@@ -1149,6 +1149,15 @@ meson-mingw32-x86_64:
     - x86_test-gl
     - meson-clover-testing
 
+.vkd3d-proton-test:
+  artifacts:
+    when: on_failure
+    name: "mesa_${CI_JOB_NAME}"
+    paths:
+      - results/vkd3d-proton.log
+  script:
+    - install/vkd3d-proton/run.sh
+
 .piglit-test:
   artifacts:
     when: on_failure
index 26a58bf..a16f6ea 100755 (executable)
@@ -33,6 +33,7 @@ cp -Rp .gitlab-ci/fossils install/
 cp -Rp .gitlab-ci/fossilize-runner.sh install/
 cp -Rp .gitlab-ci/deqp-runner.sh install/
 cp -Rp .gitlab-ci/deqp-*.txt install/
+cp -Rp .gitlab-ci/vkd3d-proton install/
 find . -path \*/ci/\*.txt \
     -o -path \*/ci/\*traces\*.yml \
     | xargs -I '{}' cp -p '{}' install/
diff --git a/.gitlab-ci/vkd3d-proton/run.sh b/.gitlab-ci/vkd3d-proton/run.sh
new file mode 100755 (executable)
index 0000000..bd5a2cc
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+set -ex
+
+if [ "x$VK_DRIVER" = "x" ]; then
+    exit 1
+fi
+
+INSTALL=$(realpath -s "$PWD"/install)
+
+RESULTS=$(realpath -s "$PWD"/results)
+
+# Set up the driver environment.
+# Modifiying here directly LD_LIBRARY_PATH may cause problems when
+# using a command wrapper. Hence, we will just set it when running the
+# command.
+export __LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$INSTALL/lib/"
+
+
+# Sanity check to ensure that our environment is sufficient to make our tests
+# run against the Mesa built by CI, rather than any installed distro version.
+MESA_VERSION=$(cat "$INSTALL/VERSION" | sed 's/\./\\./g')
+
+# Set the Vulkan driver to use.
+export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.x86_64.json"
+
+# Set environment for Wine.
+export WINEDEBUG="-all"
+export WINEPREFIX="/vkd3d-proton-wine64"
+export WINEESYNC=1
+
+SANITY_MESA_VERSION_CMD="vulkaninfo | tee /tmp/version.txt | grep \"Mesa $MESA_VERSION\(\s\|$\)\""
+
+RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $SANITY_MESA_VERSION_CMD"
+
+set +e
+eval $RUN_CMD
+
+if [ $? -ne 0 ]; then
+    printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION"
+fi
+set -e
+
+if [ -d "$RESULTS" ]; then
+    cd "$RESULTS" && rm -rf ..?* .[!.]* * && cd -
+else
+    mkdir "$RESULTS"
+fi
+
+VKD3D_PROTON_TESTSUITE_CMD="wine /vkd3d-proton-tests/x64/bin/d3d12.exe >$RESULTS/vkd3d-proton.log 2>&1"
+
+printf "Running vkd3d-proton testsuite...\n"
+RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $VKD3D_PROTON_TESTSUITE_CMD"
+
+set +e
+eval $RUN_CMD
+
+VKD3D_PROTON_RESULTS="vkd3d-proton-${VKD3D_PROTON_RESULTS:-results}"
+RESULTSFILE="$RESULTS/$VKD3D_PROTON_RESULTS.txt"
+grep "Test failed" "$RESULTS"/vkd3d-proton.log > "$RESULTSFILE"
+
+if [ -f "$INSTALL/$VKD3D_PROTON_RESULTS.txt" ]; then
+    cp "$INSTALL/$VKD3D_PROTON_RESULTS.txt" \
+       ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline"
+else
+    touch ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline"
+fi
+
+if diff -q ".gitlab-ci/vkd3d-proton/$PIGLIT_RESULTS.txt.baseline" "$RESULTSFILE"; then
+    exit 0
+fi
+
+printf "Regressions found, see vkd3d-proton.log!\n"
+exit 1