diff options
| author | Nick Desaulniers <nickdesaulniers@users.noreply.github.com> | 2025-01-09 13:40:54 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-09 13:40:54 -0800 |
| commit | 0efb376c20b220cddbbcf57f0c82ae048170ffd9 (patch) | |
| tree | 4925d2e651a3e5b712f47ea372a3d0e74bdd9534 /libc/test/UnitTest/ExecuteFunctionUnix.cpp | |
| parent | 03eb786f75e36e9e203e0092ec3c6c589fd53c4f (diff) | |
[libc][test] remove C++ stdlib includes (#122369)
These make cross compiling the test suite more difficult, as you need
the
sysroot to contain these headers and libraries cross compiled for your
target.
It's straightforward to stick with the corresponding C headers.
Diffstat (limited to 'libc/test/UnitTest/ExecuteFunctionUnix.cpp')
| -rw-r--r-- | libc/test/UnitTest/ExecuteFunctionUnix.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libc/test/UnitTest/ExecuteFunctionUnix.cpp b/libc/test/UnitTest/ExecuteFunctionUnix.cpp index 3a657c00851c..df7173866859 100644 --- a/libc/test/UnitTest/ExecuteFunctionUnix.cpp +++ b/libc/test/UnitTest/ExecuteFunctionUnix.cpp @@ -8,13 +8,13 @@ #include "ExecuteFunction.h" #include "src/__support/macros/config.h" -#include <cassert> -#include <cstdlib> -#include <cstring> -#include <iostream> -#include <memory> +#include "test/UnitTest/ExecuteFunction.h" // FunctionCaller +#include <assert.h> #include <poll.h> #include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/wait.h> #include <unistd.h> @@ -35,21 +35,20 @@ int ProcessStatus::get_fatal_signal() { } ProcessStatus invoke_in_subprocess(FunctionCaller *func, unsigned timeout_ms) { - std::unique_ptr<FunctionCaller> X(func); int pipe_fds[2]; if (::pipe(pipe_fds) == -1) return ProcessStatus::error("pipe(2) failed"); // Don't copy the buffers into the child process and print twice. - std::cout.flush(); - std::cerr.flush(); + ::fflush(stderr); + ::fflush(stdout); pid_t pid = ::fork(); if (pid == -1) return ProcessStatus::error("fork(2) failed"); if (!pid) { (*func)(); - std::exit(0); + ::exit(0); } ::close(pipe_fds[1]); |
