Files
OpenVR-AdvancedSettings-frame/build_scripts/steamframe/container-test.sh
T
Matthias JanetschekandClaude Opus 5.5 bde675f1b8 Steam Frame build, packaging and deployment scripts; render test
- build_scripts/steamframe/: Debian trixie (Qt 6.8) containers for the
  aarch64 cross build, native build and tests; toolchain; scripts to build,
  test (Vulkan validation layers), package (system Qt, ~3 MB) and deploy over
  SSH. Adapted from the vrdashboard template.
- test/render/: render test for the OpenGL and Vulkan backends, driven like
  OverlayController (option OVRAS_BUILD_TESTS).
- RPATH only $ORIGIN, without the build machine's link directories.
- Ignore dist/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 13:50:57 +02:00

51 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds and runs the tests (OVRAS_BUILD_TESTS) in a Debian container with
# both render backends, Vulkan with the Khronos validation layers. Fails on any
# validation message. Adapted from the vrdashboard template.
#
# build_scripts/steamframe/container-test.sh GPU via /dev/dri if
# available, else software
# VK_DRIVER=lvp build_scripts/steamframe/container-test.sh
# force lavapipe (software)
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root="$(cd "$here/../.." && pwd)"
engine="${CONTAINER_ENGINE:-$(command -v podman || command -v docker)}"
"$engine" build -q -t ovras-steamframe-native -f "$here/native.Dockerfile" "$here" >/dev/null
"$engine" build -q -t ovras-steamframe-test -f "$here/test.Dockerfile" "$here" >/dev/null
run=("$engine" run --rm -v "$root:$root:z" -w "$root" -e HOME=/tmp -e "VK_DRIVER=${VK_DRIVER:-}")
if [[ "$(basename "$engine")" == docker ]]; then
run+=(--user "$(id -u):$(id -g)")
else
run+=(--userns=keep-id)
fi
[[ -e /dev/dri/renderD128 ]] && run+=(--device /dev/dri/renderD128)
"${run[@]}" ovras-steamframe-test bash -c '
set -e
build=build/steamframe-test
cmake -S . -B $build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DOVRAS_BUILD_TESTS=ON >/dev/null
cmake --build $build --target tst_render
if [[ -n "$VK_DRIVER" ]]; then export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/${VK_DRIVER}_icd.json; fi
vulkaninfo --summary 2>/dev/null | grep -m1 deviceName || true
Xvfb :99 >/dev/null 2>&1 &
sleep 1
export DISPLAY=:99 OVRAS_VULKAN_VALIDATION=1
ctest --test-dir $build --output-on-failure -V > $build/ctest.log 2>&1 \
|| { tail -40 $build/ctest.log; exit 1; }
grep -E "tests passed|Test +#|Totals" $build/ctest.log
# A skipped test (no GPU context) must not count as passed.
if grep -q "SKIP" $build/ctest.log; then
echo "Tests were skipped (see $build/ctest.log)"; exit 1
fi
messages=$(grep -oE "(VUID|UNASSIGNED)-[A-Za-z0-9_.-]+" $build/ctest.log | sort | uniq -c || true)
if [[ -n "$messages" ]]; then
echo "Vulkan validation messages (see $build/ctest.log):"
echo "$messages"
exit 1
fi
echo "No Vulkan validation messages."
'