mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[MG_Util, MG_Test, MG_IntegrationTest, CI] (P6): one log per role, and every reader moved with it
The spawn work had the two roles append to one MOBILEGL_LOG_FILE_PATH under O_APPEND. It was correct - two processes at one offset would corrupt the file, O_APPEND made each write atomic - but it put two sessions' lines in one place and made every per-side assertion a search. This splits the sink: the client role writes <base>.client.log and the server role writes <base>.server.log. THE BASE NAME NAMES NO FILE ANY MORE, AND THAT IS THE POINT. Leaving the client at the old unsuffixed path would have been the compatible choice and the wrong one: a reader that was not updated would go on finding a file, go on passing, and go on seeing only half the session - and a refusal census that reports a confident zero for the half it cannot see is worse than one that fails. With both names moved, an un-updated reader gets "file not found" and says so. There were 34 such readers; every one is moved here. THE ROLE IS PER-THREAD, not per-process, because under inproc both roles are threads of one process. Log.cpp keys the sink on a thread-local role: the apply thread declares itself server (ServerLoop.cpp), a spawned image is server for its whole life (MOBILEGL_IPC_ROLE=server, read once), and everything else is the client. The naming rule (RoleLogPath) and the two whole-log operations (ReadRoleLogs / TruncateRoleLogs) are EXPORTED from the library, so no reader reimplements the derivation - a second copy is the copy that falls behind. Readers, by how they read: - unit mains set MOBILEGL_LOG_FILE_PATH and read a role file: they keep the base in the env and derive the client path from the library helper. - the death-test child runners (ReadLog) now concatenate BOTH roles: a death test asserts the CHILD said something, and the applier's refusals - the very diagnostics these check - are written under the server role. - the offset-based Emit readers derive the client path once after setenv. - PipeStatsWindow reads both, because draws/vbs increment in the backend's PrepareForDraw - the apply thread, the server role - so the summary line is in the server file even under inproc. - run_trace_case.cmake's split census reads both files; the client keeps the transport markers. - split_log_paths.py (and its self-test, and the control stub) derive both role files from the declared base. - the Android script pulls both role files off the device and concatenates them, so every downstream check is unchanged - and it judges a role file by CONTENT, because `run-as test -f` through `exec-out` returned 0 for a missing file on the device and `exec-out` folds cat's own not-found line into stdout. The monolith arm legitimately has no server file, and that is a silent skip rather than a one-line server log. Guarded so a pull build is untouched: RoleLogPath and the role sink are wholly inside MOBILEGL_BUILD_DISAGGREGATED; a non-disaggregated build writes the base path exactly as before. G1 re-measured - 0 symbol diff, .text unchanged at 0xa52203. Verified on device 2f7cbe2e: monolith writes only the client log (no phantom server log), inproc and spawn each write both and pass their transport proofs (spawn: server role in pid 16125). Unit 2353 (one pre-existing environmental failure), integration-split 186/186, integration-spawn 102/102, retrace 6/6, control smoke 12/12, split-log-paths self-test 9/9.
This commit is contained in:
@@ -239,7 +239,7 @@ collect_run_diagnostics() {
|
||||
adb_device_path shell dumpsys activity activities > "${diagnostics_dir}/activity.txt" 2>&1 || true
|
||||
adb_device_path shell run-as "${package_name}" ls -laR "${app_dir}" > "${diagnostics_dir}/app-files.txt" 2>&1 || true
|
||||
adb_device_path exec-out run-as "${package_name}" cat "${app_dir}/output/retrace.log" > "${diagnostics_dir}/retrace.log" || true
|
||||
adb_device_path exec-out run-as "${package_name}" cat "${app_dir}/output/mobilegl.log" > "${diagnostics_dir}/mobilegl.log" || true
|
||||
collect_role_logs "${app_dir}/output/mobilegl.log" "${diagnostics_dir}/mobilegl.log" || true
|
||||
}
|
||||
|
||||
# Records why a retrace was charged to the infrastructure rather than the code
|
||||
@@ -305,6 +305,39 @@ copy_app_artifact() {
|
||||
fi
|
||||
}
|
||||
|
||||
# P6: the library writes ONE LOG PER ROLE - <base>.client.log and <base>.server.log - because
|
||||
# under inproc both roles are threads of one process. Pull both and concatenate into the single
|
||||
# <dest> every downstream reader still expects: the client-only markers (ConfigLoader's transport
|
||||
# line, `spawn ARMED`, the client Config: IPC line) are present, and the Fatal census and the
|
||||
# capabilities probe see BOTH roles - the applier's refusals and its GL_RENDERER line live on the
|
||||
# server side. The two source files are also kept beside <dest> for a human reading the artifact.
|
||||
collect_role_logs() {
|
||||
base_source="$1" # e.g. <app_dir>/output/mobilegl.log
|
||||
dest="$2" # e.g. <result_dir>/mobilegl.log
|
||||
base_no_ext="${base_source%.log}"
|
||||
dest_no_ext="${dest%.log}"
|
||||
: > "${dest}"
|
||||
wrote_any=0
|
||||
for role in client server; do
|
||||
role_src="${base_no_ext}.${role}.log"
|
||||
role_dst="${dest_no_ext}.${role}.log"
|
||||
# PULL, THEN JUDGE BY CONTENT. `run-as test -f` is unreliable through `exec-out` on some
|
||||
# devices (measured: it returned 0 for a file that does not exist), and `exec-out` folds the
|
||||
# device-side `cat: ... No such file` error into the stdout stream - so a missing role file
|
||||
# arrives as a one-line log that begins with `cat:`. The monolith arm legitimately has no
|
||||
# server file, and that must be a silent skip rather than a one-line server log. So: pull,
|
||||
# then drop anything empty or carrying cat's own not-found line.
|
||||
adb_device_path exec-out run-as "${package_name}" cat "${role_src}" > "${role_dst}" 2>/dev/null || true
|
||||
if [ -s "${role_dst}" ] && ! head -1 "${role_dst}" | grep -q '^cat: .*: No such file'; then
|
||||
cat "${role_dst}" >> "${dest}"
|
||||
wrote_any=1
|
||||
else
|
||||
rm -f "${role_dst}"
|
||||
fi
|
||||
done
|
||||
[ "${wrote_any}" -eq 1 ] || rm -f "${dest}"
|
||||
}
|
||||
|
||||
copy_texture_2d_dumps() {
|
||||
[ -n "${texture_2d_dumps}" ] || return 0
|
||||
saved_ifs="${IFS}"
|
||||
@@ -505,7 +538,7 @@ run_retrace() {
|
||||
copy_app_artifact "${app_dir}/output/${safe_case}-diff.png" "${result_dir}/${safe_case}-${backend}-diff.png"
|
||||
fi
|
||||
copy_app_artifact "${app_dir}/output/retrace.log" "${result_dir}/retrace.log"
|
||||
copy_app_artifact "${app_dir}/output/mobilegl.log" "${result_dir}/mobilegl.log"
|
||||
collect_role_logs "${app_dir}/output/mobilegl.log" "${result_dir}/mobilegl.log"
|
||||
if [ "${benchmark}" -eq 1 ]; then
|
||||
copy_app_artifact "${app_dir}/output/benchmark.json" "${result_dir}/benchmark.json"
|
||||
fi
|
||||
@@ -592,10 +625,12 @@ armed = re.search(r"spawn ARMED - the server role runs in pid (\d+)", text)
|
||||
|
||||
# `any`, NOT the `all` the inproc gate uses, and the difference is load-bearing.
|
||||
#
|
||||
# Under spawn TWO PROCESSES append to one MOBILEGL_LOG_FILE_PATH, and the launcher deliberately
|
||||
# scrubs every MOBILEGL_IPC_* out of the child's environment (anti-recursion catch (b)) - so the
|
||||
# server's own `Config: IPC` line reads strict=0 role-split-state=0 BY CONSTRUCTION. Demanding
|
||||
# that every line match would red every spawn run for the one thing the design requires.
|
||||
# This log is the CONCATENATION of the two role files (collect_role_logs), so it carries the
|
||||
# SERVER's own `Config: IPC` line as well as the client's - and the server's reads strict=0
|
||||
# role-split-state=0 by construction, because the launcher scrubs every MOBILEGL_IPC_* out of
|
||||
# the child's environment (anti-recursion catch (b)). Demanding that EVERY line match would red
|
||||
# every spawn run for the one thing the design requires; `any` asks that the CLIENT's line is
|
||||
# present, which is the one that carries the knobs.
|
||||
configs = re.findall(r"Config: IPC[^\r\n]*", text)
|
||||
fatals = re.findall(r"^.*Fatal\{.*$", text, re.MULTILINE)
|
||||
required = {"strict": "1", "role-split-state": "1", "run-ahead": "1"}
|
||||
|
||||
Reference in New Issue
Block a user