[Fix] (IntegrationTest): give Split entries private diagnostic logs

This commit is contained in:
2026-09-16 08:48:30 -04:00
parent c3e736a343
commit b2dcae713f
6 changed files with 183 additions and 34 deletions
@@ -1906,6 +1906,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
# target B and PersistentCoherentMap is target C, both new in P5.
gtest_discover_tests(MobileGLIntegrationTest
TEST_PREFIX "DirectGLES.Split."
TEST_LIST MGL_SPLIT_CLEAR_TESTS
TEST_FILTER "ClearThenReadPixelsScenario.*"
DISCOVERY_TIMEOUT 30
PROPERTIES
@@ -1915,6 +1916,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
)
gtest_discover_tests(MobileGLIntegrationTest
TEST_PREFIX "DirectGLES.Split."
TEST_LIST MGL_SPLIT_TRIANGLE_TESTS
TEST_FILTER "TriangleScenario.*"
DISCOVERY_TIMEOUT 30
PROPERTIES
@@ -1924,6 +1926,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
)
gtest_discover_tests(MobileGLIntegrationTest
TEST_PREFIX "DirectGLES.Split."
TEST_LIST MGL_SPLIT_PMAP_TESTS
TEST_FILTER "PersistentCoherentMapScenario.*"
DISCOVERY_TIMEOUT 30
PROPERTIES
@@ -1947,6 +1950,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
gtest_discover_tests(MobileGLIntegrationTest
TEST_PREFIX "DirectGLES.Split.PersistentMapArm."
TEST_LIST MGL_SPLIT_ARM_TESTS
TEST_FILTER "PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares"
DISCOVERY_TIMEOUT 30
PROPERTIES
@@ -1984,6 +1988,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
PersistentCoherentMapScenario)
gtest_discover_tests(MobileGLIntegrationTest
TEST_PREFIX "DirectGLES.Split.SmallRing."
TEST_LIST "MGL_SPLIT_SMALL_${mglItestSmallRingScenario}_TESTS"
TEST_FILTER "${mglItestSmallRingScenario}.*"
DISCOVERY_TIMEOUT 30
PROPERTIES
@@ -1992,4 +1997,13 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
ENVIRONMENT "${MGL_ITEST_GLES_SPLIT_SMALL_RING_ENVIRONMENT}"
)
endforeach()
# Apply per-entry paths after GoogleTest discovery has populated the TEST_LISTs.
configure_file(Harness/SplitLogPaths.cmake.in SplitLogPaths.cmake @ONLY)
set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES
"${CMAKE_CURRENT_BINARY_DIR}/SplitLogPaths.cmake")
find_package(Python3 REQUIRED COMPONENTS Interpreter)
add_test(NAME SplitLogPaths.PrivateAndDistinct
COMMAND "${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/Harness/split_log_paths.py"
check "${CMAKE_CTEST_COMMAND}" "${CMAKE_BINARY_DIR}")
endif()
@@ -0,0 +1,14 @@
# Included by CTest after all GoogleTest discovery files (ID-53).
# CTest appends ENVIRONMENT here; keep all previously discovered lane settings.
file(MAKE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/split-logs")
foreach(entry IN LISTS MGL_SPLIT_CLEAR_TESTS MGL_SPLIT_TRIANGLE_TESTS MGL_SPLIT_PMAP_TESTS)
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
endforeach()
foreach(scenario ClearThenReadPixelsScenario TriangleScenario PersistentCoherentMapScenario)
foreach(entry IN LISTS MGL_SPLIT_SMALL_${scenario}_TESTS)
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
endforeach()
endforeach()
# PersistentMapArm retains its existing private path and RESOURCE_LOCK: b1 reads it.
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""Validate discovered Split log ownership; read only freshly reset control logs."""
import json
from pathlib import Path
import re
import subprocess
import sys
def paths(document):
owners = {}
split = {}
for test in document["tests"]:
props = {p["name"]: p["value"] for p in test.get("properties", [])}
values = [v.split("=", 1)[1] for v in props.get("ENVIRONMENT", [])
if v.startswith("MOBILEGL_LOG_FILE_PATH=")]
is_split = "integration-split" in props.get("LABELS", [])
if is_split and (len(values) != 1 or not values[0]):
raise ValueError(f"{test['name']}: requires exactly one nonempty MOBILEGL_LOG_FILE_PATH")
for value in values:
path = str(Path(value).resolve())
owners.setdefault(path, []).append(test["name"])
if is_split:
if not Path(value).is_absolute():
raise ValueError(f"{test['name']}: MOBILEGL_LOG_FILE_PATH must be absolute: {value}")
split[test["name"]] = path
if not split:
raise ValueError("integration-split: no entries discovered")
for name, path in split.items():
if len(owners[path]) != 1:
raise ValueError(f"{name}: duplicate MOBILEGL_LOG_FILE_PATH {path}: {owners[path]}")
return split
def main():
mode = sys.argv[1]
if mode == "check":
data = subprocess.check_output([sys.argv[2], "--test-dir", sys.argv[3],
"--show-only=json-v1"], text=True)
selected = paths(json.loads(data))
print(f"SplitLogPaths: {len(selected)} entries, {len(set(selected.values()))} distinct private paths")
return
selected = paths(json.loads(Path(sys.argv[2]).read_text()))
selected = {name: path for name, path in selected.items() if re.search(sys.argv[3], name)}
if not selected:
raise ValueError(f"integration-split: empty selection for {sys.argv[3]}")
if mode == "reset":
for path in selected.values():
Path(path).unlink(missing_ok=True)
elif mode == "evidence":
for name, path in selected.items():
if Path(path).is_file() and re.search(sys.argv[4], Path(path).read_text(errors="replace")):
print(f"private-log evidence: {name}: {path}")
return
raise ValueError("E1 FAILED: selected private logs lack expected Fatal{BarrierViolation, \"<slot>\"} line: "
+ ", ".join(f"{n} ({p})" for n, p in selected.items()))
else:
raise ValueError(f"unknown mode: {mode}")
if __name__ == "__main__":
try:
main()
except (ValueError, OSError, subprocess.CalledProcessError) as error:
sys.exit(f"SplitLogPaths FAILED: {error}")