Andres AG | 31f9b5b | 2016-10-04 17:14:38 +0100 | [diff] [blame] | 1 | #! /usr/bin/env sh |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 2 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 3 | # all.sh |
| 4 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 5 | # This file is part of mbed TLS (https://tls.mbed.org) |
| 6 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 7 | # Copyright (c) 2014-2017, ARM Limited, All Rights Reserved |
| 8 | |
| 9 | |
| 10 | |
| 11 | ################################################################ |
| 12 | #### Documentation |
| 13 | ################################################################ |
| 14 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 15 | # Purpose |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 16 | # ------- |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 17 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 18 | # To run all tests possible or available on the platform. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 19 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 20 | # Notes for users |
| 21 | # --------------- |
| 22 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 23 | # Warning: the test is destructive. It includes various build modes and |
| 24 | # configurations, and can and will arbitrarily change the current CMake |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 25 | # configuration. The following files must be committed into git: |
| 26 | # * include/mbedtls/config.h |
| 27 | # * Makefile, library/Makefile, programs/Makefile, tests/Makefile |
| 28 | # After running this script, the CMake cache will be lost and CMake |
| 29 | # will no longer be initialised. |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 30 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 31 | # The script assumes the presence of a number of tools: |
| 32 | # * Basic Unix tools (Windows users note: a Unix-style find must be before |
| 33 | # the Windows find in the PATH) |
| 34 | # * Perl |
| 35 | # * GNU Make |
| 36 | # * CMake |
| 37 | # * GCC and Clang (recent enough for using ASan with gcc and MemSan with clang, or valgrind) |
| 38 | # * arm-gcc and mingw-gcc |
| 39 | # * ArmCC 5 and ArmCC 6, unless invoked with --no-armcc |
| 40 | # * Yotta build dependencies, unless invoked with --no-yotta |
| 41 | # * OpenSSL and GnuTLS command line tools, recent enough for the |
| 42 | # interoperability tests. If they don't support SSLv3 then a legacy |
| 43 | # version of these tools must be present as well (search for LEGACY |
| 44 | # below). |
| 45 | # See the invocation of check_tools below for details. |
| 46 | # |
| 47 | # This script must be invoked from the toplevel directory of a git |
| 48 | # working copy of Mbed TLS. |
| 49 | # |
| 50 | # Note that the output is not saved. You may want to run |
| 51 | # script -c tests/scripts/all.sh |
| 52 | # or |
| 53 | # tests/scripts/all.sh >all.log 2>&1 |
| 54 | # |
| 55 | # Notes for maintainers |
| 56 | # --------------------- |
| 57 | # |
| 58 | # The tests are roughly in order from fastest to slowest. This doesn't |
| 59 | # have to be exact, but in general you should add slower tests towards |
| 60 | # the end and fast checks near the beginning. |
| 61 | # |
| 62 | # Sanity checks have the following form: |
| 63 | # 1. msg "short description of what is about to be done" |
| 64 | # 2. run sanity check (failure stops the script) |
| 65 | # |
| 66 | # Build or build-and-test steps have the following form: |
| 67 | # 1. msg "short description of what is about to be done" |
| 68 | # 2. cleanup |
| 69 | # 3. preparation (config.pl, cmake, ...) (failure stops the script) |
| 70 | # 4. make |
| 71 | # 5. Run tests if relevant. All tests must be prefixed with |
| 72 | # if_build_successful for the sake of --keep-going. |
| 73 | |
| 74 | |
| 75 | |
| 76 | ################################################################ |
| 77 | #### Initialization and command line parsing |
| 78 | ################################################################ |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 79 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 80 | # Abort on errors (and uninitialised variables) |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 81 | set -eu |
| 82 | |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 83 | if [ "$( uname )" != "Linux" ]; then |
| 84 | echo "This script only works in Linux" >&2 |
| 85 | exit 1 |
| 86 | elif [ -d library -a -d include -a -d tests ]; then :; else |
| 87 | echo "Must be run from mbed TLS root" >&2 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 88 | exit 1 |
| 89 | fi |
| 90 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 91 | CONFIG_H='include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 92 | CONFIG_BAK="$CONFIG_H.bak" |
| 93 | |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 94 | MEMORY=0 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 95 | FORCE=0 |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 96 | KEEP_GOING=0 |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 97 | RELEASE=0 |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 98 | RUN_ARMCC=1 |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 99 | YOTTA=1 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 100 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 101 | # Default commands, can be overriden by the environment |
| 102 | : ${OPENSSL:="openssl"} |
| 103 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 104 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 105 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 106 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 107 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 108 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 109 | : ${ARMC5_BIN_DIR:=/usr/bin} |
| 110 | : ${ARMC6_BIN_DIR:=/usr/bin} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 111 | |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 112 | # if MAKEFLAGS is not set add the -j option to speed up invocations of make |
| 113 | if [ -n "${MAKEFLAGS+set}" ]; then |
| 114 | export MAKEFLAGS="-j" |
| 115 | fi |
| 116 | |
Simon Butcher | 41eeccf | 2016-09-07 00:07:09 +0100 | [diff] [blame] | 117 | usage() |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 118 | { |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 119 | cat <<EOF |
| 120 | Usage: $0 [OPTION]... |
| 121 | -h|--help Print this help. |
| 122 | |
| 123 | General options: |
| 124 | -f|--force Force the tests to overwrite any modified files. |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 125 | -k|--keep-going Run all tests and report errors at the end. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 126 | -m|--memory Additional optional memory tests. |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 127 | --armcc Run ARM Compiler builds (on by default). |
| 128 | --no-armcc Skip ARM Compiler builds. |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 129 | --no-yotta Skip yotta module build. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 130 | --out-of-source-dir=<path> Directory used for CMake out-of-source build tests. |
| 131 | -r|--release-test Run this script in release mode. This fixes the seed value to 1. |
| 132 | -s|--seed Integer seed value to use for this test run. |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 133 | --yotta Build yotta module (on by default). |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 134 | |
| 135 | Tool path options: |
| 136 | --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory. |
| 137 | --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory. |
| 138 | --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests. |
| 139 | --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests. |
| 140 | --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests. |
| 141 | --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests. |
| 142 | --openssl=<OpenSSL_path> OpenSSL executable to use for most tests. |
| 143 | --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests e.g. SSLv3. |
| 144 | EOF |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 145 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 146 | |
| 147 | # remove built files as well as the cmake cache/config |
| 148 | cleanup() |
| 149 | { |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 150 | command make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 151 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 152 | find . -name yotta -prune -o -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+ |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 153 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 154 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 155 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 156 | |
| 157 | if [ -f "$CONFIG_BAK" ]; then |
| 158 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 159 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 160 | } |
| 161 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 162 | # Executed on exit. May be redefined depending on command line options. |
| 163 | final_report () { |
| 164 | : |
| 165 | } |
| 166 | |
| 167 | fatal_signal () { |
| 168 | cleanup |
| 169 | final_report $1 |
| 170 | trap - $1 |
| 171 | kill -$1 $$ |
| 172 | } |
| 173 | |
| 174 | trap 'fatal_signal HUP' HUP |
| 175 | trap 'fatal_signal INT' INT |
| 176 | trap 'fatal_signal TERM' TERM |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 177 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 178 | msg() |
| 179 | { |
| 180 | echo "" |
| 181 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 182 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 183 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 184 | echo "******************************************************************" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 185 | current_section=$1 |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 186 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 187 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 188 | if [ $RUN_ARMCC -ne 0 ]; then |
| 189 | armc6_build_test() |
| 190 | { |
| 191 | FLAGS="$1" |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 192 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 193 | msg "build: ARM Compiler 6 ($FLAGS), make" |
| 194 | ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \ |
| 195 | WARNING_CFLAGS='-xc -std=c99' make lib |
| 196 | make clean |
| 197 | } |
| 198 | fi |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 199 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 200 | err_msg() |
| 201 | { |
| 202 | echo "$1" >&2 |
| 203 | } |
| 204 | |
| 205 | check_tools() |
| 206 | { |
| 207 | for TOOL in "$@"; do |
| 208 | if ! `hash "$TOOL" >/dev/null 2>&1`; then |
| 209 | err_msg "$TOOL not found!" |
| 210 | exit 1 |
| 211 | fi |
| 212 | done |
| 213 | } |
| 214 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 215 | while [ $# -gt 0 ]; do |
| 216 | case "$1" in |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 217 | --armcc) |
| 218 | RUN_ARMCC=1 |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 219 | ;; |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 220 | --armc5-bin-dir) |
| 221 | shift |
| 222 | ARMC5_BIN_DIR="$1" |
| 223 | ;; |
| 224 | --armc6-bin-dir) |
| 225 | shift |
| 226 | ARMC6_BIN_DIR="$1" |
| 227 | ;; |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 228 | --force|-f) |
| 229 | FORCE=1 |
| 230 | ;; |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 231 | --gnutls-cli) |
| 232 | shift |
| 233 | GNUTLS_CLI="$1" |
| 234 | ;; |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 235 | --gnutls-legacy-cli) |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 236 | shift |
| 237 | GNUTLS_LEGACY_CLI="$1" |
| 238 | ;; |
| 239 | --gnutls-legacy-serv) |
| 240 | shift |
| 241 | GNUTLS_LEGACY_SERV="$1" |
| 242 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 243 | --gnutls-serv) |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 244 | shift |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 245 | GNUTLS_SERV="$1" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 246 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 247 | --help|-h) |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 248 | usage |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 249 | exit |
| 250 | ;; |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 251 | --keep-going|-k) |
| 252 | KEEP_GOING=1 |
| 253 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 254 | --memory|-m) |
| 255 | MEMORY=1 |
| 256 | ;; |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 257 | --no-armcc) |
| 258 | RUN_ARMCC=0 |
| 259 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 260 | --no-yotta) |
| 261 | YOTTA=0 |
| 262 | ;; |
| 263 | --openssl) |
| 264 | shift |
| 265 | OPENSSL="$1" |
| 266 | ;; |
| 267 | --openssl-legacy) |
| 268 | shift |
| 269 | OPENSSL_LEGACY="$1" |
| 270 | ;; |
| 271 | --out-of-source-dir) |
| 272 | shift |
| 273 | OUT_OF_SOURCE_DIR="$1" |
| 274 | ;; |
| 275 | --release-test|-r) |
| 276 | RELEASE=1 |
| 277 | ;; |
| 278 | --seed|-s) |
| 279 | shift |
| 280 | SEED="$1" |
| 281 | ;; |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 282 | --yotta) |
| 283 | YOTTA=1 |
| 284 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 285 | *) |
| 286 | echo >&2 "Unknown option: $1" |
| 287 | echo >&2 "Run $0 --help for usage." |
| 288 | exit 120 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 289 | ;; |
| 290 | esac |
| 291 | shift |
| 292 | done |
| 293 | |
| 294 | if [ $FORCE -eq 1 ]; then |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 295 | if [ $YOTTA -eq 1 ]; then |
| 296 | rm -rf yotta/module "$OUT_OF_SOURCE_DIR" |
| 297 | fi |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 298 | git checkout-index -f -q $CONFIG_H |
| 299 | cleanup |
| 300 | else |
| 301 | |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 302 | if [ $YOTTA -ne 0 ] && [ -d yotta/module ]; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 303 | err_msg "Warning - there is an existing yotta module in the directory 'yotta/module'" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 304 | echo "You can either delete your work and retry, or force the test to overwrite the" |
| 305 | echo "test by rerunning the script as: $0 --force" |
| 306 | exit 1 |
| 307 | fi |
| 308 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 309 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 310 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 311 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 312 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 313 | exit 1 |
| 314 | fi |
| 315 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 316 | if ! git diff-files --quiet include/mbedtls/config.h; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 317 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 318 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 319 | echo "script as: $0 --force" |
| 320 | exit 1 |
| 321 | fi |
| 322 | fi |
| 323 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 324 | build_status=0 |
| 325 | if [ $KEEP_GOING -eq 1 ]; then |
| 326 | failure_summary= |
| 327 | failure_count=0 |
| 328 | start_red= |
| 329 | end_color= |
| 330 | if [ -t 1 ]; then |
| 331 | case "$TERM" in |
| 332 | *color*|cygwin|linux|rxvt*|screen|[Eex]term*) |
| 333 | start_red=$(printf '\033[31m') |
| 334 | end_color=$(printf '\033[0m') |
| 335 | ;; |
| 336 | esac |
| 337 | fi |
| 338 | record_status () { |
| 339 | if "$@"; then |
| 340 | last_status=0 |
| 341 | else |
| 342 | last_status=$? |
| 343 | text="$current_section: $* -> $last_status" |
| 344 | failure_summary="$failure_summary |
| 345 | $text" |
| 346 | failure_count=$((failure_count + 1)) |
| 347 | echo "${start_red}^^^^$text^^^^${end_color}" |
| 348 | fi |
| 349 | } |
| 350 | make () { |
| 351 | case "$*" in |
| 352 | *test|*check) |
| 353 | if [ $build_status -eq 0 ]; then |
| 354 | record_status command make "$@" |
| 355 | else |
| 356 | echo "(skipped because the build failed)" |
| 357 | fi |
| 358 | ;; |
| 359 | *) |
| 360 | record_status command make "$@" |
| 361 | build_status=$last_status |
| 362 | ;; |
| 363 | esac |
| 364 | } |
| 365 | final_report () { |
| 366 | if [ $failure_count -gt 0 ]; then |
| 367 | echo |
| 368 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 369 | echo "${start_red}FAILED: $failure_count${end_color}$failure_summary" |
| 370 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 371 | elif [ -z "${1-}" ]; then |
| 372 | echo "SUCCESS :)" |
| 373 | fi |
| 374 | if [ -n "${1-}" ]; then |
| 375 | echo "Killed by SIG$1." |
| 376 | fi |
| 377 | } |
| 378 | else |
| 379 | record_status () { |
| 380 | "$@" |
| 381 | } |
| 382 | fi |
| 383 | if_build_succeeded () { |
| 384 | if [ $build_status -eq 0 ]; then |
| 385 | record_status "$@" |
| 386 | fi |
| 387 | } |
| 388 | |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 389 | if [ $RELEASE -eq 1 ]; then |
| 390 | # Fix the seed value to 1 to ensure that the tests are deterministic. |
| 391 | SEED=1 |
| 392 | fi |
| 393 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 394 | msg "info: $0 configuration" |
| 395 | echo "MEMORY: $MEMORY" |
| 396 | echo "FORCE: $FORCE" |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 397 | echo "SEED: ${SEED-"UNSET"}" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 398 | echo "OPENSSL: $OPENSSL" |
| 399 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 400 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 401 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 402 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 403 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 404 | echo "ARMC5_BIN_DIR: $ARMC5_BIN_DIR" |
| 405 | echo "ARMC6_BIN_DIR: $ARMC6_BIN_DIR" |
| 406 | |
| 407 | ARMC5_CC="$ARMC5_BIN_DIR/armcc" |
| 408 | ARMC5_AR="$ARMC5_BIN_DIR/armar" |
| 409 | ARMC6_CC="$ARMC6_BIN_DIR/armclang" |
| 410 | ARMC6_AR="$ARMC6_BIN_DIR/armar" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 411 | |
Andres AG | b2fdd04 | 2016-09-22 14:17:46 +0100 | [diff] [blame] | 412 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 413 | # we just export the variables they require |
| 414 | export OPENSSL_CMD="$OPENSSL" |
| 415 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 416 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 417 | |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 418 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 419 | [ ! -z ${SEED+set} ] && export SEED |
| 420 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 421 | # Make sure the tools we need are available. |
| 422 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 423 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 424 | "arm-none-eabi-gcc" "i686-w64-mingw32-gcc" |
| 425 | if [ $RUN_ARMCC -ne 0 ]; then |
| 426 | check_tools "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR" |
| 427 | fi |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 428 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 429 | |
| 430 | |
| 431 | ################################################################ |
| 432 | #### Basic checks |
| 433 | ################################################################ |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 434 | |
| 435 | # |
| 436 | # Test Suites to be executed |
| 437 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 438 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 439 | # 1. Catch possible problems early, by running first tests that run quickly |
Manuel Pégourié-Gonnard | 61bc57a | 2014-08-14 11:29:06 +0200 | [diff] [blame] | 440 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 441 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 442 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 443 | # |
| 444 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 445 | |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 446 | msg "info: output_env.sh" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 447 | OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \ |
| 448 | GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \ |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 449 | GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \ |
| 450 | ARMC6_CC="$ARMC6_CC" scripts/output_env.sh |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 451 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 452 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 453 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 454 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 455 | msg "test: freshness of generated source files" # < 1s |
| 456 | tests/scripts/check-generated-files.sh |
| 457 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 458 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 459 | tests/scripts/check-doxy-blocks.pl |
| 460 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 461 | msg "test/build: declared and exported names" # < 3s |
| 462 | cleanup |
| 463 | tests/scripts/check-names.sh |
| 464 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 465 | msg "test: doxygen warnings" # ~ 3s |
| 466 | cleanup |
| 467 | tests/scripts/doxygen.sh |
Manuel Pégourié-Gonnard | 1d552e7 | 2016-01-04 16:49:09 +0100 | [diff] [blame] | 468 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 469 | |
| 470 | |
| 471 | ################################################################ |
| 472 | #### Build and test many configurations and targets |
| 473 | ################################################################ |
| 474 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 475 | if [ $RUN_ARMCC -ne 0 ] && [ $YOTTA -ne 0 ]; then |
| 476 | # Note - use of yotta is deprecated, and yotta also requires armcc to be on the |
| 477 | # path, and uses whatever version of armcc it finds there. |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 478 | msg "build: create and build yotta module" # ~ 30s |
| 479 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 480 | record_status tests/scripts/yotta-build.sh |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 481 | fi |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 482 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 483 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 484 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 485 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 486 | make |
| 487 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 488 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 489 | make test |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 490 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 491 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 492 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 493 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 494 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 495 | if_build_succeeded tests/scripts/test-ref-configs.pl |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 496 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 497 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 498 | make |
| 499 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 500 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 501 | if_build_succeeded tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 502 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 503 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 504 | cleanup |
Simon Butcher | f413b6f | 2016-03-14 22:32:42 +0000 | [diff] [blame] | 505 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 506 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 507 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 508 | make |
| 509 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 510 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 511 | make test |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 512 | |
| 513 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 514 | if_build_succeeded tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 515 | if_build_succeeded env OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 516 | |
| 517 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 518 | if_build_succeeded tests/ssl-opt.sh |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 519 | |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 520 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
| 521 | cleanup |
| 522 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 523 | scripts/config.pl unset MBEDTLS_SSL_RENEGOTIATION |
| 524 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 525 | make |
| 526 | |
| 527 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 528 | make test |
| 529 | |
| 530 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 531 | if_build_succeeded tests/ssl-opt.sh |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 532 | |
Hanno Becker | 69d45cc | 2018-03-09 10:46:23 +0000 | [diff] [blame^] | 533 | msg "build: Default + RSA_NO_CRT (ASan build)" # ~ 6 min |
| 534 | cleanup |
| 535 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 536 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
| 537 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 538 | make |
| 539 | |
| 540 | msg "test: RSA_NO_CRT - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 541 | make test |
| 542 | |
| 543 | msg "test: RSA_NO_CRT - RSA-related part of ssl-opt.sh (ASan build)" # ~ 5s |
| 544 | tests/ssl-opt.sh -f RSA |
| 545 | |
| 546 | msg "test: RSA_NO_CRT - RSA-related part of compat.sh (ASan build)" # ~ 3 min |
| 547 | tests/compat.sh -t RSA |
| 548 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 549 | msg "build: cmake, full config, clang, C99" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 550 | cleanup |
Janos Follath | 35d48cb | 2016-04-22 14:45:00 +0100 | [diff] [blame] | 551 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 552 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 553 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 554 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check -D ENABLE_TESTING=On . |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 555 | make CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic' |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 556 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 557 | msg "test: main suites (full config)" # ~ 5s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 558 | make CFLAGS='-Werror -Wall -Wextra' test |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 559 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 560 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 561 | if_build_succeeded tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 562 | |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 563 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 564 | if_build_succeeded env OPENSSL_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é-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 565 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 566 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 567 | cleanup |
| 568 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 569 | if_build_succeeded tests/scripts/curves.pl |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 570 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 571 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 572 | cleanup |
| 573 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 574 | if_build_succeeded tests/scripts/key-exchanges.pl |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 575 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 576 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 577 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 578 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 579 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 580 | # Full configuration build, without platform support, file IO and net sockets. |
| 581 | # This should catch missing mbedtls_printf definitions, and by disabling file |
| 582 | # IO, it should catch missing '#include <stdio.h>' |
| 583 | msg "build: full config except platform/fsio/net, make, gcc, C99" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 584 | cleanup |
| 585 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 586 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 587 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 588 | scripts/config.pl unset MBEDTLS_NET_C |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 589 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 590 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 591 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 592 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
Simon Butcher | b928343 | 2016-07-13 11:02:41 +0100 | [diff] [blame] | 593 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 594 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Simon Butcher | 284b4c9 | 2016-06-26 13:10:00 +0100 | [diff] [blame] | 595 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 596 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 597 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | cb58700 | 2017-01-06 16:14:44 +0000 | [diff] [blame] | 598 | # Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19, |
| 599 | # to re-enable platform integration features otherwise disabled in C99 builds |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 600 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -O0 -D_DEFAULT_SOURCE' lib programs |
| 601 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' test |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 602 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 603 | # catch compile bugs in _uninit functions |
| 604 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 605 | cleanup |
| 606 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 607 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 608 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 609 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 610 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 611 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 612 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 613 | cleanup |
| 614 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 615 | scripts/config.pl full |
| 616 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 617 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 618 | |
| 619 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 620 | cleanup |
| 621 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 622 | scripts/config.pl full |
| 623 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 624 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 625 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 626 | # Note, C99 compliance can also be tested with the sockets support disabled, |
| 627 | # as that requires a POSIX platform (which isn't the same as C99). |
Andres AG | 788aa4a | 2016-09-14 14:32:09 +0100 | [diff] [blame] | 628 | msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 629 | cleanup |
| 630 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 631 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 632 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 633 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 634 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0 -std=c99 -pedantic' lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 635 | |
Hanno Becker | 5175ac6 | 2017-09-18 15:36:25 +0100 | [diff] [blame] | 636 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
| 637 | cleanup |
| 638 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 639 | scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 640 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 641 | make |
| 642 | |
| 643 | msg "test: ssl-opt.sh, MFL-related tests" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 644 | if_build_succeeded tests/ssl-opt.sh -f "Max fragment length" |
Hanno Becker | 5175ac6 | 2017-09-18 15:36:25 +0100 | [diff] [blame] | 645 | |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 646 | msg "build: default config with MBEDTLS_TEST_NULL_ENTROPY (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 647 | cleanup |
| 648 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 649 | scripts/config.pl set MBEDTLS_TEST_NULL_ENTROPY |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 650 | scripts/config.pl set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES |
| 651 | scripts/config.pl set MBEDTLS_ENTROPY_C |
| 652 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 653 | scripts/config.pl unset MBEDTLS_ENTROPY_HARDWARE_ALT |
| 654 | scripts/config.pl unset MBEDTLS_HAVEGE_C |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 655 | CC=gcc cmake -D UNSAFE_BUILD=ON -D CMAKE_C_FLAGS:String="-fsanitize=address -fno-common -O3" . |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 656 | make |
| 657 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 658 | msg "test: MBEDTLS_TEST_NULL_ENTROPY - main suites (inc. selftests) (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 659 | make test |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 660 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 661 | if uname -a | grep -F Linux >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 662 | msg "build/test: make shared" # ~ 40s |
| 663 | cleanup |
| 664 | make SHARED=1 all check |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 665 | fi |
| 666 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 667 | if uname -a | grep -F x86_64 >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 668 | msg "build: i386, make, gcc" # ~ 30s |
| 669 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 670 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -m32' |
Andres Amaya Garcia | dd29c2f | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 671 | |
Andres Amaya Garcia | f4fbdda | 2017-05-08 11:19:19 +0100 | [diff] [blame] | 672 | msg "test: i386, make, gcc" |
| 673 | make test |
| 674 | |
| 675 | msg "build: 64-bit ILP32, make, gcc" # ~ 30s |
| 676 | cleanup |
| 677 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32' |
| 678 | |
| 679 | msg "test: 64-bit ILP32, make, gcc" |
| 680 | make test |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 681 | fi # x86_64 |
| 682 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 683 | msg "build: gcc, force 32-bit bignum limbs" |
| 684 | cleanup |
| 685 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 686 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 687 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 688 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
| 689 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' |
| 690 | |
| 691 | msg "test: gcc, force 32-bit bignum limbs" |
| 692 | make test |
| 693 | |
| 694 | msg "build: gcc, force 64-bit bignum limbs" |
| 695 | cleanup |
| 696 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 697 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 698 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 699 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
| 700 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' |
| 701 | |
| 702 | msg "test: gcc, force 64-bit bignum limbs" |
| 703 | make test |
| 704 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 705 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 706 | cleanup |
| 707 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 708 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 709 | scripts/config.pl unset MBEDTLS_NET_C |
| 710 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 711 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 712 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 713 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 714 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 715 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 716 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 717 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 718 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 719 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 720 | make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' lib |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 721 | |
Gilles Peskine | 9a9adcd | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 722 | msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s |
| 723 | cleanup |
Simon Butcher | 51aaa99 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 724 | cp "$CONFIG_H" "$CONFIG_BAK" |
Andres Amaya Garcia | 6fb6586 | 2017-07-20 13:27:35 +0100 | [diff] [blame] | 725 | scripts/config.pl full |
| 726 | scripts/config.pl unset MBEDTLS_NET_C |
| 727 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 728 | scripts/config.pl unset MBEDTLS_FS_IO |
| 729 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 730 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
| 731 | # following things are not in the default config |
| 732 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 733 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 734 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 735 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 736 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | 9a9adcd | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 737 | scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 738 | make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' lib |
Gilles Peskine | 9a9adcd | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 739 | echo "Checking that software 64-bit division is not required" |
| 740 | ! grep __aeabi_uldiv library/*.o |
| 741 | |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 742 | msg "build: ARM Compiler 5, make" |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 743 | cleanup |
| 744 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 745 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 746 | scripts/config.pl unset MBEDTLS_NET_C |
| 747 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 748 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | 1c71965 | 2016-06-27 19:02:12 +0100 | [diff] [blame] | 749 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 750 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 751 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 752 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 753 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 754 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 755 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 756 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 757 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 758 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 759 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 4df5eaf | 2016-08-24 22:58:31 +0300 | [diff] [blame] | 760 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT # depends on MBEDTLS_HAVE_TIME |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 761 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 762 | if [ $RUN_ARMCC -ne 0 ]; then |
| 763 | make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib |
| 764 | make clean |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 765 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 766 | # ARM Compiler 6 - Target ARMv7-A |
| 767 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a" |
Simon Butcher | 51aaa99 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 768 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 769 | # ARM Compiler 6 - Target ARMv7-M |
| 770 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m" |
Simon Butcher | 51aaa99 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 771 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 772 | # ARM Compiler 6 - Target ARMv8-A - AArch32 |
| 773 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a" |
Simon Butcher | 51aaa99 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 774 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 775 | # ARM Compiler 6 - Target ARMv8-M |
| 776 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main" |
Simon Butcher | 51aaa99 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 777 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 778 | # ARM Compiler 6 - Target ARMv8-A - AArch64 |
| 779 | armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a" |
| 780 | fi |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 781 | |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 782 | msg "build: allow SHA1 in certificates by default" |
| 783 | cleanup |
| 784 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 785 | scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 786 | make CFLAGS='-Werror -Wall -Wextra' |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 787 | msg "test: allow SHA1 in certificates by default" |
| 788 | make test |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 789 | if_build_succeeded tests/ssl-opt.sh -f SHA-1 |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 790 | |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 791 | msg "build: Default + MBEDTLS_RSA_NO_CRT (ASan build)" # ~ 6 min |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 792 | cleanup |
| 793 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 794 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 795 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 796 | make |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 797 | |
| 798 | msg "test: MBEDTLS_RSA_NO_CRT - main suites (inc. selftests) (ASan build)" |
| 799 | make test |
| 800 | |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 801 | msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 802 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 803 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 lib programs |
Simon Butcher | 91aef33 | 2016-11-17 09:20:50 +0000 | [diff] [blame] | 804 | |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 805 | # note Make tests only builds the tests, but doesn't run them |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 806 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 tests |
| 807 | make WINDOWS_BUILD=1 clean |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 808 | |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 809 | msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 810 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 lib programs |
| 811 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 tests |
| 812 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 813 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 814 | # MemSan currently only available on Linux 64 bits |
| 815 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 816 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 817 | msg "build: MSan (clang)" # ~ 1 min 20s |
| 818 | cleanup |
| 819 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 820 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 821 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 822 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 823 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 824 | msg "test: main suites (MSan)" # ~ 10s |
| 825 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 826 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 827 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 828 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 829 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 830 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 831 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 832 | if [ "$MEMORY" -gt 0 ]; then |
| 833 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 834 | if_build_succeeded tests/compat.sh |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 835 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 836 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 837 | else # no MemSan |
| 838 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 839 | msg "build: Release (clang)" |
| 840 | cleanup |
| 841 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 842 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 843 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 844 | msg "test: main suites valgrind (Release)" |
| 845 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 846 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 847 | # Optional part(s) |
| 848 | # Currently broken, programs don't seem to receive signals |
| 849 | # under valgrind on OS X |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 850 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 851 | if [ "$MEMORY" -gt 0 ]; then |
| 852 | msg "test: ssl-opt.sh --memcheck (Release)" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 853 | if_build_succeeded tests/ssl-opt.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 854 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 855 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 856 | if [ "$MEMORY" -gt 1 ]; then |
| 857 | msg "test: compat.sh --memcheck (Release)" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 858 | if_build_succeeded tests/compat.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 859 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 860 | |
| 861 | fi # MemSan |
| 862 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 863 | msg "build: cmake 'out-of-source' build" |
| 864 | cleanup |
| 865 | MBEDTLS_ROOT_DIR="$PWD" |
| 866 | mkdir "$OUT_OF_SOURCE_DIR" |
| 867 | cd "$OUT_OF_SOURCE_DIR" |
| 868 | cmake "$MBEDTLS_ROOT_DIR" |
| 869 | make |
| 870 | |
| 871 | msg "test: cmake 'out-of-source' build" |
| 872 | make test |
| 873 | cd "$MBEDTLS_ROOT_DIR" |
| 874 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 875 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 876 | |
| 877 | |
| 878 | ################################################################ |
| 879 | #### Termination |
| 880 | ################################################################ |
| 881 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 882 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 883 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 884 | |
| 885 | final_report |