From e8aa15917fcb6079418cd91aff967b7d8cb0c1ec Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 5 Mar 2019 17:07:28 -0800 Subject: [PATCH] add ability to run with asan on macOS --- test/IXTest.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/IXTest.cpp b/test/IXTest.cpp index 0b62e916..382ebf35 100644 --- a/test/IXTest.cpp +++ b/test/IXTest.cpp @@ -71,8 +71,14 @@ namespace ix int getAnyFreePort() { + // ASAN complains about getsockname +#if defined(__has_feature) +# if __has_feature(address_sanitizer) + static int defaultPort = 8090; + return defaultPort++; +# endif +#else int defaultPort = 8090; - int sockfd; if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { @@ -116,6 +122,7 @@ namespace ix ::close(sockfd); return port; +#endif } int getFreePort()