Andres AG | 31f9b5b | 2016-10-04 17:14:38 +0100 | [diff] [blame] | 1 | #! /usr/bin/env sh |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 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 | |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 25 | if [ "$( uname )" != "Linux" ]; then |
| 26 | echo "This script only works in Linux" >&2 |
| 27 | exit 1 |
| 28 | elif [ -d library -a -d include -a -d tests ]; then :; else |
| 29 | echo "Must be run from mbed TLS root" >&2 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 30 | exit 1 |
| 31 | fi |
| 32 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 33 | CONFIG_H='include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 34 | CONFIG_BAK="$CONFIG_H.bak" |
| 35 | |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 36 | MEMORY=0 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 37 | FORCE=0 |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 38 | RELEASE=0 |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 39 | YOTTA=1 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 40 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 41 | # Default commands, can be overriden by the environment |
| 42 | : ${OPENSSL:="openssl"} |
| 43 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 44 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 45 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 46 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 47 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 48 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 49 | : ${ARMC5_BIN_DIR:=/usr/bin} |
| 50 | : ${ARMC6_BIN_DIR:=/usr/bin} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 51 | |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 52 | # if MAKEFLAGS is not set add the -j option to speed up invocations of make |
| 53 | if [ -n "${MAKEFLAGS+set}" ]; then |
| 54 | export MAKEFLAGS="-j" |
| 55 | fi |
| 56 | |
Simon Butcher | 41eeccf | 2016-09-07 00:07:09 +0100 | [diff] [blame] | 57 | usage() |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 58 | { |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame^] | 59 | cat <<EOF |
| 60 | Usage: $0 [OPTION]... |
| 61 | -h|--help Print this help. |
| 62 | |
| 63 | General options: |
| 64 | -f|--force Force the tests to overwrite any modified files. |
| 65 | -m|--memory Additional optional memory tests. |
| 66 | --no-yotta Skip yotta build. |
| 67 | --out-of-source-dir=<path> Directory used for CMake out-of-source build tests. |
| 68 | -r|--release-test Run this script in release mode. This fixes the seed value to 1. |
| 69 | -s|--seed Integer seed value to use for this test run. |
| 70 | |
| 71 | Tool path options: |
| 72 | --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory. |
| 73 | --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory. |
| 74 | --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests. |
| 75 | --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests. |
| 76 | --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests. |
| 77 | --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests. |
| 78 | --openssl=<OpenSSL_path> OpenSSL executable to use for most tests. |
| 79 | --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests e.g. SSLv3. |
| 80 | EOF |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 81 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 82 | |
| 83 | # remove built files as well as the cmake cache/config |
| 84 | cleanup() |
| 85 | { |
| 86 | make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 87 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 88 | 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] | 89 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 90 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 91 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 92 | |
| 93 | if [ -f "$CONFIG_BAK" ]; then |
| 94 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 95 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 96 | } |
| 97 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 98 | trap cleanup INT TERM HUP |
| 99 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 100 | msg() |
| 101 | { |
| 102 | echo "" |
| 103 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 104 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 105 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 106 | echo "******************************************************************" |
| 107 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 108 | |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 109 | armc6_build_test() |
| 110 | { |
| 111 | FLAGS="$1" |
| 112 | |
| 113 | msg "build: ARM Compiler 6 ($FLAGS), make" |
| 114 | ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \ |
Simon Butcher | cb58700 | 2017-01-06 16:14:44 +0000 | [diff] [blame] | 115 | WARNING_CFLAGS='-xc -std=c99' make lib |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 116 | make clean |
| 117 | } |
| 118 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 119 | err_msg() |
| 120 | { |
| 121 | echo "$1" >&2 |
| 122 | } |
| 123 | |
| 124 | check_tools() |
| 125 | { |
| 126 | for TOOL in "$@"; do |
| 127 | if ! `hash "$TOOL" >/dev/null 2>&1`; then |
| 128 | err_msg "$TOOL not found!" |
| 129 | exit 1 |
| 130 | fi |
| 131 | done |
| 132 | } |
| 133 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 134 | while [ $# -gt 0 ]; do |
| 135 | case "$1" in |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame^] | 136 | --armc5-bin-dir) |
| 137 | shift |
| 138 | ARMC5_BIN_DIR="$1" |
| 139 | ;; |
| 140 | --armc6-bin-dir) |
| 141 | shift |
| 142 | ARMC6_BIN_DIR="$1" |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 143 | ;; |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 144 | --force|-f) |
| 145 | FORCE=1 |
| 146 | ;; |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 147 | --gnutls-cli) |
| 148 | shift |
| 149 | GNUTLS_CLI="$1" |
| 150 | ;; |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 151 | --gnutls-legacy-cli) |
| 152 | shift |
| 153 | GNUTLS_LEGACY_CLI="$1" |
| 154 | ;; |
| 155 | --gnutls-legacy-serv) |
| 156 | shift |
| 157 | GNUTLS_LEGACY_SERV="$1" |
| 158 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame^] | 159 | --gnutls-serv) |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 160 | shift |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame^] | 161 | GNUTLS_SERV="$1" |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 162 | ;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame^] | 163 | --help|-h) |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 164 | usage |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame^] | 165 | exit |
| 166 | ;; |
| 167 | --memory|-m) |
| 168 | MEMORY=1 |
| 169 | ;; |
| 170 | --no-yotta) |
| 171 | YOTTA=0 |
| 172 | ;; |
| 173 | --openssl) |
| 174 | shift |
| 175 | OPENSSL="$1" |
| 176 | ;; |
| 177 | --openssl-legacy) |
| 178 | shift |
| 179 | OPENSSL_LEGACY="$1" |
| 180 | ;; |
| 181 | --out-of-source-dir) |
| 182 | shift |
| 183 | OUT_OF_SOURCE_DIR="$1" |
| 184 | ;; |
| 185 | --release-test|-r) |
| 186 | RELEASE=1 |
| 187 | ;; |
| 188 | --seed|-s) |
| 189 | shift |
| 190 | SEED="$1" |
| 191 | ;; |
| 192 | *) |
| 193 | echo >&2 "Unknown option: $1" |
| 194 | echo >&2 "Run $0 --help for usage." |
| 195 | exit 120 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 196 | ;; |
| 197 | esac |
| 198 | shift |
| 199 | done |
| 200 | |
| 201 | if [ $FORCE -eq 1 ]; then |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 202 | if [ $YOTTA -eq 1 ]; then |
| 203 | rm -rf yotta/module "$OUT_OF_SOURCE_DIR" |
| 204 | fi |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 205 | git checkout-index -f -q $CONFIG_H |
| 206 | cleanup |
| 207 | else |
| 208 | |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 209 | if [ $YOTTA -eq 1 ] && [ -d yotta/module ]; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 210 | 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] | 211 | echo "You can either delete your work and retry, or force the test to overwrite the" |
| 212 | echo "test by rerunning the script as: $0 --force" |
| 213 | exit 1 |
| 214 | fi |
| 215 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 216 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 217 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 218 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 219 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 220 | exit 1 |
| 221 | fi |
| 222 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 223 | if ! git diff-files --quiet include/mbedtls/config.h; then |
| 224 | echo $? |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 225 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 226 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 227 | echo "script as: $0 --force" |
| 228 | exit 1 |
| 229 | fi |
| 230 | fi |
| 231 | |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 232 | if [ $RELEASE -eq 1 ]; then |
| 233 | # Fix the seed value to 1 to ensure that the tests are deterministic. |
| 234 | SEED=1 |
| 235 | fi |
| 236 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 237 | msg "info: $0 configuration" |
| 238 | echo "MEMORY: $MEMORY" |
| 239 | echo "FORCE: $FORCE" |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 240 | echo "SEED: ${SEED-"UNSET"}" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 241 | echo "OPENSSL: $OPENSSL" |
| 242 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 243 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 244 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 245 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 246 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 247 | echo "ARMC5_BIN_DIR: $ARMC5_BIN_DIR" |
| 248 | echo "ARMC6_BIN_DIR: $ARMC6_BIN_DIR" |
| 249 | |
| 250 | ARMC5_CC="$ARMC5_BIN_DIR/armcc" |
| 251 | ARMC5_AR="$ARMC5_BIN_DIR/armar" |
| 252 | ARMC6_CC="$ARMC6_BIN_DIR/armclang" |
| 253 | ARMC6_AR="$ARMC6_BIN_DIR/armar" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 254 | |
Andres AG | b2fdd04 | 2016-09-22 14:17:46 +0100 | [diff] [blame] | 255 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 256 | # we just export the variables they require |
| 257 | export OPENSSL_CMD="$OPENSSL" |
| 258 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 259 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 260 | |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 261 | # Avoid passing --seed flag in every call to ssl-opt.sh |
| 262 | [ ! -z ${SEED+set} ] && export SEED |
| 263 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 264 | # Make sure the tools we need are available. |
| 265 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 266 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
| 267 | "arm-none-eabi-gcc" "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR" \ |
| 268 | "i686-w64-mingw32-gcc" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 269 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 270 | # |
| 271 | # Test Suites to be executed |
| 272 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 273 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 274 | # 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] | 275 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 276 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 277 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 278 | # |
| 279 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 280 | |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 281 | msg "info: output_env.sh" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 282 | OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \ |
| 283 | GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \ |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 284 | GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \ |
| 285 | ARMC6_CC="$ARMC6_CC" scripts/output_env.sh |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 286 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 287 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 288 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 289 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 290 | msg "test: freshness of generated source files" # < 1s |
| 291 | tests/scripts/check-generated-files.sh |
| 292 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 293 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 294 | tests/scripts/check-doxy-blocks.pl |
| 295 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 296 | msg "test/build: declared and exported names" # < 3s |
| 297 | cleanup |
| 298 | tests/scripts/check-names.sh |
| 299 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 300 | msg "test: doxygen warnings" # ~ 3s |
| 301 | cleanup |
| 302 | tests/scripts/doxygen.sh |
Manuel Pégourié-Gonnard | 1d552e7 | 2016-01-04 16:49:09 +0100 | [diff] [blame] | 303 | |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 304 | if [ $YOTTA -ne 0 ]; then |
| 305 | # Note - use of yotta is deprecated, and yotta also requires armcc to be |
| 306 | # on the path, and uses whatever version of armcc it finds there. |
| 307 | msg "build: create and build yotta module" # ~ 30s |
| 308 | cleanup |
| 309 | tests/scripts/yotta-build.sh |
| 310 | fi |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 311 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 312 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 313 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 314 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 315 | make |
| 316 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 317 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 318 | make test |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 319 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 320 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 321 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 322 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 323 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 324 | tests/scripts/test-ref-configs.pl |
| 325 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 326 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 327 | make |
| 328 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 329 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 330 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 331 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 332 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 333 | cleanup |
Simon Butcher | f413b6f | 2016-03-14 22:32:42 +0000 | [diff] [blame] | 334 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 335 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 336 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 337 | make |
| 338 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 339 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 340 | make test |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 341 | |
| 342 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 343 | tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 344 | OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 345 | |
| 346 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
| 347 | tests/ssl-opt.sh |
| 348 | |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 349 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
| 350 | cleanup |
| 351 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 352 | scripts/config.pl unset MBEDTLS_SSL_RENEGOTIATION |
| 353 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 354 | make |
| 355 | |
| 356 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 357 | make test |
| 358 | |
| 359 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
| 360 | tests/ssl-opt.sh |
| 361 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 362 | msg "build: cmake, full config, clang, C99" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 363 | cleanup |
Janos Follath | 35d48cb | 2016-04-22 14:45:00 +0100 | [diff] [blame] | 364 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 365 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 366 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 367 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check -D ENABLE_TESTING=On . |
| 368 | CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic' make |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 369 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 370 | msg "test: main suites (full config)" # ~ 5s |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 371 | CFLAGS='-Werror -Wall -Wextra' make test |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 372 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 373 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 374 | tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 375 | |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 376 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 377 | 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] | 378 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 379 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 380 | cleanup |
| 381 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
| 382 | tests/scripts/curves.pl |
| 383 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 384 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 385 | cleanup |
| 386 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
| 387 | tests/scripts/key-exchanges.pl |
| 388 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 389 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 390 | cleanup |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 391 | CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' make |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 392 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 393 | # Full configuration build, without platform support, file IO and net sockets. |
| 394 | # This should catch missing mbedtls_printf definitions, and by disabling file |
| 395 | # IO, it should catch missing '#include <stdio.h>' |
| 396 | msg "build: full config except platform/fsio/net, make, gcc, C99" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 397 | cleanup |
| 398 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 399 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 400 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 401 | scripts/config.pl unset MBEDTLS_NET_C |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 402 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 403 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 404 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 405 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
Simon Butcher | b928343 | 2016-07-13 11:02:41 +0100 | [diff] [blame] | 406 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 407 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Simon Butcher | 284b4c9 | 2016-06-26 13:10:00 +0100 | [diff] [blame] | 408 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 409 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 410 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | cb58700 | 2017-01-06 16:14:44 +0000 | [diff] [blame] | 411 | # Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19, |
| 412 | # to re-enable platform integration features otherwise disabled in C99 builds |
| 413 | CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -O0 -D_DEFAULT_SOURCE' make lib programs |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 414 | CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make test |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 415 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 416 | # catch compile bugs in _uninit functions |
| 417 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 418 | cleanup |
| 419 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 420 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 421 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 422 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 423 | CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 424 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 425 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 426 | cleanup |
| 427 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 428 | scripts/config.pl full |
| 429 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 430 | CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' make |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 431 | |
| 432 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 433 | cleanup |
| 434 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 435 | scripts/config.pl full |
| 436 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 437 | CC=gcc CFLAGS='-Werror -Wall -Werror -O0' make |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 438 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 439 | # Note, C99 compliance can also be tested with the sockets support disabled, |
| 440 | # as that requires a POSIX platform (which isn't the same as C99). |
Andres AG | 788aa4a | 2016-09-14 14:32:09 +0100 | [diff] [blame] | 441 | msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 442 | cleanup |
| 443 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 444 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 445 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 446 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 447 | CC=gcc CFLAGS='-Werror -Wall -Wextra -O0 -std=c99 -pedantic' make lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 448 | |
Hanno Becker | 5175ac6 | 2017-09-18 15:36:25 +0100 | [diff] [blame] | 449 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
| 450 | cleanup |
| 451 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 452 | scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 453 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 454 | make |
| 455 | |
| 456 | msg "test: ssl-opt.sh, MFL-related tests" |
| 457 | tests/ssl-opt.sh -f "Max fragment length" |
| 458 | |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 459 | msg "build: default config with MBEDTLS_TEST_NULL_ENTROPY (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 460 | cleanup |
| 461 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 462 | scripts/config.pl set MBEDTLS_TEST_NULL_ENTROPY |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 463 | scripts/config.pl set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES |
| 464 | scripts/config.pl set MBEDTLS_ENTROPY_C |
| 465 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 466 | scripts/config.pl unset MBEDTLS_ENTROPY_HARDWARE_ALT |
| 467 | scripts/config.pl unset MBEDTLS_HAVEGE_C |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 468 | 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] | 469 | make |
| 470 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 471 | msg "test: MBEDTLS_TEST_NULL_ENTROPY - main suites (inc. selftests) (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 472 | make test |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 473 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 474 | if uname -a | grep -F Linux >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 475 | msg "build/test: make shared" # ~ 40s |
| 476 | cleanup |
| 477 | make SHARED=1 all check |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 478 | fi |
| 479 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 480 | if uname -a | grep -F x86_64 >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 481 | msg "build: i386, make, gcc" # ~ 30s |
| 482 | cleanup |
| 483 | CC=gcc CFLAGS='-Werror -Wall -Wextra -m32' make |
Andres Amaya Garcia | 5e873fb | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 484 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 485 | msg "build: gcc, force 32-bit compilation" |
| 486 | cleanup |
| 487 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 488 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 489 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 490 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
| 491 | CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' make |
Andres Amaya Garcia | 5e873fb | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 492 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 493 | msg "build: gcc, force 64-bit compilation" |
| 494 | cleanup |
| 495 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 496 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 497 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 498 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
| 499 | CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' make |
Andres Amaya Garcia | 9946783 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 500 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 501 | msg "test: gcc, force 64-bit compilation" |
| 502 | make test |
Andres Amaya Garcia | 9946783 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 503 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 504 | msg "build: gcc, force 64-bit compilation" |
| 505 | cleanup |
| 506 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 507 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 508 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 509 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
| 510 | CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' make |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 511 | fi # x86_64 |
| 512 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 513 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 514 | cleanup |
| 515 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 516 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 517 | scripts/config.pl unset MBEDTLS_NET_C |
| 518 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 519 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 520 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 521 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 522 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 523 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 524 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 525 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 526 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 527 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 528 | CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 529 | |
Gilles Peskine | b1a977f | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 530 | msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s |
| 531 | cleanup |
Simon Butcher | 2c4d558 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 532 | cp "$CONFIG_H" "$CONFIG_BAK" |
Andres Amaya Garcia | 465db7e | 2017-07-20 13:27:35 +0100 | [diff] [blame] | 533 | scripts/config.pl full |
| 534 | scripts/config.pl unset MBEDTLS_NET_C |
| 535 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 536 | scripts/config.pl unset MBEDTLS_FS_IO |
| 537 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 538 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
| 539 | # following things are not in the default config |
| 540 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 541 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 542 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 543 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 544 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | b1a977f | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 545 | scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION |
| 546 | CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib |
| 547 | echo "Checking that software 64-bit division is not required" |
| 548 | ! grep __aeabi_uldiv library/*.o |
| 549 | |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 550 | msg "build: ARM Compiler 5, make" |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 551 | cleanup |
| 552 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 553 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 554 | scripts/config.pl unset MBEDTLS_NET_C |
| 555 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 556 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | 1c71965 | 2016-06-27 19:02:12 +0100 | [diff] [blame] | 557 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 558 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 559 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 560 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 561 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 562 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 563 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 564 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 565 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 566 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 567 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 4df5eaf | 2016-08-24 22:58:31 +0300 | [diff] [blame] | 568 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT # depends on MBEDTLS_HAVE_TIME |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 569 | |
Simon Butcher | 105e856 | 2017-01-05 18:26:40 +0000 | [diff] [blame] | 570 | CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' make lib |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 571 | make clean |
| 572 | |
Simon Butcher | 2c4d558 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 573 | # ARM Compiler 6 - Target ARMv7-A |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 574 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a" |
Simon Butcher | 2c4d558 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 575 | |
| 576 | # ARM Compiler 6 - Target ARMv7-M |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 577 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m" |
Simon Butcher | 2c4d558 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 578 | |
| 579 | # ARM Compiler 6 - Target ARMv8-A - AArch32 |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 580 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a" |
Simon Butcher | 2c4d558 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 581 | |
| 582 | # ARM Compiler 6 - Target ARMv8-M |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 583 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main" |
Simon Butcher | 2c4d558 | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 584 | |
| 585 | # ARM Compiler 6 - Target ARMv8-A - AArch64 |
| 586 | armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a" |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 587 | |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 588 | msg "build: allow SHA1 in certificates by default" |
| 589 | cleanup |
| 590 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 591 | scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
| 592 | CFLAGS='-Werror -Wall -Wextra' make |
| 593 | msg "test: allow SHA1 in certificates by default" |
| 594 | make test |
| 595 | tests/ssl-opt.sh -f SHA-1 |
| 596 | |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 597 | msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 598 | cleanup |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 599 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 make lib programs |
Simon Butcher | 91aef33 | 2016-11-17 09:20:50 +0000 | [diff] [blame] | 600 | |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 601 | # note Make tests only builds the tests, but doesn't run them |
| 602 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 make tests |
Manuel Pégourié-Gonnard | 52fa38a | 2015-06-23 14:29:58 +0200 | [diff] [blame] | 603 | WINDOWS_BUILD=1 make clean |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 604 | |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 605 | msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s |
| 606 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 make lib programs |
| 607 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 make tests |
Manuel Pégourié-Gonnard | e33316c | 2015-08-07 13:17:23 +0200 | [diff] [blame] | 608 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 609 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 610 | # MemSan currently only available on Linux 64 bits |
| 611 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 612 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 613 | msg "build: MSan (clang)" # ~ 1 min 20s |
| 614 | cleanup |
| 615 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 616 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 617 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 618 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 619 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 620 | msg "test: main suites (MSan)" # ~ 10s |
| 621 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 622 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 623 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
| 624 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 625 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 626 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 627 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 628 | if [ "$MEMORY" -gt 0 ]; then |
| 629 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
| 630 | tests/compat.sh |
| 631 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 632 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 633 | else # no MemSan |
| 634 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 635 | msg "build: Release (clang)" |
| 636 | cleanup |
| 637 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 638 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 639 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 640 | msg "test: main suites valgrind (Release)" |
| 641 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 642 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 643 | # Optional part(s) |
| 644 | # Currently broken, programs don't seem to receive signals |
| 645 | # under valgrind on OS X |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 646 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 647 | if [ "$MEMORY" -gt 0 ]; then |
| 648 | msg "test: ssl-opt.sh --memcheck (Release)" |
| 649 | tests/ssl-opt.sh --memcheck |
| 650 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 651 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 652 | if [ "$MEMORY" -gt 1 ]; then |
| 653 | msg "test: compat.sh --memcheck (Release)" |
| 654 | tests/compat.sh --memcheck |
| 655 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 656 | |
| 657 | fi # MemSan |
| 658 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 659 | msg "build: cmake 'out-of-source' build" |
| 660 | cleanup |
| 661 | MBEDTLS_ROOT_DIR="$PWD" |
| 662 | mkdir "$OUT_OF_SOURCE_DIR" |
| 663 | cd "$OUT_OF_SOURCE_DIR" |
| 664 | cmake "$MBEDTLS_ROOT_DIR" |
| 665 | make |
| 666 | |
| 667 | msg "test: cmake 'out-of-source' build" |
| 668 | make test |
| 669 | cd "$MBEDTLS_ROOT_DIR" |
| 670 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 671 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 672 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 673 | cleanup |