2.4 KiB
2.4 KiB
P0 Process Test Environment Isolation
Task ID: X-BASE-01 Phase: P0 Status: APPROVED
1. Context and baseline
tests/standalone/System/Process.cpp currently invokes /bin/echo, /bin/cat, and shell("seq 1 10000"). On NixOS and minimal container hosts without /bin/echo, /bin/cat, or seq in PATH, those tests fail with child exit code 127.
2. Deliverables
- Controlled standard-library helper executable
tests/helpers/ProcessHelper.cpp(VoidProcessHelper). - CMake wiring in
tests/CMakeLists.txtdefiningVOID_PROCESS_HELPER_PATHwhenVoidTestsandVoid::Systemare built. - Updated
tests/standalone/System/Process.cppusingVOID_PROCESS_HELPER_PATHinstead of host/bin/echo,/bin/cat, orseq.
3. Exact files and interfaces
tests/helpers/ProcessHelper.cpp:echo [args...]: prints space-separated args +\n, exits0.cat: copies raw stdin to stdout in 4096-byte chunks until EOF, exits0.seq <start> <end>: prints signed 64-bit integers inclusive one per line, exits0.streams: writes"to_stdout\n"tostdoutand"to_stderr\n"tostderr, exits0.exit <code>: exits with parsed integer status code.lines [--no-newline] [--stderr] [items...]: emits lines to stdout or stderr.- Invalid usage: prints diagnostic to
stderrand exits2.
tests/CMakeLists.txt: buildVoidProcessHelperwith C++26 (VOID_TESTING_NO_AUTO_SCAN TRUE) and passVOID_PROCESS_HELPER_PATH="$<TARGET_FILE:VoidProcessHelper>"toVoidTests.tests/standalone/System/Process.cpp: replace hardcoded host commands; keep shell builtin tests (/bin/shecho/exit) andrun_missing_executable_returns_code_127; add direct argvexit 42andstreamstests viaVOID_PROCESS_HELPER_PATH.
4. Edge cases
- Helper binary uses only the C++ standard library (no
Void::module dependencies) so it cannot mask failures inVoid::System. - Numeric parsing in
seqandexitusesstd::from_charsand rejects malformed/partial inputs with exit2.
5. Acceptance criteria
ProcessandProcessStreamsuites pass with 0 failures on NixOS without/bin/echo,/bin/cat, orseq.- Full
VoidTestspasses with 0 failures (only existing intentional skip demonstrations inTesting/Math.cpp).
6. Verification commands
cmake --build /tmp/void-p0-base --parallel 4
/tmp/void-p0-base/tests/VoidTests --filter "Process*"