Skip to content

Commit 0afb20f

Browse files
authored
GitLab CI: test with GCC sanitizers (#7076)
* GLCI: also test with gcc -fsanitize=... * glci-san: fail if worse than NOTE Previously, failure was only triggered by non-zero exit code from R CMD check, which is not strict enough. * Document changes to GLCI tests
1 parent f5ef6b8 commit 0afb20f

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.ci/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Test jobs:
1313
- `test-lin-dev-gcc-strict-cran` - `--as-cran` on Linux, `r-devel` built with `-enable-strict-barrier --disable-long-double`, test for compilation warnings, test for new NOTEs/WARNINGs from `R CMD check`.
1414
- `test-lin-dev-clang-cran` - same as `gcc-strict` job but R built with `clang` and no `--enable-strict-barrier --disable-long-double` flags.
1515
- `test-lin-ancient-cran` - Stated R dependency version (currently 3.4.0) on Linux.
16-
- `test-lin-dev-san` - `r-devel` on Linux built with `clang -fsanitize=address,undefined` (including LeakSanitizer), test for sanitizer output in tests and examples.
16+
- `test-lin-dev-clang-san` - `r-devel` on Linux built with `clang -fsanitize=address,undefined` (including LeakSanitizer), test for sanitizer output in tests and examples.
17+
- `test-lin-dev-gcc-san` - `r-devel` on Linux built with `gcc -fsanitize=address,undefined` (including LeakSanitizer), test for sanitizer output in tests and examples.
1718
- `test-win-rel` - `r-release` on Windows.
1819
- `test-win-dev` - `r-devel` on Windows.
1920
- `test-win-old` - `r-oldrel` on Windows.

.gitlab-ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ test-lin-ancient-cran:
218218
# Restore checking vignettes if upgrading our R dependency means knitr can be installed, or when we switch to litedown.
219219
- R CMD check --no-manual --no-build-vignettes --ignore-vignettes $(ls -1t data.table_*.tar.gz | head -n 1)
220220

221-
# run the main checks with Address(+Leak),UBSanitizer enabled
222-
test-lin-dev-san:
221+
# run the main checks with Address(+Leak),UBSanitizer enabled, GCC _and_ Clang
222+
test-lin-dev-clang-san:
223223
<<: *test-lin
224224
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-clang-san
225225
variables:
@@ -233,8 +233,27 @@ test-lin-dev-san:
233233
- |
234234
res1=0; ASAN_OPTIONS=detect_leaks=1 R CMD check --no-manual $(ls -1t data.table_*.tar.gz | head -n 1) || res1=$?
235235
res2=0; perl -nle '(print, $a=1) if /: runtime error: |ERROR: LeakSanitizer/../SUMMARY.*Sanitizer/ }{ exit $a' data.table.Rcheck/**/*.Rout* || res2=$?
236+
res3=0; tail -n 1 data.table.Rcheck/00check.log | grep -q -e '^Status: [0-9]* NOTEs*$' -e '^Status: OK$' || res3=$?
236237
# fail if R CMD check had failed or if sanitizer output found
237-
if [ $res1 -ne 0 ] || [ $res2 -ne 0 ]; then exit 1; fi
238+
if [ $res1 -ne 0 ] || [ $res2 -ne 0 ] || [ $res3 -ne 0 ]; then exit 1; fi
239+
240+
test-lin-dev-gcc-san:
241+
<<: *test-lin
242+
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-gcc-san
243+
variables:
244+
# must be set for most of the process because there are pseudo-leaks everywhere
245+
ASAN_OPTIONS: "detect_leaks=0"
246+
# fontconfig is known to leak; add more suppressions as discovered
247+
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/.dev/lsan.supp"
248+
UBSAN_OPTIONS: "print_stacktrace=1"
249+
script:
250+
- *install-deps
251+
- |
252+
res1=0; ASAN_OPTIONS=detect_leaks=1 R CMD check --no-manual $(ls -1t data.table_*.tar.gz | head -n 1) || res1=$?
253+
res2=0; perl -nle '(print, $a=1) if /: runtime error: |ERROR: LeakSanitizer/../SUMMARY.*Sanitizer/ }{ exit $a' data.table.Rcheck/**/*.Rout* || res2=$?
254+
res3=0; tail -n 1 data.table.Rcheck/00check.log | grep -q -e '^Status: [0-9]* NOTEs*$' -e '^Status: OK$' || res3=$?
255+
# fail if R CMD check had failed or if sanitizer output found
256+
if [ $res1 -ne 0 ] || [ $res2 -ne 0 ] || [ $res3 -ne 0 ]; then exit 1; fi
238257
239258
.test-win-template: &test-win
240259
<<: *test
@@ -338,7 +357,7 @@ integration:
338357
- saas-linux-medium-amd64
339358
only:
340359
- master
341-
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-dev-san","test-win-rel","test-win-dev" ,"test-win-old","test-mac-rel","test-mac-old"]
360+
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-dev-clang-san","test-lin-dev-gcc-san","test-win-rel","test-win-dev" ,"test-win-old","test-mac-rel","test-mac-old"]
342361
script:
343362
- R --version
344363
- *install-deps ## markdown pkg not present in r-pkgdown image

0 commit comments

Comments
 (0)