File tree Expand file tree Collapse file tree 3 files changed +12
-14
lines changed Expand file tree Collapse file tree 3 files changed +12
-14
lines changed Original file line number Diff line number Diff line change 88
99#include " ExecuteFunction.h"
1010#include " src/__support/macros/config.h"
11- #include < cassert>
12- #include < cstdlib>
13- #include < cstring>
14- #include < iostream>
15- #include < memory>
11+ #include " test/UnitTest/ExecuteFunction.h" // FunctionCaller
12+ #include < assert.h>
1613#include < poll.h>
1714#include < signal.h>
15+ #include < stdio.h>
16+ #include < stdlib.h>
17+ #include < string.h>
1818#include < sys/wait.h>
1919#include < unistd.h>
2020
@@ -35,21 +35,20 @@ int ProcessStatus::get_fatal_signal() {
3535}
3636
3737ProcessStatus invoke_in_subprocess (FunctionCaller *func, unsigned timeout_ms) {
38- std::unique_ptr<FunctionCaller> X (func);
3938 int pipe_fds[2 ];
4039 if (::pipe (pipe_fds) == -1 )
4140 return ProcessStatus::error (" pipe(2) failed" );
4241
4342 // Don't copy the buffers into the child process and print twice.
44- std::cout. flush ( );
45- std::cerr. flush ( );
43+ ::fflush (stderr );
44+ ::fflush (stdout );
4645 pid_t pid = ::fork ();
4746 if (pid == -1 )
4847 return ProcessStatus::error (" fork(2) failed" );
4948
5049 if (!pid) {
5150 (*func)();
52- std ::exit (0 );
51+ ::exit (0 );
5352 }
5453 ::close (pipe_fds[1 ]);
5554
Original file line number Diff line number Diff line change 99#include " FPExceptMatcher.h"
1010
1111#include " src/__support/macros/config.h"
12+ #include " test/UnitTest/ExecuteFunction.h" // FunctionCaller
1213#include " test/UnitTest/Test.h"
1314
1415#include " hdr/types/fenv_t.h"
1516#include " src/__support/FPUtil/FEnvImpl.h"
16- #include < memory>
1717#include < setjmp.h>
1818#include < signal.h>
1919
@@ -37,14 +37,13 @@ static void sigfpeHandler(int sig) {
3737}
3838
3939FPExceptMatcher::FPExceptMatcher (FunctionCaller *func) {
40- auto oldSIGFPEHandler = signal (SIGFPE, &sigfpeHandler);
41- std::unique_ptr<FunctionCaller> funcUP (func);
40+ sighandler_t oldSIGFPEHandler = signal (SIGFPE, &sigfpeHandler);
4241
4342 caughtExcept = false ;
4443 fenv_t oldEnv;
4544 fputil::get_env (&oldEnv);
4645 if (sigsetjmp (jumpBuffer, 1 ) == 0 )
47- funcUP ->call ();
46+ func ->call ();
4847 // We restore the previous floating point environment after
4948 // the call to the function which can potentially raise SIGFPE.
5049 fputil::set_env (&oldEnv);
Original file line number Diff line number Diff line change 1212#include " test/UnitTest/ExecuteFunction.h"
1313#include " test/UnitTest/TestLogger.h"
1414
15- #include < cassert >
15+ #include < assert.h >
1616
1717namespace {
1818constexpr unsigned TIMEOUT_MS = 10000 ;
You can’t perform that action at this time.
0 commit comments