arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-538: [C++] Set up AddressSanitizer (ASAN) builds
Date Wed, 08 Feb 2017 20:07:46 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 4440e4011 -> 0bdfd5efb


ARROW-538: [C++] Set up AddressSanitizer (ASAN) builds

Most of the infrastructure was already in place, only needed to fix the gtest build.

We will now build with AddressSanitizer activated on OSX.

Author: Uwe L. Korn <uwelk@xhochy.com>

Closes #324 from xhochy/ARROW-538 and squashes the following commits:

c2f8dda [Uwe L. Korn] Don't run AddressSanitizer on Travis
f6b65e5 [Uwe L. Korn] Explicitly detected 3.6
8a20d91 [Uwe L. Korn] Log detected COMPILER_VERSION in error message
acf3f69 [Uwe L. Korn] ARROW-538: [C++] Set up AddressSanitizer (ASAN) builds


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/0bdfd5ef
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/0bdfd5ef
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/0bdfd5ef

Branch: refs/heads/master
Commit: 0bdfd5efb2d7360f8ec8f6a65401d4c76a8df597
Parents: 4440e40
Author: Uwe L. Korn <uwelk@xhochy.com>
Authored: Wed Feb 8 15:07:39 2017 -0500
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Wed Feb 8 15:07:39 2017 -0500

----------------------------------------------------------------------
 cpp/CMakeLists.txt                       |  4 +++-
 cpp/build-support/run-test.sh            |  4 ++--
 cpp/build-support/sanitize-blacklist.txt | 22 ++++++++++++++++++++++
 cpp/cmake_modules/CompilerInfo.cmake     |  6 ++++++
 cpp/cmake_modules/san-config.cmake       |  5 +++--
 cpp/src/arrow/buffer-test.cc             |  3 +++
 cpp/src/arrow/memory_pool-test.cc        |  4 +++-
 python/manylinux1/Dockerfile-x86_64      |  2 +-
 8 files changed, 43 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index ff2c1a6..035cd8f 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -428,10 +428,12 @@ if(ARROW_BUILD_TESTS)
 
   if("$ENV{GTEST_HOME}" STREQUAL "")
     if(APPLE)
-      set(GTEST_CMAKE_CXX_FLAGS "-fPIC -std=c++11 -stdlib=libc++ -DGTEST_USE_OWN_TR1_TUPLE=1
-Wno-unused-value -Wno-ignored-attributes")
+      set(GTEST_CMAKE_CXX_FLAGS "-fPIC -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-value -Wno-ignored-attributes")
     else()
       set(GTEST_CMAKE_CXX_FLAGS "-fPIC")
     endif()
+    string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE)
+    set(GTEST_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}
${GTEST_CMAKE_CXX_FLAGS}")
 
     set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix/src/googletest_ep")
     set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include")

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/build-support/run-test.sh
----------------------------------------------------------------------
diff --git a/cpp/build-support/run-test.sh b/cpp/build-support/run-test.sh
index f563da5..b4da4f3 100755
--- a/cpp/build-support/run-test.sh
+++ b/cpp/build-support/run-test.sh
@@ -82,8 +82,8 @@ function setup_sanitizers() {
 
   # Enable leak detection even under LLVM 3.4, where it was disabled by default.
   # This flag only takes effect when running an ASAN build.
-  ASAN_OPTIONS="$ASAN_OPTIONS detect_leaks=1"
-  export ASAN_OPTIONS
+  # ASAN_OPTIONS="$ASAN_OPTIONS detect_leaks=1"
+  # export ASAN_OPTIONS
 
   # Set up suppressions for LeakSanitizer
   LSAN_OPTIONS="$LSAN_OPTIONS suppressions=$ROOT/build-support/lsan-suppressions.txt"

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/build-support/sanitize-blacklist.txt
----------------------------------------------------------------------
diff --git a/cpp/build-support/sanitize-blacklist.txt b/cpp/build-support/sanitize-blacklist.txt
new file mode 100644
index 0000000..f6900c6
--- /dev/null
+++ b/cpp/build-support/sanitize-blacklist.txt
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Workaround for a problem with gmock where a runtime error is caused by a call on a null
pointer,
+# on a mocked object.
+# Seen error:
+# thirdparty/gmock-1.7.0/include/gmock/gmock-spec-builders.h:1529:12: runtime error: member
call on null pointer of type 'testing::internal::ActionResultHolder<void>'
+fun:*testing*internal*InvokeWith*

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/cmake_modules/CompilerInfo.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/CompilerInfo.cmake b/cpp/cmake_modules/CompilerInfo.cmake
index 187698f..fe200be 100644
--- a/cpp/cmake_modules/CompilerInfo.cmake
+++ b/cpp/cmake_modules/CompilerInfo.cmake
@@ -30,6 +30,12 @@ elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang version.*")
   set(COMPILER_FAMILY "clang")
   string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
     COMPILER_VERSION "${COMPILER_VERSION_FULL}")
+
+# LLVM 3.6 on Mac OS X 10.9 and later
+elseif("${COMPILER_VERSION_FULL}" MATCHES ".*based on LLVM 3\\.6\\..*")
+  set(COMPILER_FAMILY "clang")
+  set(COMPILER_VERSION "3.6.0svn")
+
 # clang on Mac OS X 10.9 and later
 elseif("${COMPILER_VERSION_FULL}" MATCHES ".*based on LLVM.*")
   set(COMPILER_FAMILY "clang")

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/cmake_modules/san-config.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/san-config.cmake b/cpp/cmake_modules/san-config.cmake
index fe52fef..1917eab 100644
--- a/cpp/cmake_modules/san-config.cmake
+++ b/cpp/cmake_modules/san-config.cmake
@@ -94,8 +94,9 @@ if ("${ARROW_USE_UBSAN}" OR "${ARROW_USE_ASAN}" OR "${ARROW_USE_TSAN}")
     # Require clang 3.4 or newer; clang 3.3 has issues with TSAN and pthread
     # symbol interception.
     if("${COMPILER_VERSION}" VERSION_LESS "3.4")
-      message(SEND_ERROR "Must use clang 3.4 or newer to run a sanitizer build."
-        " Try using clang from $NATIVE_TOOLCHAIN/")
+        message(SEND_ERROR "Must use clang 3.4 or newer to run a sanitizer build."
+        " Detected unsupported version ${COMPILER_VERSION}."
+        " Try using clang from $NATIVE_TOOLCHAIN/.")
     endif()
     add_definitions("-fsanitize-blacklist=${BUILD_SUPPORT_DIR}/sanitize-blacklist.txt")
   else()

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/src/arrow/buffer-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/buffer-test.cc b/cpp/src/arrow/buffer-test.cc
index 2ded1e1..d76e991 100644
--- a/cpp/src/arrow/buffer-test.cc
+++ b/cpp/src/arrow/buffer-test.cc
@@ -67,11 +67,14 @@ TEST_F(TestBuffer, Resize) {
 }
 
 TEST_F(TestBuffer, ResizeOOM) {
+  // This test doesn't play nice with AddressSanitizer
+#ifndef ADDRESS_SANITIZER
   // realloc fails, even though there may be no explicit limit
   PoolBuffer buf;
   ASSERT_OK(buf.Resize(100));
   int64_t to_alloc = std::numeric_limits<int64_t>::max();
   ASSERT_RAISES(OutOfMemory, buf.Resize(to_alloc));
+#endif
 }
 
 TEST_F(TestBuffer, EqualsWithSameContent) {

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/cpp/src/arrow/memory_pool-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/memory_pool-test.cc b/cpp/src/arrow/memory_pool-test.cc
index 3daf727..56bb32f 100644
--- a/cpp/src/arrow/memory_pool-test.cc
+++ b/cpp/src/arrow/memory_pool-test.cc
@@ -32,7 +32,9 @@ TEST_F(TestDefaultMemoryPool, MemoryTracking) {
 }
 
 TEST_F(TestDefaultMemoryPool, OOM) {
+#ifndef ADDRESS_SANITIZER
   this->TestOOM();
+#endif
 }
 
 TEST_F(TestDefaultMemoryPool, Reallocate) {
@@ -41,7 +43,7 @@ TEST_F(TestDefaultMemoryPool, Reallocate) {
 
 // Death tests and valgrind are known to not play well 100% of the time. See
 // googletest documentation
-#ifndef ARROW_VALGRIND
+#if !(defined(ARROW_VALGRIND) || defined(ADDRESS_SANITIZER))
 
 TEST(DefaultMemoryPoolDeathTest, FreeLargeMemory) {
   MemoryPool* pool = default_memory_pool();

http://git-wip-us.apache.org/repos/asf/arrow/blob/0bdfd5ef/python/manylinux1/Dockerfile-x86_64
----------------------------------------------------------------------
diff --git a/python/manylinux1/Dockerfile-x86_64 b/python/manylinux1/Dockerfile-x86_64
index 0591588..ac47108 100644
--- a/python/manylinux1/Dockerfile-x86_64
+++ b/python/manylinux1/Dockerfile-x86_64
@@ -16,7 +16,7 @@ FROM quay.io/pypa/manylinux1_x86_64:latest
 RUN yum install -y flex openssl-devel
 
 WORKDIR /
-RUN wget http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz
-O /boost_1_60_0.tar.gz
+RUN wget --no-check-certificate http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz
-O /boost_1_60_0.tar.gz
 RUN tar xf boost_1_60_0.tar.gz
 WORKDIR /boost_1_60_0
 RUN ./bootstrap.sh


Mime
View raw message