Skip to content

Commit

Permalink
Merge pull request #5088 from gilles-peskine-arm/test_ssl_o2-2.16
Browse files Browse the repository at this point in the history
Backport 2.16: Build with -O2 when running ssl-opt
  • Loading branch information
mpg committed Oct 29, 2021
2 parents 27fc786 + 77624b2 commit d895668
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions tests/scripts/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ component_test_full_cmake_gcc_asan () {
component_test_zlib_make() {
msg "build: zlib enabled, make"
scripts/config.pl set MBEDTLS_ZLIB_SUPPORT
make ZLIB=1 CFLAGS='-Werror -O1'
make ZLIB=1 CFLAGS='-Werror -O2'

msg "test: main suites (zlib, make)"
make test
Expand All @@ -817,7 +817,7 @@ EOF
component_test_zlib_cmake() {
msg "build: zlib enabled, cmake"
scripts/config.pl set MBEDTLS_ZLIB_SUPPORT
cmake -D ENABLE_ZLIB_SUPPORT=On -D CMAKE_BUILD_TYPE:String=Check .
cmake -D ENABLE_ZLIB_SUPPORT=On -D CMAKE_BUILD_TYPE:String=Release .
make

msg "test: main suites (zlib, cmake)"
Expand Down Expand Up @@ -1055,7 +1055,7 @@ component_test_small_mbedtls_ssl_dtls_max_buffering () {
component_test_full_cmake_clang () {
msg "build: cmake, full config, clang" # ~ 50s
scripts/config.pl full
CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check -D ENABLE_TESTING=On .
CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release -D ENABLE_TESTING=On .
make

msg "test: main suites (full config)" # ~ 5s
Expand Down Expand Up @@ -1266,7 +1266,7 @@ component_test_memory_buffer_allocator_backtrace () {
scripts/config.pl set MBEDTLS_PLATFORM_MEMORY
scripts/config.pl set MBEDTLS_MEMORY_BACKTRACE
scripts/config.pl set MBEDTLS_MEMORY_DEBUG
CC=gcc cmake .
CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release .
make

msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C and MBEDTLS_MEMORY_BACKTRACE"
Expand All @@ -1277,7 +1277,7 @@ component_test_memory_buffer_allocator () {
msg "build: default config with memory buffer allocator"
scripts/config.pl set MBEDTLS_MEMORY_BUFFER_ALLOC_C
scripts/config.pl set MBEDTLS_PLATFORM_MEMORY
CC=gcc cmake .
CC=gcc cmake -DCMAKE_BUILD_TYPE:String=Release .
make

msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C"
Expand Down Expand Up @@ -1330,7 +1330,7 @@ component_test_null_entropy () {
component_test_no_date_time () {
msg "build: default config without MBEDTLS_HAVE_TIME_DATE"
scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE
CC=gcc cmake
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check .
make

msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites"
Expand Down Expand Up @@ -1442,7 +1442,8 @@ component_build_mbedtls_config_file () {
}

component_test_m32_o0 () {
# Build once with -O0, to compile out the i386 specific inline assembly
# Build without optimization, so as to use portable C code (in a 32-bit
# build) and not the i386-specific inline assembly.
msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s
scripts/config.pl full
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O0" LDFLAGS="-m32 $ASAN_CFLAGS"
Expand All @@ -1457,19 +1458,20 @@ support_test_m32_o0 () {
esac
}

component_test_m32_o1 () {
# Build again with -O1, to compile in the i386 specific inline assembly
msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s
component_test_m32_o2 () {
# Build with optimization, to use the i386 specific inline assembly
# and go faster for tests.
msg "build: i386, make, gcc -O2 (ASan build)" # ~ 30s
scripts/config.pl full
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O1" LDFLAGS="-m32 $ASAN_CFLAGS"
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS"

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

msg "test ssl-opt.sh, i386, make, gcc-O1"
msg "test ssl-opt.sh, i386, make, gcc-O2"
if_build_succeeded tests/ssl-opt.sh
}
support_test_m32_o1 () {
support_test_m32_o2 () {
support_test_m32_o0 "$@"
}

Expand Down Expand Up @@ -1720,7 +1722,7 @@ component_test_cmake_out_of_source () {
MBEDTLS_ROOT_DIR="$PWD"
mkdir "$OUT_OF_SOURCE_DIR"
cd "$OUT_OF_SOURCE_DIR"
cmake "$MBEDTLS_ROOT_DIR"
cmake -D CMAKE_BUILD_TYPE:String=Check "$MBEDTLS_ROOT_DIR"
make

msg "test: cmake 'out-of-source' build"
Expand Down

0 comments on commit d895668

Please sign in to comment.