Fix ASAN=1 with make test_command.
Test-built binaries were stripped even when ASAN was enabled (thus the stack dump couldn't give line numbers) because in portability.sh the CFLAGS change was exported but NOSTRIP=1 was local, and ASAN was unset to prevent duplicate appends to FLAGS. When test.sh->single.sh->make.sh it inherited only the CFLAGS change. While I was there I cleaned up test.sh not to call back into make, instead call the other scripts directly. (Cleaner layering.)
This commit is contained in:
parent
87b6d3f302
commit
04c395d51e
@ -30,11 +30,11 @@ fi
|
||||
if [ -n "$ASAN" ]; then
|
||||
# Turn ASan on and disable most optimization to get more readable backtraces.
|
||||
# (Technically ASAN is just "-fsanitize=address" and the rest is optional.)
|
||||
ASAN_FLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||
CFLAGS="$CFLAGS $ASAN_FLAGS"
|
||||
NOSTRIP=1
|
||||
export CFLAGS="$CFLAGS -fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||
export NOSTRIP=1
|
||||
# Ignore leaks on exit. TODO
|
||||
export ASAN_OPTIONS="detect_leaks=0"
|
||||
# only do this once
|
||||
unset ASAN
|
||||
fi
|
||||
|
||||
|
@ -8,20 +8,23 @@ export FILES="$PWD"/tests/files
|
||||
|
||||
trap 'kill $(jobs -p) 2>/dev/null; exit 1' INT
|
||||
|
||||
rm -rf generated/testdir
|
||||
mkdir -p generated/testdir/testdir
|
||||
export PREFIX=generated/testdir
|
||||
rm -rf "$PREFIX"
|
||||
mkdir -p "$PREFIX"/testdir
|
||||
|
||||
if [ -z "$TEST_HOST" ]
|
||||
then
|
||||
if [ $# -ne 0 ]
|
||||
then
|
||||
PREFIX=generated/testdir/ scripts/single.sh "$@" || exit 1
|
||||
scripts/single.sh "$@" || exit 1
|
||||
else
|
||||
make install_flat PREFIX=generated/testdir || exit 1
|
||||
scripts/make.sh &&
|
||||
scripts/install.sh --symlink --force || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd generated/testdir
|
||||
export -n PREFIX
|
||||
cd "$PREFIX"
|
||||
PATH="$PWD:$PATH"
|
||||
TESTDIR="$PWD"
|
||||
export LC_COLLATE=C
|
||||
|
Loading…
Reference in New Issue
Block a user