[MG_Remote, MG_Test, ci] (P7): one raw-peer row per latch site and the D11 bounds against a --serve supervisor, each followed by a rendering next session (PH-1 (4), fuzz arm 2)

This commit is contained in:
2026-09-23 13:44:37 -04:00
parent d681d9b1bf
commit ec3758d088
5 changed files with 1858 additions and 4 deletions
+21 -3
View File
@@ -218,6 +218,12 @@ namespace MobileGL::MG_Remote::Server {
MobileGLResult LaunchServer(const std::string& imagePath, const std::string& endpoint,
LaunchedServer* out) {
return LaunchServerWithArgs(imagePath, endpoint, {}, out);
}
MobileGLResult LaunchServerWithArgs(const std::string& imagePath, const std::string& endpoint,
const std::vector<std::string>& extraArgs,
LaunchedServer* out) {
if (out == nullptr || endpoint.empty()) {
return MOBILEGL_ERR_INVALID_ARGUMENT;
}
@@ -240,9 +246,17 @@ namespace MobileGL::MG_Remote::Server {
const std::string::size_type slash = image.find_last_of('/');
ScrubbedEnv env =
BuildChildEnv(slash == std::string::npos ? std::string() : image.substr(0, slash));
std::string argv0 = image;
std::string argv1 = endpoint;
char* argv[] = {argv0.data(), argv1.data(), nullptr};
// Built before the fork: the child may only make async-signal-safe calls until execve.
std::vector<std::string> args;
args.reserve(2 + extraArgs.size());
args.push_back(image);
args.push_back(endpoint);
for (const std::string& arg : extraArgs) args.push_back(arg);
std::vector<char*> argvStorage;
argvStorage.reserve(args.size() + 1);
for (std::string& arg : args) argvStorage.push_back(arg.data());
argvStorage.push_back(nullptr);
char** argv = argvStorage.data();
// A close-on-exec pipe so an execve that fails reports its errno back
// instead of vanishing: the app process's stderr is /dev/null on Android
@@ -339,6 +353,10 @@ namespace MobileGL::MG_Remote::Server {
"(CONTRACT-P6 §2.6); there is no fork() to build a second process from");
return MOBILEGL_ERR_UNSUPPORTED;
}
MobileGLResult LaunchServerWithArgs(const std::string& imagePath, const std::string& endpoint,
const std::vector<std::string>&, LaunchedServer* out) {
return LaunchServer(imagePath, endpoint, out);
}
MobileGLResult ReapServer(LaunchedServer&, std::uint32_t, int*) {
return MOBILEGL_ERR_UNSUPPORTED;
}
+9
View File
@@ -44,6 +44,7 @@
#include <memory>
#include <string>
#include <vector>
namespace MobileGL::MG_Remote::Server {
@@ -74,6 +75,14 @@ namespace MobileGL::MG_Remote::Server {
MobileGLResult LaunchServer(const std::string& imagePath, const std::string& endpoint,
LaunchedServer* out);
// The same launch with arguments after the endpoint - `--serve` for the fork-per-session
// supervisor a TCP deployment runs (ServerMain.cpp). PH-1 (4)'s control needs exactly that
// shape on a unit rig: a session that latches must leave a supervisor that serves the next
// connection, and a single-session server exits with its only session.
MobileGLResult LaunchServerWithArgs(const std::string& imagePath, const std::string& endpoint,
const std::vector<std::string>& extraArgs,
LaunchedServer* out);
// Waits for the child, up to `timeoutMs`. Returns MOBILEGL_ERR_TIMEOUT if it
// is still running, in which case the caller decides whether to escalate -
// this function never signals a child it did not have to.
+20 -1
View File
@@ -26,6 +26,9 @@ if (NOT WIN32)
# P6 sm: two MobileGL processes. Needs the real server image beside it, so
# the dependency is declared after the loop rather than assumed.
list(APPEND MOBILEGL_WIRE_TESTS ServerSpawnTest)
# P7 F2 latch (PH-1 (3)(4), Ph fuzz arm 2): one raw-peer row per latched site against a real
# `--serve` supervisor, each followed by a healthy next session. Needs the server image too.
list(APPEND MOBILEGL_WIRE_TESTS PeerLatchTest)
endif()
include(GoogleTest)
@@ -43,13 +46,23 @@ foreach (test IN LISTS MOBILEGL_WIRE_TESTS)
${MGL_ROOT}/MobileGL
${MGL_ROOT}/3rdparty/flatbuffers/include
)
if (test STREQUAL "PeerLatchTest")
# It builds records and a program archive by hand, so it reaches MG_Pipe and MG_State
# the way the codec suites do.
target_include_directories(${test} PRIVATE
${MGL_ROOT}/MobileGL/MG_Pipe
${MGL_ROOT}/3rdparty/xxHash
${MGL_ROOT}/3rdparty/Vulkan-Headers/include
${MGL_ROOT}/3rdparty/SPIRV-Reflect
)
endif ()
target_link_libraries(${test} PRIVATE
GTest::gtest_main
${LINK_LIBRARIES}
)
if (test STREQUAL "ServerSpawnTest")
if (test STREQUAL "ServerSpawnTest" OR test STREQUAL "PeerLatchTest")
# It execs the real image, so it must be built first and must be told
# where it is. MOBILEGL_TEST_SERVER_PATH is read by the test's
# ServerImage() helper; without it the test would depend on the working
@@ -157,6 +170,12 @@ if (Python3_Interpreter_FOUND)
add_test(NAME ProtocolSchema.RevisionPinsDigest
COMMAND ${Python3_EXECUTABLE} ${MGL_ROOT}/scripts/ci/protocol_revision_pin.py --self-test)
set_tests_properties(ProtocolSchema.RevisionPinsDigest PROPERTIES LABELS unit)
# P7 F2 latch (fuzz arm 2): every per-session latch site in the four PH-1 (3) files has a
# PeerLatchTest row whose marker names it, or is argued unreachable in the script; the
# self-test drops each covering row and requires its site to go unmapped.
add_test(NAME PeerLatch.SiteMap
COMMAND ${Python3_EXECUTABLE} ${MGL_ROOT}/scripts/ci/ph_latch_sites.py --self-test)
set_tests_properties(PeerLatch.SiteMap PROPERTIES LABELS unit)
endif ()
# Ph fuzz arm 3 (PH-6, ID-P7-2): a `--serve` supervisor, a peer that stops draining SEG_EVENT, and
File diff suppressed because it is too large Load Diff