mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 16:31:57 +09:00
[Test] (P11 B2): T0 protocol on the host - the Offer inbox (late, out of order, stale, missing) over both aux channels, the whole T0 path on a stand-in platform, A1's two handshake-Fatal cases rewritten as named fallbacks, revision 4 refused by name, AdoptTier0 lanes on the shared-segment arms and the allow switch through spawn
This commit is contained in:
@@ -2483,6 +2483,41 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
)
|
||||
list(APPEND MGL_SPLIT_ARM_TEST_LISTS "MGL_SPLIT_ARM_TESTS_${MGL_SPLIT_ARM_INDEX}")
|
||||
math(EXPR MGL_SPLIT_ARM_INDEX "${MGL_SPLIT_ARM_INDEX} + 1")
|
||||
# P11 B2 (CONTRACT-P11 B2): THE SHARED-SEGMENT ARMS WITH MOBILEGL_IPC_ADOPT_TIER=0, which A1 made
|
||||
# die at the handshake and B2 turned into an ASK. A host has no AHardwareBuffer, so the server
|
||||
# refuses T0 by name at its first native bind, publishes no kCapAdoptT0, and the client falls
|
||||
# back to T2 with one named line at its first map_persistent: every case green, the arena
|
||||
# emulated (SplitLogPaths declares it), ASessionThatCannotRunT0FallsBackToT2OnceByName reading
|
||||
# the two lines. `.AdoptT0Disallowed.` is the same on the spawn arm with the server's allow switch
|
||||
# off - which also proves MOBILEGL_IPC_ALLOW_ADOPT_T0 survives ServerSpawn's environment scrub.
|
||||
foreach(mglT0Arm IN ITEMS Split Spawn)
|
||||
string(TOUPPER "${mglT0Arm}" mglT0ArmUpper)
|
||||
string(TOLOWER "${mglT0Arm}" mglT0ArmLower)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectGLES.${mglT0Arm}.AdoptTier0."
|
||||
TEST_LIST "MGL_SPLIT_ARM_TESTS_${MGL_SPLIT_ARM_INDEX}"
|
||||
TEST_FILTER "LargeArenaAdoptionScenario.*"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-gpu\;integration-${mglT0ArmLower}"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_${mglT0ArmUpper}_ENVIRONMENT}\;MOBILEGL_IPC_ADOPT_TIER=0\;MGITEST_ADOPT_T0_FALLBACK=no AHardwareBuffer"
|
||||
)
|
||||
list(APPEND MGL_SPLIT_ARM_TEST_LISTS "MGL_SPLIT_ARM_TESTS_${MGL_SPLIT_ARM_INDEX}")
|
||||
math(EXPR MGL_SPLIT_ARM_INDEX "${MGL_SPLIT_ARM_INDEX} + 1")
|
||||
endforeach()
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectGLES.Spawn.AdoptT0Disallowed."
|
||||
TEST_LIST "MGL_SPLIT_ARM_TESTS_${MGL_SPLIT_ARM_INDEX}"
|
||||
TEST_FILTER "LargeArenaAdoptionScenario.ASessionThatCannotRunT0FallsBackToT2OnceByName:LargeArenaAdoptionScenario.TheArenaLandsInTheTierItsLaneDeclares"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES
|
||||
LABELS "integration-gpu\;integration-spawn"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_SPAWN_ENVIRONMENT}\;MOBILEGL_IPC_ADOPT_TIER=0\;MOBILEGL_IPC_ALLOW_ADOPT_T0=0\;MGITEST_ADOPT_T0_FALLBACK=disallowed"
|
||||
)
|
||||
list(APPEND MGL_SPLIT_ARM_TEST_LISTS "MGL_SPLIT_ARM_TESTS_${MGL_SPLIT_ARM_INDEX}")
|
||||
math(EXPR MGL_SPLIT_ARM_INDEX "${MGL_SPLIT_ARM_INDEX} + 1")
|
||||
|
||||
# ---- P3b/P4b espryt D1 slice 1: THE ORPHANED XFB CAPTURE TARGET -------------------------
|
||||
#
|
||||
@@ -3864,21 +3899,27 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
${mglItestArmProperties}
|
||||
ENVIRONMENT "${mglItestMagmaBandEnvironment}\;MGITEST_PERSISTENT_MAP_ARM=emulated\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/p11-arena${mglItestArmLogTag}-${arenaCase}.log")
|
||||
endforeach()
|
||||
# P11 A1 (CONTRACT-P11 §1): the tcp arm with MOBILEGL_IPC_ADOPT_TIER=0 - refused by name at
|
||||
# the client's handshake, T2, the scenario green. TCP ONLY by construction (over shared
|
||||
# segments the knob dies at the handshake); spawn_lane_parity.py names the tail in
|
||||
# MAGMA_TCP_ONLY.
|
||||
# P11 A1 + B2 (CONTRACT-P11 §1, B2): MOBILEGL_IPC_ADOPT_TIER=0 on every arm, one case set.
|
||||
# On tcp a stream refuses the tier by name at the client's handshake (A1, the stream case
|
||||
# reads the line); over shared segments (split, spawn) the knob ASKS T0, a host has no
|
||||
# AHardwareBuffer, and the session falls back to T2 by name (B2, the fallback case reads
|
||||
# both lines). Each arm's marker makes the other arm's case skip, so the three arms carry
|
||||
# the same names and spawn_lane_parity.py compares them like any other lane.
|
||||
if(mglItestArm STREQUAL "Tcp")
|
||||
foreach(arenaCase IN LISTS MGL_ITEST_ARENA_CASES ITEMS AStreamSessionRefusesTheAdoptTierOnceByName)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectVulkan.Tcp.AdoptTier0."
|
||||
TEST_FILTER "LargeArenaAdoptionScenario.${arenaCase}"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES LABELS "${mglItestMagmaLabels}" TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
${mglItestArmProperties}
|
||||
ENVIRONMENT "${mglItestMagmaBandEnvironment}\;MOBILEGL_IPC_ADOPT_TIER=0\;MGITEST_ADOPT_TIER_REFUSAL=T0\;MGITEST_PERSISTENT_MAP_ARM=emulated\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/p11-adopt-tier0-tcp-${arenaCase}.log")
|
||||
endforeach()
|
||||
set(mglItestAdoptTier0Env "MGITEST_ADOPT_TIER_REFUSAL=T0")
|
||||
else()
|
||||
set(mglItestAdoptTier0Env "MGITEST_ADOPT_T0_FALLBACK=no AHardwareBuffer")
|
||||
endif()
|
||||
foreach(arenaCase IN LISTS MGL_ITEST_ARENA_CASES ITEMS AStreamSessionRefusesTheAdoptTierOnceByName
|
||||
ASessionThatCannotRunT0FallsBackToT2OnceByName)
|
||||
gtest_discover_tests(MobileGLIntegrationTest
|
||||
TEST_PREFIX "DirectVulkan.${mglItestArm}.AdoptTier0."
|
||||
TEST_FILTER "LargeArenaAdoptionScenario.${arenaCase}"
|
||||
DISCOVERY_TIMEOUT 30
|
||||
PROPERTIES LABELS "${mglItestMagmaLabels}" TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
${mglItestArmProperties}
|
||||
ENVIRONMENT "${mglItestMagmaBandEnvironment}\;MOBILEGL_IPC_ADOPT_TIER=0\;${mglItestAdoptTier0Env}\;MGITEST_PERSISTENT_MAP_ARM=emulated\;MOBILEGL_LOG_FILE_PATH=${CMAKE_CURRENT_BINARY_DIR}/p11-adopt-tier0${mglItestArmLogTag}-${arenaCase}.log")
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@ void main() { word = 0xC0FFEEu; }
|
||||
// P11 A1: set (to the tier the lane names, "T0") only by the `.AdoptTier0.` tcp entries,
|
||||
// which also set MOBILEGL_IPC_ADOPT_TIER=0; a harness marker, never read by the library.
|
||||
constexpr const char* kAdoptTierRefusalMarker = "MGITEST_ADOPT_TIER_REFUSAL";
|
||||
// P11 B2: set by the shared-segment `.AdoptTier0.` / `.AdoptT0Disallowed.` entries to the reason word the
|
||||
// server gives for not granting T0 ("no AHardwareBuffer" on a host, "disallowed" with its allow switch off).
|
||||
constexpr const char* kAdoptT0FallbackMarker = "MGITEST_ADOPT_T0_FALLBACK";
|
||||
// Draws issued against the arena inside the counted window. One definition, many draws:
|
||||
// "one per definition" (1) and "one per draw" (kDrawsInTheWindow) have to be different
|
||||
// numbers or the assertion cannot tell them apart.
|
||||
@@ -619,4 +622,52 @@ void main() { word = 0xC0FFEEu; }
|
||||
EXPECT_EQ(log.find("Fatal{UnimplementedAdoptTier"), std::string::npos) << log;
|
||||
}
|
||||
|
||||
// P11 B2 (MG_Remote/CONTRACT-P11.md B2): A SHARED-SEGMENT SESSION THAT ASKS T0 AND CANNOT RUN IT.
|
||||
// MOBILEGL_IPC_ADOPT_TIER=0 over shared segments asks T0 in the Hello (A1 made it die at the
|
||||
// handshake; ruling ID-P11-14 made it this). The lane's server cannot grant it - a host has no
|
||||
// AHardwareBuffer, or `.AdoptT0Disallowed.` turned its allow switch off - so it refuses by name
|
||||
// at its first native bind, publishes no kCapAdoptT0, and the client falls back to T2 with ONE
|
||||
// named line at its first map_persistent. Never a Fatal; the other cases in the lane are green
|
||||
// and the arena is emulated. Everywhere else it skips.
|
||||
TEST_F(LargeArenaAdoptionScenario, ASessionThatCannotRunT0FallsBackToT2OnceByName) {
|
||||
if (!Ready() || IsSkipped()) return;
|
||||
const char* why = std::getenv(kAdoptT0FallbackMarker);
|
||||
if (why == nullptr || why[0] == '\0') {
|
||||
GTEST_SKIP() << "runs only in the shared-segment `.AdoptTier0.` / `.AdoptT0Disallowed.` entries, "
|
||||
"which set MOBILEGL_IPC_ADOPT_TIER=0 and " << kAdoptT0FallbackMarker;
|
||||
}
|
||||
if (PipeStatsWindow::LibraryLogPath().empty()) {
|
||||
GTEST_SKIP() << "the lane configured no MOBILEGL_LOG_FILE_PATH, and the two logs are where the "
|
||||
"fallback is written";
|
||||
}
|
||||
// A frame of the arena's work first: the fallback is only worth reading from a session that
|
||||
// then ran on T2 - and the client decides at its first map_persistent, which SetUp's
|
||||
// definition of the arena has already made.
|
||||
UploadQuad(0.f, 1.f, 0.f);
|
||||
DrawQuad();
|
||||
EXPECT_GT(CenterPixel()[1], 200) << "the session that fell back to T2 did not render";
|
||||
EXPECT_EQ(FirstGLError(), 0u);
|
||||
Gl().EndFrame();
|
||||
|
||||
const auto countOf = [](const std::string& text, const std::string& needle) {
|
||||
std::size_t n = 0;
|
||||
for (auto at = text.find(needle); at != std::string::npos; at = text.find(needle, at + 1)) ++n;
|
||||
return n;
|
||||
};
|
||||
const std::string client = PipeStatsWindow::ReadWholeFile(PipeStatsWindow::LibraryLogPath());
|
||||
const std::string server = PipeStatsWindow::ReadServerLogSince(PipeStatsWindow::LogMark{});
|
||||
const std::string clientLine = "Refuse{AdoptT0Unavailable, \"no kCapAdoptT0\"}";
|
||||
const std::string serverLine = std::string("Refuse{AdoptT0Unavailable, \"") + why + "\"}";
|
||||
RecordProperty("t0_client_fallbacks", static_cast<int>(countOf(client, clientLine)));
|
||||
RecordProperty("t0_server_refusals", static_cast<int>(countOf(server, serverLine)));
|
||||
EXPECT_EQ(countOf(client, clientLine), 1u)
|
||||
<< "the client names a T0 it asked for and cannot run exactly once, at its first map_persistent ("
|
||||
<< clientLine << "), in " << PipeStatsWindow::LibraryLogPath();
|
||||
EXPECT_EQ(countOf(server, serverLine), 1u)
|
||||
<< "the server names why it did not grant T0 exactly once, at its first native bind (" << serverLine
|
||||
<< "), in " << PipeStatsWindow::ServerLibraryLogPath();
|
||||
EXPECT_EQ(client.find("Fatal{"), std::string::npos) << client;
|
||||
EXPECT_EQ(server.find("Fatal{"), std::string::npos) << server;
|
||||
}
|
||||
|
||||
} // namespace MGITest
|
||||
|
||||
Reference in New Issue
Block a user