fix(testmode): skip the fd-inheritance probe when its helper is absent
The probe spawns a hand-built /tmp/checkfd binary that exists only on machines where the T-438-era investigation ran; everywhere else it failed the whole harness with a ProcessException. Absence is now an explicit skip line, and the helper path is a named constant in both the io and web-stub variants. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,10 @@ import 'package:ffi/ffi.dart' as pkg_ffi;
|
|||||||
|
|
||||||
import 'src/pty/ffi/libc.dart' as libc;
|
import 'src/pty/ffi/libc.dart' as libc;
|
||||||
|
|
||||||
|
/// The hand-built helper binary the probe spawns. Not part of the repo — the
|
||||||
|
/// harness skips this probe when it is absent.
|
||||||
|
const fdCheckHelperPath = '/tmp/checkfd';
|
||||||
|
|
||||||
/// Probe whether `Process.start` inherits socket fds (the macOS question the
|
/// Probe whether `Process.start` inherits socket fds (the macOS question the
|
||||||
/// testmode harness answers). Returns a human-readable result line.
|
/// testmode harness answers). Returns a human-readable result line.
|
||||||
Future<String> fdInheritanceCheck() async {
|
Future<String> fdInheritanceCheck() async {
|
||||||
@@ -20,7 +24,7 @@ Future<String> fdInheritanceCheck() async {
|
|||||||
final parent = sv[0];
|
final parent = sv[0];
|
||||||
final child = sv[1];
|
final child = sv[1];
|
||||||
pkg_ffi.calloc.free(sv);
|
pkg_ffi.calloc.free(sv);
|
||||||
final proc = await Process.start('/tmp/checkfd', [], environment: {...Platform.environment, 'PTYC_SOCK_FD': '$child'});
|
final proc = await Process.start(fdCheckHelperPath, [], environment: {...Platform.environment, 'PTYC_SOCK_FD': '$child'});
|
||||||
final stderr = await proc.stderr.transform(utf8.decoder).join();
|
final stderr = await proc.stderr.transform(utf8.decoder).join();
|
||||||
final exit = await proc.exitCode;
|
final exit = await proc.exitCode;
|
||||||
libc.close(parent);
|
libc.close(parent);
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
/// Web stub (T-438 web fence, D-100): no FFI fd-inheritance probe on web.
|
/// Web stub (T-438 web fence, D-100): no FFI fd-inheritance probe on web.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
|
/// Mirrors [fd_check_io.dart]; never exists on web, so the probe is skipped.
|
||||||
|
const fdCheckHelperPath = '/tmp/checkfd';
|
||||||
|
|
||||||
Future<String> fdInheritanceCheck() async => 'skipped (no FFI on web)';
|
Future<String> fdInheritanceCheck() async => 'skipped (no FFI on web)';
|
||||||
|
|||||||
+7
-1
@@ -381,7 +381,13 @@ class _ClideTestAppState extends State<ClideTestApp> {
|
|||||||
|
|
||||||
// Test: does Dart's Process.start inherit socket fds on macOS? (T-438: the
|
// Test: does Dart's Process.start inherit socket fds on macOS? (T-438: the
|
||||||
// FFI body lives in fd_check_io.dart so the web build can stub it out.)
|
// FFI body lives in fd_check_io.dart so the web build can stub it out.)
|
||||||
await _testAsync('fd inheritance check', fdInheritanceCheck);
|
// The probe needs the hand-built /tmp/checkfd helper; on machines without
|
||||||
|
// it, skip explicitly rather than failing the whole harness.
|
||||||
|
if (File(fdCheckHelperPath).existsSync()) {
|
||||||
|
await _testAsync('fd inheritance check', fdInheritanceCheck);
|
||||||
|
} else {
|
||||||
|
_say('skip | fd inheritance check | $fdCheckHelperPath not present (hand-built probe helper — see fd_check_io.dart)');
|
||||||
|
}
|
||||||
|
|
||||||
_say('');
|
_say('');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user