Skip to content

Apache DataFusion SQL Query Engine

ARROW-6214: [R] Add R sanitizer docker image

François Saint-Jacquesbb3dd0dda09a
diff --git a/.hadolint.yaml b/.hadolint.yaml
index 99ce671f46..a6d7d03f84 100644
--- a/.hadolint.yaml
+++ b/.hadolint.yaml
@@ -21,3 +21,4 @@ ignored:
- DL3018
- DL3015 # Avoid additional packages by specifying `--no-install-recommends`
- DL3028 # Ruby gem version pinning
+ - DL3007 # r-sanitizer must use latest
diff --git a/Makefile.docker b/Makefile.docker
index e6872f56c2..f1b275978b 100644
--- a/Makefile.docker
+++ b/Makefile.docker
@@ -20,7 +20,7 @@
# To run the test suite
# $ make -f Makefile.docker cpp
-LANGUAGES = cpp cpp-alpine cpp-cmake32 c_glib go java js python python-alpine rust r
+LANGUAGES = cpp cpp-alpine cpp-cmake32 c_glib go java js python python-alpine rust r r-sanitizer
MISC = lint iwyu clang-format docs pandas-master
TESTS = dask hdfs-integration spark-integration python-nopandas
diff --git a/ci/docker_build_r.sh b/ci/docker_build_r.sh
index 6355afa4ee..48f88efb50 100755
--- a/ci/docker_build_r.sh
+++ b/ci/docker_build_r.sh
@@ -20,13 +20,19 @@ set -e
export ARROW_HOME=$CONDA_PREFIX
+: ${R_BIN:=R}
+source /arrow/ci/docker_install_r_deps.sh
+
# Build arrow
pushd /arrow/r
-R CMD build --keep-empty-dirs .
-R CMD INSTALL $(ls | grep arrow_*.tar.gz)
+install_deps
+
+make clean
+${R_BIN} CMD build --keep-empty-dirs .
+${R_BIN} CMD INSTALL $(ls | grep arrow_*.tar.gz)
export _R_CHECK_FORCE_SUGGESTS_=false
-R CMD check $(ls | grep arrow_*.tar.gz) --as-cran --no-manual
+${R_BIN} CMD check $(ls | grep arrow_*.tar.gz) --as-cran --no-manual
popd
diff --git a/ci/docker_build_r_sanitizer.sh b/ci/docker_build_r_sanitizer.sh
new file mode 100755
index 0000000000..3a9e705c31
--- /dev/null
+++ b/ci/docker_build_r_sanitizer.sh
@@ -0,0 +1,39 @@
+#!/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
+
+: ${R_BIN:=RDsan}
+source /arrow/ci/docker_install_r_deps.sh
+
+# Build arrow
+pushd /arrow/r
+
+install_deps
+
+make clean
+${R_BIN} CMD INSTALL --no-byte-compile .
+
+pushd tests
+
+export UBSAN_OPTIONS="print_stacktrace=1,suppressions=/arrow/r/tools/ubsan.supp"
+${R_BIN} < testthat.R
+
+popd
+
+popd
diff --git a/ci/docker_install_r_deps.sh b/ci/docker_install_r_deps.sh
index 0a2c1fcd2d..817046a8e1 100755
--- a/ci/docker_install_r_deps.sh
+++ b/ci/docker_install_r_deps.sh
@@ -16,12 +16,8 @@
# specific language governing permissions and limitations
# under the License.
-set -e
-
-pushd /arrow/r
-
-Rscript -e "install.packages(c('remotes', 'dplyr', 'glue'))"
-Rscript -e "remotes::install_deps(dependencies = TRUE)"
-Rscript -e "remotes::install_github('romainfrancois/decor')"
-
-popd
+install_deps() {
+ ${R_BIN} -e "install.packages(c('remotes', 'dplyr', 'glue'))"
+ ${R_BIN} -e "remotes::install_deps(dependencies = TRUE)"
+ ${R_BIN} -e "remotes::install_github('romainfrancois/decor')"
+}
diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml
index 1df28d8bae..0c1ea9b1ff 100644
--- a/dev/tasks/tasks.yml
+++ b/dev/tasks/tasks.yml
@@ -73,6 +73,7 @@ groups:
docker:
- docker-r
- docker-r-conda
+ - docker-r-sanitizer
- docker-rust
- docker-cpp
- docker-cpp-alpine
@@ -164,6 +165,7 @@ groups:
- gandiva-jar-osx
- docker-r
- docker-r-conda
+ - docker-r-sanitizer
- docker-rust
- docker-cpp
- docker-cpp-cmake32
@@ -1121,6 +1123,15 @@ tasks:
- docker-compose build r-conda
- docker-compose run r-conda
+ docker-r-sanitizer:
+ ci: circle
+ platform: linux
+ template: docker-tests/circle.linux.yml
+ params:
+ commands:
+ - docker-compose build r-sanitizer
+ - docker-compose run r-sanitizer
+
docker-rust:
ci: circle
platform: linux
diff --git a/docker-compose.yml b/docker-compose.yml
index 4fde60d445..a5cb6061f6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -400,6 +400,19 @@ services:
dockerfile: r/Dockerfile
volumes: *ubuntu-volumes
+ r-sanitizer:
+ # Usage:
+ # docker-compose build r-sanitizer
+ # docker-compose run r-sanitizer
+ image: arrow:r-sanitizer
+ cap_add:
+ # LeakSanitizer and gdb requires ptrace(2)
+ - SYS_PTRACE
+ build:
+ context: .
+ dockerfile: r/Dockerfile.sanitizer
+ volumes: *ubuntu-volumes
+
r-conda:
# Usage:
# export R_VERSION=3.5.1