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) |
Andrzej Kurek | 05be06c | 2018-06-28 04:41:50 -0400 | [diff] [blame] | 38 | # * G++ |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 39 | # * arm-gcc and mingw-gcc |
| 40 | # * ArmCC 5 and ArmCC 6, unless invoked with --no-armcc |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 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 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 98 | |
Antonin Décimo | 36e89b5 | 2019-01-23 15:24:37 +0100 | [diff] [blame^] | 99 | # Default commands, can be overridden by the environment |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 100 | : ${OPENSSL:="openssl"} |
| 101 | : ${OPENSSL_LEGACY:="$OPENSSL"} |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 102 | : ${OPENSSL_NEXT:="$OPENSSL"} |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 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 | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 131 | --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] | 132 | --random-seed Use a random seed value for randomized tests (default). |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 133 | -r|--release-test Run this script in release mode. This fixes the seed value to 1. |
| 134 | -s|--seed Integer seed value to use for this test run. |
| 135 | |
| 136 | Tool path options: |
| 137 | --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory. |
| 138 | --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory. |
| 139 | --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests. |
| 140 | --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests. |
| 141 | --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests. |
| 142 | --gnutls-legacy-serv=<GnuTLS_serv_path> GnuTLS server executable to use for legacy tests. |
| 143 | --openssl=<OpenSSL_path> OpenSSL executable to use for most tests. |
| 144 | --openssl-legacy=<OpenSSL_path> OpenSSL executable to use for legacy tests e.g. SSLv3. |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 145 | --openssl-next=<OpenSSL_path> OpenSSL executable to use for recent things like ARIA |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 146 | EOF |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 147 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 148 | |
| 149 | # remove built files as well as the cmake cache/config |
| 150 | cleanup() |
| 151 | { |
Gilles Peskine | a71d64c | 2018-03-21 12:16:57 +0100 | [diff] [blame] | 152 | if [ -n "${MBEDTLS_ROOT_DIR+set}" ]; then |
| 153 | cd "$MBEDTLS_ROOT_DIR" |
| 154 | fi |
| 155 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 156 | command make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 157 | |
Gilles Peskine | 31b07e2 | 2018-03-21 12:15:06 +0100 | [diff] [blame] | 158 | # Remove CMake artefacts |
Simon Butcher | 3ad2efd | 2018-05-02 14:49:38 +0100 | [diff] [blame] | 159 | find . -name .git -prune \ |
Gilles Peskine | 31b07e2 | 2018-03-21 12:15:06 +0100 | [diff] [blame] | 160 | -iname CMakeFiles -exec rm -rf {} \+ -o \ |
| 161 | \( -iname cmake_install.cmake -o \ |
| 162 | -iname CTestTestfile.cmake -o \ |
| 163 | -iname CMakeCache.txt \) -exec rm {} \+ |
| 164 | # Recover files overwritten by in-tree CMake builds |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 165 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 166 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 167 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 168 | |
| 169 | if [ -f "$CONFIG_BAK" ]; then |
| 170 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 171 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 172 | } |
| 173 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 174 | # Executed on exit. May be redefined depending on command line options. |
| 175 | final_report () { |
| 176 | : |
| 177 | } |
| 178 | |
| 179 | fatal_signal () { |
| 180 | cleanup |
| 181 | final_report $1 |
| 182 | trap - $1 |
| 183 | kill -$1 $$ |
| 184 | } |
| 185 | |
| 186 | trap 'fatal_signal HUP' HUP |
| 187 | trap 'fatal_signal INT' INT |
| 188 | trap 'fatal_signal TERM' TERM |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 189 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 190 | msg() |
| 191 | { |
| 192 | echo "" |
| 193 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 194 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 195 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 196 | echo "******************************************************************" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 197 | current_section=$1 |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 198 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 199 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 200 | if [ $RUN_ARMCC -ne 0 ]; then |
| 201 | armc6_build_test() |
| 202 | { |
| 203 | FLAGS="$1" |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 204 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 205 | msg "build: ARM Compiler 6 ($FLAGS), make" |
| 206 | ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \ |
| 207 | WARNING_CFLAGS='-xc -std=c99' make lib |
| 208 | make clean |
| 209 | } |
| 210 | fi |
Andres AG | a5cd973 | 2016-10-17 15:23:10 +0100 | [diff] [blame] | 211 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 212 | err_msg() |
| 213 | { |
| 214 | echo "$1" >&2 |
| 215 | } |
| 216 | |
| 217 | check_tools() |
| 218 | { |
| 219 | for TOOL in "$@"; do |
Andres AG | 9839360 | 2017-01-31 17:04:45 +0000 | [diff] [blame] | 220 | if ! `type "$TOOL" >/dev/null 2>&1`; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 221 | err_msg "$TOOL not found!" |
| 222 | exit 1 |
| 223 | fi |
| 224 | done |
| 225 | } |
| 226 | |
Andrzej Kurek | 991f9fe | 2018-07-02 09:08:21 -0400 | [diff] [blame] | 227 | check_headers_in_cpp () { |
| 228 | ls include/mbedtls >headers.txt |
| 229 | <programs/test/cpp_dummy_build.cpp sed -n 's/"$//; s!^#include "mbedtls/!!p' | |
| 230 | sort | |
| 231 | diff headers.txt - |
| 232 | rm headers.txt |
| 233 | } |
| 234 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 235 | while [ $# -gt 0 ]; do |
| 236 | case "$1" in |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 237 | --armcc) RUN_ARMCC=1;; |
| 238 | --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";; |
| 239 | --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";; |
| 240 | --force|-f) FORCE=1;; |
| 241 | --gnutls-cli) shift; GNUTLS_CLI="$1";; |
| 242 | --gnutls-legacy-cli) shift; GNUTLS_LEGACY_CLI="$1";; |
| 243 | --gnutls-legacy-serv) shift; GNUTLS_LEGACY_SERV="$1";; |
| 244 | --gnutls-serv) shift; GNUTLS_SERV="$1";; |
| 245 | --help|-h) usage; exit;; |
| 246 | --keep-going|-k) KEEP_GOING=1;; |
| 247 | --memory|-m) MEMORY=1;; |
| 248 | --no-armcc) RUN_ARMCC=0;; |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 249 | --no-force) FORCE=0;; |
| 250 | --no-keep-going) KEEP_GOING=0;; |
| 251 | --no-memory) MEMORY=0;; |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 252 | --openssl) shift; OPENSSL="$1";; |
| 253 | --openssl-legacy) shift; OPENSSL_LEGACY="$1";; |
Manuel Pégourié-Gonnard | a3712be | 2018-05-22 15:58:50 +0200 | [diff] [blame] | 254 | --openssl-next) shift; OPENSSL_NEXT="$1";; |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 255 | --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";; |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 256 | --random-seed) unset SEED;; |
| 257 | --release-test|-r) SEED=1;; |
Gilles Peskine | 8a244c9 | 2018-03-21 08:39:32 +0100 | [diff] [blame] | 258 | --seed|-s) shift; SEED="$1";; |
Gilles Peskine | 709346a | 2017-12-10 23:43:39 +0100 | [diff] [blame] | 259 | *) |
| 260 | echo >&2 "Unknown option: $1" |
| 261 | echo >&2 "Run $0 --help for usage." |
| 262 | exit 120 |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 263 | ;; |
| 264 | esac |
| 265 | shift |
| 266 | done |
| 267 | |
| 268 | if [ $FORCE -eq 1 ]; then |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 269 | git checkout-index -f -q $CONFIG_H |
| 270 | cleanup |
| 271 | else |
| 272 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 273 | if [ -d "$OUT_OF_SOURCE_DIR" ]; then |
| 274 | echo "Warning - there is an existing directory at '$OUT_OF_SOURCE_DIR'" >&2 |
| 275 | echo "You can either delete this directory manually, or force the test by rerunning" |
| 276 | echo "the script as: $0 --force --out-of-source-dir $OUT_OF_SOURCE_DIR" |
| 277 | exit 1 |
| 278 | fi |
| 279 | |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 280 | if ! git diff-files --quiet include/mbedtls/config.h; then |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 281 | err_msg "Warning - the configuration file 'include/mbedtls/config.h' has been edited. " |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 282 | echo "You can either delete or preserve your work, or force the test by rerunning the" |
| 283 | echo "script as: $0 --force" |
| 284 | exit 1 |
| 285 | fi |
| 286 | fi |
| 287 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 288 | build_status=0 |
| 289 | if [ $KEEP_GOING -eq 1 ]; then |
| 290 | failure_summary= |
| 291 | failure_count=0 |
| 292 | start_red= |
| 293 | end_color= |
| 294 | if [ -t 1 ]; then |
Gilles Peskine | 9736b9d | 2018-01-02 21:54:17 +0100 | [diff] [blame] | 295 | case "${TERM:-}" in |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 296 | *color*|cygwin|linux|rxvt*|screen|[Eex]term*) |
| 297 | start_red=$(printf '\033[31m') |
| 298 | end_color=$(printf '\033[0m') |
| 299 | ;; |
| 300 | esac |
| 301 | fi |
| 302 | record_status () { |
| 303 | if "$@"; then |
| 304 | last_status=0 |
| 305 | else |
| 306 | last_status=$? |
| 307 | text="$current_section: $* -> $last_status" |
| 308 | failure_summary="$failure_summary |
| 309 | $text" |
| 310 | failure_count=$((failure_count + 1)) |
| 311 | echo "${start_red}^^^^$text^^^^${end_color}" |
| 312 | fi |
| 313 | } |
| 314 | make () { |
| 315 | case "$*" in |
| 316 | *test|*check) |
| 317 | if [ $build_status -eq 0 ]; then |
| 318 | record_status command make "$@" |
| 319 | else |
| 320 | echo "(skipped because the build failed)" |
| 321 | fi |
| 322 | ;; |
| 323 | *) |
| 324 | record_status command make "$@" |
| 325 | build_status=$last_status |
| 326 | ;; |
| 327 | esac |
| 328 | } |
| 329 | final_report () { |
| 330 | if [ $failure_count -gt 0 ]; then |
| 331 | echo |
| 332 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
| 333 | echo "${start_red}FAILED: $failure_count${end_color}$failure_summary" |
| 334 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" |
Jaeden Amero | 7c1258d | 2018-07-20 16:42:14 +0100 | [diff] [blame] | 335 | exit 1 |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 336 | elif [ -z "${1-}" ]; then |
| 337 | echo "SUCCESS :)" |
| 338 | fi |
| 339 | if [ -n "${1-}" ]; then |
| 340 | echo "Killed by SIG$1." |
| 341 | fi |
| 342 | } |
| 343 | else |
| 344 | record_status () { |
| 345 | "$@" |
| 346 | } |
| 347 | fi |
| 348 | if_build_succeeded () { |
| 349 | if [ $build_status -eq 0 ]; then |
| 350 | record_status "$@" |
| 351 | fi |
| 352 | } |
| 353 | |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 354 | # to be used instead of ! for commands run with |
| 355 | # record_status or if_build_succeeded |
| 356 | not() { |
| 357 | ! "$@" |
| 358 | } |
| 359 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 360 | msg "info: $0 configuration" |
| 361 | echo "MEMORY: $MEMORY" |
| 362 | echo "FORCE: $FORCE" |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 363 | echo "SEED: ${SEED-"UNSET"}" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 364 | echo "OPENSSL: $OPENSSL" |
| 365 | echo "OPENSSL_LEGACY: $OPENSSL_LEGACY" |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 366 | echo "OPENSSL_NEXT: $OPENSSL_NEXT" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 367 | echo "GNUTLS_CLI: $GNUTLS_CLI" |
| 368 | echo "GNUTLS_SERV: $GNUTLS_SERV" |
| 369 | echo "GNUTLS_LEGACY_CLI: $GNUTLS_LEGACY_CLI" |
| 370 | echo "GNUTLS_LEGACY_SERV: $GNUTLS_LEGACY_SERV" |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 371 | echo "ARMC5_BIN_DIR: $ARMC5_BIN_DIR" |
| 372 | echo "ARMC6_BIN_DIR: $ARMC6_BIN_DIR" |
| 373 | |
| 374 | ARMC5_CC="$ARMC5_BIN_DIR/armcc" |
| 375 | ARMC5_AR="$ARMC5_BIN_DIR/armar" |
| 376 | ARMC6_CC="$ARMC6_BIN_DIR/armclang" |
| 377 | ARMC6_AR="$ARMC6_BIN_DIR/armar" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 378 | |
Andres AG | b2fdd04 | 2016-09-22 14:17:46 +0100 | [diff] [blame] | 379 | # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh |
| 380 | # we just export the variables they require |
| 381 | export OPENSSL_CMD="$OPENSSL" |
| 382 | export GNUTLS_CLI="$GNUTLS_CLI" |
| 383 | export GNUTLS_SERV="$GNUTLS_SERV" |
| 384 | |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 385 | # Avoid passing --seed flag in every call to ssl-opt.sh |
Gilles Peskine | 38d8165 | 2018-03-21 08:40:26 +0100 | [diff] [blame] | 386 | if [ -n "${SEED-}" ]; then |
| 387 | export SEED |
| 388 | fi |
Andres AG | 7770ea8 | 2016-10-10 15:46:20 +0100 | [diff] [blame] | 389 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 390 | # Make sure the tools we need are available. |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 391 | check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$OPENSSL_NEXT" \ |
| 392 | "$GNUTLS_CLI" "$GNUTLS_SERV" \ |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 393 | "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \ |
Andres Amaya Garcia | ddebc49 | 2017-10-24 22:16:34 +0100 | [diff] [blame] | 394 | "arm-none-eabi-gcc" "i686-w64-mingw32-gcc" "gdb" |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 395 | if [ $RUN_ARMCC -ne 0 ]; then |
| 396 | check_tools "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR" |
| 397 | fi |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 398 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 399 | |
| 400 | |
| 401 | ################################################################ |
| 402 | #### Basic checks |
| 403 | ################################################################ |
SimonB | 2e23c82 | 2016-04-16 21:54:39 +0100 | [diff] [blame] | 404 | |
| 405 | # |
| 406 | # Test Suites to be executed |
| 407 | # |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 408 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 409 | # 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] | 410 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 411 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 412 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 413 | # |
| 414 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 415 | |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 416 | msg "info: output_env.sh" |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 417 | OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \ |
| 418 | GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \ |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 419 | GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \ |
Gilles Peskine | 2623296 | 2018-03-21 08:35:07 +0100 | [diff] [blame] | 420 | ARMC6_CC="$ARMC6_CC" RUN_ARMCC="$RUN_ARMCC" scripts/output_env.sh |
Janos Follath | b72c678 | 2016-07-19 14:54:17 +0100 | [diff] [blame] | 421 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 422 | msg "test: recursion.pl" # < 1s |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 423 | record_status tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 424 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 425 | msg "test: freshness of generated source files" # < 1s |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 426 | record_status tests/scripts/check-generated-files.sh |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 427 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 428 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 429 | record_status tests/scripts/check-doxy-blocks.pl |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 430 | |
Darryl Green | a07039c | 2018-03-13 16:48:16 +0000 | [diff] [blame] | 431 | msg "test: check-files.py" # < 1s |
| 432 | cleanup |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 433 | record_status tests/scripts/check-files.py |
Darryl Green | a07039c | 2018-03-13 16:48:16 +0000 | [diff] [blame] | 434 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 435 | msg "test/build: declared and exported names" # < 3s |
| 436 | cleanup |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 437 | record_status tests/scripts/check-names.sh |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 438 | |
Andres AG | d9eba4b | 2016-08-26 14:42:14 +0100 | [diff] [blame] | 439 | msg "test: doxygen warnings" # ~ 3s |
| 440 | cleanup |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 441 | record_status tests/scripts/doxygen.sh |
Manuel Pégourié-Gonnard | 1d552e7 | 2016-01-04 16:49:09 +0100 | [diff] [blame] | 442 | |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 443 | |
| 444 | |
| 445 | ################################################################ |
| 446 | #### Build and test many configurations and targets |
| 447 | ################################################################ |
| 448 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 449 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 450 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 451 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 452 | make |
| 453 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 454 | msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 455 | make test |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 456 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 457 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 458 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 459 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 460 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 461 | record_status tests/scripts/test-ref-configs.pl |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 462 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 463 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 464 | make |
| 465 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 466 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 467 | if_build_succeeded tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 468 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 469 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 470 | cleanup |
Simon Butcher | f413b6f | 2016-03-14 22:32:42 +0000 | [diff] [blame] | 471 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 472 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 473 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 474 | make |
| 475 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 476 | msg "test: SSLv3 - main suites (inc. selftests) (ASan build)" # ~ 50s |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 477 | make test |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 478 | |
| 479 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 480 | if_build_succeeded tests/compat.sh -m 'tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 481 | 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] | 482 | |
| 483 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 484 | if_build_succeeded tests/ssl-opt.sh |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 485 | |
Hanno Becker | 134c2ab | 2017-10-12 15:29:50 +0100 | [diff] [blame] | 486 | msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min |
| 487 | cleanup |
| 488 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 489 | scripts/config.pl unset MBEDTLS_SSL_RENEGOTIATION |
| 490 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 491 | make |
| 492 | |
| 493 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 494 | make test |
| 495 | |
| 496 | msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 497 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 498 | |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 499 | msg "build: Default + RSA_NO_CRT (ASan build)" # ~ 6 min |
| 500 | cleanup |
| 501 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 502 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
| 503 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 504 | make |
| 505 | |
| 506 | msg "test: RSA_NO_CRT - main suites (inc. selftests) (ASan build)" # ~ 50s |
| 507 | make test |
| 508 | |
| 509 | msg "test: RSA_NO_CRT - RSA-related part of ssl-opt.sh (ASan build)" # ~ 5s |
Gilles Peskine | bd90a8c | 2018-09-27 10:12:17 +0200 | [diff] [blame] | 510 | if_build_succeeded tests/ssl-opt.sh -f RSA |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 511 | |
| 512 | msg "test: RSA_NO_CRT - RSA-related part of compat.sh (ASan build)" # ~ 3 min |
Gilles Peskine | bd90a8c | 2018-09-27 10:12:17 +0200 | [diff] [blame] | 513 | if_build_succeeded tests/compat.sh -t RSA |
Hanno Becker | d5ba5ef | 2017-09-28 12:53:51 +0100 | [diff] [blame] | 514 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 515 | msg "build: small SSL_OUT_CONTENT_LEN (ASan build)" |
| 516 | cleanup |
| 517 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 518 | scripts/config.pl set MBEDTLS_SSL_IN_CONTENT_LEN 16384 |
| 519 | scripts/config.pl set MBEDTLS_SSL_OUT_CONTENT_LEN 4096 |
| 520 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 521 | make |
| 522 | |
| 523 | msg "test: small SSL_OUT_CONTENT_LEN - ssl-opt.sh MFL and large packet tests" |
| 524 | if_build_succeeded tests/ssl-opt.sh -f "Max fragment\|Large packet" |
| 525 | |
| 526 | msg "build: small SSL_IN_CONTENT_LEN (ASan build)" |
| 527 | cleanup |
| 528 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 529 | scripts/config.pl set MBEDTLS_SSL_IN_CONTENT_LEN 4096 |
| 530 | scripts/config.pl set MBEDTLS_SSL_OUT_CONTENT_LEN 16384 |
| 531 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 532 | make |
| 533 | |
| 534 | msg "test: small SSL_IN_CONTENT_LEN - ssl-opt.sh MFL tests" |
| 535 | if_build_succeeded tests/ssl-opt.sh -f "Max fragment" |
| 536 | |
Hanno Becker | 2f5aa4c | 2018-08-24 14:43:44 +0100 | [diff] [blame] | 537 | msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0" |
| 538 | cleanup |
| 539 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 540 | scripts/config.pl set MBEDTLS_SSL_DTLS_MAX_BUFFERING 1000 |
| 541 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 542 | make |
| 543 | |
| 544 | msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0 - ssl-opt.sh specific reordering test" |
| 545 | if_build_succeeded tests/ssl-opt.sh -f "DTLS reordering: Buffer out-of-order hs msg before reassembling next, free buffered msg" |
| 546 | |
| 547 | msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1" |
| 548 | cleanup |
| 549 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 550 | scripts/config.pl set MBEDTLS_SSL_DTLS_MAX_BUFFERING 240 |
| 551 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 552 | make |
| 553 | |
| 554 | msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1 - ssl-opt.sh specific reordering test" |
| 555 | if_build_succeeded tests/ssl-opt.sh -f "DTLS reordering: Buffer encrypted Finished message, drop for fragmented NewSessionTicket" |
| 556 | |
Manuel Pégourié-Gonnard | 602544e | 2017-06-20 10:49:24 +0200 | [diff] [blame] | 557 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 61bc57a | 2014-08-14 11:29:06 +0200 | [diff] [blame] | 558 | cleanup |
Janos Follath | 35d48cb | 2016-04-22 14:45:00 +0100 | [diff] [blame] | 559 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 560 | scripts/config.pl full |
| 561 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 562 | 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] | 563 | make |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 564 | |
| 565 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | 602544e | 2017-06-20 10:49:24 +0200 | [diff] [blame] | 566 | make test |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 567 | |
Jaeden Amero | d9c71da | 2018-06-15 20:31:26 +0100 | [diff] [blame] | 568 | msg "test: ssl-opt.sh default, ECJPAKE, SSL async (full config)" # ~ 1s |
| 569 | if_build_succeeded tests/ssl-opt.sh -f 'Default\|ECJPAKE\|SSL async private' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 570 | |
| 571 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 572 | 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] | 573 | |
Manuel Pégourié-Gonnard | 9fece7e | 2018-06-18 11:38:22 +0200 | [diff] [blame] | 574 | msg "test: compat.sh ARIA + ChachaPoly" |
| 575 | if_build_succeeded env OPENSSL_CMD="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA' |
Manuel Pégourié-Gonnard | 6b36892 | 2018-02-20 12:02:07 +0100 | [diff] [blame] | 576 | |
Gilles Peskine | b4ef45b | 2018-03-01 22:23:50 +0100 | [diff] [blame] | 577 | msg "build: make, full config + DEPRECATED_WARNING, gcc -O" # ~ 30s |
| 578 | cleanup |
| 579 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 580 | scripts/config.pl full |
Gilles Peskine | 0afe624 | 2018-02-21 19:28:12 +0100 | [diff] [blame] | 581 | scripts/config.pl set MBEDTLS_DEPRECATED_WARNING |
Gilles Peskine | b4ef45b | 2018-03-01 22:23:50 +0100 | [diff] [blame] | 582 | # Build with -O -Wextra to catch a maximum of issues. |
| 583 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra' lib programs |
| 584 | make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-unused-function' tests |
| 585 | |
| 586 | msg "build: make, full config + DEPRECATED_REMOVED, clang -O" # ~ 30s |
| 587 | # No cleanup, just tweak the configuration and rebuild |
| 588 | make clean |
| 589 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
Gilles Peskine | 0afe624 | 2018-02-21 19:28:12 +0100 | [diff] [blame] | 590 | scripts/config.pl set MBEDTLS_DEPRECATED_REMOVED |
Gilles Peskine | b4ef45b | 2018-03-01 22:23:50 +0100 | [diff] [blame] | 591 | # Build with -O -Wextra to catch a maximum of issues. |
| 592 | make CC=clang CFLAGS='-O -Werror -Wall -Wextra' lib programs |
| 593 | make CC=clang CFLAGS='-O -Werror -Wall -Wextra -Wno-unused-function' tests |
Gilles Peskine | 0afe624 | 2018-02-21 19:28:12 +0100 | [diff] [blame] | 594 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 595 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
| 596 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 597 | record_status tests/scripts/curves.pl |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 598 | |
Manuel Pégourié-Gonnard | 1fe6bb9 | 2017-06-06 11:36:16 +0200 | [diff] [blame] | 599 | msg "test/build: depends-hashes.pl (gcc)" # ~ 2 min |
| 600 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 601 | record_status tests/scripts/depends-hashes.pl |
Manuel Pégourié-Gonnard | 1fe6bb9 | 2017-06-06 11:36:16 +0200 | [diff] [blame] | 602 | |
Manuel Pégourié-Gonnard | 43be6cd | 2017-06-20 09:53:42 +0200 | [diff] [blame] | 603 | msg "test/build: depends-pkalgs.pl (gcc)" # ~ 2 min |
| 604 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 605 | record_status tests/scripts/depends-pkalgs.pl |
Manuel Pégourié-Gonnard | 43be6cd | 2017-06-20 09:53:42 +0200 | [diff] [blame] | 606 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 607 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 608 | cleanup |
Gilles Peskine | 396fac1 | 2018-03-22 22:26:03 +0100 | [diff] [blame] | 609 | record_status tests/scripts/key-exchanges.pl |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 610 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 611 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 612 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 613 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 614 | |
Andrzej Kurek | 991f9fe | 2018-07-02 09:08:21 -0400 | [diff] [blame] | 615 | msg "test: verify header list in cpp_dummy_build.cpp" |
| 616 | record_status check_headers_in_cpp |
| 617 | |
| 618 | msg "build: Unix make, incremental g++" |
| 619 | make TEST_CPP=1 |
| 620 | |
Manuel Pégourié-Gonnard | 840af0a | 2018-12-11 10:34:04 +0100 | [diff] [blame] | 621 | |
| 622 | msg "build+test: MBEDTLS_CHECK_PARAMS without MBEDTLS_PLATFORM_C" |
| 623 | cleanup |
Jaeden Amero | ee427b2 | 2018-12-18 21:04:55 +0000 | [diff] [blame] | 624 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | 840af0a | 2018-12-11 10:34:04 +0100 | [diff] [blame] | 625 | scripts/config.pl full # includes CHECK_PARAMS |
| 626 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
| 627 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 628 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
| 629 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT |
| 630 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 631 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
| 632 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 633 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
| 634 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 635 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
| 636 | make CC=gcc CFLAGS='-Werror -O1' all test |
| 637 | |
| 638 | msg "build+test: MBEDTLS_CHECK_PARAMS with alternative MBEDTLS_PARAM_FAILED()" |
| 639 | cleanup |
Jaeden Amero | ee427b2 | 2018-12-18 21:04:55 +0000 | [diff] [blame] | 640 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | 840af0a | 2018-12-11 10:34:04 +0100 | [diff] [blame] | 641 | scripts/config.pl full # includes CHECK_PARAMS |
| 642 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
| 643 | sed -i 's/.*\(#define MBEDTLS_PARAM_FAILED( cond )\).*/\1/' "$CONFIG_H" |
| 644 | make CC=gcc CFLAGS='-Werror -O1' all test |
| 645 | |
| 646 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 647 | # Full configuration build, without platform support, file IO and net sockets. |
| 648 | # This should catch missing mbedtls_printf definitions, and by disabling file |
| 649 | # IO, it should catch missing '#include <stdio.h>' |
| 650 | 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] | 651 | cleanup |
| 652 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 653 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 654 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 655 | scripts/config.pl unset MBEDTLS_NET_C |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 656 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 657 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 658 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 659 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
Simon Butcher | b928343 | 2016-07-13 11:02:41 +0100 | [diff] [blame] | 660 | scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 661 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Simon Butcher | 284b4c9 | 2016-06-26 13:10:00 +0100 | [diff] [blame] | 662 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 663 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 664 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | cb58700 | 2017-01-06 16:14:44 +0000 | [diff] [blame] | 665 | # Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19, |
| 666 | # to re-enable platform integration features otherwise disabled in C99 builds |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 667 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -O0 -D_DEFAULT_SOURCE' lib programs |
| 668 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' test |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 669 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 670 | # catch compile bugs in _uninit functions |
| 671 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 672 | cleanup |
| 673 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 674 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 675 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 676 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 677 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 678 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 679 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 680 | cleanup |
| 681 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 682 | scripts/config.pl full |
| 683 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 684 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 685 | |
| 686 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 687 | cleanup |
| 688 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 689 | scripts/config.pl full |
| 690 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 691 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O0' |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 692 | |
Simon Butcher | f95c176 | 2016-11-10 17:25:58 +0000 | [diff] [blame] | 693 | # Note, C99 compliance can also be tested with the sockets support disabled, |
| 694 | # 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] | 695 | 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] | 696 | cleanup |
| 697 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 698 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 699 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 700 | 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] | 701 | 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] | 702 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 703 | # Run max fragment length tests with MFL disabled |
Hanno Becker | 5175ac6 | 2017-09-18 15:36:25 +0100 | [diff] [blame] | 704 | msg "build: default config except MFL extension (ASan build)" # ~ 30s |
| 705 | cleanup |
| 706 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 707 | scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 708 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 709 | make |
| 710 | |
| 711 | msg "test: ssl-opt.sh, MFL-related tests" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 712 | 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] | 713 | |
Angus Gratton | c4dd073 | 2018-04-11 16:28:39 +1000 | [diff] [blame] | 714 | msg "build: no MFL extension, small SSL_OUT_CONTENT_LEN (ASan build)" |
| 715 | cleanup |
| 716 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 717 | scripts/config.pl unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH |
| 718 | scripts/config.pl set MBEDTLS_SSL_IN_CONTENT_LEN 16384 |
| 719 | scripts/config.pl set MBEDTLS_SSL_OUT_CONTENT_LEN 4096 |
| 720 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 721 | make |
| 722 | |
| 723 | msg "test: MFL tests (disabled MFL extension case) & large packet tests" |
| 724 | if_build_succeeded tests/ssl-opt.sh -f "Max fragment length\|Large buffer" |
| 725 | |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 726 | msg "build: default config with MBEDTLS_TEST_NULL_ENTROPY (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 727 | cleanup |
| 728 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | ab5df40 | 2016-06-11 02:31:21 +0100 | [diff] [blame] | 729 | scripts/config.pl set MBEDTLS_TEST_NULL_ENTROPY |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 730 | scripts/config.pl set MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES |
| 731 | scripts/config.pl set MBEDTLS_ENTROPY_C |
| 732 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 733 | scripts/config.pl unset MBEDTLS_ENTROPY_HARDWARE_ALT |
| 734 | scripts/config.pl unset MBEDTLS_HAVEGE_C |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 735 | 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] | 736 | make |
| 737 | |
Simon Butcher | 8e3afc7 | 2016-09-15 17:13:08 +0100 | [diff] [blame] | 738 | msg "test: MBEDTLS_TEST_NULL_ENTROPY - main suites (inc. selftests) (ASan build)" |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 739 | make test |
Janos Follath | 06c5400 | 2016-06-09 13:57:40 +0100 | [diff] [blame] | 740 | |
Hanno Becker | e5fecec | 2018-10-11 11:02:52 +0100 | [diff] [blame] | 741 | msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)" |
| 742 | cleanup |
| 743 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 744 | scripts/config.pl set MBEDTLS_PLATFORM_MEMORY |
| 745 | scripts/config.pl set MBEDTLS_PLATFORM_CALLOC_MACRO calloc |
| 746 | scripts/config.pl set MBEDTLS_PLATFORM_FREE_MACRO free |
| 747 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 748 | make |
| 749 | |
| 750 | msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)" |
| 751 | make test |
| 752 | |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 753 | msg "build: default config with AES_FEWER_TABLES enabled" |
| 754 | cleanup |
| 755 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 756 | scripts/config.pl set MBEDTLS_AES_FEWER_TABLES |
Hanno Becker | 98a6786 | 2018-03-27 17:10:09 +0100 | [diff] [blame] | 757 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 758 | |
| 759 | msg "test: AES_FEWER_TABLES" |
| 760 | make test |
| 761 | |
| 762 | msg "build: default config with AES_ROM_TABLES enabled" |
| 763 | cleanup |
| 764 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 765 | scripts/config.pl set MBEDTLS_AES_ROM_TABLES |
Hanno Becker | 98a6786 | 2018-03-27 17:10:09 +0100 | [diff] [blame] | 766 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 767 | |
| 768 | msg "test: AES_ROM_TABLES" |
| 769 | make test |
| 770 | |
| 771 | msg "build: default config with AES_ROM_TABLES and AES_FEWER_TABLES enabled" |
| 772 | cleanup |
| 773 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 774 | scripts/config.pl set MBEDTLS_AES_FEWER_TABLES |
| 775 | scripts/config.pl set MBEDTLS_AES_ROM_TABLES |
Hanno Becker | 98a6786 | 2018-03-27 17:10:09 +0100 | [diff] [blame] | 776 | make CC=gcc CFLAGS='-Werror -Wall -Wextra' |
Hanno Becker | 83ebf78 | 2017-07-07 12:29:15 +0100 | [diff] [blame] | 777 | |
| 778 | msg "test: AES_FEWER_TABLES + AES_ROM_TABLES" |
| 779 | make test |
| 780 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 781 | if uname -a | grep -F Linux >/dev/null; then |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 782 | msg "build/test: make shared" # ~ 40s |
| 783 | cleanup |
| 784 | make SHARED=1 all check |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 785 | fi |
| 786 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 787 | if uname -a | grep -F x86_64 >/dev/null; then |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 788 | # Build once with -O0, to compile out the i386 specific inline assembly |
| 789 | msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 790 | cleanup |
Simon Butcher | 7a6da6e | 2018-06-27 21:52:54 +0100 | [diff] [blame] | 791 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 792 | scripts/config.pl full |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 793 | make CC=gcc CFLAGS='-O0 -Werror -Wall -Wextra -m32 -fsanitize=address' |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 794 | |
Simon Butcher | 8e6a22a | 2018-07-20 21:27:33 +0100 | [diff] [blame] | 795 | msg "test: i386, make, gcc -O0 (ASan build)" |
| 796 | make test |
| 797 | |
| 798 | # Build again with -O1, to compile in the i386 specific inline assembly |
| 799 | msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s |
| 800 | cleanup |
| 801 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 802 | scripts/config.pl full |
| 803 | make CC=gcc CFLAGS='-O1 -Werror -Wall -Wextra -m32 -fsanitize=address' |
| 804 | |
| 805 | msg "test: i386, make, gcc -O1 (ASan build)" |
Andres Amaya Garcia | f4fbdda | 2017-05-08 11:19:19 +0100 | [diff] [blame] | 806 | make test |
| 807 | |
| 808 | msg "build: 64-bit ILP32, make, gcc" # ~ 30s |
| 809 | cleanup |
Simon Butcher | 7a6da6e | 2018-06-27 21:52:54 +0100 | [diff] [blame] | 810 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 811 | scripts/config.pl full |
Andres Amaya Garcia | f4fbdda | 2017-05-08 11:19:19 +0100 | [diff] [blame] | 812 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -mx32' |
| 813 | |
| 814 | msg "test: 64-bit ILP32, make, gcc" |
| 815 | make test |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 816 | fi # x86_64 |
| 817 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 818 | msg "build: gcc, force 32-bit bignum limbs" |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 819 | cleanup |
| 820 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 821 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 822 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 823 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 824 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 825 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 826 | msg "test: gcc, force 32-bit bignum limbs" |
Andres Amaya Garcia | 84e6ce8 | 2017-05-04 11:35:51 +0100 | [diff] [blame] | 827 | make test |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 828 | |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 829 | msg "build: gcc, force 64-bit bignum limbs" |
Andres Amaya Garcia | fe843a3 | 2017-07-20 13:21:34 +0100 | [diff] [blame] | 830 | cleanup |
| 831 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 832 | scripts/config.pl unset MBEDTLS_HAVE_ASM |
| 833 | scripts/config.pl unset MBEDTLS_AESNI_C |
| 834 | scripts/config.pl unset MBEDTLS_PADLOCK_C |
Gilles Peskine | 14c3c06 | 2018-01-29 21:25:12 +0100 | [diff] [blame] | 835 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' |
| 836 | |
| 837 | msg "test: gcc, force 64-bit bignum limbs" |
| 838 | make test |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 839 | |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 840 | |
| 841 | msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 842 | cleanup |
| 843 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 844 | scripts/config.pl full |
| 845 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
| 846 | scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION |
| 847 | make CFLAGS='-Werror -O1' |
| 848 | |
| 849 | msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 850 | make test |
| 851 | |
| 852 | |
| 853 | msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 854 | cleanup |
| 855 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 856 | scripts/config.pl full |
| 857 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
| 858 | scripts/config.pl set MBEDTLS_NO_64BIT_MULTIPLICATION |
| 859 | make CFLAGS='-Werror -O1' |
| 860 | |
| 861 | msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 862 | make test |
| 863 | |
| 864 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 865 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 866 | cleanup |
| 867 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 868 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 869 | scripts/config.pl unset MBEDTLS_NET_C |
| 870 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 871 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | eebf1b9 | 2016-06-27 01:42:39 +0100 | [diff] [blame] | 872 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 873 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 874 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 875 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 876 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 877 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 878 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 879 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 880 | 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] | 881 | |
Gilles Peskine | ed942f8 | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 882 | msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s |
| 883 | cleanup |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 884 | cp "$CONFIG_H" "$CONFIG_BAK" |
Andres Amaya Garcia | 0593197 | 2017-07-20 13:27:35 +0100 | [diff] [blame] | 885 | scripts/config.pl full |
| 886 | scripts/config.pl unset MBEDTLS_NET_C |
| 887 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 888 | scripts/config.pl unset MBEDTLS_FS_IO |
| 889 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 890 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
| 891 | # following things are not in the default config |
| 892 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 893 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 894 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 895 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 896 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Gilles Peskine | ed942f8 | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 897 | scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 898 | 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] | 899 | echo "Checking that software 64-bit division is not required" |
Manuel Pégourié-Gonnard | 2adb375 | 2018-06-07 10:51:44 +0200 | [diff] [blame] | 900 | if_build_succeeded not grep __aeabi_uldiv library/*.o |
| 901 | |
| 902 | msg "build: arm-none-eabi-gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s |
| 903 | cleanup |
| 904 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 905 | scripts/config.pl full |
| 906 | scripts/config.pl unset MBEDTLS_NET_C |
| 907 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 908 | scripts/config.pl unset MBEDTLS_FS_IO |
| 909 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
| 910 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
| 911 | # following things are not in the default config |
| 912 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 913 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 914 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 915 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 916 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
| 917 | scripts/config.pl set MBEDTLS_NO_64BIT_MULTIPLICATION |
| 918 | make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -O1 -march=armv6-m -mthumb' lib |
| 919 | echo "Checking that software 64-bit multiplication is not required" |
| 920 | if_build_succeeded not grep __aeabi_lmul library/*.o |
Gilles Peskine | ed942f8 | 2017-06-08 15:19:20 +0200 | [diff] [blame] | 921 | |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 922 | msg "build: ARM Compiler 5, make" |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 923 | cleanup |
| 924 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 925 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 926 | scripts/config.pl unset MBEDTLS_NET_C |
| 927 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 928 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | 1c71965 | 2016-06-27 19:02:12 +0100 | [diff] [blame] | 929 | scripts/config.pl unset MBEDTLS_ENTROPY_NV_SEED |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 930 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 931 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 932 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 933 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 934 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 935 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 936 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 937 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 938 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 939 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Simon Butcher | 4df5eaf | 2016-08-24 22:58:31 +0300 | [diff] [blame] | 940 | 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] | 941 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 942 | if [ $RUN_ARMCC -ne 0 ]; then |
| 943 | make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib |
| 944 | make clean |
Andres AG | 87bb577 | 2016-09-27 15:05:15 +0100 | [diff] [blame] | 945 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 946 | # ARM Compiler 6 - Target ARMv7-A |
| 947 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 948 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 949 | # ARM Compiler 6 - Target ARMv7-M |
| 950 | armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 951 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 952 | # ARM Compiler 6 - Target ARMv8-A - AArch32 |
| 953 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 954 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 955 | # ARM Compiler 6 - Target ARMv8-M |
| 956 | armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main" |
Simon Butcher | 940737f | 2017-07-23 13:42:36 +0200 | [diff] [blame] | 957 | |
Gilles Peskine | bca6ab9 | 2017-12-19 18:24:31 +0100 | [diff] [blame] | 958 | # ARM Compiler 6 - Target ARMv8-A - AArch64 |
| 959 | armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a" |
| 960 | fi |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 961 | |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 962 | msg "build: allow SHA1 in certificates by default" |
| 963 | cleanup |
| 964 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 965 | scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 966 | make CFLAGS='-Werror -Wall -Wextra' |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 967 | msg "test: allow SHA1 in certificates by default" |
| 968 | make test |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 969 | if_build_succeeded tests/ssl-opt.sh -f SHA-1 |
Gilles Peskine | 2a458da | 2017-05-12 15:26:58 +0200 | [diff] [blame] | 970 | |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 971 | msg "build: Default + MBEDTLS_RSA_NO_CRT (ASan build)" # ~ 6 min |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 972 | cleanup |
| 973 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 974 | scripts/config.pl set MBEDTLS_RSA_NO_CRT |
Hanno Becker | d485c31 | 2018-01-05 13:03:53 +0000 | [diff] [blame] | 975 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 976 | make |
Hanno Becker | e963efa | 2018-01-03 10:03:43 +0000 | [diff] [blame] | 977 | |
| 978 | msg "test: MBEDTLS_RSA_NO_CRT - main suites (inc. selftests) (ASan build)" |
| 979 | make test |
Simon Butcher | 002bc62 | 2016-11-17 09:27:45 +0000 | [diff] [blame] | 980 | |
| 981 | msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s |
| 982 | cleanup |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 983 | 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] | 984 | |
Manuel Pégourié-Gonnard | e33316c | 2015-08-07 13:17:23 +0200 | [diff] [blame] | 985 | # note Make tests only builds the tests, but doesn't run them |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 986 | make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 tests |
| 987 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 988 | |
| 989 | msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 990 | 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 |
| 991 | 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 |
| 992 | make WINDOWS_BUILD=1 clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 993 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 994 | # MemSan currently only available on Linux 64 bits |
| 995 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 996 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 997 | msg "build: MSan (clang)" # ~ 1 min 20s |
| 998 | cleanup |
| 999 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 1000 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
| 1001 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 1002 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 1003 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1004 | msg "test: main suites (MSan)" # ~ 10s |
| 1005 | make test |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 1006 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1007 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 1008 | if_build_succeeded tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 1009 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1010 | # Optional part(s) |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 1011 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1012 | if [ "$MEMORY" -gt 0 ]; then |
| 1013 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 1014 | if_build_succeeded tests/compat.sh |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1015 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 1016 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 1017 | else # no MemSan |
| 1018 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1019 | msg "build: Release (clang)" |
| 1020 | cleanup |
| 1021 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 1022 | make |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 1023 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1024 | msg "test: main suites valgrind (Release)" |
| 1025 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 1026 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1027 | # Optional part(s) |
| 1028 | # Currently broken, programs don't seem to receive signals |
| 1029 | # under valgrind on OS X |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 1030 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1031 | if [ "$MEMORY" -gt 0 ]; then |
| 1032 | msg "test: ssl-opt.sh --memcheck (Release)" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 1033 | if_build_succeeded tests/ssl-opt.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1034 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 1035 | |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1036 | if [ "$MEMORY" -gt 1 ]; then |
| 1037 | msg "test: compat.sh --memcheck (Release)" |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 1038 | if_build_succeeded tests/compat.sh --memcheck |
Gilles Peskine | 7ad603e | 2017-12-10 23:22:20 +0100 | [diff] [blame] | 1039 | fi |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 1040 | |
| 1041 | fi # MemSan |
| 1042 | |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 1043 | msg "build: cmake 'out-of-source' build" |
| 1044 | cleanup |
| 1045 | MBEDTLS_ROOT_DIR="$PWD" |
| 1046 | mkdir "$OUT_OF_SOURCE_DIR" |
| 1047 | cd "$OUT_OF_SOURCE_DIR" |
| 1048 | cmake "$MBEDTLS_ROOT_DIR" |
| 1049 | make |
| 1050 | |
| 1051 | msg "test: cmake 'out-of-source' build" |
| 1052 | make test |
Gilles Peskine | 0114ffc | 2018-03-21 12:17:20 +0100 | [diff] [blame] | 1053 | # Test an SSL option that requires an auxiliary script in test/scripts/. |
| 1054 | # Also ensure that there are no error messages such as |
| 1055 | # "No such file or directory", which would indicate that some required |
| 1056 | # file is missing (ssl-opt.sh tolerates the absence of some files so |
| 1057 | # may exit with status 0 but emit errors). |
| 1058 | if_build_succeeded ./tests/ssl-opt.sh -f 'Fallback SCSV: beginning of list' 2>ssl-opt.err |
| 1059 | if [ -s ssl-opt.err ]; then |
| 1060 | cat ssl-opt.err >&2 |
| 1061 | record_status [ ! -s ssl-opt.err ] |
| 1062 | rm ssl-opt.err |
| 1063 | fi |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 1064 | cd "$MBEDTLS_ROOT_DIR" |
| 1065 | rm -rf "$OUT_OF_SOURCE_DIR" |
Gilles Peskine | a71d64c | 2018-03-21 12:16:57 +0100 | [diff] [blame] | 1066 | unset MBEDTLS_ROOT_DIR |
Andres AG | dc19221 | 2016-08-31 17:33:13 +0100 | [diff] [blame] | 1067 | |
Andres Amaya Garcia | 9b04e19 | 2018-06-12 20:16:03 +0100 | [diff] [blame] | 1068 | # Test that the function mbedtls_platform_zeroize() is not optimized away by |
| 1069 | # different combinations of compilers and optimization flags by using an |
| 1070 | # auxiliary GDB script. Unfortunately, GDB does not return error values to the |
| 1071 | # system in all cases that the script fails, so we must manually search the |
| 1072 | # output to check whether the pass string is present and no failure strings |
| 1073 | # were printed. |
Andres Amaya Garcia | 2967381 | 2017-10-25 10:35:51 +0100 | [diff] [blame] | 1074 | for optimization_flag in -O2 -O3 -Ofast -Os; do |
| 1075 | for compiler in clang gcc; do |
Andres Amaya Garcia | 708c5cb | 2018-04-24 08:33:31 -0500 | [diff] [blame] | 1076 | msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()" |
Andres Amaya Garcia | 2967381 | 2017-10-25 10:35:51 +0100 | [diff] [blame] | 1077 | cleanup |
Andres Amaya Garcia | 9b04e19 | 2018-06-12 20:16:03 +0100 | [diff] [blame] | 1078 | make programs CC="$compiler" DEBUG=1 CFLAGS="$optimization_flag" |
Andres Amaya Garcia | 7994766 | 2018-06-20 09:34:54 +0100 | [diff] [blame] | 1079 | if_build_succeeded gdb -x tests/scripts/test_zeroize.gdb -nw -batch -nx 2>&1 | tee test_zeroize.log |
Andres Amaya Garcia | 7994766 | 2018-06-20 09:34:54 +0100 | [diff] [blame] | 1080 | if_build_succeeded grep "The buffer was correctly zeroized" test_zeroize.log |
| 1081 | if_build_succeeded not grep -i "error" test_zeroize.log |
Andres Amaya Garcia | 9b04e19 | 2018-06-12 20:16:03 +0100 | [diff] [blame] | 1082 | rm -f test_zeroize.log |
Andres Amaya Garcia | 2967381 | 2017-10-25 10:35:51 +0100 | [diff] [blame] | 1083 | done |
| 1084 | done |
Andres Amaya Garcia | d0d7bf6 | 2017-10-25 09:01:31 +0100 | [diff] [blame] | 1085 | |
Mohammad Azim Khan | ee6529e | 2018-07-06 00:50:34 +0100 | [diff] [blame] | 1086 | msg "Lint: Python scripts" |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 1087 | record_status tests/scripts/check-python-files.sh |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 1088 | |
Mohammad Azim Khan | ee6529e | 2018-07-06 00:50:34 +0100 | [diff] [blame] | 1089 | msg "uint test: generate_test_code.py" |
Gilles Peskine | 487cdf5 | 2018-09-26 15:54:40 +0200 | [diff] [blame] | 1090 | record_status ./tests/scripts/test_generate_test_code.py |
Gilles Peskine | 192c72f | 2017-12-21 15:59:21 +0100 | [diff] [blame] | 1091 | |
| 1092 | ################################################################ |
| 1093 | #### Termination |
| 1094 | ################################################################ |
| 1095 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 1096 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 1097 | cleanup |
| 1098 | |
Gilles Peskine | 7c65216 | 2017-12-11 00:01:40 +0100 | [diff] [blame] | 1099 | final_report |