Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 3 | # all.sh |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 4 | # |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 5 | # This file is part of mbed TLS (https://tls.mbed.org) |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 6 | # |
Gilles Peskine | d7602c2 | 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 | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 15 | # Purpose |
Gilles Peskine | d7602c2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 16 | # ------- |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 17 | # |
| 18 | # To run all tests possible or available on the platform. |
| 19 | # |
Gilles Peskine | d7602c2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 20 | # Notes for users |
| 21 | # --------------- |
| 22 | # |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +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 | d7602c2 | 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. |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 30 | # |
Gilles Peskine | d7602c2 | 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 | # * OpenSSL and GnuTLS command line tools, recent enough for the |
| 41 | # interoperability tests. If they don't support SSLv3 then a legacy |
| 42 | # version of these tools must be present as well (search for LEGACY |
| 43 | # below). |
| 44 | # See the invocation of check_tools below for details. |
| 45 | # |
| 46 | # This script must be invoked from the toplevel directory of a git |
| 47 | # working copy of Mbed TLS. |
| 48 | # |
| 49 | # Note that the output is not saved. You may want to run |
| 50 | # script -c tests/scripts/all.sh |
| 51 | # or |
| 52 | # tests/scripts/all.sh >all.log 2>&1 |
| 53 | # |
| 54 | # Notes for maintainers |
| 55 | # --------------------- |
| 56 | # |
| 57 | # The tests are roughly in order from fastest to slowest. This doesn't |
| 58 | # have to be exact, but in general you should add slower tests towards |
| 59 | # the end and fast checks near the beginning. |
| 60 | # |
| 61 | # Sanity checks have the following form: |
| 62 | # 1. msg "short description of what is about to be done" |
| 63 | # 2. run sanity check (failure stops the script) |
| 64 | # |
| 65 | # Build or build-and-test steps have the following form: |
| 66 | # 1. msg "short description of what is about to be done" |
| 67 | # 2. cleanup |
| 68 | # 3. preparation (config.pl, cmake, ...) (failure stops the script) |
| 69 | # 4. make |
| 70 | # 5. Run tests if relevant. All tests must be prefixed with |
| 71 | # if_build_successful for the sake of --keep-going. |
| 72 | |
| 73 | |
| 74 | |
| 75 | ################################################################ |
| 76 | #### Initialization and command line parsing |
| 77 | ################################################################ |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 78 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 79 | # Abort on errors (and uninitialised variables) |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 80 | set -eu |
| 81 | |
| 82 | if [ -d library -a -d include -a -d tests ]; then :; else |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 83 | err_msg "Must be run from mbed TLS root" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 84 | exit 1 |
| 85 | fi |
| 86 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 87 | CONFIG_H='include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 88 | CONFIG_BAK="$CONFIG_H.bak" |
| 89 | |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 90 | MEMORY=0 |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 91 | FORCE=0 |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 92 | KEEP_GOING=0 |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 93 | RELEASE=0 |
Gilles Peskine | b9344e3 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 94 | RUN_ARMCC=1 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 95 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 96 | # Default commands, can be overriden by the environment |
| 97 | : ${OPENSSL:="openssl"} |
| 98 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 99 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 100 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 101 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 102 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
| 103 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
| 104 | |
| 105 | usage() |
| 106 | { |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 107 | cat <<EOF |
| 108 | Usage: $0 [OPTION]... |
| 109 | -h|--help Print this help. |
| 110 | |
| 111 | General options: |
| 112 | -f|--force Force the tests to overwrite any modified files. |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 113 | -k|--keep-going Run all tests and report errors at the end. |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 114 | -m|--memory Additional optional memory tests. |
Gilles Peskine | b9344e3 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 115 | --armcc Run ARM Compiler builds (on by default). |
| 116 | --no-armcc Skip ARM Compiler builds. |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 117 | --out-of-source-dir=<path> Directory used for CMake out-of-source build tests. |
| 118 | -r|--release-test Run this script in release mode. This fixes the seed value to 1. |
| 119 | -s|--seed Integer seed value to use for this test run. |
| 120 | |
| 121 | Tool path options: |
| 122 | --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests. |
| 123 | --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests. |
| 124 | --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests. |
| 125 | --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests. |
| 126 | --openssl=<OpenSSL_path> OpenSSL executable to use for most tests. |
| 127 | --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests e.g. SSLv3. |
| 128 | EOF |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 129 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 130 | |
| 131 | # remove built files as well as the cmake cache/config |
| 132 | cleanup() |
| 133 | { |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 134 | command make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 135 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 136 | 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] | 137 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 138 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 139 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 140 | |
| 141 | if [ -f "$CONFIG_BAK" ]; then |
| 142 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 143 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 144 | } |
| 145 | |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 146 | # Executed on exit. May be redefined depending on command line options. |
| 147 | final_report () { |
| 148 | : |
| 149 | } |
| 150 | |
| 151 | fatal_signal () { |
| 152 | cleanup |
| 153 | final_report $1 |
| 154 | trap - $1 |
| 155 | kill -$1 $$ |
| 156 | } |
| 157 | |
| 158 | trap 'fatal_signal HUP' HUP |
| 159 | trap 'fatal_signal INT' INT |
| 160 | trap 'fatal_signal TERM' TERM |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 161 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 162 | msg() |
| 163 | { |
| 164 | echo "" |
| 165 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 166 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 167 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 168 | echo "******************************************************************" |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 169 | current_section=$1 |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 170 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 171 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 172 | err_msg() |
| 173 | { |
| 174 | echo "$1" >&2 |
| 175 | } |
| 176 | |
| 177 | check_tools() |
| 178 | { |
| 179 | for TOOL in "$@"; do |
| 180 | if ! `hash "$TOOL" >/dev/null 2>&1`; then |
| 181 | err_msg "$TOOL not found!" |
| 182 | exit 1 |
| 183 | fi |
| 184 | done |
| 185 | } |
| 186 | |
| 187 | while [ $# -gt 0 ]; do |
| 188 | case "$1" in |
Gilles Peskine | b9344e3 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 189 | --armcc) |
| 190 | RUN_ARMCC=1 |
| 191 | ;; |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 192 | --force|-f) |
| 193 | FORCE=1 |
| 194 | ;; |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 195 | --gnutls-cli) |
| 196 | shift |
| 197 | GNUTLS_CLI="$1" |
| 198 | ;; |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 199 | --gnutls-legacy-cli) |
| 200 | shift |
| 201 | GNUTLS_LEGACY_CLI="$1" |
| 202 | ;; |
| 203 | --gnutls-legacy-serv) |
| 204 | shift |
| 205 | GNUTLS_LEGACY_SERV="$1" |
| 206 | ;; |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 207 | --gnutls-serv) |
| 208 | shift |
| 209 | GNUTLS_SERV="$1" |
| 210 | ;; |
| 211 | --help|-h) |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 212 | usage |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 213 | exit |
| 214 | ;; |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 215 | --keep-going|-k) |
| 216 | KEEP_GOING=1 |
| 217 | ;; |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 218 | --memory|-m) |
| 219 | MEMORY=1 |
| 220 | ;; |
Gilles Peskine | b9344e3 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 221 | --no-armcc) |
| 222 | RUN_ARMCC=0 |
| 223 | ;; |
Gilles Peskine | a6901f4 | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 224 | --openssl) |
| 225 | shift |
| 226 | OPENSSL="$1" |
| 227 | ;; |
| 228 | --openssl-legacy) |
| 229 | shift |
| 230 | OPENSSL_LEGACY="$1" |
| 231 | ;; |
| 232 | --out-of-source-dir) |
| 233 | shift |
| 234 | OUT_OF_SOURCE_DIR="$1" |
| 235 | ;; |
| 236 | --release-test|-r) |
| 237 | RELEASE=1 |
| 238 | ;; |
| 239 | --seed|-s) |
| 240 | shift |
| 241 | SEED="$1" |
| 242 | ;; |
| 243 | *) |
| 244 | echo >&2 "Unknown option: $1" |
| 245 | echo >&2 "Run $0 --help for usage." |
| 246 | exit 120 |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 247 | ;; |
| 248 | esac |
| 249 | shift |
| 250 | done |
| 251 | |
| 252 | if [ $FORCE -eq 1 ]; then |
| 253 | rm -rf yotta/module "$OUT_OF_SOURCE_DIR" |
| 254 | git checkout-index -f -q $CONFIG_H |
| 255 | cleanup |
| 256 | else |
| 257 | |
| 258 | if [ -d yotta/module ]; then |
| 259 | err_msg "Warning - there is an existing yotta module in the directory 'yotta/module'" |
| 260 | echo "You can either delete your work and retry, or force the test to overwrite the" |
| 261 | echo "test by rerunning the script as: $0 --force" |
| 262 | exit 1 |
| 263 | fi |
| 264 | |
| 265 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 266 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 267 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 268 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 269 | exit 1 |
| 270 | fi |
| 271 | |
| 272 | if ! git diff-files --quiet include/mbedtls/config.h; then |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 273 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
| 274 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 275 | echo "script as: $0 --force" |
| 276 | exit 1 |
| 277 | fi |
| 278 | fi |
| 279 | |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 280 | build_status=0 |
| 281 | if [ $KEEP_GOING -eq 1 ]; then |
| 282 | failure_summary= |
| 283 | failure_count=0 |
| 284 | start_red= |
| 285 | end_color= |
| 286 | if [ -t 1 ]; then |
| 287 | case "$TERM" in |
| 288 | *color*|cygwin|linux|rxvt*|screen|[Eex]term*) |
| 289 | start_red=$(printf '\033[31m') |
| 290 | end_color=$(printf '\033[0m') |
| 291 | ;; |
| 292 | esac |
| 293 | fi |
| 294 | record_status () { |
| 295 | if "$@"; then |
| 296 | last_status=0 |
| 297 | else |
| 298 | last_status=$? |
| 299 | text="$current_section: $* -> $last_status" |
| 300 | failure_summary="$failure_summary |
| 301 | $text" |
| 302 | failure_count=$((failure_count + 1)) |
| 303 | echo "${start_red}^^^^$text^^^^${end_color}" |
| 304 | fi |
| 305 | } |
| 306 | make () { |
| 307 | case "$*" in |
| 308 | *test|*check) |
| 309 | if [ $build_status -eq 0 ]; then |
| 310 | record_status command make "$@" |
| 311 | else |
| 312 | echo "(skipped because the build failed)" |
| 313 | fi |
| 314 | ;; |
| 315 | *) |
| 316 | record_status command make "$@" |
| 317 | build_status=$last_status |
| 318 | ;; |
| 319 | esac |
| 320 | } |
| 321 | final_report () { |
| 322 | if [ $failure_count -gt 0 ]; then |
| 323 | echo |
| 324 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 325 | echo "${start_red}FAILED: $failure_count${end_color}$failure_summary" |
| 326 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 327 | elif [ -z "${1-}" ]; then |
| 328 | echo "SUCCESS :)" |
| 329 | fi |
| 330 | if [ -n "${1-}" ]; then |
| 331 | echo "Killed by SIG$1." |
| 332 | fi |
| 333 | } |
| 334 | else |
| 335 | record_status () { |
| 336 | "$@" |
| 337 | } |
| 338 | fi |
| 339 | if_build_succeeded () { |
| 340 | if [ $build_status -eq 0 ]; then |
| 341 | record_status "$@" |
| 342 | fi |
| 343 | } |
| 344 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 345 | if [ $RELEASE -eq 1 ]; then |
| 346 | # Fix the seed value to 1 to ensure that the tests are deterministic. |
| 347 | SEED=1 |
| 348 | fi |
| 349 | |
| 350 | msg "info: $0 configuration" |
| 351 | echo "MEMORY: $MEMORY" |
| 352 | echo "FORCE: $FORCE" |
| 353 | echo "SEED: ${SEED-"UNSET"}" |
| 354 | echo "OPENSSL: $OPENSSL" |
| 355 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 356 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 357 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 358 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 359 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
| 360 | |
| 361 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 362 | # we just export the variables they require |
| 363 | export OPENSSL_CMD="$OPENSSL" |
| 364 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 365 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 366 | |
| 367 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 368 | [ ! -z ${SEED+set} ] && export SEED |
| 369 | |
| 370 | # Make sure the tools we need are available. |
| 371 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 372 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
Gilles Peskine | b9344e3 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 373 | "arm-none-eabi-gcc" |
| 374 | if [ $RUN_ARMCC -ne 0 ]; then |
| 375 | check_tools "armcc" |
| 376 | fi |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 377 | |
Gilles Peskine | d7602c2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 378 | |
| 379 | |
| 380 | ################################################################ |
| 381 | #### Basic checks |
| 382 | ################################################################ |
| 383 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 384 | # |
| 385 | # Test Suites to be executed |
| 386 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 387 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 388 | # 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] | 389 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 390 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 391 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 392 | # |
| 393 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 394 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 395 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 396 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 397 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 398 | msg "test: freshness of generated source files" # < 1s |
| 399 | tests/scripts/check-generated-files.sh |
| 400 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 401 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 402 | tests/scripts/check-doxy-blocks.pl |
| 403 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 404 | msg "test/build: declared and exported names" # < 3s |
| 405 | cleanup |
| 406 | tests/scripts/check-names.sh |
| 407 | |
Gilles Peskine | d7602c2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 408 | |
| 409 | |
| 410 | ################################################################ |
| 411 | #### Build and test many configurations and targets |
| 412 | ################################################################ |
| 413 | |
Simon Butcher | 7315635 | 2015-11-04 00:36:30 +0000 | [diff] [blame] | 414 | # Yotta not supported in 2.1 branch |
| 415 | #msg "build: create and build yotta module" # ~ 30s |
| 416 | #cleanup |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 417 | #record_status tests/scripts/yotta-build.sh |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 418 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 419 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 420 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 421 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 422 | make |
| 423 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 424 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 425 | make test |
| 426 | programs/test/selftest |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 427 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 428 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 429 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 430 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 431 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 432 | if_build_succeeded tests/scripts/test-ref-configs.pl |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 433 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 434 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 435 | make |
| 436 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 437 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 438 | if_build_succeeded tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 439 | |
Hanno Becker | 797c084 | 2017-10-19 15:49:21 +0100 | [diff] [blame] | 440 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
| 441 | cleanup |
| 442 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 443 | scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 444 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 445 | make |
| 446 | |
| 447 | msg "test: ssl-opt.sh, MFL-related tests" |
| 448 | tests/ssl-opt.sh -f "Max fragment length" |
| 449 | |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 450 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 451 | cleanup |
| 452 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 453 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 454 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 455 | make |
| 456 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 457 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 458 | make test |
| 459 | programs/test/selftest |
| 460 | |
| 461 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 462 | if_build_succeeded tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 463 | if_build_succeeded env OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 464 | |
| 465 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 466 | if_build_succeeded tests/ssl-opt.sh |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 467 | |
Hanno Becker | 4f9973e | 2017-10-24 11:56:28 +0100 | [diff] [blame] | 468 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
| 469 | cleanup |
| 470 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 471 | scripts/config.pl unset MBEDTLS_SSL_RENEGOTIATION |
| 472 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 473 | make |
| 474 | |
| 475 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 476 | make test |
| 477 | |
| 478 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 479 | if_build_succeeded tests/ssl-opt.sh |
Hanno Becker | 4f9973e | 2017-10-24 11:56:28 +0100 | [diff] [blame] | 480 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 481 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 482 | cleanup |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 483 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 484 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 485 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 486 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 487 | make |
| 488 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 489 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 490 | make test |
| 491 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 492 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 493 | if_build_succeeded tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 494 | |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 495 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 496 | 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] | 497 | |
Gilles Peskine | 31ed29d | 2018-03-01 22:23:50 +0100 | [diff] [blame^] | 498 | msg "build: make, full config + DEPRECATED_WARNING, gcc -O" # ~ 30s |
| 499 | cleanup |
| 500 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 501 | scripts/config.pl full |
Gilles Peskine | 29af5f3 | 2018-02-21 19:28:12 +0100 | [diff] [blame] | 502 | scripts/config.pl set MBEDTLS_DEPRECATED_WARNING |
Gilles Peskine | 31ed29d | 2018-03-01 22:23:50 +0100 | [diff] [blame^] | 503 | # Build with -O -Wextra to catch a maximum of issues. |
| 504 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra' lib programs |
| 505 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-unused-function' tests |
| 506 | |
| 507 | msg "build: make, full config + DEPRECATED_REMOVED, clang -O" # ~ 30s |
| 508 | # No cleanup, just tweak the configuration and rebuild |
| 509 | make clean |
| 510 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
Gilles Peskine | 29af5f3 | 2018-02-21 19:28:12 +0100 | [diff] [blame] | 511 | scripts/config.pl set MBEDTLS_DEPRECATED_REMOVED |
Gilles Peskine | 31ed29d | 2018-03-01 22:23:50 +0100 | [diff] [blame^] | 512 | # Build with -O -Wextra to catch a maximum of issues. |
| 513 | make CC=clang CFLAGS='-O -Werror -Wall -Wextra' lib programs |
| 514 | make CC=clang CFLAGS='-O -Werror -Wall -Wextra -Wno-unused-function' tests |
Gilles Peskine | 29af5f3 | 2018-02-21 19:28:12 +0100 | [diff] [blame] | 515 | |
Manuel Pégourié-Gonnard | 134ca18 | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 516 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 517 | cleanup |
| 518 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 519 | if_build_succeeded tests/scripts/curves.pl |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 520 | |
Manuel Pégourié-Gonnard | 134ca18 | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 521 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 522 | cleanup |
| 523 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 524 | if_build_succeeded tests/scripts/key-exchanges.pl |
Manuel Pégourié-Gonnard | 134ca18 | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 525 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 526 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 527 | cleanup |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 528 | make CC=gcc CFLAGS='-Werror -Os' |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 529 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 530 | # this is meant to cath missing #define mbedtls_printf etc |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 531 | # disable fsio to catch some more missing #include <stdio.h> |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 532 | msg "build: full config except platform/fsio, make, gcc" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 533 | cleanup |
| 534 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 535 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 536 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
| 537 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 538 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 539 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 540 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
| 541 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 542 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 543 | scripts/config.pl unset MBEDTLS_FS_IO |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 544 | make CC=gcc CFLAGS='-Werror -O0' |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 545 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 546 | # catch compile bugs in _uninit functions |
| 547 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 548 | cleanup |
| 549 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 550 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 551 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 552 | make CC=gcc CFLAGS='-Werror -O0' |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 553 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 554 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 555 | cleanup |
| 556 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 557 | scripts/config.pl full |
| 558 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 559 | make CC=gcc CFLAGS='-Werror -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 560 | |
| 561 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 562 | cleanup |
| 563 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 564 | scripts/config.pl full |
| 565 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 566 | make CC=gcc CFLAGS='-Werror -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 567 | |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 568 | msg "build: full config except net.c, make, gcc -std=c99 -pedantic" # ~ 30s |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 569 | cleanup |
| 570 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 571 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 572 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 573 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 574 | make CC=gcc CFLAGS='-Werror -O0 -std=c99 -pedantic' lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 575 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 576 | if uname -a | grep -F Linux >/dev/null; then |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 577 | msg "build/test: make shared" # ~ 40s |
| 578 | cleanup |
| 579 | make SHARED=1 all check |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 580 | fi |
| 581 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 582 | if uname -a | grep -F x86_64 >/dev/null; then |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 583 | msg "build: i386, make, gcc" # ~ 30s |
| 584 | cleanup |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 585 | make CC=gcc CFLAGS='-Werror -m32' |
Andres Amaya Garcia | 401441b | 2017-05-08 11:19:19 +0100 | [diff] [blame] | 586 | |
| 587 | msg "test: i386, make, gcc" |
| 588 | make test |
| 589 | |
| 590 | msg "build: 64-bit ILP32, make, gcc" # ~ 30s |
| 591 | cleanup |
| 592 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32' |
| 593 | |
| 594 | msg "test: 64-bit ILP32, make, gcc" |
| 595 | make test |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 596 | fi # x86_64 |
| 597 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 598 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 599 | cleanup |
| 600 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 601 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 602 | scripts/config.pl unset MBEDTLS_NET_C |
| 603 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 604 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 605 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 606 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 607 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 608 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 609 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 610 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 611 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 612 | make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS=-Werror lib |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 613 | |
Gilles Peskine | b9344e3 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 614 | if [ $RUN_ARMCC -ne 0 ]; then |
| 615 | msg "build: armcc, make" |
| 616 | cleanup |
| 617 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 618 | scripts/config.pl full |
| 619 | scripts/config.pl unset MBEDTLS_NET_C |
| 620 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 621 | scripts/config.pl unset MBEDTLS_FS_IO |
| 622 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
| 623 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
| 624 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
| 625 | # following things are not in the default config |
| 626 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 627 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 628 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 629 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 630 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 631 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
| 632 | make CC=armcc AR=armar WARNING_CFLAGS= lib |
| 633 | fi |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 634 | |
Gilles Peskine | b49351d | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 635 | msg "build: allow SHA1 in certificates by default" |
| 636 | cleanup |
| 637 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 638 | scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 639 | make CFLAGS='-Werror -Wall -Wextra' |
Gilles Peskine | b49351d | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 640 | msg "test: allow SHA1 in certificates by default" |
| 641 | make test |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 642 | if_build_succeeded tests/ssl-opt.sh -f SHA-1 |
Gilles Peskine | b49351d | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 643 | |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 644 | if which i686-w64-mingw32-gcc >/dev/null; then |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 645 | msg "build: cross-mingw64, make" # ~ 30s |
| 646 | cleanup |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 647 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 |
| 648 | make WINDOWS_BUILD=1 clean |
| 649 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 SHARED=1 |
| 650 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 651 | fi |
| 652 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 653 | # MemSan currently only available on Linux 64 bits |
| 654 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 655 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 656 | msg "build: MSan (clang)" # ~ 1 min 20s |
| 657 | cleanup |
| 658 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 659 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 660 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 661 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 662 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 663 | msg "test: main suites (MSan)" # ~ 10s |
| 664 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 665 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 666 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 667 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 668 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 669 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 670 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 671 | if [ "$MEMORY" -gt 0 ]; then |
| 672 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 673 | if_build_succeeded tests/compat.sh |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 674 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 675 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 676 | else # no MemSan |
| 677 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 678 | msg "build: Release (clang)" |
| 679 | cleanup |
| 680 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 681 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 682 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 683 | msg "test: main suites valgrind (Release)" |
| 684 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 685 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 686 | # Optional part(s) |
| 687 | # Currently broken, programs don't seem to receive signals |
| 688 | # under valgrind on OS X |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 689 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 690 | if [ "$MEMORY" -gt 0 ]; then |
| 691 | msg "test: ssl-opt.sh --memcheck (Release)" |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 692 | if_build_succeeded tests/ssl-opt.sh --memcheck |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 693 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 694 | |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 695 | if [ "$MEMORY" -gt 1 ]; then |
| 696 | msg "test: compat.sh --memcheck (Release)" |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 697 | if_build_succeeded tests/compat.sh --memcheck |
Gilles Peskine | 30dfbaf | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 698 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 699 | |
| 700 | fi # MemSan |
| 701 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 702 | msg "build: cmake 'out-of-source' build" |
| 703 | cleanup |
| 704 | MBEDTLS_ROOT_DIR="$PWD" |
| 705 | mkdir "$OUT_OF_SOURCE_DIR" |
| 706 | cd "$OUT_OF_SOURCE_DIR" |
| 707 | cmake "$MBEDTLS_ROOT_DIR" |
| 708 | make |
| 709 | |
| 710 | msg "test: cmake 'out-of-source' build" |
| 711 | make test |
| 712 | cd "$MBEDTLS_ROOT_DIR" |
| 713 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 714 | |
Gilles Peskine | d7602c2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 715 | |
| 716 | |
| 717 | ################################################################ |
| 718 | #### Termination |
| 719 | ################################################################ |
| 720 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 721 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 722 | cleanup |
Gilles Peskine | a8bf986 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 723 | |
| 724 | final_report |