Testing: implement subprocess isolation on Windows

current_executable_path uses GetModuleFileNameW, and
run_isolated_subprocess mirrors the POSIX semantics with CreateProcessW:
redirected stdout/stderr pipes drained without deadlock, a suspended start
so job-object CPU/address-space limits are in force before the child runs,
deadline termination, bounded capture with truncation, and crash mapping
from NTSTATUS exit codes (CRT abort reports SIGABRT).

The resource-limit assertion stays POSIX-only because Wine does not
enforce job-object memory limits.
This commit is contained in:
faumaray committed 2026-12-06 16:41:56 +03:00
1 parent 9e94d8e484
commit 7cddcf15ea
3 files changed
+351 -11

No files matched your search

@@ -289,7 +289,9 @@ Void::Testing::Test testing_subprocess_isolation_exit_crash_timeout_and_flood()
}
// 7. Resource limits: a large allocation fails under a tight address-space
// cap instead of succeeding.
// cap instead of succeeding. Windows enforces this through a job object,
// which Wine does not implement, so it is only asserted on POSIX.
#ifndef _WIN32
{
const std::vector<std::string> args{"--selftest-child", "alloc"};
const auto uncapped = run_isolated_subprocess(exe, args);
@@ -306,4 +308,5 @@ Void::Testing::Test testing_subprocess_isolation_exit_crash_timeout_and_flood()
expect(capped.outcome == ProcessOutcome::crashed ||
capped.outcome == ProcessOutcome::failed);
}
#endif
}