Skip to content

Commit ad3a831

Browse files
committed
Add the check workflow with sanitizers enabled
1 parent 3a7ec2d commit ad3a831

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.github/workflows/LSan.supp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leak:libfontconfig.so

.github/workflows/sanitizers.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- GHA-sanitizers # during development
6+
workflow_dispatch:
7+
pull_request:
8+
9+
name: R-CMD-check-sanitized
10+
11+
concurrency:
12+
group: ${{ github.event.pull_request.number || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
R-CMD-check-sanitized:
17+
runs-on: ubuntu-latest
18+
container:
19+
image: docker://ghcr.io/r-hub/containers/clang-asan
20+
21+
strategy:
22+
fail-fast: true
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: "Set things up"
28+
run: |
29+
# setting aside the other.Rraw dependencies for now (will need cache)
30+
Rscript -e 'pak::pak()'
31+
# this should at least help with the build step
32+
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
33+
# fontconfig is known to leak; add more suppressions as discovered
34+
echo "LSAN_OPTIONS=suppressions=$(realpath .github/workflows/LSan.supp)" >> $GITHUB_ENV
35+
# disabled by default, so reenable (needs suppressions above)
36+
echo "ASAN_OPTIONS=detect_leaks=1" >> $GITHUB_ENV
37+
# otherwise there are literal jumps to ud1 in the code with no diagnostics
38+
sed -i 's/-fsanitize-trap\S*//g' /opt/R/devel-asan/lib/R/etc/Makeconf
39+
40+
- name: "Build"
41+
run: R CMD build .
42+
43+
- name: "Check"
44+
run: |
45+
set +e # expect some things to fail and keep going
46+
echo "::group::full R CMD check output"
47+
R CMD check --no-manual data.table_*.tar.gz; res1=$?
48+
echo "::endgroup::"
49+
perl -nle '(print, $a=1) if /: runtime error: |ERROR: LeakSanitizer/../SUMMARY.*Sanitizer/ }{ exit $a' data.table.Rcheck/**/*.Rout*; res2=$?
50+
# fail if R CMD check had failed or if sanitizer output found
51+
[ $res1 -eq 0 ] && [ $res2 -eq 0 ]

0 commit comments

Comments
 (0)