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 | # |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 7 | # Copyright (c) 2014-2016, ARM Limited, All Rights Reserved |
| 8 | # |
| 9 | # Purpose |
| 10 | # |
| 11 | # To run all tests possible or available on the platform. |
| 12 | # |
| 13 | # Warning: the test is destructive. It includes various build modes and |
| 14 | # configurations, and can and will arbitrarily change the current CMake |
| 15 | # configuration. After this script has been run, the CMake cache will be lost |
| 16 | # and CMake will no longer be initialised. |
| 17 | # |
| 18 | # The script assumes the presence of gcc and clang (recent enough for using |
| 19 | # ASan with gcc and MemSan with clang, or valgrind) are available, as well as |
| 20 | # cmake and a "good" find. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 21 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 22 | # Abort on errors (and uninitialised variables) |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 23 | set -eu |
| 24 | |
| 25 | if [ -d library -a -d include -a -d tests ]; then :; else |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 26 | err_msg "Must be run from mbed TLS root" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 27 | exit 1 |
| 28 | fi |
| 29 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 30 | CONFIG_H='include/polarssl/config.h' |
| 31 | CONFIG_BAK="$CONFIG_H.bak" |
| 32 | |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 33 | MEMORY=0 |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 34 | FORCE=0 |
| 35 | RELEASE=0 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 36 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 37 | # Default commands, can be overriden by the environment |
| 38 | : ${OPENSSL:="openssl"} |
| 39 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 40 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 41 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 42 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 43 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
| 44 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
| 45 | |
| 46 | usage() |
| 47 | { |
| 48 | printf "Usage: $0\n" |
| 49 | printf " -h|--help\t\tPrint this help.\n" |
| 50 | printf " -m|--memory\t\tAdditional optional memory tests.\n" |
| 51 | printf " -f|--force\t\tForce the tests to overwrite any modified files.\n" |
| 52 | printf " -s|--seed\t\tInteger seed value to use for this test run.\n" |
| 53 | printf " -r|--release-test\t\tRun this script in release mode. This fixes the seed value to 1.\n" |
| 54 | printf " --out-of-source-dir=<path>\t\tDirectory used for CMake out-of-source build tests." |
| 55 | printf " --openssl=<OpenSSL_path>\t\tPath to OpenSSL executable to use for most tests.\n" |
| 56 | printf " --openssl-legacy=<OpenSSL_path>\t\tPath to OpenSSL executable to use for legacy tests e.g. SSLv3.\n" |
| 57 | printf " --gnutls-cli=<GnuTLS_cli_path>\t\tPath to GnuTLS client executable to use for most tests.\n" |
| 58 | printf " --gnutls-serv=<GnuTLS_serv_path>\t\tPath to GnuTLS server executable to use for most tests.\n" |
| 59 | printf " --gnutls-legacy-cli=<GnuTLS_cli_path>\t\tPath to GnuTLS client executable to use for legacy tests.\n" |
| 60 | printf " --gnutls-legacy-serv=<GnuTLS_serv_path>\t\tPath to GnuTLS server executable to use for legacy tests.\n" |
| 61 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 62 | |
| 63 | # remove built files as well as the cmake cache/config |
| 64 | cleanup() |
| 65 | { |
| 66 | make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 67 | |
Manuel Pégourié-Gonnard | 76c99a0 | 2014-12-11 10:33:43 +0100 | [diff] [blame] | 68 | find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+ |
Manuel Pégourié-Gonnard | 897a595 | 2014-03-25 13:23:04 +0100 | [diff] [blame] | 69 | rm -f include/Makefile include/polarssl/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 70 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 71 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 72 | |
| 73 | if [ -f "$CONFIG_BAK" ]; then |
| 74 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 75 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 76 | } |
| 77 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 78 | trap cleanup INT TERM HUP |
| 79 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 80 | msg() |
| 81 | { |
| 82 | echo "" |
| 83 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 84 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 85 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 86 | echo "******************************************************************" |
| 87 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 88 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 89 | err_msg() |
| 90 | { |
| 91 | echo "$1" >&2 |
| 92 | } |
| 93 | |
| 94 | check_tools() |
| 95 | { |
| 96 | for TOOL in "$@"; do |
| 97 | if ! `hash "$TOOL" >/dev/null 2>&1`; then |
| 98 | err_msg "$TOOL not found!" |
| 99 | exit 1 |
| 100 | fi |
| 101 | done |
| 102 | } |
| 103 | |
| 104 | while [ $# -gt 0 ]; do |
| 105 | case "$1" in |
| 106 | --memory|-m*) |
| 107 | MEMORY=${1#-m} |
| 108 | ;; |
| 109 | --force|-f) |
| 110 | FORCE=1 |
| 111 | ;; |
| 112 | --seed|-s) |
| 113 | shift |
| 114 | SEED="$1" |
| 115 | ;; |
| 116 | --release-test|-r) |
| 117 | RELEASE=1 |
| 118 | ;; |
| 119 | --out-of-source-dir) |
| 120 | shift |
| 121 | OUT_OF_SOURCE_DIR="$1" |
| 122 | ;; |
| 123 | --openssl) |
| 124 | shift |
| 125 | OPENSSL="$1" |
| 126 | ;; |
| 127 | --openssl-legacy) |
| 128 | shift |
| 129 | OPENSSL_LEGACY="$1" |
| 130 | ;; |
| 131 | --gnutls-cli) |
| 132 | shift |
| 133 | GNUTLS_CLI="$1" |
| 134 | ;; |
| 135 | --gnutls-serv) |
| 136 | shift |
| 137 | GNUTLS_SERV="$1" |
| 138 | ;; |
| 139 | --gnutls-legacy-cli) |
| 140 | shift |
| 141 | GNUTLS_LEGACY_CLI="$1" |
| 142 | ;; |
| 143 | --gnutls-legacy-serv) |
| 144 | shift |
| 145 | GNUTLS_LEGACY_SERV="$1" |
| 146 | ;; |
| 147 | --help|-h|*) |
| 148 | usage |
| 149 | exit 1 |
| 150 | ;; |
| 151 | esac |
| 152 | shift |
| 153 | done |
| 154 | |
| 155 | if [ $FORCE -eq 1 ]; then |
| 156 | git checkout-index -f -q $CONFIG_H |
| 157 | cleanup |
| 158 | else |
| 159 | |
| 160 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 161 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 162 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 163 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 164 | exit 1 |
| 165 | fi |
| 166 | |
| 167 | if ! git diff-files --quiet include/polarssl/config.h; then |
| 168 | echo $? |
| 169 | err_msg "Warning - the configuration file 'include/polarssl/config.h' has been edited. " |
| 170 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 171 | echo "script as: $0 --force" |
| 172 | exit 1 |
| 173 | fi |
| 174 | fi |
| 175 | |
| 176 | if [ $RELEASE -eq 1 ]; then |
| 177 | # Fix the seed value to 1 to ensure that the tests are deterministic. |
| 178 | SEED=1 |
| 179 | fi |
| 180 | |
| 181 | msg "info: $0 configuration" |
| 182 | echo "MEMORY: $MEMORY" |
| 183 | echo "FORCE: $FORCE" |
| 184 | echo "SEED: ${SEED-"UNSET"}" |
| 185 | echo "OPENSSL: $OPENSSL" |
| 186 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 187 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 188 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 189 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 190 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
| 191 | |
| 192 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 193 | # we just export the variables they require |
| 194 | export OPENSSL_CMD="$OPENSSL" |
| 195 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 196 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 197 | |
| 198 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 199 | [ ! -z ${SEED+set} ] && export SEED |
| 200 | |
| 201 | # Make sure the tools we need are available. |
| 202 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
| 203 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
| 204 | "arm-none-eabi-gcc" "armcc" |
| 205 | |
| 206 | # |
| 207 | # Test Suites to be executed |
| 208 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 209 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 210 | # 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] | 211 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 212 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 213 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 214 | # |
| 215 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 216 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 217 | msg "test: recursion.pl" # < 1s |
| 218 | scripts/recursion.pl library/*.c |
| 219 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 220 | msg "test: freshness of generated source files" # < 1s |
| 221 | tests/scripts/check-generated-files.sh |
| 222 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 223 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 224 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 225 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 226 | make |
| 227 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 228 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 229 | make test |
| 230 | programs/test/selftest |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 231 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 232 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 233 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 234 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 235 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 236 | tests/scripts/test-ref-configs.pl |
| 237 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 238 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 239 | make |
| 240 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 241 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 242 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 243 | |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 244 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 245 | cleanup |
| 246 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 247 | scripts/config.pl set POLARSSL_SSL_PROTO_SSL3 |
| 248 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 249 | make |
| 250 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 251 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 252 | make test |
| 253 | programs/test/selftest |
| 254 | |
| 255 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 256 | tests/compat.sh -m 'tls1 tls1_1 tls1_2' |
| 257 | OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 258 | |
| 259 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 260 | tests/ssl-opt.sh |
Janos Follath | 4dfecab | 2016-03-14 13:40:43 +0000 | [diff] [blame] | 261 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 262 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 263 | cleanup |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 264 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 265 | scripts/config.pl full |
| 266 | 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] | 267 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 268 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 269 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 270 | make |
| 271 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 272 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 273 | make test |
| 274 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 275 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 276 | tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 277 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 278 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
| 279 | 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' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 280 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 281 | |
| 282 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 283 | cleanup |
| 284 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
| 285 | tests/scripts/curves.pl |
| 286 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 287 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 288 | cleanup |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 289 | CC=gcc CFLAGS='-Werror -Os' make |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 290 | |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 291 | # this is meant to cath missing #define polarssl_printf etc |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 292 | # disable fsio to catch some more missing #include <stdio.h> |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 293 | msg "build: full config except platform/fsio, make, gcc" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 294 | cleanup |
| 295 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 296 | scripts/config.pl full |
| 297 | scripts/config.pl unset POLARSSL_PLATFORM_C |
Manuel Pégourié-Gonnard | 6ca4076 | 2015-02-13 15:57:35 +0000 | [diff] [blame] | 298 | scripts/config.pl unset POLARSSL_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 721e6bb | 2015-06-03 13:38:20 +0100 | [diff] [blame] | 299 | scripts/config.pl unset POLARSSL_PLATFORM_PRINTF_ALT |
| 300 | scripts/config.pl unset POLARSSL_PLATFORM_FPRINTF_ALT |
| 301 | scripts/config.pl unset POLARSSL_PLATFORM_SNPRINTF_ALT |
| 302 | scripts/config.pl unset POLARSSL_PLATFORM_EXIT_ALT |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 303 | scripts/config.pl unset POLARSSL_MEMORY_C |
| 304 | scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 305 | scripts/config.pl unset POLARSSL_FS_IO |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 306 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 307 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 308 | CC=gcc CFLAGS='-Werror -O0' make |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 309 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 310 | # catch compile bugs in _uninit functions |
| 311 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 312 | cleanup |
| 313 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 314 | scripts/config.pl full |
| 315 | scripts/config.pl set POLARSSL_PLATFORM_NO_STD_FUNCTIONS |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 316 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 317 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 318 | CC=gcc CFLAGS='-Werror -O0' make |
| 319 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 320 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 321 | cleanup |
| 322 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 323 | scripts/config.pl full |
| 324 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 325 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
| 326 | scripts/config.pl unset POLARSSL_SSL_SRV_C |
| 327 | CC=gcc CFLAGS='-Werror -O0' make |
| 328 | |
| 329 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 330 | cleanup |
| 331 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 332 | scripts/config.pl full |
| 333 | scripts/config.pl unset POLARSSL_SSL_CLI_C |
| 334 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 335 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
| 336 | CC=gcc CFLAGS='-Werror -O0' make |
| 337 | |
Manuel Pégourié-Gonnard | 1b1254f | 2015-08-10 11:56:06 +0200 | [diff] [blame] | 338 | if uname -a | grep -F Linux >/dev/null; then |
| 339 | msg "build/test: make shared" # ~ 40s |
| 340 | cleanup |
| 341 | make SHARED=1 all check |
| 342 | fi |
| 343 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 344 | if uname -a | grep -F x86_64 >/dev/null; then |
| 345 | msg "build: i386, make, gcc" # ~ 30s |
| 346 | cleanup |
| 347 | CC=gcc CFLAGS='-Werror -m32' make |
| 348 | fi # x86_64 |
| 349 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 350 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 351 | cleanup |
| 352 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 353 | scripts/config.pl full |
| 354 | scripts/config.pl unset POLARSSL_NET_C |
| 355 | scripts/config.pl unset POLARSSL_TIMING_C |
| 356 | scripts/config.pl unset POLARSSL_FS_IO |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 357 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 358 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 359 | scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 360 | # following things are not in the default config |
| 361 | scripts/config.pl unset POLARSSL_HAVEGE_C # depends on timing.c |
| 362 | scripts/config.pl unset POLARSSL_THREADING_PTHREAD |
| 363 | scripts/config.pl unset POLARSSL_THREADING_C |
| 364 | scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h |
| 365 | scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 366 | CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS=-Werror make lib |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 367 | |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 368 | msg "build: armcc, make" |
| 369 | cleanup |
| 370 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 371 | scripts/config.pl full |
| 372 | scripts/config.pl unset POLARSSL_NET_C |
| 373 | scripts/config.pl unset POLARSSL_TIMING_C |
| 374 | scripts/config.pl unset POLARSSL_FS_IO |
| 375 | scripts/config.pl unset POLARSSL_HAVE_TIME |
Manuel Pégourié-Gonnard | b0282ea | 2015-09-02 12:12:44 +0200 | [diff] [blame] | 376 | scripts/config.pl unset POLARSSL_ERROR_STRERROR_BC # deprecated |
| 377 | scripts/config.pl unset POLARSSL_PBKDF2_C # deprecated |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 378 | scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 379 | # following things are not in the default config |
Manuel Pégourié-Gonnard | f1002f8 | 2015-03-25 16:44:26 +0100 | [diff] [blame] | 380 | scripts/config.pl unset POLARSSL_DEPRECATED_WARNING |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 381 | scripts/config.pl unset POLARSSL_HAVEGE_C # depends on timing.c |
| 382 | scripts/config.pl unset POLARSSL_THREADING_PTHREAD |
| 383 | scripts/config.pl unset POLARSSL_THREADING_C |
| 384 | scripts/config.pl unset POLARSSL_MEMORY_BACKTRACE # execinfo.h |
| 385 | scripts/config.pl unset POLARSSL_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 386 | CC=armcc AR=armar WARNING_CFLAGS= make lib |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 387 | |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 388 | if which i686-w64-mingw32-gcc >/dev/null; then |
| 389 | msg "build: cross-mingw64, make" # ~ 30s |
| 390 | cleanup |
Manuel Pégourié-Gonnard | 1b1254f | 2015-08-10 11:56:06 +0200 | [diff] [blame] | 391 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 make |
| 392 | WINDOWS_BUILD=1 make clean |
| 393 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 SHARED=1 make |
| 394 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 395 | fi |
| 396 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 397 | # MemSan currently only available on Linux 64 bits |
| 398 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 399 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 400 | msg "build: MSan (clang)" # ~ 1 min 20s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 401 | cleanup |
| 402 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 403 | scripts/config.pl unset POLARSSL_AESNI_C # memsan doesn't grok asm |
Manuel Pégourié-Gonnard | 1e77a96 | 2015-01-26 14:11:51 +0100 | [diff] [blame] | 404 | scripts/config.pl set POLARSSL_NO_PLATFORM_ENTROPY # memsan vs getrandom() |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 405 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 406 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 407 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 408 | msg "test: main suites (MSan)" # ~ 10s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 409 | make test |
| 410 | |
| 411 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 412 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 413 | |
| 414 | # Optional part(s) |
| 415 | |
| 416 | if [ "$MEMORY" -gt 0 ]; then |
| 417 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 418 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 419 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 420 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 421 | else # no MemSan |
| 422 | |
| 423 | msg "build: Release (clang)" |
| 424 | cleanup |
| 425 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 426 | make |
| 427 | |
| 428 | msg "test: main suites valgrind (Release)" |
| 429 | make test |
| 430 | |
| 431 | # Optional part(s) |
| 432 | # Currently broken, programs don't seem to receive signals |
| 433 | # under valgrind on OS X |
| 434 | |
| 435 | if [ "$MEMORY" -gt 0 ]; then |
| 436 | msg "test: ssl-opt.sh --memcheck (Release)" |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 437 | tests/ssl-opt.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 438 | fi |
| 439 | |
| 440 | if [ "$MEMORY" -gt 1 ]; then |
| 441 | msg "test: compat.sh --memcheck (Release)" |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 442 | tests/compat.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 443 | fi |
| 444 | |
| 445 | fi # MemSan |
| 446 | |
Simon Butcher | 123fb02 | 2016-10-15 22:18:05 +0100 | [diff] [blame^] | 447 | msg "build: cmake 'out-of-source' build" |
| 448 | cleanup |
| 449 | MBEDTLS_ROOT_DIR="$PWD" |
| 450 | mkdir "$OUT_OF_SOURCE_DIR" |
| 451 | cd "$OUT_OF_SOURCE_DIR" |
| 452 | cmake "$MBEDTLS_ROOT_DIR" |
| 453 | make |
| 454 | |
| 455 | msg "test: cmake 'out-of-source' build" |
| 456 | make test |
| 457 | cd "$MBEDTLS_ROOT_DIR" |
| 458 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 459 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 460 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 461 | cleanup |
| 462 | |