Files
MobileGL/MobileGL/MG_IntegrationTest/run_integration_test.sh
T
BZLZHH 313b75a7c0 [Test] (MG_IntegrationTest): pin the two shipped memo bugs with rendered pixels
Both d7976326 bugs passed every unit test while corrupting real frames -
state-level assertions cannot see them. This module renders and reads
back.

A headless EGL-pbuffer harness (no window, no GLFW) linking MobileGL_s
directly, registered once per backend under the ctest label
integration-gpu, behind the default-OFF option
MOBILEGL_BUILD_INTEGRATION_TEST. The platform pre-flight runs the ENTIRE
bring-up in a forked child first - MobileGL aborts rather than returning
errors on an unusable platform, and the child dying on any signal turns
into a clean GTEST_SKIP instead of taking the test binary down.
MOBILEGL_ITEST_REQUIRE_GPU makes the label falsifiable: with it set, an
unusable harness (or a context that lands on a software rasterizer) is a
FAILURE - without it, a CI runner whose driver pinning silently broke
reports the same green as one that rendered every frame. Configure-time
detection pins the EGL vendor and Vulkan ICD jsons, preferring hardware
vendors and never selecting llvmpipe/lavapipe.

Scenarios assert on glReadPixels with whole-region pixel counts (a
2x2 quadrant pattern whose signature distinguishes all eight square
symmetries; every region predicate reports the first offending pixel):
- OrientationScenario: default -> FBO -> default, pinning the
  transform-flags memo key. Keying GetBaseTransformFlagsRaw on the
  pre-transform alone fails exactly 3 entries.
- StreamedArenaScenario: an untouched streamed vertex buffer must
  survive transient-arena recycling. Re-enabling only the cross-frame
  vertex revalidation fails exactly this entry.
- CrossFrameBufferScenario + ResidentIndexScenario: cross-frame
  mutation matrix (SubData, map/unmap, persistent+flush, coherent
  persistent, orphan, CopyBufferSubData; vertex and index) plus six
  adversarial resident-EBO constructions. Instrumentation showed the
  cross-frame EBO memo cannot be made to serve wrong bytes from GL
  level on this stack (89 entries, 81 accepts, zero divergent slices) -
  these cases are freshness tripwires, documented as such in-file; the
  EBO half of d7976326 remains unpinned by a failing test.

At the buggy commit 72ee7c43 the suite fails 4 entries (3 orientation +
1 streamed-arena); at d7976326 all 52 pass, 5 consecutive runs, zero
flakes, and the default build is bit-for-bit unaffected (unit suite
unchanged). Adversarially verified twice, including hostile-platform
sweeps (26 configurations, all clean skips) and hand-edits of each
production hole in isolation.
2026-08-07 03:30:18 -04:00

48 lines
2.0 KiB
Bash

#!/bin/bash
# Run the headless MobileGL integration scenarios on one backend:
# ./run_integration_test.sh espryt [gtest args...] -> DirectGLES
# ./run_integration_test.sh magma [gtest args...] -> DirectVulkan
#
# The backend is latched at initialization from MOBILEGL_BACKEND_TYPE, so one
# process is one backend; this script is the dev-box equivalent of the two ctest
# registrations in CMakeLists.txt.
#
# Pin the vendor libraries explicitly, for the same reason
# MG_Benchmark/Driver/run_driver_bench.sh does: a bare libEGL on a glvnd system
# resolves to whatever vendor comes first, which is usually Mesa/llvmpipe - a
# software rasteriser silently replacing the GPU under a GPU test. Override
# MGL_EGL_VENDOR / MGL_VK_ICD to test another driver.
#
# Set MOBILEGL_ITEST_REQUIRE_GPU=1 to turn "the harness is unusable" from a clean
# skip into a failure. Do that anywhere the machine is supposed to have a GPU: a
# run that skipped everything and a run that passed everything are otherwise the
# same green, so without it a broken driver pinning is invisible.
set -eu
HERE=$(cd "$(dirname "$0")" && pwd)
BIN=${MOBILEGL_ITEST_BIN:-$HERE/MobileGLIntegrationTest}
EGL_VENDOR=${MGL_EGL_VENDOR:-/usr/share/glvnd/egl_vendor.d/10_nvidia.json}
VK_ICD=${MGL_VK_ICD:-/usr/share/vulkan/icd.d/nvidia_icd.x86_64.json}
MODE=$1; shift
if [ ! -x "$BIN" ]; then
echo "MobileGLIntegrationTest not found at $BIN"
echo "configure with -DMOBILEGL_BUILD_INTEGRATION_TEST=ON and set MOBILEGL_ITEST_BIN"
exit 1
fi
[ -r "$EGL_VENDOR" ] && export __EGL_VENDOR_LIBRARY_FILENAMES=$EGL_VENDOR
export EGL_PLATFORM=${EGL_PLATFORM:-x11}
case "$MODE" in
espryt|DirectGLES)
export MOBILEGL_BACKEND_TYPE=DirectGLES
;;
magma|DirectVulkan)
export MOBILEGL_BACKEND_TYPE=DirectVulkan
[ -r "$VK_ICD" ] && export VK_ICD_FILENAMES=$VK_ICD
;;
*) echo "unknown mode: $MODE (espryt|magma)"; exit 1 ;;
esac
export MOBILEGL_ITEST_REQUIRE_GPU=${MOBILEGL_ITEST_REQUIRE_GPU:-}
exec "$BIN" "$@"