Skip to content

Commit 5a489e0

Browse files
powerboat9dkm
authored andcommitted
Compile using ASAN on the github CI
ChangeLog: * .github/workflows/ccpp.yml: Add job for running tests with ASAN. * .github/no-bootstrap-asan.mk: New file. Signed-off-by: Owen Avery <[email protected]>
1 parent 83cfdee commit 5a489e0

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

.github/no-bootstrap-asan.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This option enables -fsanitize=address for stage1.
2+
3+
# Suppress LeakSanitizer in bootstrap.
4+
export ASAN_OPTIONS=detect_leaks=0:use_odr_indicator=1
5+
6+
STAGE1_CFLAGS += -fsanitize=address
7+
STAGE1_LDFLAGS += -fsanitize=address -static-libasan

.github/workflows/ccpp.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,87 @@ jobs:
386386
else \
387387
exit 0; \
388388
fi
389+
390+
build-and-check-asan:
391+
392+
env:
393+
# Force locale, in particular for reproducible results re '.github/bors_log_expected_warnings' (see below).
394+
LC_ALL: C.UTF-8
395+
396+
runs-on: ubuntu-22.04
397+
398+
steps:
399+
- uses: actions/checkout@v3
400+
401+
- name: Install Deps
402+
run: |
403+
sudo apt-get update;
404+
sudo apt-get install -y \
405+
automake \
406+
autoconf \
407+
libtool \
408+
autogen \
409+
bison \
410+
flex \
411+
libgmp3-dev \
412+
libmpfr-dev \
413+
libmpc-dev \
414+
build-essential \
415+
gcc-multilib \
416+
g++-multilib \
417+
dejagnu;
418+
# install Rust directly using rustup
419+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.72.0;
420+
421+
- name: Configure
422+
run: |
423+
mkdir -p gccrs-build;
424+
cd gccrs-build;
425+
../configure \
426+
--enable-languages=rust \
427+
--disable-bootstrap \
428+
--enable-multilib \
429+
--with-build-config=../.github/no-bootstrap-asan
430+
431+
- name: Build
432+
shell: bash
433+
run: |
434+
cd gccrs-build; \
435+
# Add cargo to our path quickly
436+
. "$HOME/.cargo/env";
437+
make -Otarget -j $(nproc) 2>&1 | tee log
438+
439+
# Skip warnings check
440+
# - name: Check for new warnings
441+
# run: |
442+
# cd gccrs-build
443+
# < log grep 'warning: ' | sort > log_warnings
444+
# if diff -U0 ../.github/bors_log_expected_warnings log_warnings; then
445+
# :
446+
# else
447+
# echo 'See <https://github.com/Rust-GCC/gccrs/pull/1026>.'
448+
# exit 1
449+
# fi >&2
450+
451+
- name: Run Tests
452+
run: |
453+
cd gccrs-build; \
454+
ASAN_OPTIONS=detect_leaks=0:use_odr_indicator=1 \
455+
make check-rust RUNTESTFLAGS="--target_board=unix\{-m64}"
456+
- name: Archive check-rust results
457+
uses: actions/upload-artifact@v3
458+
with:
459+
name: check-rust-logs
460+
path: |
461+
gccrs-build/gcc/testsuite/rust/
462+
- name: Check regressions
463+
run: |
464+
cd gccrs-build; \
465+
if grep -e "unexpected" -e "unresolved" -e "ERROR:" gcc/testsuite/rust/rust.sum;\
466+
then \
467+
echo "::error title=Regression test failed::some tests are not correct"; \
468+
perl -n ../.github/emit_test_errors.pl < gcc/testsuite/rust/rust.sum; \
469+
exit 1; \
470+
else \
471+
exit 0; \
472+
fi

0 commit comments

Comments
 (0)