3.1 KiB
3.1 KiB
Testing Per-Run Reporters, Subprocess Isolation, and Deterministic Harness
Task ID: M-TESTING-02, M-TESTING-03 Phase: P1 Status: APPROVED Contracts: C-01, C-04, C-16
1. Context and baseline
Testing (Runner.cpp, Assert.cpp, Config.hpp, JUnitReporter.cpp) currently uses a process-global static std::ofstream for JUnit reporting, silently turns malformed regex or empty explicit filter selections into passing 0-test runs, retains unbounded per-test assertions, and lacks owned FailureCapture, isolated subprocess test execution, versioned deterministic property shrinking, and clock/order-controlled DeterministicRun.
2. Deliverables
- Updated
include/Void/Testing/{Config,Assert,Runner}.hppandsrc/Testing/{Assert,Runner}.cpp:- Per-run owned JUnit stream checking open/write health cleanly.
- Strict CLI/config validation (invalid regex, unknown reporter, unopenable output path, empty selection without
--allow-emptyfail with exit code 2). - Bounded per-test assertion retention (
1000assertions /1 MiBdiagnostics) and stray-assertion counter. - Single-teardown fixture lifecycle recording teardown errors in
cleanup_errorwithout masking primary test failure. --selftest-child <abort|hang|flood>fixtures insideRunner::main.
- New
include/Void/Testing/Capture.hpp(FailureCapture) andinclude/Void/Testing/{Subprocess.hpp}+src/Testing/Subprocess.cpp(current_executable_path,run_isolated_subprocess,ProcessTestOptions,ProcessOutcome,ProcessTestResult). - New
include/Void/Testing/Deterministic.hpp(ReplayToken, version-1 rejection-mappedDeterministicRng,check_propertywith shrinking & budget-exhaustioninconclusive, andDeterministicRunschedule/clock/timer harness). - Tests in
tests/standalone/Testing/{FrameworkHardening,Deterministic}.cpp.
3. Exact files and interfaces
include/Void/Testing/{Config,Assert,Runner,Capture,Subprocess,Deterministic}.hppsrc/Testing/{Assert,Runner,Subprocess}.cpptests/standalone/Testing/{FrameworkHardening,Deterministic}.cpp
4. Edge cases
- Child process
floodsaturating stdout and stderr concurrently drains via non-blockingpollwith bounded truncation without pipe deadlock. - Child process
hangbeyondProcessTestOptions::timeoutterminates viaSIGKILLand reportsProcessOutcome::timed_out. - Child process
abortreportsProcessOutcome::crashed(SIGABRT) safely even under ASan/UBSan. - Property shrinking preserves counterexample failure category and reports
inconclusiveon step, time, or discard exhaustion.
5. Acceptance criteria
FrameworkHardening*|Deterministic*|Math*|ContainerFixture*|StructRepr*and full 1,345+VoidTestspass under RelWithDebInfo-Werrorand ASan+UBSan.
6. Verification commands
dev cpp-gcc -c bash -lc 'cmake -S . -B /tmp/void-w4b-testing -G Ninja -DVOID_ENABLED_MODULES="Core;Testing" -DVOID_WARNINGS_AS_ERRORS=ON && cmake --build /tmp/void-w4b-testing && /tmp/void-w4b-testing/tests/VoidTests --filter "FrameworkHardening*|Deterministic*|Math*|ContainerFixture*|StructRepr*" && ctest --test-dir /tmp/void-w4b-testing --output-on-failure --timeout 60'