Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ repos:
?^ci/scripts/r_revdepcheck\.sh$|
?^ci/scripts/r_sanitize\.sh$|
?^ci/scripts/r_test\.sh$|
?^ci/scripts/r_valgrind\.sh$|
?^ci/scripts/release_test\.sh$|
?^ci/scripts/ruby_test\.sh$|
?^ci/scripts/rust_build\.sh$|
Expand Down
18 changes: 11 additions & 7 deletions ci/scripts/r_valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,32 @@

set -ex

: ${R_BIN:=RDvalgrind}
: "${R_BIN:=RDvalgrind}"

source_dir=${1}/r
source_dir="${1}/r"

export CMAKE_BUILD_TYPE=RelWithDebInfo

pushd ${source_dir}
pushd "${source_dir}"

# Convert the space-separated options into a Bash array.
# This avoids ShellCheck SC2086 and preserves argument boundaries.
read -r -a R_INSTALL_ARGS <<< "${INSTALL_ARGS:-}"

# build first so that any stray compiled files in r/src are ignored
${R_BIN} CMD build --no-build-vignettes .
${R_BIN} CMD INSTALL ${INSTALL_ARGS} arrow*.tar.gz
"${R_BIN}" CMD build --no-build-vignettes .
"${R_BIN}" CMD INSTALL "${R_INSTALL_ARGS[@]}" arrow*.tar.gz

pushd tests

# 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 --suppressions=/${1}/ci/etc/valgrind-cran.supp" -f testthat.R |& tee testthat.out
"${R_BIN}" --vanilla -d "valgrind --tool=memcheck --leak-check=full --track-origins=yes --suppressions=/${1}/ci/etc/valgrind-cran.supp" -f testthat.R |& tee testthat.out

# valgrind --error-exitcode=1 should return an erroring exit code that we can catch,
# but R eats that and returns 0, so we need to look at the output and make sure that
# we have 0 errors instead.
if [ $(grep -c "ERROR SUMMARY: 0 errors" testthat.out) != 1 ]; then
if ! grep -q "ERROR SUMMARY: 0 errors" testthat.out; then
cat testthat.out
Comment thread
hiroyuki-sato marked this conversation as resolved.
echo "Found Valgrind errors"
exit 1
Expand Down
Loading