diff --git a/.travis.yml b/.travis.yml
index c682a9d9db89..01c368f17fe7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -53,6 +53,7 @@ matrix:
before_script:
- export CC="gcc-4.9"
- export CXX="g++-4.9"
+ - export ARROW_TRAVIS_COVERAGE=1
- export ARROW_TRAVIS_USE_TOOLCHAIN=1
- export ARROW_TRAVIS_VALGRIND=1
- export ARROW_TRAVIS_PLASMA=1
@@ -60,6 +61,7 @@ matrix:
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
+ - $TRAVIS_BUILD_DIR/ci/upload_cpp_coverage.sh
- $TRAVIS_BUILD_DIR/ci/travis_build_parquet_cpp.sh
- $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 2.7
- $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 3.6
diff --git a/README.md b/README.md
index 9dda25de9117..3ef01498d107 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,11 @@
+
+
Code Coverage |
+
+
+ |
diff --git a/ci/travis_before_script_cpp.sh b/ci/travis_before_script_cpp.sh
index dbdcd33ed0d5..8dc0298047e8 100755
--- a/ci/travis_before_script_cpp.sh
+++ b/ci/travis_before_script_cpp.sh
@@ -89,6 +89,10 @@ if [ $ARROW_TRAVIS_VALGRIND == "1" ]; then
CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_TEST_MEMCHECK=ON"
fi
+if [ $ARROW_TRAVIS_COVERAGE == "1" ]; then
+ CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_GENERATE_COVERAGE=1"
+fi
+
if [ $TRAVIS_OS_NAME == "linux" ]; then
cmake $CMAKE_COMMON_FLAGS \
$CMAKE_LINUX_FLAGS \
diff --git a/ci/upload_cpp_coverage.sh b/ci/upload_cpp_coverage.sh
new file mode 100755
index 000000000000..13d75f8e8b8f
--- /dev/null
+++ b/ci/upload_cpp_coverage.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+# 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.
+#
+
+set -e
+set -x
+
+ROOT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
+
+source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh
+
+# Current cpp-coveralls version 0.4 throws an error (PARQUET-1075) on Travis
+# CI. Pin to last working version
+pip install cpp_coveralls==0.3.12
+
+mkdir coverage_artifacts
+python $TRAVIS_BUILD_DIR/cpp/build-support/collect_coverage.py \
+ $ARROW_CPP_BUILD_DIR \
+ coverage_artifacts
+
+cd coverage_artifacts
+
+ls -l
+
+coveralls --gcov-options '\-l' \
+ -r $ARROW_CPP_DIR \
+ --include $ARROW_CPP_DIR \
+ --exclude $CPP_TOOLCHAIN \
+ --exclude $ARROW_CPP_BUILD_DIR/boost_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/boost_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/brotli_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/brotli_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/flatbuffers_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/flatbuffers_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/gbenchmark_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/gbenchmark_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/gflags_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/gflags_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/googletest_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/googletest_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/grpc_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/grpc_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/jemalloc_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/jemalloc_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/lz4_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/lz4_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/rapidjson_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/rapidjson_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/snappy_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/snappy_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/zlib_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/zlib_ep-prefix \
+ --exclude $ARROW_CPP_BUILD_DIR/zstd_ep \
+ --exclude $ARROW_CPP_BUILD_DIR/zstd_ep-prefix \
+ --exclude /usr
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a159b1e5674b..abbafd855b31 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -267,8 +267,6 @@ include(ThirdpartyToolchain)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARROW_CXXFLAGS}")
-message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
-
if ("${COMPILER_FAMILY}" STREQUAL "clang")
# Using Clang with ccache causes a bunch of spurious warnings that are
# purportedly fixed in the next version of ccache. See the following for details:
@@ -306,6 +304,8 @@ if ("${ARROW_GENERATE_COVERAGE}")
endif()
endif()
+message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
+
# set compile output directory
string (TOLOWER ${CMAKE_BUILD_TYPE} BUILD_SUBDIR_NAME)
diff --git a/cpp/build-support/collect_coverage.py b/cpp/build-support/collect_coverage.py
new file mode 100755
index 000000000000..eb010c0ba441
--- /dev/null
+++ b/cpp/build-support/collect_coverage.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# 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.
+
+import os
+import os.path as osp
+import shutil
+import sys
+
+
+def is_coverage_file(path):
+ return path.endswith('gcno') or path.endswith('gcda')
+
+
+def copy_files(path, outpath='.'):
+ for root, dirs, files in os.walk(path):
+ if len(files) > 0:
+ print(root)
+ print(dirs)
+ print(files)
+ for fname in files:
+ if not is_coverage_file(fname):
+ continue
+ relpath = osp.join(root, fname)
+ dstpath = '_'.join((root.replace(path, '').replace('/', '_'),
+ fname))
+
+ shutil.copy(relpath, osp.join(outpath, dstpath))
+
+
+if __name__ == '__main__':
+ path = sys.argv[1]
+ outpath = sys.argv[2]
+ copy_files(path, outpath)