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 | # |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +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 | d7f1902 | 2016-10-14 09:49:48 +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 | d7f1902 | 2016-10-14 09:49:48 +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 | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 30 | CONFIG_H='include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 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 | d7f1902 | 2016-10-14 09:49:48 +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 | d7f1902 | 2016-10-14 09:49:48 +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 | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 68 | 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] | 69 | rm -f include/Makefile include/mbedtls/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 | d7f1902 | 2016-10-14 09:49:48 +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 | rm -rf yotta/module "$OUT_OF_SOURCE_DIR" |
| 157 | git checkout-index -f -q $CONFIG_H |
| 158 | cleanup |
| 159 | else |
| 160 | |
| 161 | if [ -d yotta/module ]; then |
| 162 | err_msg "Warning - there is an existing yotta module in the directory 'yotta/module'" |
| 163 | echo "You can either delete your work and retry, or force the test to overwrite the" |
| 164 | echo "test by rerunning the script as: $0 --force" |
| 165 | exit 1 |
| 166 | fi |
| 167 | |
| 168 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 169 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 170 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 171 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 172 | exit 1 |
| 173 | fi |
| 174 | |
| 175 | if ! git diff-files --quiet include/mbedtls/config.h; then |
| 176 | echo $? |
| 177 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
| 178 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 179 | echo "script as: $0 --force" |
| 180 | exit 1 |
| 181 | fi |
| 182 | fi |
| 183 | |
| 184 | if [ $RELEASE -eq 1 ]; then |
| 185 | # Fix the seed value to 1 to ensure that the tests are deterministic. |
| 186 | SEED=1 |
| 187 | fi |
| 188 | |
| 189 | msg "info: $0 configuration" |
| 190 | echo "MEMORY: $MEMORY" |
| 191 | echo "FORCE: $FORCE" |
| 192 | echo "SEED: ${SEED-"UNSET"}" |
| 193 | echo "OPENSSL: $OPENSSL" |
| 194 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 195 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 196 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 197 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 198 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
| 199 | |
| 200 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 201 | # we just export the variables they require |
| 202 | export OPENSSL_CMD="$OPENSSL" |
| 203 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 204 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 205 | |
| 206 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 207 | [ ! -z ${SEED+set} ] && export SEED |
| 208 | |
| 209 | # Make sure the tools we need are available. |
| 210 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
| 211 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
| 212 | "arm-none-eabi-gcc" "armcc" |
| 213 | |
| 214 | # |
| 215 | # Test Suites to be executed |
| 216 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 217 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 218 | # 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] | 219 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 220 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 221 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 222 | # |
| 223 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 224 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 225 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 226 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 227 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 228 | msg "test: freshness of generated source files" # < 1s |
| 229 | tests/scripts/check-generated-files.sh |
| 230 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 231 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 232 | tests/scripts/check-doxy-blocks.pl |
| 233 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 234 | msg "test/build: declared and exported names" # < 3s |
| 235 | cleanup |
| 236 | tests/scripts/check-names.sh |
| 237 | |
Simon Butcher | 7315635 | 2015-11-04 00:36:30 +0000 | [diff] [blame] | 238 | # Yotta not supported in 2.1 branch |
| 239 | #msg "build: create and build yotta module" # ~ 30s |
| 240 | #cleanup |
| 241 | #tests/scripts/yotta-build.sh |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 242 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 243 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 244 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 245 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 246 | make |
| 247 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 248 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 249 | make test |
| 250 | programs/test/selftest |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 251 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 252 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 253 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 254 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 255 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 256 | tests/scripts/test-ref-configs.pl |
| 257 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 258 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 259 | make |
| 260 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 261 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 262 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 263 | |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 264 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 265 | cleanup |
| 266 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 267 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 268 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 269 | make |
| 270 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 271 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 272 | make test |
| 273 | programs/test/selftest |
| 274 | |
| 275 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 276 | tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 277 | OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Simon Butcher | 02b8d48 | 2016-03-15 20:39:52 +0000 | [diff] [blame] | 278 | |
| 279 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
| 280 | tests/ssl-opt.sh |
| 281 | |
Hanno Becker | 9293592 | 2017-11-06 15:07:09 +0000 | [diff] [blame^] | 282 | msg "build: Default + RSA_NO_CRT (ASan build)" # ~ 6 min |
| 283 | cleanup |
| 284 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 285 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
| 286 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 287 | make |
| 288 | |
| 289 | msg "test: RSA_NO_CRT - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 290 | make test |
| 291 | |
| 292 | msg "test: RSA_NO_CRT - RSA-related part of ssl-opt.sh (ASan build)" # ~ 5s |
| 293 | tests/ssl-opt.sh -f RSA |
| 294 | |
| 295 | msg "test: RSA_NO_CRT - RSA-related part of compat.sh (ASan build)" # ~ 3 min |
| 296 | tests/compat.sh -t RSA |
| 297 | |
| 298 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 299 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 300 | cleanup |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 301 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 302 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 303 | 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] | 304 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 305 | make |
| 306 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 307 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 308 | make test |
| 309 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 310 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 311 | tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 312 | |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 313 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 314 | 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] | 315 | |
Manuel Pégourié-Gonnard | 134ca18 | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 316 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 317 | cleanup |
| 318 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
| 319 | tests/scripts/curves.pl |
| 320 | |
Manuel Pégourié-Gonnard | 134ca18 | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 321 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 322 | cleanup |
| 323 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
| 324 | tests/scripts/key-exchanges.pl |
| 325 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 326 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 327 | cleanup |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 328 | CC=gcc CFLAGS='-Werror -Os' make |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 329 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 330 | # this is meant to cath missing #define mbedtls_printf etc |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 331 | # disable fsio to catch some more missing #include <stdio.h> |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 332 | msg "build: full config except platform/fsio, make, gcc" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 333 | cleanup |
| 334 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 335 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 336 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
| 337 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 338 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 339 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 340 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
| 341 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 342 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 343 | scripts/config.pl unset MBEDTLS_FS_IO |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 344 | CC=gcc CFLAGS='-Werror -O0' make |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 345 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 346 | # catch compile bugs in _uninit functions |
| 347 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 348 | cleanup |
| 349 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 350 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 351 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 352 | CC=gcc CFLAGS='-Werror -O0' make |
| 353 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 354 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 355 | cleanup |
| 356 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 357 | scripts/config.pl full |
| 358 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
| 359 | CC=gcc CFLAGS='-Werror -O0' make |
| 360 | |
| 361 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 362 | cleanup |
| 363 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 364 | scripts/config.pl full |
| 365 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
| 366 | CC=gcc CFLAGS='-Werror -O0' make |
| 367 | |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 368 | 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] | 369 | cleanup |
| 370 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 371 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 372 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 373 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Manuel Pégourié-Gonnard | 7185936 | 2015-06-02 16:39:22 +0100 | [diff] [blame] | 374 | CC=gcc CFLAGS='-Werror -O0 -std=c99 -pedantic' make lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 375 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 376 | if uname -a | grep -F Linux >/dev/null; then |
| 377 | msg "build/test: make shared" # ~ 40s |
| 378 | cleanup |
| 379 | make SHARED=1 all check |
| 380 | fi |
| 381 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 382 | if uname -a | grep -F x86_64 >/dev/null; then |
| 383 | msg "build: i386, make, gcc" # ~ 30s |
| 384 | cleanup |
| 385 | CC=gcc CFLAGS='-Werror -m32' make |
| 386 | fi # x86_64 |
| 387 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 388 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 389 | cleanup |
| 390 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 391 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 392 | scripts/config.pl unset MBEDTLS_NET_C |
| 393 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 394 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 395 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 396 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 397 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 398 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 399 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 400 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 401 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Manuel Pégourié-Gonnard | e058ea2 | 2015-06-25 09:04:13 +0200 | [diff] [blame] | 402 | 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] | 403 | |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 404 | msg "build: armcc, make" |
| 405 | cleanup |
| 406 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 407 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 408 | scripts/config.pl unset MBEDTLS_NET_C |
| 409 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 410 | scripts/config.pl unset MBEDTLS_FS_IO |
| 411 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 412 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 413 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 414 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 415 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 416 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 417 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 418 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 419 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 420 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 421 | CC=armcc AR=armar WARNING_CFLAGS= make lib |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 422 | |
Gilles Peskine | b49351d | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 423 | msg "build: allow SHA1 in certificates by default" |
| 424 | cleanup |
| 425 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 426 | scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
| 427 | CFLAGS='-Werror -Wall -Wextra' make |
| 428 | msg "test: allow SHA1 in certificates by default" |
| 429 | make test |
| 430 | tests/ssl-opt.sh -f SHA-1 |
| 431 | |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 432 | if which i686-w64-mingw32-gcc >/dev/null; then |
| 433 | msg "build: cross-mingw64, make" # ~ 30s |
| 434 | cleanup |
Manuel Pégourié-Gonnard | e058ea2 | 2015-06-25 09:04:13 +0200 | [diff] [blame] | 435 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 make |
Manuel Pégourié-Gonnard | 52fa38a | 2015-06-23 14:29:58 +0200 | [diff] [blame] | 436 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | e33316c | 2015-08-07 13:17:23 +0200 | [diff] [blame] | 437 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 SHARED=1 make |
| 438 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 439 | fi |
| 440 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 441 | # MemSan currently only available on Linux 64 bits |
| 442 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 443 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 444 | msg "build: MSan (clang)" # ~ 1 min 20s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 445 | cleanup |
| 446 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 447 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 448 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 449 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 450 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 451 | msg "test: main suites (MSan)" # ~ 10s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 452 | make test |
| 453 | |
| 454 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 455 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 456 | |
| 457 | # Optional part(s) |
| 458 | |
| 459 | if [ "$MEMORY" -gt 0 ]; then |
| 460 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 461 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 462 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 463 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 464 | else # no MemSan |
| 465 | |
| 466 | msg "build: Release (clang)" |
| 467 | cleanup |
| 468 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 469 | make |
| 470 | |
| 471 | msg "test: main suites valgrind (Release)" |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 472 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 473 | |
| 474 | # Optional part(s) |
| 475 | # Currently broken, programs don't seem to receive signals |
| 476 | # under valgrind on OS X |
| 477 | |
| 478 | if [ "$MEMORY" -gt 0 ]; then |
| 479 | msg "test: ssl-opt.sh --memcheck (Release)" |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 480 | tests/ssl-opt.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 481 | fi |
| 482 | |
| 483 | if [ "$MEMORY" -gt 1 ]; then |
| 484 | msg "test: compat.sh --memcheck (Release)" |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 485 | tests/compat.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 486 | fi |
| 487 | |
| 488 | fi # MemSan |
| 489 | |
Simon Butcher | d7f1902 | 2016-10-14 09:49:48 +0100 | [diff] [blame] | 490 | msg "build: cmake 'out-of-source' build" |
| 491 | cleanup |
| 492 | MBEDTLS_ROOT_DIR="$PWD" |
| 493 | mkdir "$OUT_OF_SOURCE_DIR" |
| 494 | cd "$OUT_OF_SOURCE_DIR" |
| 495 | cmake "$MBEDTLS_ROOT_DIR" |
| 496 | make |
| 497 | |
| 498 | msg "test: cmake 'out-of-source' build" |
| 499 | make test |
| 500 | cd "$MBEDTLS_ROOT_DIR" |
| 501 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 502 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 503 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 504 | cleanup |
| 505 | |