1#!/bin/sh 2 3set -ex 4 5if [ "x$VK_DRIVER" = "x" ]; then 6 exit 1 7fi 8 9INSTALL=$(realpath -s "$PWD"/install) 10 11RESULTS=$(realpath -s "$PWD"/results) 12 13# Set up the driver environment. 14# Modifiying here directly LD_LIBRARY_PATH may cause problems when 15# using a command wrapper. Hence, we will just set it when running the 16# command. 17export __LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$INSTALL/lib/" 18 19 20# Sanity check to ensure that our environment is sufficient to make our tests 21# run against the Mesa built by CI, rather than any installed distro version. 22MESA_VERSION=$(cat "$INSTALL/VERSION" | sed 's/\./\\./g') 23 24# Set the Vulkan driver to use. 25export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.x86_64.json" 26 27# Set environment for Wine. 28export WINEDEBUG="-all" 29export WINEPREFIX="/vkd3d-proton-wine64" 30export WINEESYNC=1 31 32print_red() { 33 RED='\033[0;31m' 34 NC='\033[0m' # No Color 35 printf "${RED}" 36 "$@" 37 printf "${NC}" 38} 39 40# wrapper to supress +x to avoid spamming the log 41quiet() { 42 set +x 43 "$@" 44 set -x 45} 46 47SANITY_MESA_VERSION_CMD="vulkaninfo | tee /tmp/version.txt | grep \"Mesa $MESA_VERSION\(\s\|$\)\"" 48 49HANG_DETECTION_CMD="/parallel-deqp-runner/build/bin/hang-detection" 50 51RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $SANITY_MESA_VERSION_CMD" 52 53set +e 54eval $RUN_CMD 55 56if [ $? -ne 0 ]; then 57 printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION" 58fi 59set -e 60 61if [ -d "$RESULTS" ]; then 62 cd "$RESULTS" && rm -rf ..?* .[!.]* * && cd - 63else 64 mkdir "$RESULTS" 65fi 66 67VKD3D_PROTON_TESTSUITE_CMD="wine /vkd3d-proton-tests/x64/bin/d3d12.exe >$RESULTS/vkd3d-proton.log 2>&1" 68 69quiet printf "%s\n" "Running vkd3d-proton testsuite..." 70RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $HANG_DETECTION_CMD $VKD3D_PROTON_TESTSUITE_CMD" 71 72set +e 73eval $RUN_CMD 74 75VKD3D_PROTON_RESULTS="vkd3d-proton-${VKD3D_PROTON_RESULTS:-results}" 76RESULTSFILE="$RESULTS/$VKD3D_PROTON_RESULTS.txt" 77mkdir -p .gitlab-ci/vkd3d-proton 78grep "Test failed" "$RESULTS"/vkd3d-proton.log > "$RESULTSFILE" 79 80if [ -f "$INSTALL/$VKD3D_PROTON_RESULTS.txt" ]; then 81 cp "$INSTALL/$VKD3D_PROTON_RESULTS.txt" \ 82 ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" 83else 84 touch ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" 85fi 86 87if diff -q ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE"; then 88 exit 0 89fi 90 91quiet print_red printf "%s\n" "Changes found, see vkd3d-proton.log!" 92quiet diff --color=always -u ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE" 93exit 1 94