mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 15:33:22 +09:00
[MG_Impl, MG_IntegrationTest, ci] (P7): the compare-at-read hook gets a negative control of its own
- MGPipeVerifyReadHook honours MOBILEGL_PIPE_VERIFY_CORRUPT: it perturbs the ORACLE after CopyField, and AGAIN after the ID-49 neutral-pack overwrite, because that overwrite replaces the pack half wholesale and CorruptStorage perturbs an array's element 0 - which is the pack half - until now the knob only ever reached EntryCompare, so every red it could produce was the client thread's where=entry and the hook that runs on the server's apply thread at every backend read had no falsifier at all - new entry per backend, DirectGLES/DirectVulkan.VerifySplitReadCorrupted., with CORRUPT=GetPixelStoreParameters and VERIFY_FATAL=0 - the field is in the kReadback fill mask, so the client entry compare would otherwise abort the process before the server reached the read - the case reads the SERVER role's half of its private log alone: with the knob armed a union search over both halves would be satisfied by the arm that is not under test - PipeStatsWindow.h gains ReadServerLogSince for that - test.yml grows the matching control step - run the two entries, then re-read both server halves from outside for the where=read report - measured: 2/2 green, server halves 3 and 2 lines, client halves 0 lines; revert-and-run with the two corruption blocks removed gives 2/2 red and both server halves 0 lines - the lane goes 1070 to 1072
This commit is contained in:
@@ -3967,6 +3967,28 @@ if (MOBILEGL_BUILD_DISAGGREGATED AND MOBILEGL_PIPE_VERIFY)
|
||||
ENVIRONMENT "${mglItestVerifyArmEnv}\;MOBILEGL_PIPE_VERIFY_CORRUPT=GetRenderStateParameters\;MOBILEGL_PIPE_VERIFY_FATAL=0\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/pipe-verify-split-corrupt-${mglItestVerifyBackend}.log"
|
||||
RESOURCE_LOCK "pipe-verify-split-corrupt-${mglItestVerifyBackend}.log"
|
||||
)
|
||||
# A ON THE OTHER ARM (P7 wave 3, V1). Control A above perturbs EntryCompare's snapshot,
|
||||
# which runs on the CLIENT thread at a verb boundary and reports `where=entry`; the
|
||||
# compare-at-read hook, which runs on the SERVER's apply thread at every backend read and
|
||||
# is the only comparator that arm ever runs, had no control at all until this entry. The
|
||||
# knob names GetPixelStoreParameters because ReadPixels is where the hook does its one
|
||||
# piece of arm-specific reasoning - the ID-49 neutral pack window, whose oracle it rewrites
|
||||
# - so a control aimed anywhere else would leave exactly that branch unproven.
|
||||
#
|
||||
# FATAL=0 for the corrupt entry's reason and one more: this field IS in kReadback's fill
|
||||
# mask (FillPoints.def), so the client's entry compare fires first and with FATAL at its
|
||||
# default the process would die before the server reached the read. The case reads the
|
||||
# SERVER role's half of its private log and nothing else.
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "${mglItestVerifyBackend}.VerifySplitReadCorrupted."
|
||||
TEST_FILTER "PipeVerifyArmingScenario.CorruptedFieldIsReportedOnTheServerRead"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-verify-split"
|
||||
TIMEOUT ${MGL_ITEST_VERIFY_TIMEOUT}
|
||||
ENVIRONMENT "${mglItestVerifyArmEnv}\;MOBILEGL_PIPE_VERIFY_CORRUPT=GetPixelStoreParameters\;MOBILEGL_PIPE_VERIFY_FATAL=0\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/pipe-verify-split-read-corrupt-${mglItestVerifyBackend}.log"
|
||||
RESOURCE_LOCK "pipe-verify-split-read-corrupt-${mglItestVerifyBackend}.log"
|
||||
)
|
||||
# B (G5): the child brings up its own inproc session from the inherited environment, and
|
||||
# PoisonOmissionScenario's ReadChildLog reads BOTH role halves of the child's log, because
|
||||
# under a transport the poisoned read can fire on either side of the seam.
|
||||
|
||||
@@ -147,6 +147,20 @@ namespace MGITest::PipeStatsWindow {
|
||||
|
||||
inline std::string ReadLaneLog() { return ReadLaneLogSince(LogMark{}); }
|
||||
|
||||
// THE SERVER HALF ALONE, for a claim whose whole content is WHICH ROLE said it. The
|
||||
// concatenation above answers "did anyone report this", which is the right question for a
|
||||
// diagnostic that could honestly come from either side; it is the wrong question for a
|
||||
// control that exists to prove the SERVER's apply thread still runs the comparator, because
|
||||
// the client's own entry compare reports the same field on the same verb and would satisfy a
|
||||
// union search all by itself. Empty in a pull build (there is no server half), which a caller
|
||||
// must read as "could not look" rather than as "the server said nothing".
|
||||
inline std::string ReadServerLogSince(const LogMark& mark) {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
MGPipeSyncPeerLog();
|
||||
#endif
|
||||
return ReadFileSince(ServerLibraryLogPath(), mark.server);
|
||||
}
|
||||
|
||||
// The last summary line in the log, verbatim. `found` is false when the library never emitted
|
||||
// one, which is a different failure from "the counter read zero" and has to be reported as
|
||||
// one: it means the stats channel never reached the process, not that the workload did
|
||||
|
||||
@@ -25,6 +25,15 @@
|
||||
// perturbed before the entry compare, so a comparator that works must
|
||||
// report Fatal{PipeVerifyDiffer, "<Field>@<Verb>"}. A comparator that
|
||||
// compares nothing stays quiet and this case goes red.
|
||||
// CorruptedFieldIsReportedOnTheServerRead
|
||||
// - the same control aimed at the OTHER comparator (P7 wave 3, V1).
|
||||
// The entry compare runs on the client thread at a verb boundary; the
|
||||
// compare-at-read hook runs on the server's apply thread at every
|
||||
// backend read, and until this case existed nothing could tell a hook
|
||||
// that had stopped comparing from a hook with nothing to say. It
|
||||
// reads the SERVER role's half of the log, because with the knob
|
||||
// armed the client reports the same field and a union search would be
|
||||
// satisfied by the arm that is not under test.
|
||||
//
|
||||
// The observable is the library's own log, because MG_Config is not reachable from this module
|
||||
// (on Android it links the SHIPPING libMobileGL.so, built -fvisibility=hidden) and the arming
|
||||
@@ -265,5 +274,83 @@ void main() { o_color = vec4(0.25, 0.5, 0.75, 1.0); }
|
||||
<< appended;
|
||||
}
|
||||
|
||||
// NEGATIVE CONTROL A ON THE OTHER ARM (P7 wave 3, V1): the COMPARE-AT-READ hook, on the
|
||||
// SERVER's apply thread, inside the ID-49 neutral pack window.
|
||||
//
|
||||
// WHY THE CASE ABOVE DOES NOT COVER IT. MOBILEGL_PIPE_VERIFY_CORRUPT used to perturb only
|
||||
// EntryCompare's snapshot, so every red it could produce came from the CLIENT thread at a
|
||||
// verb boundary and said `where=entry`. The hook that runs on every backend read - the
|
||||
// whole of the split lane's per-read work, and the only comparator the server's apply
|
||||
// thread ever runs - had no falsifier: a hook that had stopped comparing looked exactly
|
||||
// like a hook with nothing to report, and the lane would have been just as green.
|
||||
//
|
||||
// WHY THIS FIELD AND THIS VERB. GetPixelStoreParameters@ReadPixels is where the hook does
|
||||
// its one piece of ARM-SPECIFIC reasoning (PipeFill.cpp's
|
||||
// ServerReadsInsideTheNeutralPackWindow): the applier reads the backend with the neutral
|
||||
// pack, so inside that window the oracle for the pack half is the neutral pack rather than
|
||||
// the live context. A control aimed anywhere else would leave exactly that branch unproven.
|
||||
//
|
||||
// THE SERVER HALF, NOT THE UNION. With this knob armed the client's own entry compare
|
||||
// reports `GetPixelStoreParameters@...` too, in the client's log, so a whole-lane search
|
||||
// would be satisfied without the server having run anything at all. The assertion below
|
||||
// reads the server role's half and nothing else.
|
||||
//
|
||||
// MOBILEGL_PIPE_VERIFY_FATAL=0, for CorruptedFieldIsReported's reason and one more: the
|
||||
// client's entry compare on the ReadPixels verb fires FIRST (kReadback's fill mask carries
|
||||
// this field, FillPoints.def), so with FATAL at its default the process would abort before
|
||||
// the server ever reached the read.
|
||||
TEST_F(PipeVerifyArmingScenario, CorruptedFieldIsReportedOnTheServerRead) {
|
||||
if (!Ready()) return;
|
||||
|
||||
constexpr const char* kPackField = "GetPixelStoreParameters";
|
||||
const char* knob = std::getenv("MOBILEGL_PIPE_VERIFY_CORRUPT");
|
||||
if (knob == nullptr || std::string(knob) != kPackField) {
|
||||
GTEST_SKIP() << "this case is the compare-at-read hook's negative control and needs "
|
||||
"MOBILEGL_PIPE_VERIFY_CORRUPT=" << kPackField << " for the whole "
|
||||
"process, which is what the VerifySplitReadCorrupted. ctest entries "
|
||||
"set; no other field is read by the server inside a window whose "
|
||||
"oracle the hook rewrites";
|
||||
}
|
||||
if (AmbientQuirkFromEnvironment("MOBILEGL_PIPE_VERIFY") != AmbientQuirk::On) {
|
||||
GTEST_SKIP() << "MOBILEGL_PIPE_VERIFY_CORRUPT is set but MOBILEGL_PIPE_VERIFY is not, so "
|
||||
"the comparator is dormant and there is nothing to corrupt";
|
||||
}
|
||||
if (LibraryLogPath().empty()) {
|
||||
GTEST_SKIP() << "MOBILEGL_LOG_FILE_PATH is not set, so the library has nowhere to report "
|
||||
"the divergence; the VerifySplitReadCorrupted. ctest entries set both";
|
||||
}
|
||||
if (MGITest::PipeStatsWindow::ServerLibraryLogPath().empty()) {
|
||||
GTEST_SKIP() << "this build writes no server-role log, so there is no half in which the "
|
||||
"server's own report could be told apart from the client's; the hook's "
|
||||
"read arm is registered on the split (inproc) lane only";
|
||||
}
|
||||
|
||||
const MGITest::PipeStatsWindow::LogMark before = LibraryLogMark();
|
||||
ASSERT_NO_FATAL_FAILURE(DrawOneFrame());
|
||||
|
||||
const std::string server = MGITest::PipeStatsWindow::ReadServerLogSince(before);
|
||||
const std::string expected =
|
||||
std::string(kDifferPrefix) + ", \"" + kPackField + "@ReadPixels\"";
|
||||
const std::size_t at = server.find(expected);
|
||||
ASSERT_NE(at, std::string::npos)
|
||||
<< "MOBILEGL_PIPE_VERIFY_CORRUPT=" << kPackField << " perturbs the hook's ORACLE at "
|
||||
"every backend read of that field, and the server's read_pixels reads it under "
|
||||
"the server's own stamp - so the server role's log had to carry " << expected
|
||||
<< ", ...}. It carried nothing: either the compare-at-read hook is not running on "
|
||||
"the apply thread, or the neutral-pack window swallowed the perturbation, and "
|
||||
"in both cases every per-read green in this lane is green for no reason. Server "
|
||||
"half of the log appended by this case:\n"
|
||||
<< server;
|
||||
|
||||
const std::size_t eol = server.find('\n', at);
|
||||
const std::string line =
|
||||
server.substr(at, eol == std::string::npos ? std::string::npos : eol - at);
|
||||
EXPECT_NE(line.find("where=read"), std::string::npos)
|
||||
<< "the server half reported the corrupted field, but not from the compare-at-read "
|
||||
"arm - `where=` says which comparator spoke, and only `read` is this case's "
|
||||
"subject. Line:\n"
|
||||
<< line;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace MGITest
|
||||
|
||||
Reference in New Issue
Block a user