mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 15:33:22 +09:00
[WIP] (MG_Remote): implement P6.5 TCP and stream transport
This commit is contained in:
@@ -2003,6 +2003,38 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
"MOBILEGL_IPC_SERVER_PATH=${MGL_ITEST_SPLIT_SERVER_PATH}" "MGITEST_SPLIT_LANE=1"
|
||||
${MGL_ITEST_CAPABILITY_ENV} ${MGL_ITEST_COMMON_ENV})
|
||||
|
||||
# A single supervisor serves one session at a time. Fixture teardown also reaps a
|
||||
# child left behind by a failed client; the resource lock serializes this lane.
|
||||
set(MOBILEGL_ITEST_TCP_ENDPOINT "tcp://127.0.0.1:40613" CACHE STRING "Loopback TCP integration endpoint")
|
||||
set(MOBILEGL_ITEST_TCP_DEVICE_ENDPOINT "" CACHE STRING "Optional device TCP integration endpoint")
|
||||
set(MOBILEGL_ITEST_TCP_DEVICE_TOKEN "" CACHE STRING "Token for the device TCP integration endpoint")
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
set(MGL_TCP_FIXTURE "${CMAKE_SOURCE_DIR}/scripts/ci/tcp_server_fixture.py")
|
||||
set(MGL_TCP_STATE "${CMAKE_CURRENT_BINARY_DIR}/tcp-server.json")
|
||||
add_test(NAME TcpServer.Start COMMAND "${Python3_EXECUTABLE}" "${MGL_TCP_FIXTURE}"
|
||||
start --server "${MGL_ITEST_SPLIT_SERVER_PATH}" --endpoint "${MOBILEGL_ITEST_TCP_ENDPOINT}"
|
||||
--state "${MGL_TCP_STATE}")
|
||||
add_test(NAME TcpServer.Stop COMMAND "${Python3_EXECUTABLE}" "${MGL_TCP_FIXTURE}"
|
||||
stop --state "${MGL_TCP_STATE}")
|
||||
set_tests_properties(TcpServer.Start PROPERTIES FIXTURES_SETUP mobilegl-tcp TIMEOUT 20)
|
||||
set_tests_properties(TcpServer.Stop PROPERTIES FIXTURES_CLEANUP mobilegl-tcp TIMEOUT 20)
|
||||
add_test(NAME TcpLane.AccountingControls COMMAND "${Python3_EXECUTABLE}"
|
||||
"${CMAKE_SOURCE_DIR}/scripts/ci/tcp_lane_tools_test.py")
|
||||
set_tests_properties(TcpLane.AccountingControls PROPERTIES LABELS unit TIMEOUT 20)
|
||||
mgl_itest_join_environment(MGL_ITEST_GLES_TCP_ENVIRONMENT
|
||||
"MOBILEGL_BACKEND_TYPE=DirectGLES" "MOBILEGL_TRANSPORT=spawn"
|
||||
"MOBILEGL_IPC_CONTROL=${MOBILEGL_ITEST_TCP_ENDPOINT}" "MOBILEGL_IPC_DATA=stream"
|
||||
"MOBILEGL_IPC_REQUIRE_SAME_BUILD=1" "MOBILEGL_IPC_LOG_FORWARD=1" "MOBILEGL_IPC_TOKEN="
|
||||
"MGITEST_SPLIT_LANE=1" "MGITEST_TCP_LANE=1" "MOBILEGL_ITEST_REQUIRE_GPU=1"
|
||||
${MGL_ITEST_CAPABILITY_ENV} ${MGL_ITEST_COMMON_ENV})
|
||||
mgl_itest_join_environment(MGL_ITEST_GLES_TCPDEVICE_ENVIRONMENT
|
||||
"MOBILEGL_BACKEND_TYPE=DirectGLES" "MOBILEGL_TRANSPORT=spawn"
|
||||
"MOBILEGL_IPC_CONTROL=${MOBILEGL_ITEST_TCP_DEVICE_ENDPOINT}" "MOBILEGL_IPC_DATA=stream"
|
||||
"MOBILEGL_IPC_REQUIRE_SAME_BUILD=1" "MOBILEGL_IPC_LOG_FORWARD=1"
|
||||
"MOBILEGL_IPC_TOKEN=${MOBILEGL_ITEST_TCP_DEVICE_TOKEN}"
|
||||
"MGITEST_SPLIT_LANE=1" "MGITEST_TCP_LANE=1" "MOBILEGL_ITEST_REQUIRE_GPU=1"
|
||||
${MGL_ITEST_CAPABILITY_ENV} ${MGL_ITEST_COMMON_ENV})
|
||||
|
||||
# scenarioFilter, a PREFIX TAIL (empty for most; "F1." and "Ct." for the two per-slot loops,
|
||||
# which name their sub-lane in the test name), then zero or more EXTRA LABEL STEMS. A stem is
|
||||
# suffixed with the arm's own name (`integration-clientarrays` becomes `-split` on one arm and
|
||||
@@ -2017,9 +2049,20 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
set(MGL_SPLIT_ARM_TEST_LISTS "")
|
||||
set(MGL_SPLIT_ARM_INDEX 0)
|
||||
macro(mgl_itest_register_split_arms scenarioFilter prefixTail)
|
||||
foreach(mglItestArm IN ITEMS Split Spawn)
|
||||
set(mglItestArms Split Spawn Tcp)
|
||||
if(MOBILEGL_ITEST_TCP_DEVICE_ENDPOINT)
|
||||
list(APPEND mglItestArms TcpDevice)
|
||||
endif()
|
||||
foreach(mglItestArm IN LISTS mglItestArms)
|
||||
string(TOLOWER "${mglItestArm}" mglItestArmLower)
|
||||
string(TOUPPER "${mglItestArm}" mglItestArmUpper)
|
||||
set(mglItestArmProperties)
|
||||
if(mglItestArm STREQUAL "Tcp")
|
||||
set(mglItestArmProperties FIXTURES_REQUIRED mobilegl-tcp RESOURCE_LOCK mobilegl-tcp)
|
||||
elseif(mglItestArm STREQUAL "TcpDevice")
|
||||
set(mglItestArmLower tcp-device)
|
||||
set(mglItestArmProperties RESOURCE_LOCK mobilegl-tcp-device)
|
||||
endif()
|
||||
set(mglItestArmLabels "integration-gpu\\;integration-${mglItestArmLower}")
|
||||
foreach(mglItestExtra IN ITEMS ${ARGN})
|
||||
set(mglItestArmLabels "${mglItestArmLabels}\\;${mglItestExtra}-${mglItestArmLower}")
|
||||
@@ -2042,6 +2085,7 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
|
||||
LABELS "${mglItestArmLabels}"
|
||||
TIMEOUT ${MGL_ITEST_TIMEOUT}
|
||||
ENVIRONMENT "${MGL_ITEST_GLES_${mglItestArmUpper}_ENVIRONMENT}"
|
||||
${mglItestArmProperties}
|
||||
)
|
||||
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")
|
||||
|
||||
@@ -327,7 +327,18 @@ namespace MGITest {
|
||||
// has thought of. Only then does the parent do the real bring-up.
|
||||
//
|
||||
// Returns an empty string when the platform survived a full bring-up.
|
||||
bool RemoteConnectRequested() {
|
||||
const char* control = std::getenv("MOBILEGL_IPC_CONTROL");
|
||||
return control != nullptr && std::strncmp(control, "tcp://", 6) == 0;
|
||||
}
|
||||
|
||||
std::string PreflightBringUp() {
|
||||
// Connect already isolates driver setup in the server's session
|
||||
// child. A local pre-flight would consume a remote session, then
|
||||
// race its teardown and make the actual test receive Refuse{Busy}.
|
||||
if (RemoteConnectRequested()) {
|
||||
return {};
|
||||
}
|
||||
#if !MGITEST_HAVE_FORK_PREFLIGHT
|
||||
// No fork(): let the in-process bring-up speak for itself, which is
|
||||
// what this module did before. Windows/macOS are not CI targets for
|
||||
@@ -585,7 +596,9 @@ namespace MGITest {
|
||||
// That is a real result, not a machine without a GPU, so say so: it
|
||||
// means something is different between the two attempts (a leaked
|
||||
// exclusive device, an environment the child did not have).
|
||||
m_skipReason = reason + " - although an identical bring-up in a forked pre-flight child succeeded";
|
||||
m_skipReason = reason + (RemoteConnectRequested()
|
||||
? " - remote TCP bring-up failed"
|
||||
: " - although an identical bring-up in a forked pre-flight child succeeded");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
extern "C" void MGPipeSyncPeerLog();
|
||||
#endif
|
||||
|
||||
namespace MGITest::PipeStatsWindow {
|
||||
|
||||
// P6: MOBILEGL_LOG_FILE_PATH IS A BASE NAME, NOT A FILE. The library writes one log per
|
||||
@@ -121,6 +125,9 @@ namespace MGITest::PipeStatsWindow {
|
||||
}
|
||||
|
||||
inline LogMark MarkLaneLog() {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
MGPipeSyncPeerLog();
|
||||
#endif
|
||||
return LogMark{FileSizeOrZero(LibraryLogPath()), FileSizeOrZero(ServerLibraryLogPath())};
|
||||
}
|
||||
|
||||
@@ -131,6 +138,9 @@ namespace MGITest::PipeStatsWindow {
|
||||
// which is the most expensive possible way to be wrong: it accuses the product of a defect
|
||||
// that the reader itself invented.
|
||||
inline std::string ReadLaneLogSince(const LogMark& mark) {
|
||||
#if MOBILEGL_BUILD_DISAGGREGATED
|
||||
MGPipeSyncPeerLog();
|
||||
#endif
|
||||
return ReadFileSince(LibraryLogPath(), mark.client)
|
||||
+ ReadFileSince(ServerLibraryLogPath(), mark.server);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#if defined(__linux__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -152,6 +156,18 @@ namespace MGITest {
|
||||
RecordProperty("split_transport", state.transportName);
|
||||
RecordProperty("split_implemented_verbs", static_cast<int>(state.implementedVerbs));
|
||||
RecordProperty("split_emit_seq_at_setup", static_cast<int>(state.emitSeq));
|
||||
#if defined(__linux__)
|
||||
if (std::getenv("MGITEST_TCP_LANE")) {
|
||||
// Connect must never silently launch a local server. The
|
||||
// companion log gate proves the remote Welcome pid/endpoint.
|
||||
std::ifstream children("/proc/self/task/" + std::to_string(::getpid()) + "/children");
|
||||
ASSERT_TRUE(children.good()) << "TCP topology proof cannot read /proc children";
|
||||
int child = 0;
|
||||
ASSERT_FALSE(static_cast<bool>(children >> child))
|
||||
<< "Dial=Connect created a local server child: " << child;
|
||||
RecordProperty("tcp_local_children", 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// A scenario starts from a clean slate but shares the context (and so
|
||||
// the renderer's memos) with every other scenario in this process -
|
||||
|
||||
@@ -48,7 +48,8 @@ def paths(document):
|
||||
props = {p["name"]: p["value"] for p in test.get("properties", [])}
|
||||
values = [v.split("=", 1)[1] for v in props.get("ENVIRONMENT", [])
|
||||
if v.startswith("MOBILEGL_LOG_FILE_PATH=")]
|
||||
is_split = test["name"].startswith(("DirectGLES.Split.", "DirectVulkan.Split."))
|
||||
is_split = test["name"].startswith(("DirectGLES.Split.", "DirectVulkan.Split.",
|
||||
"DirectGLES.Spawn.", "DirectGLES.Tcp.", "DirectGLES.TcpDevice."))
|
||||
if is_split and (len(values) != 1 or not values[0]):
|
||||
raise ValueError(f"{test['name']}: requires exactly one nonempty MOBILEGL_LOG_FILE_PATH")
|
||||
for value in values:
|
||||
|
||||
Reference in New Issue
Block a user