test(System): replace host /bin utility assumptions with VoidProcessHelper (X-BASE-01)

This commit is contained in:
faumaray committed 2026-11-24 02:10:06 +03:00
1 parent 563da02c0f
commit 340acaec34
3 files changed
+194 -5

No files matched your search

+22 -3
View File
@@ -29,7 +29,8 @@ Void::Testing::Test shell_captures_stderr_separately()
Void::Testing::Test run_with_args_builds_correct_argv()
{
auto r = Void::Process::run("/bin/echo", {"hello", "world"});
auto r = Void::Process::run(VOID_PROCESS_HELPER_PATH,
{"echo", "hello", "world"});
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->exit_code, 0);
Void::Testing::expect(r->out.find("hello world") != std::string::npos);
@@ -37,12 +38,30 @@ Void::Testing::Test run_with_args_builds_correct_argv()
Void::Testing::Test run_stdin_forwarded_to_cat()
{
auto r = Void::Process::run("/bin/cat", {}, "piped_input");
auto r = Void::Process::run(VOID_PROCESS_HELPER_PATH, {"cat"}, "piped_input");
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->exit_code, 0);
Void::Testing::expect(r->out.find("piped_input") != std::string::npos);
}
Void::Testing::Test run_direct_exit_code_propagates()
{
auto r = Void::Process::run(VOID_PROCESS_HELPER_PATH, {"exit", "42"});
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->exit_code, 42);
}
Void::Testing::Test run_direct_stdout_and_stderr_independent()
{
auto r = Void::Process::run(VOID_PROCESS_HELPER_PATH, {"streams"});
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->exit_code, 0);
Void::Testing::expect(r->out.find("to_stdout") != std::string::npos);
Void::Testing::expect(r->err.find("to_stderr") != std::string::npos);
Void::Testing::expect(r->out.find("to_stderr") == std::string::npos);
Void::Testing::expect(r->err.find("to_stdout") == std::string::npos);
}
Void::Testing::Test run_missing_executable_returns_code_127()
{
auto r = Void::Process::run("/this/binary/does/not/exist");
@@ -65,7 +84,7 @@ Void::Testing::Test run_stdout_and_stderr_independent()
Void::Testing::Test run_large_output_is_captured_fully()
{
// Generate 10 000 lines; poll-based reader must accumulate them all.
auto r = Void::Process::shell("seq 1 10000");
auto r = Void::Process::run(VOID_PROCESS_HELPER_PATH, {"seq", "1", "10000"});
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->exit_code, 0);
// "10000\n" must be present, and total output must be substantial