blob: 33c17e2d3535162600f921e9e999d06bcb54c762 [file] [log] [blame]
Andres AG31f9b5b2016-10-04 17:14:38 +01001#! /usr/bin/env sh
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +01002
Simon Butcher3ea7f522016-03-07 23:22:10 +00003# all.sh
4#
SimonB2e23c822016-04-16 21:54:39 +01005# This file is part of mbed TLS (https://tls.mbed.org)
6#
Simon Butcher3ea7f522016-03-07 23:22:10 +00007# Copyright (c) 2014-2016, ARM Limited, All Rights Reserved
8#
9# Purpose
10#
SimonB2e23c822016-04-16 21:54:39 +010011# To run all tests possible or available on the platform.
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010012#
SimonB2e23c822016-04-16 21:54:39 +010013# Warning: the test is destructive. It includes various build modes and
14# configurations, and can and will arbitrarily change the current CMake
15# configuration. After this script has been run, the CMake cache will be lost
16# and CMake will no longer be initialised.
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +010017#
SimonB2e23c822016-04-16 21:54:39 +010018# The script assumes the presence of gcc and clang (recent enough for using
19# ASan with gcc and MemSan with clang, or valgrind) are available, as well as
20# cmake and a "good" find.
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010021
SimonB2e23c822016-04-16 21:54:39 +010022# Abort on errors (and uninitialised variables)
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010023set -eu
24
Andres AG38495a32016-07-12 16:54:33 +010025if [ "$( uname )" != "Linux" ]; then
26 echo "This script only works in Linux" >&2
27 exit 1
28elif [ -d library -a -d include -a -d tests ]; then :; else
29 echo "Must be run from mbed TLS root" >&2
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010030 exit 1
31fi
32
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000033CONFIG_H='include/mbedtls/config.h'
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +020034CONFIG_BAK="$CONFIG_H.bak"
35
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010036MEMORY=0
SimonB2e23c822016-04-16 21:54:39 +010037FORCE=0
Andres AG7770ea82016-10-10 15:46:20 +010038RELEASE=0
Gilles Peskineda519252017-11-30 13:22:04 +010039YOTTA=1
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010040
Andres AGd9eba4b2016-08-26 14:42:14 +010041# Default commands, can be overriden by the environment
42: ${OPENSSL:="openssl"}
43: ${OPENSSL_LEGACY:="$OPENSSL"}
44: ${GNUTLS_CLI:="gnutls-cli"}
45: ${GNUTLS_SERV:="gnutls-serv"}
46: ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"}
47: ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"}
Andres AGdc192212016-08-31 17:33:13 +010048: ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build}
Andres AG87bb5772016-09-27 15:05:15 +010049: ${ARMC5_BIN_DIR:=/usr/bin}
50: ${ARMC6_BIN_DIR:=/usr/bin}
Andres AGdc192212016-08-31 17:33:13 +010051
Andres AG38495a32016-07-12 16:54:33 +010052# if MAKEFLAGS is not set add the -j option to speed up invocations of make
53if [ -n "${MAKEFLAGS+set}" ]; then
54 export MAKEFLAGS="-j"
55fi
56
Simon Butcher41eeccf2016-09-07 00:07:09 +010057usage()
SimonB2e23c822016-04-16 21:54:39 +010058{
Andres AGd9eba4b2016-08-26 14:42:14 +010059 printf "Usage: $0\n"
60 printf " -h|--help\t\tPrint this help.\n"
61 printf " -m|--memory\t\tAdditional optional memory tests.\n"
62 printf " -f|--force\t\tForce the tests to overwrite any modified files.\n"
Andres AG7770ea82016-10-10 15:46:20 +010063 printf " -s|--seed\t\tInteger seed value to use for this test run.\n"
64 printf " -r|--release-test\t\tRun this script in release mode. This fixes the seed value to 1.\n"
Gilles Peskineda519252017-11-30 13:22:04 +010065 printf " --no-yotta\t\tSkip yotta build\n"
Simon Butcher41eeccf2016-09-07 00:07:09 +010066 printf " --out-of-source-dir=<path>\t\tDirectory used for CMake out-of-source build tests."
Andres AGd9eba4b2016-08-26 14:42:14 +010067 printf " --openssl=<OpenSSL_path>\t\tPath to OpenSSL executable to use for most tests.\n"
68 printf " --openssl-legacy=<OpenSSL_path>\t\tPath to OpenSSL executable to use for legacy tests e.g. SSLv3.\n"
69 printf " --gnutls-cli=<GnuTLS_cli_path>\t\tPath to GnuTLS client executable to use for most tests.\n"
70 printf " --gnutls-serv=<GnuTLS_serv_path>\t\tPath to GnuTLS server executable to use for most tests.\n"
71 printf " --gnutls-legacy-cli=<GnuTLS_cli_path>\t\tPath to GnuTLS client executable to use for legacy tests.\n"
72 printf " --gnutls-legacy-serv=<GnuTLS_serv_path>\t\tPath to GnuTLS server executable to use for legacy tests.\n"
Andres AG87bb5772016-09-27 15:05:15 +010073 printf " --armc5-bin-dir=<ARMC5_bin_dir_path>\t\tPath to the ARM Compiler 5 bin directory.\n"
74 printf " --armc6-bin-dir=<ARMC6_bin_dir_path>\t\tPath to the ARM Compiler 6 bin directory.\n"
SimonB2e23c822016-04-16 21:54:39 +010075}
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010076
77# remove built files as well as the cmake cache/config
78cleanup()
79{
80 make clean
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +020081
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +020082 find . -name yotta -prune -o -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000083 rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile
Paul Bakkerfe0984d2014-06-13 00:13:45 +020084 git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile
85 git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +020086
87 if [ -f "$CONFIG_BAK" ]; then
88 mv "$CONFIG_BAK" "$CONFIG_H"
89 fi
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +010090}
91
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +020092trap cleanup INT TERM HUP
93
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +010094msg()
95{
96 echo ""
97 echo "******************************************************************"
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +010098 echo "* $1 "
Manuel Pégourié-Gonnard392d3dd2015-01-26 14:03:56 +000099 printf "* "; date
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +0100100 echo "******************************************************************"
101}
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +0100102
Andres AGa5cd9732016-10-17 15:23:10 +0100103armc6_build_test()
104{
105 FLAGS="$1"
106
107 msg "build: ARM Compiler 6 ($FLAGS), make"
108 ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \
Simon Butchercb587002017-01-06 16:14:44 +0000109 WARNING_CFLAGS='-xc -std=c99' make lib
Andres AGa5cd9732016-10-17 15:23:10 +0100110 make clean
111}
112
Andres AGd9eba4b2016-08-26 14:42:14 +0100113err_msg()
114{
115 echo "$1" >&2
116}
117
118check_tools()
119{
120 for TOOL in "$@"; do
121 if ! `hash "$TOOL" >/dev/null 2>&1`; then
122 err_msg "$TOOL not found!"
123 exit 1
124 fi
125 done
126}
127
SimonB2e23c822016-04-16 21:54:39 +0100128while [ $# -gt 0 ]; do
129 case "$1" in
130 --memory|-m*)
131 MEMORY=${1#-m}
132 ;;
SimonB2e23c822016-04-16 21:54:39 +0100133 --force|-f)
134 FORCE=1
135 ;;
Andres AG7770ea82016-10-10 15:46:20 +0100136 --seed|-s)
137 shift
138 SEED="$1"
139 ;;
140 --release-test|-r)
141 RELEASE=1
142 ;;
Gilles Peskineda519252017-11-30 13:22:04 +0100143 --no-yotta)
144 YOTTA=0
145 ;;
Andres AGdc192212016-08-31 17:33:13 +0100146 --out-of-source-dir)
147 shift
148 OUT_OF_SOURCE_DIR="$1"
149 ;;
Andres AGd9eba4b2016-08-26 14:42:14 +0100150 --openssl)
151 shift
152 OPENSSL="$1"
153 ;;
154 --openssl-legacy)
155 shift
156 OPENSSL_LEGACY="$1"
157 ;;
158 --gnutls-cli)
159 shift
160 GNUTLS_CLI="$1"
161 ;;
162 --gnutls-serv)
163 shift
164 GNUTLS_SERV="$1"
165 ;;
166 --gnutls-legacy-cli)
167 shift
168 GNUTLS_LEGACY_CLI="$1"
169 ;;
170 --gnutls-legacy-serv)
171 shift
172 GNUTLS_LEGACY_SERV="$1"
173 ;;
Andres AG87bb5772016-09-27 15:05:15 +0100174 --armc5-bin-dir)
175 shift
176 ARMC5_BIN_DIR="$1"
177 ;;
178 --armc6-bin-dir)
179 shift
180 ARMC6_BIN_DIR="$1"
181 ;;
SimonB2e23c822016-04-16 21:54:39 +0100182 --help|-h|*)
Andres AGd9eba4b2016-08-26 14:42:14 +0100183 usage
SimonB2e23c822016-04-16 21:54:39 +0100184 exit 1
185 ;;
186 esac
187 shift
188done
189
190if [ $FORCE -eq 1 ]; then
Gilles Peskineda519252017-11-30 13:22:04 +0100191 if [ $YOTTA -eq 1 ]; then
192 rm -rf yotta/module "$OUT_OF_SOURCE_DIR"
193 fi
SimonB2e23c822016-04-16 21:54:39 +0100194 git checkout-index -f -q $CONFIG_H
195 cleanup
196else
197
Gilles Peskineda519252017-11-30 13:22:04 +0100198 if [ $YOTTA -eq 1 ] && [ -d yotta/module ]; then
Andres AGd9eba4b2016-08-26 14:42:14 +0100199 err_msg "Warning - there is an existing yotta module in the directory 'yotta/module'"
SimonB2e23c822016-04-16 21:54:39 +0100200 echo "You can either delete your work and retry, or force the test to overwrite the"
201 echo "test by rerunning the script as: $0 --force"
202 exit 1
203 fi
204
Andres AGdc192212016-08-31 17:33:13 +0100205 if [ -d "$OUT_OF_SOURCE_DIR" ]; then
206 echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2
207 echo "You can either delete this directory manually, or force the test by rerunning"
208 echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR"
209 exit 1
210 fi
211
SimonB2e23c822016-04-16 21:54:39 +0100212 if ! git diff-files --quiet include/mbedtls/config.h; then
213 echo $?
Andres AGd9eba4b2016-08-26 14:42:14 +0100214 err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. "
SimonB2e23c822016-04-16 21:54:39 +0100215 echo "You can either delete or preserve your work, or force the test by rerunning the"
216 echo "script as: $0 --force"
217 exit 1
218 fi
219fi
220
Andres AG7770ea82016-10-10 15:46:20 +0100221if [ $RELEASE -eq 1 ]; then
222 # Fix the seed value to 1 to ensure that the tests are deterministic.
223 SEED=1
224fi
225
Andres AGd9eba4b2016-08-26 14:42:14 +0100226msg "info: $0 configuration"
227echo "MEMORY: $MEMORY"
228echo "FORCE: $FORCE"
Andres AG7770ea82016-10-10 15:46:20 +0100229echo "SEED: ${SEED-"UNSET"}"
Andres AGd9eba4b2016-08-26 14:42:14 +0100230echo "OPENSSL: $OPENSSL"
231echo "OPENSSL_LEGACY: $OPENSSL_LEGACY"
232echo "GNUTLS_CLI: $GNUTLS_CLI"
233echo "GNUTLS_SERV: $GNUTLS_SERV"
234echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI"
235echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV"
Andres AG87bb5772016-09-27 15:05:15 +0100236echo "ARMC5_BIN_DIR: $ARMC5_BIN_DIR"
237echo "ARMC6_BIN_DIR: $ARMC6_BIN_DIR"
238
239ARMC5_CC="$ARMC5_BIN_DIR/armcc"
240ARMC5_AR="$ARMC5_BIN_DIR/armar"
241ARMC6_CC="$ARMC6_BIN_DIR/armclang"
242ARMC6_AR="$ARMC6_BIN_DIR/armar"
Andres AGd9eba4b2016-08-26 14:42:14 +0100243
Andres AGb2fdd042016-09-22 14:17:46 +0100244# To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh
245# we just export the variables they require
246export OPENSSL_CMD="$OPENSSL"
247export GNUTLS_CLI="$GNUTLS_CLI"
248export GNUTLS_SERV="$GNUTLS_SERV"
249
Andres AG7770ea82016-10-10 15:46:20 +0100250# Avoid passing --seed flag in every call to ssl-opt.sh
251[ ! -z ${SEED+set} ] && export SEED
252
Andres AGd9eba4b2016-08-26 14:42:14 +0100253# Make sure the tools we need are available.
254check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \
255 "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \
Simon Butcher105e8562017-01-05 18:26:40 +0000256 "arm-none-eabi-gcc" "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR" \
257 "i686-w64-mingw32-gcc"
Andres AGd9eba4b2016-08-26 14:42:14 +0100258
SimonB2e23c822016-04-16 21:54:39 +0100259#
260# Test Suites to be executed
261#
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200262# The test ordering tries to optimize for the following criteria:
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100263# 1. Catch possible problems early, by running first tests that run quickly
Manuel Pégourié-Gonnard61bc57a2014-08-14 11:29:06 +0200264# and/or are more likely to fail than others (eg I use Clang most of the
265# time, so start with a GCC build).
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200266# 2. Minimize total running time, by avoiding useless rebuilds
267#
268# Indicative running times are given for reference.
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +0100269
Janos Follathb72c6782016-07-19 14:54:17 +0100270msg "info: output_env.sh"
Andres AGd9eba4b2016-08-26 14:42:14 +0100271OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \
272 GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \
Andres AG87bb5772016-09-27 15:05:15 +0100273 GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \
274 ARMC6_CC="$ARMC6_CC" scripts/output_env.sh
Janos Follathb72c6782016-07-19 14:54:17 +0100275
Manuel Pégourié-Gonnardea29d152014-11-20 17:32:33 +0100276msg "test: recursion.pl" # < 1s
Manuel Pégourié-Gonnardd09a6b52015-04-09 17:19:23 +0200277tests/scripts/recursion.pl library/*.c
Manuel Pégourié-Gonnardea29d152014-11-20 17:32:33 +0100278
Manuel Pégourié-Gonnardb3b8e432015-02-13 14:52:19 +0000279msg "test: freshness of generated source files" # < 1s
280tests/scripts/check-generated-files.sh
281
Manuel Pégourié-Gonnardd09a6b52015-04-09 17:19:23 +0200282msg "test: doxygen markup outside doxygen blocks" # < 1s
283tests/scripts/check-doxy-blocks.pl
284
Manuel Pégourié-Gonnarda687baf2015-04-09 11:09:03 +0200285msg "test/build: declared and exported names" # < 3s
286cleanup
287tests/scripts/check-names.sh
288
Andres AGd9eba4b2016-08-26 14:42:14 +0100289msg "test: doxygen warnings" # ~ 3s
290cleanup
291tests/scripts/doxygen.sh
Manuel Pégourié-Gonnard1d552e72016-01-04 16:49:09 +0100292
Gilles Peskineda519252017-11-30 13:22:04 +0100293if [ $YOTTA -ne 0 ]; then
294 # Note - use of yotta is deprecated, and yotta also requires armcc to be
295 # on the path, and uses whatever version of armcc it finds there.
296 msg "build: create and build yotta module" # ~ 30s
297 cleanup
298 tests/scripts/yotta-build.sh
299fi
Manuel Pégourié-Gonnard77d56bb2015-07-28 15:00:37 +0200300
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100301msg "build: cmake, gcc, ASan" # ~ 1 min 50s
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +0100302cleanup
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100303CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +0100304make
305
Simon Butcher8e3afc72016-09-15 17:13:08 +0100306msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100307make test
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200308
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100309msg "test: ssl-opt.sh (ASan build)" # ~ 1 min
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100310tests/ssl-opt.sh
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200311
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100312msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200313tests/scripts/test-ref-configs.pl
314
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200315msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min
316make
317
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100318msg "test: compat.sh (ASan build)" # ~ 6 min
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100319tests/compat.sh
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200320
Simon Butcher3ea7f522016-03-07 23:22:10 +0000321msg "build: Default + SSLv3 (ASan build)" # ~ 6 min
322cleanup
Simon Butcherf413b6f2016-03-14 22:32:42 +0000323cp "$CONFIG_H" "$CONFIG_BAK"
Simon Butcher3ea7f522016-03-07 23:22:10 +0000324scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3
325CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
326make
327
Simon Butcher8e3afc72016-09-15 17:13:08 +0100328msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s
Simon Butcher3ea7f522016-03-07 23:22:10 +0000329make test
Simon Butcher3ea7f522016-03-07 23:22:10 +0000330
331msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min
Andres AGd9eba4b2016-08-26 14:42:14 +0100332tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2'
333OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3'
Simon Butcher3ea7f522016-03-07 23:22:10 +0000334
335msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min
336tests/ssl-opt.sh
337
Hanno Becker134c2ab2017-10-12 15:29:50 +0100338msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min
339cleanup
340cp "$CONFIG_H" "$CONFIG_BAK"
341scripts/config.pl unset MBEDTLS_SSL_RENEGOTIATION
342CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
343make
344
345msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s
346make test
347
348msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min
349tests/ssl-opt.sh
350
Simon Butcherf95c1762016-11-10 17:25:58 +0000351msg "build: cmake, full config, clang, C99" # ~ 50s
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +0100352cleanup
Janos Follath35d48cb2016-04-22 14:45:00 +0100353cp "$CONFIG_H" "$CONFIG_BAK"
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200354scripts/config.pl full
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200355scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests
Simon Butcherf95c1762016-11-10 17:25:58 +0000356CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check -D ENABLE_TESTING=On .
357CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic' make
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +0100358
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100359msg "test: main suites (full config)" # ~ 5s
Simon Butcherf95c1762016-11-10 17:25:58 +0000360CFLAGS='-Werror -Wall -Wextra' make test
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200361
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100362msg "test: ssl-opt.sh default (full config)" # ~ 1s
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100363tests/ssl-opt.sh -f Default
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200364
Manuel Pégourié-Gonnardea0920f2015-03-24 09:50:15 +0100365msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min
Andres AGd9eba4b2016-08-26 14:42:14 +0100366OPENSSL_CMD="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_LEGACY_CLI" GNUTLS_SERV="$GNUTLS_LEGACY_SERV" tests/compat.sh -e '3DES\|DES-CBC3' -f 'NULL\|DES\|RC4\|ARCFOUR'
Manuel Pégourié-Gonnarde73b2632014-07-12 04:00:00 +0200367
Manuel Pégourié-Gonnard503a5ef2015-10-23 09:04:45 +0200368msg "test/build: curves.pl (gcc)" # ~ 4 min
Manuel Pégourié-Gonnard246978d2014-11-20 13:29:53 +0100369cleanup
370cmake -D CMAKE_BUILD_TYPE:String=Debug .
371tests/scripts/curves.pl
372
Manuel Pégourié-Gonnard503a5ef2015-10-23 09:04:45 +0200373msg "test/build: key-exchanges (gcc)" # ~ 1 min
374cleanup
375cmake -D CMAKE_BUILD_TYPE:String=Check .
376tests/scripts/key-exchanges.pl
377
Manuel Pégourié-Gonnard61fe8b02015-03-13 14:33:16 +0000378msg "build: Unix make, -Os (gcc)" # ~ 30s
Manuel Pégourié-Gonnard3895f5a2014-03-27 14:44:04 +0100379cleanup
Simon Butcherf95c1762016-11-10 17:25:58 +0000380CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' make
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +0100381
Simon Butcherf95c1762016-11-10 17:25:58 +0000382# Full configuration build, without platform support, file IO and net sockets.
383# This should catch missing mbedtls_printf definitions, and by disabling file
384# IO, it should catch missing '#include <stdio.h>'
385msg "build: full config except platform/fsio/net, make, gcc, C99" # ~ 30s
Manuel Pégourié-Gonnarda71780e2015-02-13 13:56:55 +0000386cleanup
387cp "$CONFIG_H" "$CONFIG_BAK"
388scripts/config.pl full
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200389scripts/config.pl unset MBEDTLS_PLATFORM_C
Simon Butcherf95c1762016-11-10 17:25:58 +0000390scripts/config.pl unset MBEDTLS_NET_C
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200391scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY
Manuel Pégourié-Gonnard3d4755b2015-06-03 14:03:17 +0100392scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT
393scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT
394scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT
Simon Butcherb9283432016-07-13 11:02:41 +0100395scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT
Manuel Pégourié-Gonnard3d4755b2015-06-03 14:03:17 +0100396scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT
Simon Butcher284b4c92016-06-26 13:10:00 +0100397scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200398scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C
399scripts/config.pl unset MBEDTLS_FS_IO
Simon Butchercb587002017-01-06 16:14:44 +0000400# Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19,
401# to re-enable platform integration features otherwise disabled in C99 builds
402CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -O0 -D_DEFAULT_SOURCE' make lib programs
Simon Butcherf95c1762016-11-10 17:25:58 +0000403CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make test
Manuel Pégourié-Gonnarda71780e2015-02-13 13:56:55 +0000404
Manuel Pégourié-Gonnarddccb80b2015-06-03 10:20:33 +0100405# catch compile bugs in _uninit functions
406msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s
407cleanup
408cp "$CONFIG_H" "$CONFIG_BAK"
409scripts/config.pl full
Manuel Pégourié-Gonnard7ee5ddd2015-06-03 10:33:55 +0100410scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
Simon Butchereebf1b92016-06-27 01:42:39 +0100411scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
Simon Butcherf95c1762016-11-10 17:25:58 +0000412CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make
Manuel Pégourié-Gonnarddccb80b2015-06-03 10:20:33 +0100413
Manuel Pégourié-Gonnard66b8e952015-05-20 11:13:56 +0200414msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s
415cleanup
416cp "$CONFIG_H" "$CONFIG_BAK"
417scripts/config.pl full
418scripts/config.pl unset MBEDTLS_SSL_SRV_C
Simon Butcherf95c1762016-11-10 17:25:58 +0000419CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make
Manuel Pégourié-Gonnard66b8e952015-05-20 11:13:56 +0200420
421msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s
422cleanup
423cp "$CONFIG_H" "$CONFIG_BAK"
424scripts/config.pl full
425scripts/config.pl unset MBEDTLS_SSL_CLI_C
Simon Butcherf95c1762016-11-10 17:25:58 +0000426CC=gcc CFLAGS='-Werror -Wall -Werror -O0' make
Manuel Pégourié-Gonnard66b8e952015-05-20 11:13:56 +0200427
Simon Butcherf95c1762016-11-10 17:25:58 +0000428# Note, C99 compliance can also be tested with the sockets support disabled,
429# as that requires a POSIX platform (which isn't the same as C99).
Andres AG788aa4a2016-09-14 14:32:09 +0100430msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s
Manuel Pégourié-Gonnard009a2642015-05-29 10:31:13 +0200431cleanup
432cp "$CONFIG_H" "$CONFIG_BAK"
433scripts/config.pl full
Manuel Pégourié-Gonnardf78e4de2015-05-29 10:52:14 +0200434scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc.
435scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux
Simon Butcherf95c1762016-11-10 17:25:58 +0000436CC=gcc CFLAGS='-Werror -Wall -Wextra -O0 -std=c99 -pedantic' make lib
Manuel Pégourié-Gonnard009a2642015-05-29 10:31:13 +0200437
Hanno Becker5175ac62017-09-18 15:36:25 +0100438msg "build: default config except MFL extension (ASan build)" # ~ 30s
439cleanup
440cp "$CONFIG_H" "$CONFIG_BAK"
441scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
442CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
443make
444
445msg "test: ssl-opt.sh, MFL-related tests"
446tests/ssl-opt.sh -f "Max fragment length"
447
Simon Butcherab5df402016-06-11 02:31:21 +0100448msg "build: default config with MBEDTLS_TEST_NULL_ENTROPY (ASan build)"
Janos Follath06c54002016-06-09 13:57:40 +0100449cleanup
450cp "$CONFIG_H" "$CONFIG_BAK"
Simon Butcherab5df402016-06-11 02:31:21 +0100451scripts/config.pl set MBEDTLS_TEST_NULL_ENTROPY
Janos Follath06c54002016-06-09 13:57:40 +0100452scripts/config.pl set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
453scripts/config.pl set MBEDTLS_ENTROPY_C
454scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
455scripts/config.pl unset MBEDTLS_ENTROPY_HARDWARE_ALT
456scripts/config.pl unset MBEDTLS_HAVEGE_C
Simon Butchereebf1b92016-06-27 01:42:39 +0100457CC=gcc cmake -D UNSAFE_BUILD=ON -D CMAKE_C_FLAGS:String="-fsanitize=address -fno-common -O3" .
Janos Follath06c54002016-06-09 13:57:40 +0100458make
459
Simon Butcher8e3afc72016-09-15 17:13:08 +0100460msg "test: MBEDTLS_TEST_NULL_ENTROPY - main suites (inc. selftests) (ASan build)"
Janos Follath06c54002016-06-09 13:57:40 +0100461make test
Janos Follath06c54002016-06-09 13:57:40 +0100462
Manuel Pégourié-Gonnard9b06abe2015-06-25 09:56:07 +0200463if uname -a | grep -F Linux >/dev/null; then
464msg "build/test: make shared" # ~ 40s
465cleanup
466make SHARED=1 all check
467fi
468
Manuel Pégourié-Gonnardedb2dc92015-02-10 14:36:31 +0000469if uname -a | grep -F x86_64 >/dev/null; then
470msg "build: i386, make, gcc" # ~ 30s
471cleanup
Simon Butcherf95c1762016-11-10 17:25:58 +0000472CC=gcc CFLAGS='-Werror -Wall -Wextra -m32' make
Andres Amaya Garciadd29c2f2017-05-04 11:35:51 +0100473
Hanno Beckerbf37b102017-08-23 10:29:42 +0100474msg "build: default config, MBEDTLS_RSA_NO_CRT, make, gcc"
475cleanup
476cp "$CONFIG_H" "$CONFIG_BAK"
477scripts/config.pl set MBEDTLS_RSA_NO_CRT
478CC=gcc CFLAGS='-Werror -Wall -Werror -O0' make
479
480msg "test: MBEDTLS_RSA_NO_CRT - main suites (inc. selftests) (ASan build)"
481make test
482
Andres Amaya Garciadd29c2f2017-05-04 11:35:51 +0100483msg "build: gcc, force 32-bit compilation"
484cleanup
485cp "$CONFIG_H" "$CONFIG_BAK"
486scripts/config.pl unset MBEDTLS_HAVE_ASM
487scripts/config.pl unset MBEDTLS_AESNI_C
488scripts/config.pl unset MBEDTLS_PADLOCK_C
489CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' make
490
Andres Amaya Garcia33264d72017-07-20 13:21:34 +0100491msg "build: gcc, force 64-bit compilation"
492cleanup
493cp "$CONFIG_H" "$CONFIG_BAK"
494scripts/config.pl unset MBEDTLS_HAVE_ASM
495scripts/config.pl unset MBEDTLS_AESNI_C
496scripts/config.pl unset MBEDTLS_PADLOCK_C
497CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' make
498
499msg "test: gcc, force 64-bit compilation"
Andres Amaya Garciadd29c2f2017-05-04 11:35:51 +0100500make test
Andres Amaya Garcia33264d72017-07-20 13:21:34 +0100501
Andres Amaya Garciac327aa12017-07-21 10:50:25 +0100502msg "build: gcc, force 64-bit compilation"
Andres Amaya Garcia33264d72017-07-20 13:21:34 +0100503cleanup
504cp "$CONFIG_H" "$CONFIG_BAK"
505scripts/config.pl unset MBEDTLS_HAVE_ASM
506scripts/config.pl unset MBEDTLS_AESNI_C
507scripts/config.pl unset MBEDTLS_PADLOCK_C
Andres Amaya Garciac327aa12017-07-21 10:50:25 +0100508CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' make
Manuel Pégourié-Gonnardedb2dc92015-02-10 14:36:31 +0000509fi # x86_64
510
Manuel Pégourié-Gonnardedb2dc92015-02-10 14:36:31 +0000511msg "build: arm-none-eabi-gcc, make" # ~ 10s
512cleanup
513cp "$CONFIG_H" "$CONFIG_BAK"
514scripts/config.pl full
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200515scripts/config.pl unset MBEDTLS_NET_C
516scripts/config.pl unset MBEDTLS_TIMING_C
517scripts/config.pl unset MBEDTLS_FS_IO
Simon Butchereebf1b92016-06-27 01:42:39 +0100518scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
Simon Butcherbc6a4862016-03-07 17:35:59 +0000519scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY
Manuel Pégourié-Gonnardedb2dc92015-02-10 14:36:31 +0000520# following things are not in the default config
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200521scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c
522scripts/config.pl unset MBEDTLS_THREADING_PTHREAD
523scripts/config.pl unset MBEDTLS_THREADING_C
524scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h
525scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
Simon Butcherf95c1762016-11-10 17:25:58 +0000526CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib
Manuel Pégourié-Gonnardedb2dc92015-02-10 14:36:31 +0000527
Gilles Peskine9a9adcd2017-06-08 15:19:20 +0200528msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s
529cleanup
Simon Butcher51aaa992017-07-23 13:42:36 +0200530cp "$CONFIG_H" "$CONFIG_BAK"
Andres Amaya Garcia6fb65862017-07-20 13:27:35 +0100531scripts/config.pl full
532scripts/config.pl unset MBEDTLS_NET_C
533scripts/config.pl unset MBEDTLS_TIMING_C
534scripts/config.pl unset MBEDTLS_FS_IO
535scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
536scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY
537# following things are not in the default config
538scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c
539scripts/config.pl unset MBEDTLS_THREADING_PTHREAD
540scripts/config.pl unset MBEDTLS_THREADING_C
541scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h
542scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
Gilles Peskine9a9adcd2017-06-08 15:19:20 +0200543scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION
544CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib
545echo "Checking that software 64-bit division is not required"
546! grep __aeabi_uldiv library/*.o
547
Andres AG87bb5772016-09-27 15:05:15 +0100548msg "build: ARM Compiler 5, make"
Manuel Pégourié-Gonnardc5c59392015-02-10 17:38:54 +0100549cleanup
550cp "$CONFIG_H" "$CONFIG_BAK"
551scripts/config.pl full
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200552scripts/config.pl unset MBEDTLS_NET_C
553scripts/config.pl unset MBEDTLS_TIMING_C
554scripts/config.pl unset MBEDTLS_FS_IO
Simon Butcher1c719652016-06-27 19:02:12 +0100555scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200556scripts/config.pl unset MBEDTLS_HAVE_TIME
Manuel Pégourié-Gonnardbbc60db2015-06-22 14:31:50 +0200557scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE
Simon Butcherbc6a4862016-03-07 17:35:59 +0000558scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY
Manuel Pégourié-Gonnardc5c59392015-02-10 17:38:54 +0100559# following things are not in the default config
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200560scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING
561scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c
562scripts/config.pl unset MBEDTLS_THREADING_PTHREAD
563scripts/config.pl unset MBEDTLS_THREADING_C
564scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h
565scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
Simon Butcher4df5eaf2016-08-24 22:58:31 +0300566scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT # depends on MBEDTLS_HAVE_TIME
Andres AG87bb5772016-09-27 15:05:15 +0100567
Simon Butcher105e8562017-01-05 18:26:40 +0000568CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' make lib
Andres AG87bb5772016-09-27 15:05:15 +0100569make clean
570
Simon Butcher51aaa992017-07-23 13:42:36 +0200571# ARM Compiler 6 - Target ARMv7-A
Andres AGa5cd9732016-10-17 15:23:10 +0100572armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a"
Simon Butcher51aaa992017-07-23 13:42:36 +0200573
574# ARM Compiler 6 - Target ARMv7-M
Andres AGa5cd9732016-10-17 15:23:10 +0100575armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m"
Simon Butcher51aaa992017-07-23 13:42:36 +0200576
577# ARM Compiler 6 - Target ARMv8-A - AArch32
Andres AGa5cd9732016-10-17 15:23:10 +0100578armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a"
Simon Butcher51aaa992017-07-23 13:42:36 +0200579
580# ARM Compiler 6 - Target ARMv8-M
Andres AGa5cd9732016-10-17 15:23:10 +0100581armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main"
Simon Butcher51aaa992017-07-23 13:42:36 +0200582
583# ARM Compiler 6 - Target ARMv8-A - AArch64
584armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a"
Manuel Pégourié-Gonnardc5c59392015-02-10 17:38:54 +0100585
Gilles Peskine2a458da2017-05-12 15:26:58 +0200586msg "build: allow SHA1 in certificates by default"
587cleanup
588cp "$CONFIG_H" "$CONFIG_BAK"
589scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
590CFLAGS='-Werror -Wall -Wextra' make
591msg "test: allow SHA1 in certificates by default"
592make test
593tests/ssl-opt.sh -f SHA-1
594
Simon Butcher002bc622016-11-17 09:27:45 +0000595msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s
Manuel Pégourié-Gonnard6448bce2015-02-16 17:18:36 +0100596cleanup
Simon Butcher002bc622016-11-17 09:27:45 +0000597CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 make lib programs
Simon Butcher91aef332016-11-17 09:20:50 +0000598
Simon Butcher002bc622016-11-17 09:27:45 +0000599# note Make tests only builds the tests, but doesn't run them
600CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 make tests
Manuel Pégourié-Gonnard52fa38a2015-06-23 14:29:58 +0200601WINDOWS_BUILD=1 make clean
Simon Butcherf95c1762016-11-10 17:25:58 +0000602
Simon Butcher002bc622016-11-17 09:27:45 +0000603msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s
604CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 make lib programs
605CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 make tests
Manuel Pégourié-Gonnarde33316c2015-08-07 13:17:23 +0200606WINDOWS_BUILD=1 make clean
Manuel Pégourié-Gonnard6448bce2015-02-16 17:18:36 +0100607
Manuel Pégourié-Gonnardedb2dc92015-02-10 14:36:31 +0000608# MemSan currently only available on Linux 64 bits
609if uname -a | grep 'Linux.*x86_64' >/dev/null; then
Manuel Pégourié-Gonnard392d3dd2015-01-26 14:03:56 +0000610
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100611msg "build: MSan (clang)" # ~ 1 min 20s
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100612cleanup
613cp "$CONFIG_H" "$CONFIG_BAK"
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200614scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100615CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
616make
Manuel Pégourié-Gonnard4a9dc2a2014-05-09 13:46:59 +0200617
Manuel Pégourié-Gonnard89d69b32014-11-20 13:48:53 +0100618msg "test: main suites (MSan)" # ~ 10s
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100619make test
620
621msg "test: ssl-opt.sh (MSan)" # ~ 1 min
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100622tests/ssl-opt.sh
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100623
624# Optional part(s)
625
626if [ "$MEMORY" -gt 0 ]; then
627 msg "test: compat.sh (MSan)" # ~ 6 min 20s
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100628 tests/compat.sh
Manuel Pégourié-Gonnard57255b12014-06-09 11:21:49 +0200629fi
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +0100630
Manuel Pégourié-Gonnard392d3dd2015-01-26 14:03:56 +0000631else # no MemSan
632
633msg "build: Release (clang)"
634cleanup
635CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release .
636make
637
638msg "test: main suites valgrind (Release)"
Manuel Pégourié-Gonnard9afdc832015-08-04 17:15:13 +0200639make memcheck
Manuel Pégourié-Gonnard392d3dd2015-01-26 14:03:56 +0000640
641# Optional part(s)
642# Currently broken, programs don't seem to receive signals
643# under valgrind on OS X
644
645if [ "$MEMORY" -gt 0 ]; then
646 msg "test: ssl-opt.sh --memcheck (Release)"
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100647 tests/ssl-opt.sh --memcheck
Manuel Pégourié-Gonnard392d3dd2015-01-26 14:03:56 +0000648fi
649
650if [ "$MEMORY" -gt 1 ]; then
651 msg "test: compat.sh --memcheck (Release)"
Manuel Pégourié-Gonnard3d404b42015-07-08 21:59:16 +0100652 tests/compat.sh --memcheck
Manuel Pégourié-Gonnard392d3dd2015-01-26 14:03:56 +0000653fi
654
655fi # MemSan
656
Andres AGdc192212016-08-31 17:33:13 +0100657msg "build: cmake 'out-of-source' build"
658cleanup
659MBEDTLS_ROOT_DIR="$PWD"
660mkdir "$OUT_OF_SOURCE_DIR"
661cd "$OUT_OF_SOURCE_DIR"
662cmake "$MBEDTLS_ROOT_DIR"
663make
664
665msg "test: cmake 'out-of-source' build"
666make test
667cd "$MBEDTLS_ROOT_DIR"
668rm -rf "$OUT_OF_SOURCE_DIR"
669
Manuel Pégourié-Gonnard9bda9b32014-11-20 13:10:22 +0100670msg "Done, cleaning up"
Manuel Pégourié-Gonnard80955ee2014-03-19 18:29:01 +0100671cleanup