Skip to content

Commit ec904e4

Browse files
authored
Merge pull request #2899 from gilles-peskine-arm/asan-test-fail-2.16
Backport 2.16: Make sure Asan failures are detected in 'make test'
2 parents 8fedeaa + 33685f5 commit ec904e4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/scripts/all.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ pre_initialize_variables () {
137137
export MAKEFLAGS="-j"
138138
fi
139139

140+
# CFLAGS and LDFLAGS for Asan builds that don't use CMake
141+
ASAN_CFLAGS='-Werror -Wall -Wextra -fsanitize=address,undefined -fno-sanitize-recover=all'
142+
140143
# Gather the list of available components. These are the functions
141144
# defined in this script whose name starts with "component_".
142145
# Parse the script with sed, because in sh there is no way to list
@@ -1064,7 +1067,7 @@ component_test_m32_o0 () {
10641067
# Build once with -O0, to compile out the i386 specific inline assembly
10651068
msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s
10661069
scripts/config.pl full
1067-
make CC=gcc CFLAGS='-O0 -Werror -Wall -Wextra -m32 -fsanitize=address' LDFLAGS='-m32 -fsanitize=address'
1070+
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O0" LDFLAGS="-m32 $ASAN_CFLAGS"
10681071

10691072
msg "test: i386, make, gcc -O0 (ASan build)"
10701073
make test
@@ -1080,7 +1083,7 @@ component_test_m32_o1 () {
10801083
# Build again with -O1, to compile in the i386 specific inline assembly
10811084
msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s
10821085
scripts/config.pl full
1083-
make CC=gcc CFLAGS='-O1 -Werror -Wall -Wextra -m32 -fsanitize=address' LDFLAGS='-m32 -fsanitize=address'
1086+
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O1" LDFLAGS="-m32 $ASAN_CFLAGS"
10841087

10851088
msg "test: i386, make, gcc -O1 (ASan build)"
10861089
make test

tests/scripts/run-test-suites.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ sub pad_print_center {
9393
$suite_cases_failed = () = $result =~ /.. FAILED/g;
9494
$suite_cases_skipped = () = $result =~ /.. ----/g;
9595

96-
if( $result =~ /PASSED/ ) {
96+
if( $? == 0 ) {
9797
print "PASS\n";
9898
if( $verbose > 2 ) {
9999
pad_print_center( 72, '-', "Begin $suite" );

0 commit comments

Comments
 (0)