Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLab CI workflow with sanitizers #6746

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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 .dev/lsan.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
leak:libfontconfig.so
2 changes: 2 additions & 0 deletions .dev/ubsan.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO(bit>4.5.0.1): remove after a new 'bit' version is on CRAN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

planning to do that next after data.table release :)

function:R_doDotCall
21 changes: 20 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,25 @@ test-lin-ancient-cran:
# Restore checking vignettes if upgrading our R dependency means knitr can be installed.
- R CMD check --no-manual --no-build-vignettes --ignore-vignettes $(ls -1t data.table_*.tar.gz | head -n 1)

# run the main checks with Address(+Leak),UBSanitizer enabled
test-lin-san:
<<: *test-lin
image: docker.io/rocker/r-devel-ubsan-clang
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this r-devel-gcc-strict image equivalent?

https://gitlab.com/jangorecki/dockerfiles/-/blame/master/r-devel/r-devel-gcc-strict?ref_type=heads#L43

(thinking it may be preferable to consistently use Jan's repo)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the entire R and (almost) all packages are compiled with -fsanitize=address,undefined. I think there is a way compile just data.table with sanitizers by setting PKG_CFLAGS, PKG_LIBS, but then either the sanitizers must be manually preloaded using LD_PRELOAD or R must be linked with custom MAIN_LD(FLAGS) set.

variables:
# must be set for most of the process because there are pseudo-leaks everywhere
ASAN_OPTIONS: "detect_leaks=0"
# fontconfig is known to leak; add more suppressions as discovered
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/.dev/lsan.supp"
UBSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/.dev/ubsan.supp"
script:
- ln -svf "$(which RDscript)" "$(which Rscript)" # install-deps will run 'Rscript', we need R-devel+sanitizers
- *install-deps
- >-
ASAN_OPTIONS=detect_leaks=1 RD CMD check --no-manual $(ls -1t data.table_*.tar.gz | head -n 1); res1=$?
perl -nle '(print, $a=1) if /: runtime error: |ERROR: LeakSanitizer/../SUMMARY.*Sanitizer/ }{ exit $a' data.table.Rcheck/**/*.Rout*; res2=$?
# fail if R CMD check had failed or if sanitizer output found
[ $res1 -eq 0 ] && [ $res2 -eq 0 ]

.test-win-template: &test-win
<<: *test
tags:
Expand Down Expand Up @@ -311,7 +330,7 @@ integration:
- saas-linux-medium-amd64
only:
- master
needs: ["mirror-packages","build","test-lin-rel","test-lin-rel-cran","test-lin-dev-gcc-strict-cran","test-lin-dev-clang-cran","test-lin-rel-vanilla","test-lin-ancient-cran","test-win-rel","test-win-dev" ,"test-win-old","test-mac-rel","test-mac-old"]
needs: ["mirror-packages","build","test-lin-rel","test-lin-rel-cran","test-lin-dev-gcc-strict-cran","test-lin-dev-clang-cran","test-lin-rel-vanilla","test-lin-ancient-cran","test-lin-san","test-win-rel","test-win-dev" ,"test-win-old","test-mac-rel","test-mac-old"]
script:
- R --version
- *install-deps ## markdown pkg not present in r-pkgdown image
Expand Down
Loading