nealrichardson commented on a change in pull request #10237:
URL: https://github.com/apache/arrow/pull/10237#discussion_r625956698



##########
File path: r/tests/testthat/helper-skip.R
##########
@@ -22,13 +22,19 @@ build_features <- c(
 )
 
 skip_if_not_available <- function(feature) {
+  if (feature == "re2" && identical(tolower(Sys.info()[["sysname"]]), 
"linux")) {
+    skip_on_cran()
+  }
+

Review comment:
       ```suggestion
     if (feature == "re2") {
       # RE2 does not support valgrind (on purpose): 
https://github.com/google/re2/issues/177
       skip_on_valgrind()
     }
   
   ```

##########
File path: docker-compose.yml
##########
@@ -1050,6 +1051,33 @@ services:
       /bin/bash -c "
         /arrow/ci/scripts/r_sanitize.sh /arrow"
 
+  ubuntu-r-valgrind:
+    # Only 18.04 and amd64 supported
+    # Usage:
+    #   docker-compose build ubuntu-r-valgrind
+    #   docker-compose run ubuntu-r-valgrind
+    image: ${REPO}:amd64-ubuntu-18.04-r-valgrind
+    build:
+      context: .
+      dockerfile: ci/docker/linux-r.dockerfile
+      cache_from:
+        - ${REPO}:amd64-ubuntu-18.04-r-valgrind
+      args:
+        base: wch1/r-debug:latest
+        r_bin: RDvalgrind
+    environment:
+      <<: *ccache
+      # AVX512 not supported by Valgrind (similar to ARROW-9851) some runners 
support AVX512 and some do not
+      # so some build might pass without this setting
+      ARROW_USER_SIMD_LEVEL: "AVX2"
+      ARROW_RUNTIME_SIMD_LEVEL: "AVX2"

Review comment:
       ```suggestion
   ```

##########
File path: r/tests/testthat/helper-skip.R
##########
@@ -49,6 +55,18 @@ skip_if_not_running_large_memory_tests <- function() {
   )
 }
 
+skip_on_valgrind <- function() {
+  # This does not actually skip on valgrind, however it skips on CRAN when the 
+  # OS is linux + and the R versoin is development (which is where valgrind is 
run
+  # as of this code)

Review comment:
       ```suggestion
     # This does not actually skip on valgrind because we can't exactly detect 
it.
     # Instead, it skips on CRAN when the OS is linux + and the R version is 
development 
     # (which is where valgrind is run as of this code)
   ```

##########
File path: ci/scripts/r_valgrind.sh
##########
@@ -0,0 +1,34 @@
+#!/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 -ex
+
+: ${R_BIN:=RDvalgrind}
+
+source_dir=${1}/r
+
+${R_BIN} CMD INSTALL ${source_dir}
+pushd ${source_dir}/tests
+
+export TEST_R_WITH_ARROW=TRUE
+# to generate suppression files run:
+# ${R_BIN} --vanilla -d "valgrind --tool=memcheck --leak-check=full 
--track-origins=yes --gen-suppressions=all --log-file=memcheck.log" -f 
testthat.R 
+${R_BIN} --vanilla -d "valgrind --tool=memcheck --leak-check=full 
--track-origins=yes --error-exitcode=1 
--suppressions=/${1}/ci/etc/valgrind-cran.supp" -f testthat.R | tee 
testthat.out 

Review comment:
       Have you confirmed that this job (in the script's final form) correctly 
fails if there's a valgrind failure? You could try this by making 
`skip_on_valgrind()` no-op and see if it fails as expected, then restore the 
skips.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to