Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 3 | # all.sh |
| 4 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 5 | # This file is part of mbed TLS (https://tls.mbed.org) |
| 6 | # |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 7 | # Copyright (c) 2014-2016, ARM Limited, All Rights Reserved |
| 8 | # |
| 9 | # Purpose |
| 10 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 11 | # To run all tests possible or available on the platform. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 12 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 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. |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 17 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 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 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +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 |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +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 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 34 | FORCE=0 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 35 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 36 | # Default commands, can be overriden by the environment |
| 37 | : ${OPENSSL:="openssl"} |
| 38 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 39 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 40 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 41 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 42 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 43 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
| 44 | |
Simon Butcher | 41eeccf | 2016-09-07 00:07:09 +0100 | [diff] [blame^] | 45 | usage() |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 46 | { |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 47 | printf "Usage: $0\n" |
| 48 | printf " -h|--help\t\tPrint this help.\n" |
| 49 | printf " -m|--memory\t\tAdditional optional memory tests.\n" |
| 50 | printf " -f|--force\t\tForce the tests to overwrite any modified files.\n" |
Simon Butcher | 41eeccf | 2016-09-07 00:07:09 +0100 | [diff] [blame^] | 51 | printf " --out-of-source-dir=<path>\t\tDirectory used for CMake out-of-source build tests." |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 52 | printf " --openssl=<OpenSSL_path>\t\tPath to OpenSSL executable to use for most tests.\n" |
| 53 | printf " --openssl-legacy=<OpenSSL_path>\t\tPath to OpenSSL executable to use for legacy tests e.g. SSLv3.\n" |
| 54 | printf " --gnutls-cli=<GnuTLS_cli_path>\t\tPath to GnuTLS client executable to use for most tests.\n" |
| 55 | printf " --gnutls-serv=<GnuTLS_serv_path>\t\tPath to GnuTLS server executable to use for most tests.\n" |
| 56 | printf " --gnutls-legacy-cli=<GnuTLS_cli_path>\t\tPath to GnuTLS client executable to use for legacy tests.\n" |
| 57 | printf " --gnutls-legacy-serv=<GnuTLS_serv_path>\t\tPath to GnuTLS server executable to use for legacy tests.\n" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 58 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 59 | |
| 60 | # remove built files as well as the cmake cache/config |
| 61 | cleanup() |
| 62 | { |
| 63 | make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 64 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 65 | 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] | 66 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 67 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 68 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 69 | |
| 70 | if [ -f "$CONFIG_BAK" ]; then |
| 71 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 72 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 73 | } |
| 74 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 75 | trap cleanup INT TERM HUP |
| 76 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 77 | msg() |
| 78 | { |
| 79 | echo "" |
| 80 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 81 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 82 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 83 | echo "******************************************************************" |
| 84 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 85 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 86 | err_msg() |
| 87 | { |
| 88 | echo "$1" >&2 |
| 89 | } |
| 90 | |
| 91 | check_tools() |
| 92 | { |
| 93 | for TOOL in "$@"; do |
| 94 | if ! `hash "$TOOL" >/dev/null 2>&1`; then |
| 95 | err_msg "$TOOL not found!" |
| 96 | exit 1 |
| 97 | fi |
| 98 | done |
| 99 | } |
| 100 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 101 | while [ $# -gt 0 ]; do |
| 102 | case "$1" in |
| 103 | --memory|-m*) |
| 104 | MEMORY=${1#-m} |
| 105 | ;; |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 106 | --force|-f) |
| 107 | FORCE=1 |
| 108 | ;; |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 109 | --out-of-source-dir) |
| 110 | shift |
| 111 | OUT_OF_SOURCE_DIR="$1" |
| 112 | ;; |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 113 | --openssl) |
| 114 | shift |
| 115 | OPENSSL="$1" |
| 116 | ;; |
| 117 | --openssl-legacy) |
| 118 | shift |
| 119 | OPENSSL_LEGACY="$1" |
| 120 | ;; |
| 121 | --gnutls-cli) |
| 122 | shift |
| 123 | GNUTLS_CLI="$1" |
| 124 | ;; |
| 125 | --gnutls-serv) |
| 126 | shift |
| 127 | GNUTLS_SERV="$1" |
| 128 | ;; |
| 129 | --gnutls-legacy-cli) |
| 130 | shift |
| 131 | GNUTLS_LEGACY_CLI="$1" |
| 132 | ;; |
| 133 | --gnutls-legacy-serv) |
| 134 | shift |
| 135 | GNUTLS_LEGACY_SERV="$1" |
| 136 | ;; |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 137 | --help|-h|*) |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 138 | usage |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 139 | exit 1 |
| 140 | ;; |
| 141 | esac |
| 142 | shift |
| 143 | done |
| 144 | |
| 145 | if [ $FORCE -eq 1 ]; then |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 146 | rm -rf yotta/module "$OUT_OF_SOURCE_DIR" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 147 | git checkout-index -f -q $CONFIG_H |
| 148 | cleanup |
| 149 | else |
| 150 | |
| 151 | if [ -d yotta/module ]; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 152 | err_msg "Warning - there is an existing yotta module in the directory 'yotta/module'" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 153 | echo "You can either delete your work and retry, or force the test to overwrite the" |
| 154 | echo "test by rerunning the script as: $0 --force" |
| 155 | exit 1 |
| 156 | fi |
| 157 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 158 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 159 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 160 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 161 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 162 | exit 1 |
| 163 | fi |
| 164 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 165 | if ! git diff-files --quiet include/mbedtls/config.h; then |
| 166 | echo $? |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 167 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 168 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 169 | echo "script as: $0 --force" |
| 170 | exit 1 |
| 171 | fi |
| 172 | fi |
| 173 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 174 | msg "info: $0 configuration" |
| 175 | echo "MEMORY: $MEMORY" |
| 176 | echo "FORCE: $FORCE" |
| 177 | echo "OPENSSL: $OPENSSL" |
| 178 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 179 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 180 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 181 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 182 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
| 183 | |
| 184 | # Make sure the tools we need are available. |
| 185 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
| 186 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
| 187 | "arm-none-eabi-gcc" "armcc" |
| 188 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 189 | # |
| 190 | # Test Suites to be executed |
| 191 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 192 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 193 | # 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] | 194 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 195 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 196 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 197 | # |
| 198 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 199 | |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 200 | msg "info: output_env.sh" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 201 | OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \ |
| 202 | GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \ |
| 203 | GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" scripts/output_env.sh |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 204 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 205 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 206 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 207 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 208 | msg "test: freshness of generated source files" # < 1s |
| 209 | tests/scripts/check-generated-files.sh |
| 210 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 211 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 212 | tests/scripts/check-doxy-blocks.pl |
| 213 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 214 | msg "test/build: declared and exported names" # < 3s |
| 215 | cleanup |
| 216 | tests/scripts/check-names.sh |
| 217 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 218 | msg "test: doxygen warnings" # ~ 3s |
| 219 | cleanup |
| 220 | tests/scripts/doxygen.sh |
Manuel Pégourié-Gonnard | 1d552e7 | 2016-01-04 16:49:09 +0100 | [diff] [blame] | 221 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 222 | msg "build: create and build yotta module" # ~ 30s |
| 223 | cleanup |
| 224 | tests/scripts/yotta-build.sh |
| 225 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 226 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 227 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 228 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 229 | make |
| 230 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 231 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 232 | make test |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 233 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 234 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 235 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 236 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 237 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 238 | tests/scripts/test-ref-configs.pl |
| 239 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 240 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 241 | make |
| 242 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 243 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 244 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 245 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 246 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 247 | cleanup |
Simon Butcher | f413b6f | 2016-03-14 22:32:42 +0000 | [diff] [blame] | 248 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 249 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 250 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 251 | make |
| 252 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 253 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 254 | make test |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 255 | |
| 256 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 257 | tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 258 | OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 259 | |
| 260 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
| 261 | tests/ssl-opt.sh |
| 262 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 263 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 264 | cleanup |
Janos Follath | 35d48cb | 2016-04-22 14:45:00 +0100 | [diff] [blame] | 265 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 266 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 267 | 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] | 268 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 269 | make |
| 270 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 271 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 272 | make test |
| 273 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 274 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 275 | tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 276 | |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 277 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 278 | 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] | 279 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 280 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 281 | cleanup |
| 282 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
| 283 | tests/scripts/curves.pl |
| 284 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 285 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 286 | cleanup |
| 287 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
| 288 | tests/scripts/key-exchanges.pl |
| 289 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 290 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 291 | cleanup |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 292 | CC=gcc CFLAGS='-Werror -Os' make |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 293 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 294 | # this is meant to cath missing #define mbedtls_printf etc |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 295 | # disable fsio to catch some more missing #include <stdio.h> |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 296 | msg "build: full config except platform/fsio, make, gcc" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 297 | cleanup |
| 298 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 299 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 300 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
| 301 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 302 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 303 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 304 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
Simon Butcher | b928343 | 2016-07-13 11:02:41 +0100 | [diff] [blame] | 305 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 306 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Simon Butcher | 284b4c9 | 2016-06-26 13:10:00 +0100 | [diff] [blame] | 307 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 308 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 309 | scripts/config.pl unset MBEDTLS_FS_IO |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 310 | CC=gcc CFLAGS='-Werror -O0' make |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 311 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 312 | # catch compile bugs in _uninit functions |
| 313 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 314 | cleanup |
| 315 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 316 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 317 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 318 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 319 | CC=gcc CFLAGS='-Werror -O0' make |
| 320 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 321 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 322 | cleanup |
| 323 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 324 | scripts/config.pl full |
| 325 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
| 326 | CC=gcc CFLAGS='-Werror -O0' make |
| 327 | |
| 328 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 329 | cleanup |
| 330 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 331 | scripts/config.pl full |
| 332 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
| 333 | CC=gcc CFLAGS='-Werror -O0' make |
| 334 | |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 335 | 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] | 336 | cleanup |
| 337 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 338 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 339 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 340 | 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] | 341 | CC=gcc CFLAGS='-Werror -O0 -std=c99 -pedantic' make lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 342 | |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 343 | msg "build: default config with MBEDTLS_TEST_NULL_ENTROPY (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 344 | cleanup |
| 345 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 346 | scripts/config.pl set MBEDTLS_TEST_NULL_ENTROPY |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 347 | scripts/config.pl set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES |
| 348 | scripts/config.pl set MBEDTLS_ENTROPY_C |
| 349 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 350 | scripts/config.pl unset MBEDTLS_ENTROPY_HARDWARE_ALT |
| 351 | scripts/config.pl unset MBEDTLS_HAVEGE_C |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 352 | CC=gcc cmake -D UNSAFE_BUILD=ON -D CMAKE_C_FLAGS:String="-fsanitize=address -fno-common -O3" . |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 353 | make |
| 354 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 355 | msg "test: MBEDTLS_TEST_NULL_ENTROPY - main suites (inc. selftests) (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 356 | make test |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 357 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 358 | if uname -a | grep -F Linux >/dev/null; then |
| 359 | msg "build/test: make shared" # ~ 40s |
| 360 | cleanup |
| 361 | make SHARED=1 all check |
| 362 | fi |
| 363 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 364 | if uname -a | grep -F x86_64 >/dev/null; then |
| 365 | msg "build: i386, make, gcc" # ~ 30s |
| 366 | cleanup |
| 367 | CC=gcc CFLAGS='-Werror -m32' make |
| 368 | fi # x86_64 |
| 369 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 370 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 371 | cleanup |
| 372 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 373 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 374 | scripts/config.pl unset MBEDTLS_NET_C |
| 375 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 376 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 377 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 378 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 379 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 380 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 381 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 382 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 383 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 384 | 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] | 385 | 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] | 386 | |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 387 | msg "build: armcc, make" |
| 388 | cleanup |
| 389 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 390 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 391 | scripts/config.pl unset MBEDTLS_NET_C |
| 392 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 393 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | 1c71965 | 2016-06-27 19:02:12 +0100 | [diff] [blame] | 394 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 395 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 396 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 397 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 398 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 399 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 400 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 401 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 402 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 403 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 404 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 4df5eaf | 2016-08-24 22:58:31 +0300 | [diff] [blame] | 405 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT # depends on MBEDTLS_HAVE_TIME |
Simon Butcher | a4ed19c | 2016-08-24 22:37:43 +0300 | [diff] [blame] | 406 | CC=armcc AR=armar WARNING_CFLAGS= make lib |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 407 | |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 408 | if which i686-w64-mingw32-gcc >/dev/null; then |
| 409 | msg "build: cross-mingw64, make" # ~ 30s |
| 410 | cleanup |
Manuel Pégourié-Gonnard | e058ea2 | 2015-06-25 09:04:13 +0200 | [diff] [blame] | 411 | 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] | 412 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | e33316c | 2015-08-07 13:17:23 +0200 | [diff] [blame] | 413 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 SHARED=1 make |
| 414 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 415 | fi |
| 416 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 417 | # MemSan currently only available on Linux 64 bits |
| 418 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 419 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 420 | msg "build: MSan (clang)" # ~ 1 min 20s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 421 | cleanup |
| 422 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 423 | 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] | 424 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 425 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 426 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 427 | msg "test: main suites (MSan)" # ~ 10s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 428 | make test |
| 429 | |
| 430 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 431 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 432 | |
| 433 | # Optional part(s) |
| 434 | |
| 435 | if [ "$MEMORY" -gt 0 ]; then |
| 436 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 437 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 438 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 439 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 440 | else # no MemSan |
| 441 | |
| 442 | msg "build: Release (clang)" |
| 443 | cleanup |
| 444 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 445 | make |
| 446 | |
| 447 | msg "test: main suites valgrind (Release)" |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 448 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 449 | |
| 450 | # Optional part(s) |
| 451 | # Currently broken, programs don't seem to receive signals |
| 452 | # under valgrind on OS X |
| 453 | |
| 454 | if [ "$MEMORY" -gt 0 ]; then |
| 455 | msg "test: ssl-opt.sh --memcheck (Release)" |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 456 | tests/ssl-opt.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 457 | fi |
| 458 | |
| 459 | if [ "$MEMORY" -gt 1 ]; then |
| 460 | msg "test: compat.sh --memcheck (Release)" |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 461 | tests/compat.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 462 | fi |
| 463 | |
| 464 | fi # MemSan |
| 465 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 466 | msg "build: cmake 'out-of-source' build" |
| 467 | cleanup |
| 468 | MBEDTLS_ROOT_DIR="$PWD" |
| 469 | mkdir "$OUT_OF_SOURCE_DIR" |
| 470 | cd "$OUT_OF_SOURCE_DIR" |
| 471 | cmake "$MBEDTLS_ROOT_DIR" |
| 472 | make |
| 473 | |
| 474 | msg "test: cmake 'out-of-source' build" |
| 475 | make test |
| 476 | cd "$MBEDTLS_ROOT_DIR" |
| 477 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 478 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 479 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 480 | cleanup |
| 481 | |