[MG_Util, MG_IntegrationTest, CI] (P6): the readers the role split left behind

The per-role log split renamed BOTH halves so that an un-updated reader would
fail loudly instead of silently reading half a session. It worked: CI found
four readers this way. This is them.

- MG_Util/Debug/Log.h: the role vocabulary now exists in the PULL build too,
  header-only. It was wholly inside #if MOBILEGL_BUILD_DISAGGREGATED, so
  PipeInputsTest - which builds in the verify flavour - could not name
  ReadRoleLogs and took the whole build-linux-verify job down at compile time.
  Inline rather than out-of-line because of G1: nothing in the library calls
  these, so an inline definition emits code into the readers and NOTHING into
  libMobileGL.so. Verified: pull symbols 30570 -> 30570, 0 added / 0 removed,
  .text still 0xa52203, and zero role-log symbols in the pull library.

- PipeStatsWindow.h: the harness copy of the naming rule is now flavour-aware.
  It derived `.client` in BOTH flavours, so in the verify build - one role,
  MOBILEGL_LOG_FILE_PATH written unchanged - it opened a file that never
  existed. The copy has to stay a copy: MG_Util's RoleLogPath is `t` (local)
  in the shipping .so this module links, so calling it does not link.
  Added LogMark/MarkLaneLog/ReadLaneLogSince: one offset PER ROLE, because a
  single scalar over the concatenation slides by whatever the other role wrote.

- The four arming scenarios: they asserted on lines the BACKEND emits, and
  under inproc the backend runs on the apply thread - the server role - so the
  line lands in the server's log. Reading only the client's half reported the
  emulation unarmed, i.e. accused the product of a defect the reader invented.
  Four copies of the same private helper pair now delegate to the harness.

- scripts/ci/magma_runahead_checks.py: it unlinked and read the base name as
  if it were a file, so the negative arm saw an empty log and could not prove
  the knob took. It now imports split_log_paths' derivation - the authoritative
  one - rather than becoming a third copy.

Local verification (WSL, lk-split + c6-pull):
  - the 4 CI-red entries: 10/10 PASS under inproc, 10/10 under monolith
  - unit role-log readers: 510/510 PASS
  - magma_runahead_checks negative: run_ahead_0 EXPECTED_RED, restored GREEN
  - the 5 affected TUs compile clean with MOBILEGL_BUILD_DISAGGREGATED=0
  - G1: 0/0/0/0, .text 0xa52203

Red-once is the CI run itself (35677991453), which failed for each of these
reasons before the change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 00:37:39 -04:00
co-authored by Claude Opus 5
parent 98d0b96cbe
commit 71aa995128
7 changed files with 191 additions and 73 deletions
@@ -111,24 +111,23 @@ void main() { o_color = vec4(0.25, 0.5, 0.75, 1.0); }
return std::filesystem::path(MGITest::PipeStatsWindow::LibraryLogPath());
}
static std::uintmax_t LibraryLogSize() {
std::error_code ec;
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return 0;
const std::uintmax_t size = std::filesystem::file_size(path, ec);
return ec ? 0 : size;
// ONE MARK PER ROLE. The library writes a log per role, so "how long is the log
// right now" is two numbers; a single scalar applied to the concatenation would slide
// by whatever the other role wrote in between and start the read mid-line.
static MGITest::PipeStatsWindow::LogMark LibraryLogMark() {
return MGITest::PipeStatsWindow::MarkLaneLog();
}
static std::string LibraryLogSince(std::uintmax_t offset) {
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return {};
std::ifstream file(path, std::ios::binary);
if (!file.good()) return {};
file.seekg(static_cast<std::streamoff>(offset));
return std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
// BOTH ROLES. The arming diagnostics this case looks for are emitted by the
// BACKEND, and under inproc the backend runs on the apply thread - the server role -
// so the line lands in the server's log. Reading only the client's found nothing and
// reported the emulation unarmed, which accused the product of a defect the reader
// had invented.
static std::string LibraryLogSince(const MGITest::PipeStatsWindow::LogMark& mark) {
return MGITest::PipeStatsWindow::ReadLaneLogSince(mark);
}
static std::string LibraryLog() { return LibraryLogSince(0); }
static std::string LibraryLog() { return MGITest::PipeStatsWindow::ReadLaneLog(); }
// One frame that crosses several verb boundaries: a clear (kClear), a draw (kDraw) and
// a readback (kReadback). Three of the nine fill classes, so an entry compare that only
@@ -201,7 +200,7 @@ void main() { o_color = vec4(0.25, 0.5, 0.75, 1.0); }
"backwards; the VerifyCorrupted. lane owns that half";
}
const std::uintmax_t before = LibraryLogSize();
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
ASSERT_NO_FATAL_FAILURE(DrawOneFrame());
EXPECT_EQ(FirstGLError(), 0u);
@@ -252,7 +251,7 @@ void main() { o_color = vec4(0.25, 0.5, 0.75, 1.0); }
}
const std::string knob = std::getenv("MOBILEGL_PIPE_VERIFY_CORRUPT");
const std::uintmax_t before = LibraryLogSize();
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
ASSERT_NO_FATAL_FAILURE(DrawOneFrame());
const std::string appended = LibraryLogSince(before);
@@ -311,22 +311,20 @@ void main()
return std::filesystem::path(MGITest::PipeStatsWindow::LibraryLogPath());
}
static std::uintmax_t LibraryLogSize() {
std::error_code ec;
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return 0;
const std::uintmax_t size = std::filesystem::file_size(path, ec);
return ec ? 0 : size;
// ONE MARK PER ROLE. The library writes a log per role, so "how long is the log
// right now" is two numbers; a single scalar applied to the concatenation would slide
// by whatever the other role wrote in between and start the read mid-line.
static MGITest::PipeStatsWindow::LogMark LibraryLogMark() {
return MGITest::PipeStatsWindow::MarkLaneLog();
}
static std::string LibraryLogSince(std::uintmax_t offset) {
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return {};
std::ifstream file(path, std::ios::binary);
if (!file.good()) return {};
file.seekg(static_cast<std::streamoff>(offset));
return std::string((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
// BOTH ROLES. The arming diagnostics this case looks for are emitted by the
// BACKEND, and under inproc the backend runs on the apply thread - the server role -
// so the line lands in the server's log. Reading only the client's found nothing and
// reported the emulation unarmed, which accused the product of a defect the reader
// had invented.
static std::string LibraryLogSince(const MGITest::PipeStatsWindow::LogMark& mark) {
return MGITest::PipeStatsWindow::ReadLaneLogSince(mark);
}
std::string m_buildLog;
@@ -494,7 +492,7 @@ void main()
// Taken BEFORE the program is built, so the line this looks for can only be one
// this process wrote.
const std::uintmax_t before = LibraryLogSize();
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
const GLuint program = BuildCaptureProgram({{GL_VERTEX_SHADER, kPointVertexSource},
{GL_GEOMETRY_SHADER, kPointGeometrySource},
@@ -256,22 +256,20 @@ void main() {
return std::filesystem::path(MGITest::PipeStatsWindow::LibraryLogPath());
}
static std::uintmax_t LibraryLogSize() {
std::error_code ec;
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return 0;
const std::uintmax_t size = std::filesystem::file_size(path, ec);
return ec ? 0 : size;
// ONE MARK PER ROLE. The library writes a log per role, so "how long is the log
// right now" is two numbers; a single scalar applied to the concatenation would slide
// by whatever the other role wrote in between and start the read mid-line.
static MGITest::PipeStatsWindow::LogMark LibraryLogMark() {
return MGITest::PipeStatsWindow::MarkLaneLog();
}
static std::string LibraryLogSince(std::uintmax_t offset) {
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return {};
std::ifstream file(path, std::ios::binary);
if (!file.good()) return {};
file.seekg(static_cast<std::streamoff>(offset));
return std::string((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
// BOTH ROLES. The arming diagnostics this case looks for are emitted by the
// BACKEND, and under inproc the backend runs on the apply thread - the server role -
// so the line lands in the server's log. Reading only the client's found nothing and
// reported the emulation unarmed, which accused the product of a defect the reader
// had invented.
static std::string LibraryLogSince(const MGITest::PipeStatsWindow::LogMark& mark) {
return MGITest::PipeStatsWindow::ReadLaneLogSince(mark);
}
GLuint m_vao = 0;
@@ -536,7 +534,7 @@ void main() {
// Taken BEFORE the draw, so the line this looks for can only be one this
// process wrote for this span. The latch fires on the FIRST rerouted
// draw, which is inside the query below.
const std::uintmax_t before = LibraryLogSize();
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
const GLuint generated = QueryGenerated([]() { glDrawArrays(GL_TRIANGLES, 0, 3); });
EXPECT_EQ(DrainGLErrors(), 0u);
EXPECT_EQ(generated, 1u) << "the pinned-on lane did not even count correctly";
@@ -364,22 +364,20 @@ void main()
// is searched from here forward, because the file is APPENDED to by every process
// in the lane and a line left behind by an earlier one would otherwise satisfy the
// assertion without this process having done anything at all.
static std::uintmax_t LibraryLogSize() {
std::error_code ec;
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return 0;
const std::uintmax_t size = std::filesystem::file_size(path, ec);
return ec ? 0 : size;
// ONE MARK PER ROLE. The library writes a log per role, so "how long is the log
// right now" is two numbers; a single scalar applied to the concatenation would slide
// by whatever the other role wrote in between and start the read mid-line.
static MGITest::PipeStatsWindow::LogMark LibraryLogMark() {
return MGITest::PipeStatsWindow::MarkLaneLog();
}
static std::string LibraryLogSince(std::uintmax_t offset) {
const std::filesystem::path path = LibraryLogPath();
if (path.empty()) return {};
std::ifstream file(path, std::ios::binary);
if (!file.good()) return {};
file.seekg(static_cast<std::streamoff>(offset));
return std::string((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
// BOTH ROLES. The arming diagnostics this case looks for are emitted by the
// BACKEND, and under inproc the backend runs on the apply thread - the server role -
// so the line lands in the server's log. Reading only the client's found nothing and
// reported the emulation unarmed, which accused the product of a defect the reader
// had invented.
static std::string LibraryLogSince(const MGITest::PipeStatsWindow::LogMark& mark) {
return MGITest::PipeStatsWindow::ReadLaneLogSince(mark);
}
static GLenum FirstGLError() {
@@ -500,7 +498,7 @@ void main()
// Taken BEFORE the program is built, so the line this looks for can only be one
// this process wrote. The latch means it is emitted at the FIRST stage of the
// FIRST affected program, which is inside the build below.
const std::uintmax_t before = LibraryLogSize();
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
const GLuint program = BuildPipeline(kDistinctTessEvalSource, kDistinctGeometrySource);
if (program == 0) {