1#!/usr/bin/env bash 2# shellcheck disable=SC2086 # we want word splitting 3 4set -ex 5 6if [[ -z "$VK_DRIVER" ]]; then 7 exit 1 8fi 9 10# Useful debug output, you rarely know what envirnoment you'll be 11# running in within container-land, this can be a landmark. 12ls -l 13 14INSTALL=$(realpath -s "$PWD"/install) 15RESULTS=$(realpath -s "$PWD"/results) 16 17# Set up the driver environment. 18# Modifiying here directly LD_LIBRARY_PATH may cause problems when 19# using a command wrapper. Hence, we will just set it when running the 20# command. 21export __LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$INSTALL/lib/" 22 23# Sanity check to ensure that our environment is sufficient to make our tests 24# run against the Mesa built by CI, rather than any installed distro version. 25MESA_VERSION=$(sed 's/\./\\./g' "$INSTALL/VERSION") 26 27# Force the stdout and stderr streams to be unbuffered in python. 28export PYTHONUNBUFFERED=1 29 30# Set the Vulkan driver to use. 31export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.x86_64.json" 32if [ "${VK_DRIVER}" = "radeon" ]; then 33 # Disable vsync 34 export MESA_VK_WSI_PRESENT_MODE=mailbox 35 export vblank_mode=0 36fi 37 38# Set environment for Wine. 39export WINEDEBUG="-all" 40export WINEPREFIX="/dxvk-wine64" 41export WINEESYNC=1 42 43# Wait for amdgpu to be fully loaded 44sleep 1 45 46# Avoid having to perform nasty command pre-processing to insert the 47# wine executable in front of the test executables. Instead, use the 48# kernel's binfmt support to automatically use Wine as an interpreter 49# when asked to load PE executables. 50# TODO: Have boot2container mount this filesystem for all jobs? 51mount -t binfmt_misc none /proc/sys/fs/binfmt_misc 52echo ':DOSWin:M::MZ::/usr/bin/wine64:' > /proc/sys/fs/binfmt_misc/register 53 54# Set environment for DXVK. 55export DXVK_LOG_LEVEL="info" 56export DXVK_LOG="$RESULTS/dxvk" 57[ -d "$DXVK_LOG" ] || mkdir -pv "$DXVK_LOG" 58export DXVK_STATE_CACHE=0 59 60# Set environment for replaying traces. 61export PATH="/apitrace-msvc-win64/bin:/gfxreconstruct/build/bin:$PATH" 62 63SANITY_MESA_VERSION_CMD="vulkaninfo" 64 65# Set up the Window System Interface (WSI) 66# TODO: Can we get away with GBM? 67if [ "${TEST_START_XORG:-0}" -eq 1 ]; then 68 "$INSTALL"/common/start-x.sh "$INSTALL" 69 export DISPLAY=:0 70fi 71 72wine64 --version 73 74SANITY_MESA_VERSION_CMD="$SANITY_MESA_VERSION_CMD | tee /tmp/version.txt | grep \"Mesa $MESA_VERSION\(\s\|$\)\"" 75 76RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $SANITY_MESA_VERSION_CMD" 77 78set +e 79if ! eval $RUN_CMD; 80then 81 printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION" 82fi 83set -e 84 85# Just to be sure... 86chmod +x ./valvetraces-run.sh 87./valvetraces-run.sh 88