Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 9591b0d

Browse files
authored
Merge pull request #145 from seq-lang/develop
Develop
2 parents 3f41d30 + 22d3921 commit 9591b0d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ExternalProject_Add(bdwgc
2525
URL https://github.com/ivmai/bdwgc/releases/download/v8.0.4/gc-8.0.4.tar.gz
2626
SOURCE_DIR ${CMAKE_BINARY_DIR}/bdwgc
2727
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
2929
BUILD_IN_SOURCE ON
3030
INSTALL_DIR ${CMAKE_BINARY_DIR}/bdwgc/build
3131
INSTALL_COMMAND make install
@@ -174,6 +174,7 @@ add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
174174
EXCLUDE_FROM_ALL)
175175

176176
add_executable(seqtest test/main.cpp)
177+
target_include_directories(seqtest PRIVATE ${BDWGC_DIR}/include)
177178
target_link_libraries(seqtest seq gtest_main)
178179
target_compile_definitions(seqtest PRIVATE TEST_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test")
179180

test/main.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <dirent.h>
33
#include <fcntl.h>
44
#include <fstream>
5+
#include <gc.h>
56
#include <iostream>
67
#include <sstream>
78
#include <string>
@@ -36,9 +37,11 @@ class SeqTest : public testing::TestWithParam<
3637
const bool debug = get<1>(GetParam());
3738
assert(pipe(out_pipe) != -1);
3839
pid = fork();
40+
GC_atfork_prepare();
3941
assert(pid != -1);
4042

4143
if (pid == 0) {
44+
GC_atfork_child();
4245
dup2(out_pipe[1], STDOUT_FILENO);
4346
close(out_pipe[0]);
4447
close(out_pipe[1]);
@@ -48,6 +51,7 @@ class SeqTest : public testing::TestWithParam<
4851
fflush(stdout);
4952
exit(EXIT_SUCCESS);
5053
} else {
54+
GC_atfork_parent();
5155
int status = -1;
5256
close(out_pipe[1]);
5357
assert(waitpid(pid, &status, 0) == pid);

0 commit comments

Comments
 (0)