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