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