Files
kdm-re/tests/golden/README.md
T

3.3 KiB
Raw Blame History

T9 — Golden-I/O replay harness

A standalone, Linux-reproducible golden-I/O replay harness that replays committed (input → expected-output) tuples recorded from the project's existing introspection dumps and asserts an independent reconstruction of three gamekdm/shim subsystems against them within a float tolerance.

It is a supplement to the Unicorn differential harness (T8):

  • T8 (differential) is the universal gate — it runs the shipping gamekdm code under emulation and compares against a native reimplementation for any reachable function. It needs no recordings.
  • T9 (golden, this harness) covers the functions for which recorded introspection dumps already exist, needs no new Windows capture, and runs from the committed fixtures alone. Where a tuple does not exist, that function is left to the T8 differential (noted below).

What it checks

subsystem fixture source of the recorded tuple
nui_depth_to_skeleton fixtures/depth_projection.json Kinect NuiTransformDepthImageToSkeleton reimpl (kinect/core/mapping/mapping.cpp, scale 3.501e-3); input points from the shipping round-trip test (kinect/tests/test_mapping.cpp). Each expected position is self-checked by the inverse projection back to the original integer pixel.
skeleton_validity_gate fixtures/validity_gate.json game-internals.md §2 — gamekdm FUN_10018570 / FUN_100e4140 / FUN_101ab6d0, validity box DAT_103d3230 = A (0,1,0), B (1.22,1,0.675), m14=2.5, tol 0.05; recorded live by sensor.cpp DumpGameDisplayState() → the game-skel2/3/4 shim-log lines. Published floor-clip rule vFloorClipPlane.w = 1 − hip.y.
recorded_pose_hip_center fixtures/pose_ref.json (+ fixtures/ref.txt) kinect/tracker-native/testdata/ref.txt — the committed PoseEstimator dump on sample_rgb.bin; hip-center = (lm23.x + lm24.x)·0.5 per two_person_probe.cpp.

Run

./run.sh                      # regenerate fixtures, assert, then prove non-vacuity
python3 golden_harness.py     # assert only (exit 0 = all tuples matched)
python3 golden_harness.py --perturb m14   # corrupt one constant → FAIL (exit 1)
python3 gen_fixtures.py       # re-derive the committed fixtures from source dumps

No third-party dependencies (Python 3 stdlib only), no top-level CMake, no network, no game binary.

Non-vacuity (misleading-success guard)

The reconstruction constants live in Recon. --perturb FIELD (scale | m14 | box_b_x | box_b_z | tol | hip_mid) nudges one constant so the golden assertions fail on purpose. run.sh runs the clean pass and every perturbation, and reports VACUITY VIOLATION if any perturbed run still passes. A clean run is exit 0; any perturbation is exit 1.

Coverage left to the T8 differential

  • Live cursor read / OK-button snapping (FUN_1007fbf0, FUN_1007e330, afp_mc_get_param 0x1008) — the handcur: log is gated behind kShimDebug=false, so no cursor-paired recording is committed here. The cursor→button math runs against the game binary under the T8 differential.
  • Arm-amplification gains (kArmGainX/Y) and the L/R swap are exercised by the kinect host tests; this harness asserts only the hip-center (validity-box anchor), which the arm gains leave untouched by design.