Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 3 | # all.sh |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 4 | # |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +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 | e8be5e2 | 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 | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 15 | # Purpose |
Gilles Peskine | e8be5e2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 16 | # ------- |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 17 | # |
| 18 | # To run all tests possible or available on the platform. |
| 19 | # |
Gilles Peskine | e8be5e2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 20 | # Notes for users |
| 21 | # --------------- |
| 22 | # |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +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 | e8be5e2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 25 | # configuration. The following files must be committed into git: |
| 26 | # * include/polarssl/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 | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 30 | # |
Gilles Peskine | e8be5e2 | 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 | 123fb02 | 2016-10-15 22:18:05 +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 | 123fb02 | 2016-10-15 22:18:05 +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 | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 87 | CONFIG_H='include/polarssl/config.h' |
| 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 | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 91 | FORCE=0 |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 92 | KEEP_GOING=0 |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 93 | RELEASE=0 |
Gilles Peskine | 273ac90 | 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 | 123fb02 | 2016-10-15 22:18:05 +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 | 4d4872a | 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 | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 113 | -k|--keep-going Run all tests and report errors at the end. |
Gilles Peskine | 4d4872a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 114 | -m|--memory Additional optional memory tests. |
Gilles Peskine | 273ac90 | 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 | 4d4872a | 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 | 123fb02 | 2016-10-15 22:18:05 +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 | ded50da | 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 | 76c99a0 | 2014-12-11 10:33:43 +0100 | [diff] [blame] | 136 | find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+ |
Manuel Pégourié-Gonnard | 897a595 | 2014-03-25 13:23:04 +0100 | [diff] [blame] | 137 | rm -f include/Makefile include/polarssl/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 | ded50da | 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 | ded50da | 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 | 123fb02 | 2016-10-15 22:18:05 +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 | 273ac90 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 189 | --armcc) |
| 190 | RUN_ARMCC=1 |
| 191 | ;; |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 192 | --force|-f) |
| 193 | FORCE=1 |
| 194 | ;; |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 195 | --gnutls-cli) |
| 196 | shift |
| 197 | GNUTLS_CLI="$1" |
| 198 | ;; |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +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 | 4d4872a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 207 | --gnutls-serv) |
| 208 | shift |
| 209 | GNUTLS_SERV="$1" |
| 210 | ;; |
| 211 | --help|-h) |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 212 | usage |
Gilles Peskine | 4d4872a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 213 | exit |
| 214 | ;; |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 215 | --keep-going|-k) |
| 216 | KEEP_GOING=1 |
| 217 | ;; |
Gilles Peskine | 4d4872a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 218 | --memory|-m) |
| 219 | MEMORY=1 |
| 220 | ;; |
Gilles Peskine | 273ac90 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 221 | --no-armcc) |
| 222 | RUN_ARMCC=0 |
| 223 | ;; |
Gilles Peskine | 4d4872a | 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 | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 247 | ;; |
| 248 | esac |
| 249 | shift |
| 250 | done |
| 251 | |
| 252 | if [ $FORCE -eq 1 ]; then |
| 253 | git checkout-index -f -q $CONFIG_H |
| 254 | cleanup |
| 255 | else |
| 256 | |
| 257 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 258 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 259 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 260 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 261 | exit 1 |
| 262 | fi |
| 263 | |
| 264 | if ! git diff-files --quiet include/polarssl/config.h; then |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 265 | err_msg "Warning - the configuration file 'include/polarssl/config.h' has been edited. " |
| 266 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 267 | echo "script as: $0 --force" |
| 268 | exit 1 |
| 269 | fi |
| 270 | fi |
| 271 | |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 272 | build_status=0 |
| 273 | if [ $KEEP_GOING -eq 1 ]; then |
| 274 | failure_summary= |
| 275 | failure_count=0 |
| 276 | start_red= |
| 277 | end_color= |
| 278 | if [ -t 1 ]; then |
| 279 | case "$TERM" in |
| 280 | *color*|cygwin|linux|rxvt*|screen|[Eex]term*) |
| 281 | start_red=$(printf '\033[31m') |
| 282 | end_color=$(printf '\033[0m') |
| 283 | ;; |
| 284 | esac |
| 285 | fi |
| 286 | record_status () { |
| 287 | if "$@"; then |
| 288 | last_status=0 |
| 289 | else |
| 290 | last_status=$? |
| 291 | text="$current_section: $* -> $last_status" |
| 292 | failure_summary="$failure_summary |
| 293 | $text" |
| 294 | failure_count=$((failure_count + 1)) |
| 295 | echo "${start_red}^^^^$text^^^^${end_color}" |
| 296 | fi |
| 297 | } |
| 298 | make () { |
| 299 | case "$*" in |
| 300 | *test|*check) |
| 301 | if [ $build_status -eq 0 ]; then |
| 302 | record_status command make "$@" |
| 303 | else |
| 304 | echo "(skipped because the build failed)" |
| 305 | fi |
| 306 | ;; |
| 307 | *) |
| 308 | record_status command make "$@" |
| 309 | build_status=$last_status |
| 310 | ;; |
| 311 | esac |
| 312 | } |
| 313 | final_report () { |
| 314 | if [ $failure_count -gt 0 ]; then |
| 315 | echo |
| 316 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 317 | echo "${start_red}FAILED: $failure_count${end_color}$failure_summary" |
| 318 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 319 | elif [ -z "${1-}" ]; then |
| 320 | echo "SUCCESS :)" |
| 321 | fi |
| 322 | if [ -n "${1-}" ]; then |
| 323 | echo "Killed by SIG$1." |
| 324 | fi |
| 325 | } |
| 326 | else |
| 327 | record_status () { |
| 328 | "$@" |
| 329 | } |
| 330 | fi |
| 331 | if_build_succeeded () { |
| 332 | if [ $build_status -eq 0 ]; then |
| 333 | record_status "$@" |
| 334 | fi |
| 335 | } |
| 336 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 337 | if [ $RELEASE -eq 1 ]; then |
| 338 | # Fix the seed value to 1 to ensure that the tests are deterministic. |
| 339 | SEED=1 |
| 340 | fi |
| 341 | |
| 342 | msg "info: $0 configuration" |
| 343 | echo "MEMORY: $MEMORY" |
| 344 | echo "FORCE: $FORCE" |
| 345 | echo "SEED: ${SEED-"UNSET"}" |
| 346 | echo "OPENSSL: $OPENSSL" |
| 347 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 348 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 349 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 350 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 351 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
| 352 | |
| 353 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 354 | # we just export the variables they require |
| 355 | export OPENSSL_CMD="$OPENSSL" |
| 356 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 357 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 358 | |
| 359 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 360 | [ ! -z ${SEED+set} ] && export SEED |
| 361 | |
| 362 | # Make sure the tools we need are available. |
| 363 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 364 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
Gilles Peskine | 273ac90 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 365 | "arm-none-eabi-gcc" |
| 366 | if [ $RUN_ARMCC -ne 0 ]; then |
| 367 | check_tools "armcc" |
| 368 | fi |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 369 | |
Gilles Peskine | e8be5e2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 370 | |
| 371 | |
| 372 | ################################################################ |
| 373 | #### Basic checks |
| 374 | ################################################################ |
| 375 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 376 | # |
| 377 | # Test Suites to be executed |
| 378 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 379 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 380 | # 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] | 381 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 382 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 383 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 384 | # |
| 385 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 386 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 387 | msg "test: recursion.pl" # < 1s |
| 388 | scripts/recursion.pl library/*.c |
| 389 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 390 | msg "test: freshness of generated source files" # < 1s |
| 391 | tests/scripts/check-generated-files.sh |
| 392 | |
Gilles Peskine | e8be5e2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 393 | |
| 394 | |
| 395 | ################################################################ |
| 396 | #### Build and test many configurations and targets |
| 397 | ################################################################ |
| 398 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 399 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 400 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 401 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 402 | make |
| 403 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 404 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 405 | make test |
| 406 | programs/test/selftest |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 407 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 408 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 409 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 410 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 411 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 412 | if_build_succeeded tests/scripts/test-ref-configs.pl |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 413 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 414 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 415 | make |
| 416 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 417 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 418 | if_build_succeeded tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 419 | |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 420 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 421 | cleanup |
| 422 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 423 | scripts/config.pl set POLARSSL_SSL_PROTO_SSL3 |
| 424 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 425 | make |
| 426 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 427 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 428 | make test |
| 429 | programs/test/selftest |
| 430 | |
| 431 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 432 | if_build_succeeded tests/compat.sh -m 'tls1 tls1_1 tls1_2' |
| 433 | if_build_succeeded env OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 434 | |
| 435 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 436 | if_build_succeeded tests/ssl-opt.sh |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 437 | |
Hanno Becker | be812f6 | 2017-10-25 09:49:13 +0100 | [diff] [blame] | 438 | msg "build: Default + POLARSSL_SSL_DISABLE_RENEGOTIATION (ASan build)" # ~ 6 min |
| 439 | cleanup |
| 440 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 441 | scripts/config.pl set POLARSSL_SSL_DISABLE_RENEGOTIATION |
| 442 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 443 | make |
| 444 | |
| 445 | msg "test: POLARSSL_SSL_DISABLE_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 446 | make test |
| 447 | |
| 448 | msg "test: POLARSSL_SSL_DISABLE_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 449 | if_build_succeeded tests/ssl-opt.sh |
Hanno Becker | be812f6 | 2017-10-25 09:49:13 +0100 | [diff] [blame] | 450 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 451 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 452 | cleanup |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 453 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 454 | scripts/config.pl full |
| 455 | scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # too slow for tests |
Manuel Pégourié-Gonnard | 4d9e36a | 2015-09-02 10:10:32 +0200 | [diff] [blame] | 456 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 457 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 458 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 459 | make |
| 460 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 461 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 462 | make test |
| 463 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 464 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 465 | if_build_succeeded tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 466 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 467 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 468 | if_build_succeeded env OPENSSL_CMD="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_LEGACY_CLI" GNUTLS_SERV="$GNUTLS_LEGACY_SERV" tests/compat.sh -e '^$' -f 'NULL\|3DES-EDE-CBC\|DES-CBC3' |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 469 | |
| 470 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 471 | cleanup |
| 472 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 473 | if_build_succeeded tests/scripts/curves.pl |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 474 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 475 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 476 | cleanup |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 477 | make CC=gcc CFLAGS='-Werror -Os' |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 478 | |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 479 | # this is meant to cath missing #define polarssl_printf etc |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 480 | # disable fsio to catch some more missing #include <stdio.h> |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 481 | msg "build: full config except platform/fsio, make, gcc" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 482 | cleanup |
| 483 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 484 | scripts/config.pl full |
| 485 | scripts/config.pl unset POLARSSL_PLATFORM_C |
Manuel Pégourié-Gonnard | 6ca4076 | 2015-02-13 15:57:35 +0000 | [diff] [blame] | 486 | scripts/config.pl unset POLARSSL_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 721e6bb | 2015-06-03 13:38:20 +0100 | [diff] [blame] | 487 | scripts/config.pl unset POLARSSL_PLATFORM_PRINTF_ALT |
| 488 | scripts/config.pl unset POLARSSL_PLATFORM_FPRINTF_ALT |
| 489 | scripts/config.pl unset POLARSSL_PLATFORM_SNPRINTF_ALT |
| 490 | scripts/config.pl unset POLARSSL_PLATFORM_EXIT_ALT |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 491 | scripts/config.pl unset POLARSSL_MEMORY_C |
| 492 | scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 493 | scripts/config.pl unset POLARSSL_FS_IO |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 494 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 495 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 496 | make CC=gcc CFLAGS='-Werror -O0' |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 497 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 498 | # catch compile bugs in _uninit functions |
| 499 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 500 | cleanup |
| 501 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 502 | scripts/config.pl full |
| 503 | scripts/config.pl set POLARSSL_PLATFORM_NO_STD_FUNCTIONS |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 504 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 505 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 506 | make CC=gcc CFLAGS='-Werror -O0' |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 507 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 508 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 509 | cleanup |
| 510 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 511 | scripts/config.pl full |
| 512 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 513 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
| 514 | scripts/config.pl unset POLARSSL_SSL_SRV_C |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 515 | make CC=gcc CFLAGS='-Werror -O0' |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 516 | |
| 517 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 518 | cleanup |
| 519 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 520 | scripts/config.pl full |
| 521 | scripts/config.pl unset POLARSSL_SSL_CLI_C |
| 522 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 523 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 524 | make CC=gcc CFLAGS='-Werror -O0' |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 525 | |
Manuel Pégourié-Gonnard | 1b1254f | 2015-08-10 11:56:06 +0200 | [diff] [blame] | 526 | if uname -a | grep -F Linux >/dev/null; then |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 527 | msg "build/test: make shared" # ~ 40s |
| 528 | cleanup |
| 529 | make SHARED=1 all check |
Manuel Pégourié-Gonnard | 1b1254f | 2015-08-10 11:56:06 +0200 | [diff] [blame] | 530 | fi |
| 531 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 532 | if uname -a | grep -F x86_64 >/dev/null; then |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 533 | msg "build: i386, make, gcc" # ~ 30s |
| 534 | cleanup |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 535 | make CC=gcc CFLAGS='-Werror -m32' |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 536 | fi # x86_64 |
| 537 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 538 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 539 | cleanup |
| 540 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 541 | scripts/config.pl full |
| 542 | scripts/config.pl unset POLARSSL_NET_C |
| 543 | scripts/config.pl unset POLARSSL_TIMING_C |
| 544 | scripts/config.pl unset POLARSSL_FS_IO |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 545 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 546 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 547 | scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 548 | # following things are not in the default config |
| 549 | scripts/config.pl unset POLARSSL_HAVEGE_C # depends on timing.c |
| 550 | scripts/config.pl unset POLARSSL_THREADING_PTHREAD |
| 551 | scripts/config.pl unset POLARSSL_THREADING_C |
| 552 | scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h |
| 553 | scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 554 | 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] | 555 | |
Gilles Peskine | 273ac90 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 556 | if [ $RUN_ARMCC -ne 0 ]; then |
| 557 | msg "build: armcc, make" |
| 558 | cleanup |
| 559 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 560 | scripts/config.pl full |
| 561 | scripts/config.pl unset POLARSSL_NET_C |
| 562 | scripts/config.pl unset POLARSSL_TIMING_C |
| 563 | scripts/config.pl unset POLARSSL_FS_IO |
| 564 | scripts/config.pl unset POLARSSL_HAVE_TIME |
| 565 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 566 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
| 567 | scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY |
| 568 | # following things are not in the default config |
| 569 | scripts/config.pl unset POLARSSL_DEPRECATED_WARNING |
| 570 | scripts/config.pl unset POLARSSL_HAVEGE_C # depends on timing.c |
| 571 | scripts/config.pl unset POLARSSL_THREADING_PTHREAD |
| 572 | scripts/config.pl unset POLARSSL_THREADING_C |
| 573 | scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h |
| 574 | scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit |
| 575 | make CC=armcc AR=armar WARNING_CFLAGS= lib |
| 576 | fi |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 577 | |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 578 | if which i686-w64-mingw32-gcc >/dev/null; then |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 579 | msg "build: cross-mingw64, make" # ~ 30s |
| 580 | cleanup |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 581 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 |
| 582 | make WINDOWS_BUILD=1 clean |
| 583 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 SHARED=1 |
| 584 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 585 | fi |
| 586 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 587 | # MemSan currently only available on Linux 64 bits |
| 588 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 589 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 590 | msg "build: MSan (clang)" # ~ 1 min 20s |
| 591 | cleanup |
| 592 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 593 | scripts/config.pl unset POLARSSL_AESNI_C # memsan doesn't grok asm |
| 594 | scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY # memsan vs getrandom() |
| 595 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 596 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 597 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 598 | msg "test: main suites (MSan)" # ~ 10s |
| 599 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 600 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 601 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 602 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 603 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 604 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 605 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 606 | if [ "$MEMORY" -gt 0 ]; then |
| 607 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 608 | if_build_succeeded tests/compat.sh |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 609 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 610 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 611 | else # no MemSan |
| 612 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 613 | msg "build: Release (clang)" |
| 614 | cleanup |
| 615 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 616 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 617 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 618 | msg "test: main suites valgrind (Release)" |
| 619 | make test |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 620 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 621 | # Optional part(s) |
| 622 | # Currently broken, programs don't seem to receive signals |
| 623 | # under valgrind on OS X |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 624 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 625 | if [ "$MEMORY" -gt 0 ]; then |
| 626 | msg "test: ssl-opt.sh --memcheck (Release)" |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 627 | if_build_succeeded tests/ssl-opt.sh --memcheck |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 628 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 629 | |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 630 | if [ "$MEMORY" -gt 1 ]; then |
| 631 | msg "test: compat.sh --memcheck (Release)" |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 632 | if_build_succeeded tests/compat.sh --memcheck |
Gilles Peskine | fb18b6c | 2017-12-20 14:00:06 +0100 | [diff] [blame] | 633 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 634 | |
| 635 | fi # MemSan |
| 636 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame] | 637 | msg "build: cmake 'out-of-source' build" |
| 638 | cleanup |
| 639 | MBEDTLS_ROOT_DIR="$PWD" |
| 640 | mkdir "$OUT_OF_SOURCE_DIR" |
| 641 | cd "$OUT_OF_SOURCE_DIR" |
| 642 | cmake "$MBEDTLS_ROOT_DIR" |
| 643 | make |
| 644 | |
| 645 | msg "test: cmake 'out-of-source' build" |
| 646 | make test |
| 647 | cd "$MBEDTLS_ROOT_DIR" |
| 648 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 649 | |
Gilles Peskine | e8be5e2 | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 650 | |
| 651 | |
| 652 | ################################################################ |
| 653 | #### Termination |
| 654 | ################################################################ |
| 655 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 656 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 657 | cleanup |
| 658 | |
Gilles Peskine | ded50da | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 659 | final_report |