[client] tests: add framebuffer rendering validation

Add an optional EGL framebuffer capture path for the test transport.
Capture the fully composed frame before presentation and retain its
surface format and HDR state for validation.

Add GoogleTest integration tests which run the production client
under a headless Weston compositor and compare every output pixel
against an independent reference implementation.

The matrix covers BGRA, RGBA, BGR32, RGB24, PQ RGBA10 and scRGB
RGBA16F with full, moving, overlapping, maximum-count, invalid, null
and zero-area damage rectangles. Validate HDR-to-SDR conversion and
native HDR output metadata when supported by the compositor.

Keep tests opt-in through ENABLE_RENDER_TESTS and document how to run
the software and native HDR tiers.
This commit is contained in:
Geoffrey McRae
2026-07-30 14:53:38 +10:00
parent a1fc3d20d3
commit 74ae4f543e
11 changed files with 1172 additions and 6 deletions

View File

@@ -0,0 +1,62 @@
#!/bin/bash
set -euo pipefail
weston_bin=$1
shift
runtime_dir=$(mktemp -d /tmp/lg-render-tests.XXXXXX)
weston_pid=
cleanup()
{
if [[ -n "$weston_pid" ]]; then
kill "$weston_pid" 2>/dev/null || true
wait "$weston_pid" 2>/dev/null || true
fi
rm -rf -- "$runtime_dir"
}
trap cleanup EXIT
chmod 700 "$runtime_dir"
export XDG_RUNTIME_DIR="$runtime_dir"
export LIBGL_ALWAYS_SOFTWARE=1
unset DISPLAY WAYLAND_DISPLAY
socket_name=lg-render-tests
"$weston_bin" \
--backend=headless \
--renderer=gl \
--width=1024 \
--height=768 \
--idle-time=0 \
--no-config \
--socket="$socket_name" \
--log="$runtime_dir/weston.log" &
weston_pid=$!
startup_deadline=$((SECONDS + 30))
while (( SECONDS < startup_deadline )); do
if [[ -S "$runtime_dir/$socket_name" ]]; then
break
fi
if ! kill -0 "$weston_pid" 2>/dev/null; then
sed -n '1,240p' "$runtime_dir/weston.log" >&2
exit 1
fi
sleep 0.1
done
if [[ ! -S "$runtime_dir/$socket_name" ]]; then
echo "Timed out waiting for the Weston Wayland socket" >&2
sed -n '1,240p' "$runtime_dir/weston.log" >&2
exit 1
fi
export WAYLAND_DISPLAY="$socket_name"
set +e
"$@"
status=$?
set -e
if (( status != 0 )); then
sed -n '1,240p' "$runtime_dir/weston.log" >&2
fi
exit "$status"