summaryrefslogtreecommitdiff
path: root/test/regress_main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-04-11 21:33:27 -0400
committerNick Mathewson <nickm@torproject.org>2012-04-11 21:33:51 -0400
commitb62b31f1f10bf5c42d893020f7375a38785d5821 (patch)
tree8c6e9f881bd382ca92fb95b254bfe04afa73c9e7 /test/regress_main.c
parent53a07fe2f95c360d060b9fd58dfcd929c2c1aac2 (diff)
downloadlibevent-b62b31f1f10bf5c42d893020f7375a38785d5821.tar.gz
Work-around a stupid gcov-breaking bug in OSX 10.6
This only affects the unit tests. Fix found at http://rachelbythebay.com/w/2011/07/12/forkcrash/
Diffstat (limited to 'test/regress_main.c')
-rw-r--r--test/regress_main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/regress_main.c b/test/regress_main.c
index 96b5b7ee..05e28433 100644
--- a/test/regress_main.c
+++ b/test/regress_main.c
@@ -33,6 +33,14 @@
#include <fcntl.h>
#endif
+#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 && \
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
+#define FORK_BREAKS_GCOV
+#include <vproc.h>
+#endif
+#endif
+
#include "event2/event-config.h"
#ifdef EVENT____func__
@@ -157,6 +165,18 @@ regress_make_tmpfile(const void *data, size_t datalen, char **filename_out)
#endif
}
+#ifndef _WIN32
+pid_t
+regress_fork(void)
+{
+ pid_t pid = fork();
+#ifdef FORK_BREAKS_GCOV
+ vproc_transaction_begin(0);
+#endif
+ return pid;
+}
+#endif
+
static void
ignore_log_cb(int s, const char *msg)
{