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 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 7 | # Copyright (c) 2014-2017, ARM Limited, All Rights Reserved |
| 8 | |
| 9 | |
| 10 | |
| 11 | ################################################################ |
| 12 | #### Documentation |
| 13 | ################################################################ |
| 14 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 15 | # Purpose |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 16 | # ------- |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 17 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 18 | # To run all tests possible or available on the platform. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 19 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 20 | # Notes for users |
| 21 | # --------------- |
| 22 | # |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 23 | # Warning: the test is destructive. It includes various build modes and |
| 24 | # configurations, and can and will arbitrarily change the current CMake |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 25 | # configuration. The following files must be committed into git: |
| 26 | # * include/mbedtls/config.h |
| 27 | # * Makefile, library/Makefile, programs/Makefile, tests/Makefile |
| 28 | # After running this script, the CMake cache will be lost and CMake |
| 29 | # will no longer be initialised. |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 30 | # |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 31 | # The script assumes the presence of a number of tools: |
| 32 | # * Basic Unix tools (Windows users note: a Unix-style find must be before |
| 33 | # the Windows find in the PATH) |
| 34 | # * Perl |
| 35 | # * GNU Make |
| 36 | # * CMake |
| 37 | # * GCC and Clang (recent enough for using ASan with gcc and MemSan with clang, or valgrind) |
| 38 | # * arm-gcc and mingw-gcc |
| 39 | # * ArmCC 5 and ArmCC 6, unless invoked with --no-armcc |
| 40 | # * Yotta build dependencies, unless invoked with --no-yotta |
| 41 | # * OpenSSL and GnuTLS command line tools, recent enough for the |
| 42 | # interoperability tests. If they don't support SSLv3 then a legacy |
| 43 | # version of these tools must be present as well (search for LEGACY |
| 44 | # below). |
| 45 | # See the invocation of check_tools below for details. |
| 46 | # |
| 47 | # This script must be invoked from the toplevel directory of a git |
| 48 | # working copy of Mbed TLS. |
| 49 | # |
| 50 | # Note that the output is not saved. You may want to run |
| 51 | # script -c tests/scripts/all.sh |
| 52 | # or |
| 53 | # tests/scripts/all.sh >all.log 2>&1 |
| 54 | # |
| 55 | # Notes for maintainers |
| 56 | # --------------------- |
| 57 | # |
| 58 | # The tests are roughly in order from fastest to slowest. This doesn't |
| 59 | # have to be exact, but in general you should add slower tests towards |
| 60 | # the end and fast checks near the beginning. |
| 61 | # |
| 62 | # Sanity checks have the following form: |
| 63 | # 1. msg "short description of what is about to be done" |
| 64 | # 2. run sanity check (failure stops the script) |
| 65 | # |
| 66 | # Build or build-and-test steps have the following form: |
| 67 | # 1. msg "short description of what is about to be done" |
| 68 | # 2. cleanup |
| 69 | # 3. preparation (config.pl, cmake, ...) (failure stops the script) |
| 70 | # 4. make |
| 71 | # 5. Run tests if relevant. All tests must be prefixed with |
| 72 | # if_build_successful for the sake of --keep-going. |
| 73 | |
| 74 | |
| 75 | |
| 76 | ################################################################ |
| 77 | #### Initialization and command line parsing |
| 78 | ################################################################ |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 79 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 80 | # Abort on errors (and uninitialised variables) |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 81 | set -eu |
| 82 | |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 83 | if [ "$( uname )" != "Linux" ]; then |
| 84 | echo "This script only works in Linux" >&2 |
| 85 | exit 1 |
| 86 | elif [ -d library -a -d include -a -d tests ]; then :; else |
| 87 | echo "Must be run from mbed TLS root" >&2 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 88 | exit 1 |
| 89 | fi |
| 90 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 91 | CONFIG_H='include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 92 | CONFIG_BAK="$CONFIG_H.bak" |
| 93 | |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 94 | MEMORY=0 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 95 | FORCE=0 |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 96 | KEEP_GOING=0 |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 97 | RUN_ARMCC=1 |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 98 | YOTTA=1 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 99 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 100 | # Default commands, can be overriden by the environment |
| 101 | : ${OPENSSL:="openssl"} |
| 102 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
| 103 | : ${GNUTLS_CLI:="gnutls-cli"} |
| 104 | : ${GNUTLS_SERV:="gnutls-serv"} |
| 105 | : ${GNUTLS_LEGACY_CLI:="$GNUTLS_CLI"} |
| 106 | : ${GNUTLS_LEGACY_SERV:="$GNUTLS_SERV"} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 107 | : ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build} |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 108 | : ${ARMC5_BIN_DIR:=/usr/bin} |
| 109 | : ${ARMC6_BIN_DIR:=/usr/bin} |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 110 | |
Andres AG | 38495a3 | 2016-07-12 16:54:33 +0100 | [diff] [blame] | 111 | # if MAKEFLAGS is not set add the -j option to speed up invocations of make |
| 112 | if [ -n "${MAKEFLAGS+set}" ]; then |
| 113 | export MAKEFLAGS="-j" |
| 114 | fi |
| 115 | |
Simon Butcher | 41eeccf | 2016-09-07 00:07:09 +0100 | [diff] [blame] | 116 | usage() |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 117 | { |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 118 | cat <<EOF |
| 119 | Usage: $0 [OPTION]... |
| 120 | -h|--help Print this help. |
| 121 | |
| 122 | General options: |
| 123 | -f|--force Force the tests to overwrite any modified files. |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 124 | -k|--keep-going Run all tests and report errors at the end. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 125 | -m|--memory Additional optional memory tests. |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 126 | --armcc Run ARM Compiler builds (on by default). |
| 127 | --no-armcc Skip ARM Compiler builds. |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 128 | --no-force Refuse to overwrite modified files (default). |
| 129 | --no-keep-going Stop at the first error (default). |
| 130 | --no-memory No additional memory tests (default). |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 131 | --no-yotta Skip yotta module build. |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 132 | --out-of-source-dir=<path> Directory used for CMake out-of-source build tests. |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 133 | --random-seed Use a random seed value for randomized tests (default). |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 134 | -r|--release-test Run this script in release mode. This fixes the seed value to 1. |
| 135 | -s|--seed Integer seed value to use for this test run. |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 136 | --yotta Build yotta module (on by default). |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 137 | |
| 138 | Tool path options: |
| 139 | --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory. |
| 140 | --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory. |
| 141 | --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests. |
| 142 | --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests. |
| 143 | --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests. |
| 144 | --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests. |
| 145 | --openssl=<OpenSSL_path> OpenSSL executable to use for most tests. |
| 146 | --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests e.g. SSLv3. |
| 147 | EOF |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 148 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 149 | |
| 150 | # remove built files as well as the cmake cache/config |
| 151 | cleanup() |
| 152 | { |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 153 | command make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 154 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 155 | 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] | 156 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 157 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 158 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 159 | |
| 160 | if [ -f "$CONFIG_BAK" ]; then |
| 161 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 162 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 163 | } |
| 164 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 165 | # Executed on exit. May be redefined depending on command line options. |
| 166 | final_report () { |
| 167 | : |
| 168 | } |
| 169 | |
| 170 | fatal_signal () { |
| 171 | cleanup |
| 172 | final_report $1 |
| 173 | trap - $1 |
| 174 | kill -$1 $$ |
| 175 | } |
| 176 | |
| 177 | trap 'fatal_signal HUP' HUP |
| 178 | trap 'fatal_signal INT' INT |
| 179 | trap 'fatal_signal TERM' TERM |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 180 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 181 | msg() |
| 182 | { |
| 183 | echo "" |
| 184 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 185 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 186 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 187 | echo "******************************************************************" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 188 | current_section=$1 |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 189 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 190 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 191 | if [ $RUN_ARMCC -ne 0 ]; then |
| 192 | armc6_build_test() |
| 193 | { |
| 194 | FLAGS="$1" |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 195 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 196 | msg "build: ARM Compiler 6 ($FLAGS), make" |
| 197 | ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \ |
| 198 | WARNING_CFLAGS='-xc -std=c99' make lib |
| 199 | make clean |
| 200 | } |
| 201 | fi |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 202 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 203 | err_msg() |
| 204 | { |
| 205 | echo "$1" >&2 |
| 206 | } |
| 207 | |
| 208 | check_tools() |
| 209 | { |
| 210 | for TOOL in "$@"; do |
| 211 | if ! `hash "$TOOL" >/dev/null 2>&1`; then |
| 212 | err_msg "$TOOL not found!" |
| 213 | exit 1 |
| 214 | fi |
| 215 | done |
| 216 | } |
| 217 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 218 | while [ $# -gt 0 ]; do |
| 219 | case "$1" in |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 220 | --armcc) RUN_ARMCC=1;; |
| 221 | --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";; |
| 222 | --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";; |
| 223 | --force|-f) FORCE=1;; |
| 224 | --gnutls-cli) shift; GNUTLS_CLI="$1";; |
| 225 | --gnutls-legacy-cli) shift; GNUTLS_LEGACY_CLI="$1";; |
| 226 | --gnutls-legacy-serv) shift; GNUTLS_LEGACY_SERV="$1";; |
| 227 | --gnutls-serv) shift; GNUTLS_SERV="$1";; |
| 228 | --help|-h) usage; exit;; |
| 229 | --keep-going|-k) KEEP_GOING=1;; |
| 230 | --memory|-m) MEMORY=1;; |
| 231 | --no-armcc) RUN_ARMCC=0;; |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 232 | --no-force) FORCE=0;; |
| 233 | --no-keep-going) KEEP_GOING=0;; |
| 234 | --no-memory) MEMORY=0;; |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 235 | --no-yotta) YOTTA=0;; |
| 236 | --openssl) shift; OPENSSL="$1";; |
| 237 | --openssl-legacy) shift; OPENSSL_LEGACY="$1";; |
| 238 | --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";; |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 239 | --random-seed) unset SEED;; |
| 240 | --release-test|-r) SEED=1;; |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 241 | --seed|-s) shift; SEED="$1";; |
| 242 | --yotta) YOTTA=1;; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 243 | *) |
| 244 | echo >&2 "Unknown option: $1" |
| 245 | echo >&2 "Run $0 --help for usage." |
| 246 | exit 120 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 247 | ;; |
| 248 | esac |
| 249 | shift |
| 250 | done |
| 251 | |
| 252 | if [ $FORCE -eq 1 ]; then |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 253 | if [ $YOTTA -eq 1 ]; then |
| 254 | rm -rf yotta/module "$OUT_OF_SOURCE_DIR" |
| 255 | fi |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 256 | git checkout-index -f -q $CONFIG_H |
| 257 | cleanup |
| 258 | else |
| 259 | |
Gilles Peskine | 2a22a80 | 2017-12-21 15:19:00 +0100 | [diff] [blame] | 260 | if [ $YOTTA -ne 0 ] && [ -d yotta/module ]; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 261 | 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] | 262 | echo "You can either delete your work and retry, or force the test to overwrite the" |
| 263 | echo "test by rerunning the script as: $0 --force" |
| 264 | exit 1 |
| 265 | fi |
| 266 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 267 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 268 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 269 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 270 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 271 | exit 1 |
| 272 | fi |
| 273 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 274 | if ! git diff-files --quiet include/mbedtls/config.h; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 275 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 276 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 277 | echo "script as: $0 --force" |
| 278 | exit 1 |
| 279 | fi |
| 280 | fi |
| 281 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 282 | build_status=0 |
| 283 | if [ $KEEP_GOING -eq 1 ]; then |
| 284 | failure_summary= |
| 285 | failure_count=0 |
| 286 | start_red= |
| 287 | end_color= |
| 288 | if [ -t 1 ]; then |
Gilles Peskine | 9736b9d | 2018-01-02 21:54:17 +0100 | [diff] [blame] | 289 | case "${TERM:-}" in |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 290 | *color*|cygwin|linux|rxvt*|screen|[Eex]term*) |
| 291 | start_red=$(printf '\033[31m') |
| 292 | end_color=$(printf '\033[0m') |
| 293 | ;; |
| 294 | esac |
| 295 | fi |
| 296 | record_status () { |
| 297 | if "$@"; then |
| 298 | last_status=0 |
| 299 | else |
| 300 | last_status=$? |
| 301 | text="$current_section: $* -> $last_status" |
| 302 | failure_summary="$failure_summary |
| 303 | $text" |
| 304 | failure_count=$((failure_count + 1)) |
| 305 | echo "${start_red}^^^^$text^^^^${end_color}" |
| 306 | fi |
| 307 | } |
| 308 | make () { |
| 309 | case "$*" in |
| 310 | *test|*check) |
| 311 | if [ $build_status -eq 0 ]; then |
| 312 | record_status command make "$@" |
| 313 | else |
| 314 | echo "(skipped because the build failed)" |
| 315 | fi |
| 316 | ;; |
| 317 | *) |
| 318 | record_status command make "$@" |
| 319 | build_status=$last_status |
| 320 | ;; |
| 321 | esac |
| 322 | } |
| 323 | final_report () { |
| 324 | if [ $failure_count -gt 0 ]; then |
| 325 | echo |
| 326 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 327 | echo "${start_red}FAILED: $failure_count${end_color}$failure_summary" |
| 328 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 329 | elif [ -z "${1-}" ]; then |
| 330 | echo "SUCCESS :)" |
| 331 | fi |
| 332 | if [ -n "${1-}" ]; then |
| 333 | echo "Killed by SIG$1." |
| 334 | fi |
| 335 | } |
| 336 | else |
| 337 | record_status () { |
| 338 | "$@" |
| 339 | } |
| 340 | fi |
| 341 | if_build_succeeded () { |
| 342 | if [ $build_status -eq 0 ]; then |
| 343 | record_status "$@" |
| 344 | fi |
| 345 | } |
| 346 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 347 | msg "info: $0 configuration" |
| 348 | echo "MEMORY: $MEMORY" |
| 349 | echo "FORCE: $FORCE" |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 350 | echo "SEED: ${SEED-"UNSET"}" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 351 | echo "OPENSSL: $OPENSSL" |
| 352 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
| 353 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 354 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 355 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 356 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 357 | echo "ARMC5_BIN_DIR: $ARMC5_BIN_DIR" |
| 358 | echo "ARMC6_BIN_DIR: $ARMC6_BIN_DIR" |
| 359 | |
| 360 | ARMC5_CC="$ARMC5_BIN_DIR/armcc" |
| 361 | ARMC5_AR="$ARMC5_BIN_DIR/armar" |
| 362 | ARMC6_CC="$ARMC6_BIN_DIR/armclang" |
| 363 | ARMC6_AR="$ARMC6_BIN_DIR/armar" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 364 | |
Andres AG | b2fdd04 | 2016-09-22 14:17:46 +0100 | [diff] [blame] | 365 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 366 | # we just export the variables they require |
| 367 | export OPENSSL_CMD="$OPENSSL" |
| 368 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 369 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 370 | |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 371 | # Avoid passing --seed flag in every call to ssl-opt.sh |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 372 | if [ -n "${SEED-}" ]; then |
| 373 | export SEED |
| 374 | fi |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 375 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 376 | # Make sure the tools we need are available. |
| 377 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 378 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
Andres Amaya Garcia | ddebc49 | 2017-10-24 22:16:34 +0100 | [diff] [blame] | 379 | "arm-none-eabi-gcc" "i686-w64-mingw32-gcc" "gdb" |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 380 | if [ $RUN_ARMCC -ne 0 ]; then |
| 381 | check_tools "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR" |
| 382 | fi |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 383 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 384 | |
| 385 | |
| 386 | ################################################################ |
| 387 | #### Basic checks |
| 388 | ################################################################ |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 389 | |
| 390 | # |
| 391 | # Test Suites to be executed |
| 392 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 393 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 394 | # 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] | 395 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 396 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 397 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 398 | # |
| 399 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 400 | |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 401 | msg "info: output_env.sh" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 402 | OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \ |
| 403 | GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \ |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 404 | GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \ |
Gilles Peskine | 2623296 | 2018-03-21 08:35:07 +0100 | [diff] [blame] | 405 | ARMC6_CC="$ARMC6_CC" RUN_ARMCC="$RUN_ARMCC" scripts/output_env.sh |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 406 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 407 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 408 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 409 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 410 | msg "test: freshness of generated source files" # < 1s |
| 411 | tests/scripts/check-generated-files.sh |
| 412 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 413 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 414 | tests/scripts/check-doxy-blocks.pl |
| 415 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 416 | msg "test/build: declared and exported names" # < 3s |
| 417 | cleanup |
| 418 | tests/scripts/check-names.sh |
| 419 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 420 | msg "test: doxygen warnings" # ~ 3s |
| 421 | cleanup |
| 422 | tests/scripts/doxygen.sh |
Manuel Pégourié-Gonnard | 1d552e7 | 2016-01-04 16:49:09 +0100 | [diff] [blame] | 423 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 424 | |
| 425 | |
| 426 | ################################################################ |
| 427 | #### Build and test many configurations and targets |
| 428 | ################################################################ |
| 429 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 430 | if [ $RUN_ARMCC -ne 0 ] && [ $YOTTA -ne 0 ]; then |
| 431 | # Note - use of yotta is deprecated, and yotta also requires armcc to be on the |
| 432 | # path, and uses whatever version of armcc it finds there. |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 433 | msg "build: create and build yotta module" # ~ 30s |
| 434 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 435 | record_status tests/scripts/yotta-build.sh |
Gilles Peskine | da51925 | 2017-11-30 13:22:04 +0100 | [diff] [blame] | 436 | fi |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 437 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 438 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 439 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 440 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 441 | make |
| 442 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 443 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 444 | make test |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 445 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 446 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 447 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 448 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 449 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 450 | record_status tests/scripts/test-ref-configs.pl |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 451 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 452 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 453 | make |
| 454 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 455 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 456 | if_build_succeeded tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 457 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 458 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 459 | cleanup |
Simon Butcher | f413b6f | 2016-03-14 22:32:42 +0000 | [diff] [blame] | 460 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 461 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 462 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 463 | make |
| 464 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 465 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 466 | make test |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 467 | |
| 468 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 469 | if_build_succeeded tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 470 | if_build_succeeded env OPENSSL_CMD="$OPENSSL_LEGACY" tests/compat.sh -m 'ssl3' |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 471 | |
| 472 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 473 | if_build_succeeded tests/ssl-opt.sh |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 474 | |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 475 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
| 476 | cleanup |
| 477 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 478 | scripts/config.pl unset MBEDTLS_SSL_RENEGOTIATION |
| 479 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 480 | make |
| 481 | |
| 482 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 483 | make test |
| 484 | |
| 485 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 486 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 487 | |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 488 | msg "build: Default + RSA_NO_CRT (ASan build)" # ~ 6 min |
| 489 | cleanup |
| 490 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 491 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
| 492 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 493 | make |
| 494 | |
| 495 | msg "test: RSA_NO_CRT - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 496 | make test |
| 497 | |
| 498 | msg "test: RSA_NO_CRT - RSA-related part of ssl-opt.sh (ASan build)" # ~ 5s |
| 499 | tests/ssl-opt.sh -f RSA |
| 500 | |
| 501 | msg "test: RSA_NO_CRT - RSA-related part of compat.sh (ASan build)" # ~ 3 min |
| 502 | tests/compat.sh -t RSA |
| 503 | |
Manuel Pégourié-Gonnard | 602544e | 2017-06-20 10:49:24 +0200 | [diff] [blame] | 504 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 61bc57a | 2014-08-14 11:29:06 +0200 | [diff] [blame] | 505 | cleanup |
Janos Follath | 35d48cb | 2016-04-22 14:45:00 +0100 | [diff] [blame] | 506 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 507 | scripts/config.pl full |
| 508 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 509 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check -D ENABLE_TESTING=On . |
Manuel Pégourié-Gonnard | 602544e | 2017-06-20 10:49:24 +0200 | [diff] [blame] | 510 | make |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 511 | |
| 512 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | 602544e | 2017-06-20 10:49:24 +0200 | [diff] [blame] | 513 | make test |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 514 | |
| 515 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 516 | if_build_succeeded tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 517 | |
| 518 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 519 | if_build_succeeded env 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] | 520 | |
| 521 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
| 522 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 523 | record_status tests/scripts/curves.pl |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 524 | |
Manuel Pégourié-Gonnard | 1fe6bb9 | 2017-06-06 11:36:16 +0200 | [diff] [blame] | 525 | msg "test/build: depends-hashes.pl (gcc)" # ~ 2 min |
| 526 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 527 | record_status tests/scripts/depends-hashes.pl |
Manuel Pégourié-Gonnard | 1fe6bb9 | 2017-06-06 11:36:16 +0200 | [diff] [blame] | 528 | |
Manuel Pégourié-Gonnard | 43be6cd | 2017-06-20 09:53:42 +0200 | [diff] [blame] | 529 | msg "test/build: depends-pkalgs.pl (gcc)" # ~ 2 min |
| 530 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 531 | record_status tests/scripts/depends-pkalgs.pl |
Manuel Pégourié-Gonnard | 43be6cd | 2017-06-20 09:53:42 +0200 | [diff] [blame] | 532 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 533 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 534 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 535 | record_status tests/scripts/key-exchanges.pl |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 536 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 537 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 538 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 539 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 540 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 541 | # Full configuration build, without platform support, file IO and net sockets. |
| 542 | # This should catch missing mbedtls_printf definitions, and by disabling file |
| 543 | # IO, it should catch missing '#include <stdio.h>' |
| 544 | 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] | 545 | cleanup |
| 546 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 547 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 548 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 549 | scripts/config.pl unset MBEDTLS_NET_C |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 550 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 551 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 552 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 553 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
Simon Butcher | b928343 | 2016-07-13 11:02:41 +0100 | [diff] [blame] | 554 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 555 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Simon Butcher | 284b4c9 | 2016-06-26 13:10:00 +0100 | [diff] [blame] | 556 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 557 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 558 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | cb58700 | 2017-01-06 16:14:44 +0000 | [diff] [blame] | 559 | # Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19, |
| 560 | # to re-enable platform integration features otherwise disabled in C99 builds |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 561 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -O0 -D_DEFAULT_SOURCE' lib programs |
| 562 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' test |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 563 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 564 | # catch compile bugs in _uninit functions |
| 565 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 566 | cleanup |
| 567 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 568 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 569 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 570 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 571 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 572 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 573 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 574 | cleanup |
| 575 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 576 | scripts/config.pl full |
| 577 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 578 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 579 | |
| 580 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 581 | cleanup |
| 582 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 583 | scripts/config.pl full |
| 584 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 585 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 586 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 587 | # Note, C99 compliance can also be tested with the sockets support disabled, |
| 588 | # 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] | 589 | 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] | 590 | cleanup |
| 591 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 592 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 593 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 594 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 595 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0 -std=c99 -pedantic' lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 596 | |
Hanno Becker | 5175ac6 | 2017-09-18 15:36:25 +0100 | [diff] [blame] | 597 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
| 598 | cleanup |
| 599 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 600 | scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 601 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 602 | make |
| 603 | |
| 604 | msg "test: ssl-opt.sh, MFL-related tests" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 605 | if_build_succeeded tests/ssl-opt.sh -f "Max fragment length" |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 606 | |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 607 | msg "build: default config with MBEDTLS_TEST_NULL_ENTROPY (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 608 | cleanup |
| 609 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 610 | scripts/config.pl set MBEDTLS_TEST_NULL_ENTROPY |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 611 | scripts/config.pl set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES |
| 612 | scripts/config.pl set MBEDTLS_ENTROPY_C |
| 613 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 614 | scripts/config.pl unset MBEDTLS_ENTROPY_HARDWARE_ALT |
| 615 | scripts/config.pl unset MBEDTLS_HAVEGE_C |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 616 | 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] | 617 | make |
| 618 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 619 | msg "test: MBEDTLS_TEST_NULL_ENTROPY - main suites (inc. selftests) (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 620 | make test |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 621 | |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 622 | msg "build: default config with AES_FEWER_TABLES enabled" |
| 623 | cleanup |
| 624 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 625 | scripts/config.pl set MBEDTLS_AES_FEWER_TABLES |
Hanno Becker | 98a6786 | 2018-03-27 17:10:09 +0100 | [diff] [blame] | 626 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 627 | |
| 628 | msg "test: AES_FEWER_TABLES" |
| 629 | make test |
| 630 | |
| 631 | msg "build: default config with AES_ROM_TABLES enabled" |
| 632 | cleanup |
| 633 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 634 | scripts/config.pl set MBEDTLS_AES_ROM_TABLES |
Hanno Becker | 98a6786 | 2018-03-27 17:10:09 +0100 | [diff] [blame] | 635 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 636 | |
| 637 | msg "test: AES_ROM_TABLES" |
| 638 | make test |
| 639 | |
| 640 | msg "build: default config with AES_ROM_TABLES and AES_FEWER_TABLES enabled" |
| 641 | cleanup |
| 642 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 643 | scripts/config.pl set MBEDTLS_AES_FEWER_TABLES |
| 644 | scripts/config.pl set MBEDTLS_AES_ROM_TABLES |
Hanno Becker | 98a6786 | 2018-03-27 17:10:09 +0100 | [diff] [blame] | 645 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 646 | |
| 647 | msg "test: AES_FEWER_TABLES + AES_ROM_TABLES" |
| 648 | make test |
| 649 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 650 | if uname -a | grep -F Linux >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 651 | msg "build/test: make shared" # ~ 40s |
| 652 | cleanup |
| 653 | make SHARED=1 all check |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 654 | fi |
| 655 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 656 | if uname -a | grep -F x86_64 >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 657 | msg "build: i386, make, gcc" # ~ 30s |
| 658 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 659 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -m32' |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 660 | |
Andres Amaya Garcia | f4fbdda | 2017-05-08 11:19:19 +0100 | [diff] [blame] | 661 | msg "test: i386, make, gcc" |
| 662 | make test |
| 663 | |
| 664 | msg "build: 64-bit ILP32, make, gcc" # ~ 30s |
| 665 | cleanup |
| 666 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32' |
| 667 | |
| 668 | msg "test: 64-bit ILP32, make, gcc" |
| 669 | make test |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 670 | fi # x86_64 |
| 671 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 672 | msg "build: gcc, force 32-bit bignum limbs" |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 673 | cleanup |
| 674 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 675 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 676 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 677 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 678 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 679 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 680 | msg "test: gcc, force 32-bit bignum limbs" |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 681 | make test |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 682 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 683 | msg "build: gcc, force 64-bit bignum limbs" |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 684 | cleanup |
| 685 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 686 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 687 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 688 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 689 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' |
| 690 | |
| 691 | msg "test: gcc, force 64-bit bignum limbs" |
| 692 | make test |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 693 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 694 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 695 | cleanup |
| 696 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 697 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 698 | scripts/config.pl unset MBEDTLS_NET_C |
| 699 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 700 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 701 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 702 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 703 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 704 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 705 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 706 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 707 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 708 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 709 | make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' lib |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 710 | |
Gilles Peskine | ed942f8 | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 711 | msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s |
| 712 | cleanup |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 713 | cp "$CONFIG_H" "$CONFIG_BAK" |
Andres Amaya Garcia | 0593197 | 2017-07-20 13:27:35 +0100 | [diff] [blame] | 714 | scripts/config.pl full |
| 715 | scripts/config.pl unset MBEDTLS_NET_C |
| 716 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 717 | scripts/config.pl unset MBEDTLS_FS_IO |
| 718 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 719 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
| 720 | # following things are not in the default config |
| 721 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 722 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 723 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 724 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 725 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | ed942f8 | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 726 | scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 727 | make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' lib |
Gilles Peskine | ed942f8 | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 728 | echo "Checking that software 64-bit division is not required" |
| 729 | ! grep __aeabi_uldiv library/*.o |
| 730 | |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 731 | msg "build: ARM Compiler 5, make" |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 732 | cleanup |
| 733 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 734 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 735 | scripts/config.pl unset MBEDTLS_NET_C |
| 736 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 737 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | 1c71965 | 2016-06-27 19:02:12 +0100 | [diff] [blame] | 738 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 739 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 740 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 741 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 742 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 743 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 744 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 745 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 746 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 747 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 748 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 4df5eaf | 2016-08-24 22:58:31 +0300 | [diff] [blame] | 749 | 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] | 750 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 751 | if [ $RUN_ARMCC -ne 0 ]; then |
| 752 | make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib |
| 753 | make clean |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 754 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 755 | # ARM Compiler 6 - Target ARMv7-A |
| 756 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 757 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 758 | # ARM Compiler 6 - Target ARMv7-M |
| 759 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 760 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 761 | # ARM Compiler 6 - Target ARMv8-A - AArch32 |
| 762 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 763 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 764 | # ARM Compiler 6 - Target ARMv8-M |
| 765 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 766 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 767 | # ARM Compiler 6 - Target ARMv8-A - AArch64 |
| 768 | armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a" |
| 769 | fi |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 770 | |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 771 | msg "build: allow SHA1 in certificates by default" |
| 772 | cleanup |
| 773 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 774 | scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 775 | make CFLAGS='-Werror -Wall -Wextra' |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 776 | msg "test: allow SHA1 in certificates by default" |
| 777 | make test |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 778 | if_build_succeeded tests/ssl-opt.sh -f SHA-1 |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 779 | |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 780 | msg "build: Default + MBEDTLS_RSA_NO_CRT (ASan build)" # ~ 6 min |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 781 | cleanup |
| 782 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 783 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 784 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 785 | make |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 786 | |
| 787 | msg "test: MBEDTLS_RSA_NO_CRT - main suites (inc. selftests) (ASan build)" |
| 788 | make test |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 789 | |
| 790 | msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s |
| 791 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 792 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 lib programs |
Manuel Pégourié-Gonnard | 52fa38a | 2015-06-23 14:29:58 +0200 | [diff] [blame] | 793 | |
Manuel Pégourié-Gonnard | e33316c | 2015-08-07 13:17:23 +0200 | [diff] [blame] | 794 | # note Make tests only builds the tests, but doesn't run them |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 795 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 tests |
| 796 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 797 | |
| 798 | msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 799 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 lib programs |
| 800 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 tests |
| 801 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 802 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 803 | # MemSan currently only available on Linux 64 bits |
| 804 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 805 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 806 | msg "build: MSan (clang)" # ~ 1 min 20s |
| 807 | cleanup |
| 808 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 809 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 810 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 811 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 812 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 813 | msg "test: main suites (MSan)" # ~ 10s |
| 814 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 815 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 816 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 817 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 818 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 819 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 820 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 821 | if [ "$MEMORY" -gt 0 ]; then |
| 822 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 823 | if_build_succeeded tests/compat.sh |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 824 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 825 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 826 | else # no MemSan |
| 827 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 828 | msg "build: Release (clang)" |
| 829 | cleanup |
| 830 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 831 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 832 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 833 | msg "test: main suites valgrind (Release)" |
| 834 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 835 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 836 | # Optional part(s) |
| 837 | # Currently broken, programs don't seem to receive signals |
| 838 | # under valgrind on OS X |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 839 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 840 | if [ "$MEMORY" -gt 0 ]; then |
| 841 | msg "test: ssl-opt.sh --memcheck (Release)" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 842 | if_build_succeeded tests/ssl-opt.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 843 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 844 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 845 | if [ "$MEMORY" -gt 1 ]; then |
| 846 | msg "test: compat.sh --memcheck (Release)" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 847 | if_build_succeeded tests/compat.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 848 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 849 | |
| 850 | fi # MemSan |
| 851 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 852 | msg "build: cmake 'out-of-source' build" |
| 853 | cleanup |
| 854 | MBEDTLS_ROOT_DIR="$PWD" |
| 855 | mkdir "$OUT_OF_SOURCE_DIR" |
| 856 | cd "$OUT_OF_SOURCE_DIR" |
| 857 | cmake "$MBEDTLS_ROOT_DIR" |
| 858 | make |
| 859 | |
| 860 | msg "test: cmake 'out-of-source' build" |
| 861 | make test |
| 862 | cd "$MBEDTLS_ROOT_DIR" |
| 863 | rm -rf "$OUT_OF_SOURCE_DIR" |
| 864 | |
Andres Amaya Garcia | 2967381 | 2017-10-25 10:35:51 +0100 | [diff] [blame] | 865 | for optimization_flag in -O2 -O3 -Ofast -Os; do |
| 866 | for compiler in clang gcc; do |
Andres Amaya Garcia | 708c5cb | 2018-04-24 08:33:31 -0500 | [diff] [blame] | 867 | msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()" |
Andres Amaya Garcia | 2967381 | 2017-10-25 10:35:51 +0100 | [diff] [blame] | 868 | cleanup |
| 869 | CC="$compiler" DEBUG=1 CFLAGS="$optimization_flag" make programs |
| 870 | gdb -x tests/scripts/test_zeroize.gdb -nw -batch -nx |
| 871 | done |
| 872 | done |
Andres Amaya Garcia | d0d7bf6 | 2017-10-25 09:01:31 +0100 | [diff] [blame] | 873 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 874 | |
| 875 | |
| 876 | ################################################################ |
| 877 | #### Termination |
| 878 | ################################################################ |
| 879 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 880 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 881 | cleanup |
| 882 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 883 | final_report |