This repository was archived by the owner on Dec 8, 2022. It is now read-only.
File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ ExternalProject_Add(bdwgc
25
25
URL https://github.com/ivmai/bdwgc/releases/download/v8.0.4/gc-8.0.4.tar.gz
26
26
SOURCE_DIR ${CMAKE_BINARY_DIR} /bdwgc
27
27
CONFIGURE_COMMAND ${CMAKE_BINARY_DIR} /bdwgc/configure CFLAGS=-fPIC --enable-threads=posix --enable-cplusplus --enable-thread-local-alloc --enable-large-config --prefix =${CMAKE_BINARY_DIR} /bdwgc/build
28
- BUILD_COMMAND make LDFLAGS=-static
28
+ BUILD_COMMAND make CFLAGS=-DHANDLE_FORK LDFLAGS=-static
29
29
BUILD_IN_SOURCE ON
30
30
INSTALL_DIR ${CMAKE_BINARY_DIR} /bdwgc/build
31
31
INSTALL_COMMAND make install
@@ -174,6 +174,7 @@ add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
174
174
EXCLUDE_FROM_ALL )
175
175
176
176
add_executable (seqtest test /main.cpp)
177
+ target_include_directories (seqtest PRIVATE ${BDWGC_DIR} /include )
177
178
target_link_libraries (seqtest seq gtest_main)
178
179
target_compile_definitions (seqtest PRIVATE TEST_DIR="${CMAKE_CURRENT_SOURCE_DIR} /test" )
179
180
Original file line number Diff line number Diff line change 2
2
#include < dirent.h>
3
3
#include < fcntl.h>
4
4
#include < fstream>
5
+ #include < gc.h>
5
6
#include < iostream>
6
7
#include < sstream>
7
8
#include < string>
@@ -36,9 +37,11 @@ class SeqTest : public testing::TestWithParam<
36
37
const bool debug = get<1 >(GetParam ());
37
38
assert (pipe (out_pipe) != -1 );
38
39
pid = fork ();
40
+ GC_atfork_prepare ();
39
41
assert (pid != -1 );
40
42
41
43
if (pid == 0 ) {
44
+ GC_atfork_child ();
42
45
dup2 (out_pipe[1 ], STDOUT_FILENO);
43
46
close (out_pipe[0 ]);
44
47
close (out_pipe[1 ]);
@@ -48,6 +51,7 @@ class SeqTest : public testing::TestWithParam<
48
51
fflush (stdout);
49
52
exit (EXIT_SUCCESS);
50
53
} else {
54
+ GC_atfork_parent ();
51
55
int status = -1 ;
52
56
close (out_pipe[1 ]);
53
57
assert (waitpid (pid, &status, 0 ) == pid);
You can’t perform that action at this time.
0 commit comments