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 8
8
9
9
#include " ExecuteFunction.h"
10
10
#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>
16
13
#include < poll.h>
17
14
#include < signal.h>
15
+ #include < stdio.h>
16
+ #include < stdlib.h>
17
+ #include < string.h>
18
18
#include < sys/wait.h>
19
19
#include < unistd.h>
20
20
@@ -35,21 +35,20 @@ int ProcessStatus::get_fatal_signal() {
35
35
}
36
36
37
37
ProcessStatus invoke_in_subprocess (FunctionCaller *func, unsigned timeout_ms) {
38
- std::unique_ptr<FunctionCaller> X (func);
39
38
int pipe_fds[2 ];
40
39
if (::pipe (pipe_fds) == -1 )
41
40
return ProcessStatus::error (" pipe(2) failed" );
42
41
43
42
// 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 );
46
45
pid_t pid = ::fork ();
47
46
if (pid == -1 )
48
47
return ProcessStatus::error (" fork(2) failed" );
49
48
50
49
if (!pid) {
51
50
(*func)();
52
- std ::exit (0 );
51
+ ::exit (0 );
53
52
}
54
53
::close (pipe_fds[1 ]);
55
54
Original file line number Diff line number Diff line change 9
9
#include " FPExceptMatcher.h"
10
10
11
11
#include " src/__support/macros/config.h"
12
+ #include " test/UnitTest/ExecuteFunction.h" // FunctionCaller
12
13
#include " test/UnitTest/Test.h"
13
14
14
15
#include " hdr/types/fenv_t.h"
15
16
#include " src/__support/FPUtil/FEnvImpl.h"
16
- #include < memory>
17
17
#include < setjmp.h>
18
18
#include < signal.h>
19
19
@@ -37,14 +37,13 @@ static void sigfpeHandler(int sig) {
37
37
}
38
38
39
39
FPExceptMatcher::FPExceptMatcher (FunctionCaller *func) {
40
- auto oldSIGFPEHandler = signal (SIGFPE, &sigfpeHandler);
41
- std::unique_ptr<FunctionCaller> funcUP (func);
40
+ sighandler_t oldSIGFPEHandler = signal (SIGFPE, &sigfpeHandler);
42
41
43
42
caughtExcept = false ;
44
43
fenv_t oldEnv;
45
44
fputil::get_env (&oldEnv);
46
45
if (sigsetjmp (jumpBuffer, 1 ) == 0 )
47
- funcUP ->call ();
46
+ func ->call ();
48
47
// We restore the previous floating point environment after
49
48
// the call to the function which can potentially raise SIGFPE.
50
49
fputil::set_env (&oldEnv);
Original file line number Diff line number Diff line change 12
12
#include " test/UnitTest/ExecuteFunction.h"
13
13
#include " test/UnitTest/TestLogger.h"
14
14
15
- #include < cassert >
15
+ #include < assert.h >
16
16
17
17
namespace {
18
18
constexpr unsigned TIMEOUT_MS = 10000 ;
You can’t perform that action at this time.
0 commit comments