mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-04-29 16:36:33 +00:00
all.sh: don't insist on Linux; always run Valgrind
Don't bail out of all.sh if the OS isn't Linux. We only expect everything to pass on a recent Linux x86_64, but it's useful to call all.sh to run some components on any platform. In all.sh, always run both MemorySanitizer and Valgrind. Valgrind is slower than ASan and MSan but finds some things that they don't. Run MSan unconditionally, not just on Linux/x86_64. MSan is supported on some other OSes and CPUs these days. Use `all.sh --except test_memsan` if you want to omit MSan because it isn't supported on your platform. Use `all.sh --except test_memcheck` if you want to omit Valgrind because it's too slow. Portability: ecognize amd64 (FreeBSD arch string) as well as x86_64 (Linux arch string) for `uname -m`. The `make` utility must still be GNU make.
This commit is contained in:
parent
4e7b323fd8
commit
770ad7e2c9
|
@ -81,10 +81,7 @@
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
pre_check_environment () {
|
pre_check_environment () {
|
||||||
if [ "$( uname )" != "Linux" ]; then
|
if [ -d library -a -d include -a -d tests ]; then :; else
|
||||||
echo "This script only works in Linux" >&2
|
|
||||||
exit 1
|
|
||||||
elif [ -d library -a -d include -a -d tests ]; then :; else
|
|
||||||
echo "Must be run from mbed TLS root" >&2
|
echo "Must be run from mbed TLS root" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -737,15 +734,13 @@ component_test_platform_calloc_macro () {
|
||||||
}
|
}
|
||||||
|
|
||||||
component_test_make_shared () {
|
component_test_make_shared () {
|
||||||
if uname -a | grep -F Linux >/dev/null; then
|
|
||||||
msg "build/test: make shared" # ~ 40s
|
msg "build/test: make shared" # ~ 40s
|
||||||
make SHARED=1 all check
|
make SHARED=1 all check
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component_test_m32_o0 () {
|
case $(uname -m) in
|
||||||
if uname -a | grep -F x86_64 >/dev/null; then
|
amd64|x86_64)
|
||||||
|
component_test_m32_o0 () {
|
||||||
# Build once with -O0, to compile out the i386 specific inline assembly
|
# Build once with -O0, to compile out the i386 specific inline assembly
|
||||||
msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s
|
msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s
|
||||||
scripts/config.pl full
|
scripts/config.pl full
|
||||||
|
@ -753,11 +748,9 @@ component_test_m32_o0 () {
|
||||||
|
|
||||||
msg "test: i386, make, gcc -O0 (ASan build)"
|
msg "test: i386, make, gcc -O0 (ASan build)"
|
||||||
make test
|
make test
|
||||||
fi # x86_64
|
}
|
||||||
}
|
|
||||||
|
|
||||||
component_test_m32_o1 () {
|
component_test_m32_o1 () {
|
||||||
if uname -a | grep -F x86_64 >/dev/null; then
|
|
||||||
# Build again with -O1, to compile in the i386 specific inline assembly
|
# Build again with -O1, to compile in the i386 specific inline assembly
|
||||||
msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s
|
msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s
|
||||||
scripts/config.pl full
|
scripts/config.pl full
|
||||||
|
@ -765,19 +758,18 @@ component_test_m32_o1 () {
|
||||||
|
|
||||||
msg "test: i386, make, gcc -O1 (ASan build)"
|
msg "test: i386, make, gcc -O1 (ASan build)"
|
||||||
make test
|
make test
|
||||||
fi # x86_64
|
}
|
||||||
}
|
|
||||||
|
|
||||||
component_test_mx32 () {
|
component_test_mx32 () {
|
||||||
if uname -a | grep -F x86_64 >/dev/null; then
|
|
||||||
msg "build: 64-bit ILP32, make, gcc" # ~ 30s
|
msg "build: 64-bit ILP32, make, gcc" # ~ 30s
|
||||||
scripts/config.pl full
|
scripts/config.pl full
|
||||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32'
|
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32'
|
||||||
|
|
||||||
msg "test: 64-bit ILP32, make, gcc"
|
msg "test: 64-bit ILP32, make, gcc"
|
||||||
make test
|
make test
|
||||||
fi # x86_64
|
}
|
||||||
}
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
component_test_have_int32 () {
|
component_test_have_int32 () {
|
||||||
msg "build: gcc, force 32-bit bignum limbs"
|
msg "build: gcc, force 32-bit bignum limbs"
|
||||||
|
@ -902,8 +894,6 @@ component_build_mingw () {
|
||||||
}
|
}
|
||||||
|
|
||||||
component_test_memsan () {
|
component_test_memsan () {
|
||||||
# MemSan currently only available on Linux 64 bits
|
|
||||||
if uname -a | grep 'Linux.*x86_64' >/dev/null; then
|
|
||||||
msg "build: MSan (clang)" # ~ 1 min 20s
|
msg "build: MSan (clang)" # ~ 1 min 20s
|
||||||
scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm
|
scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm
|
||||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
|
CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
|
||||||
|
@ -921,12 +911,9 @@ component_test_memsan () {
|
||||||
msg "test: compat.sh (MSan)" # ~ 6 min 20s
|
msg "test: compat.sh (MSan)" # ~ 6 min 20s
|
||||||
if_build_succeeded tests/compat.sh
|
if_build_succeeded tests/compat.sh
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component_test_memcheck () {
|
component_test_memcheck () {
|
||||||
# Only run if MemSan is not available
|
|
||||||
if ! uname -a | grep 'Linux.*x86_64' >/dev/null; then
|
|
||||||
msg "build: Release (clang)"
|
msg "build: Release (clang)"
|
||||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release .
|
CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||||
make
|
make
|
||||||
|
@ -947,8 +934,6 @@ component_test_memcheck () {
|
||||||
msg "test: compat.sh --memcheck (Release)"
|
msg "test: compat.sh --memcheck (Release)"
|
||||||
if_build_succeeded tests/compat.sh --memcheck
|
if_build_succeeded tests/compat.sh --memcheck
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi # MemSan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component_test_cmake_out_of_source () {
|
component_test_cmake_out_of_source () {
|
||||||
|
|
Loading…
Reference in a new issue