Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 3 | # all.sh |
| 4 | # |
| 5 | # Copyright (c) 2014-2016, ARM Limited, All Rights Reserved |
| 6 | # |
| 7 | # Purpose |
| 8 | # |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 9 | # Run all available tests (mostly). |
| 10 | # |
| 11 | # Warning: includes various build modes, so it will mess with the current |
| 12 | # CMake configuration. After this script is run, the CMake cache is lost and |
| 13 | # CMake is not initialised any more! |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 14 | # |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 15 | # Assumes gcc and clang (recent enough for using ASan with gcc and MemSan with |
| 16 | # clang, or valgrind) are available, as well as cmake and a "good" find. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 17 | |
| 18 | # Abort on errors (and uninitiliased variables) |
| 19 | set -eu |
| 20 | |
| 21 | if [ -d library -a -d include -a -d tests ]; then :; else |
Manuel Pégourié-Gonnard | e4f6edc | 2015-01-22 16:43:54 +0000 | [diff] [blame] | 22 | echo "Must be run from mbed TLS root" >&2 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 23 | exit 1 |
| 24 | fi |
| 25 | |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 26 | CONFIG_H='include/mbedtls/config.h' |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 27 | CONFIG_BAK="$CONFIG_H.bak" |
| 28 | |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 29 | MEMORY=0 |
Manuel Pégourié-Gonnard | 259b08a | 2016-01-08 16:27:41 +0100 | [diff] [blame] | 30 | SHORT=0 |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 31 | |
| 32 | while [ $# -gt 0 ]; do |
| 33 | case "$1" in |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 34 | -m*) |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 35 | MEMORY=${1#-m} |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 36 | ;; |
Manuel Pégourié-Gonnard | 259b08a | 2016-01-08 16:27:41 +0100 | [diff] [blame] | 37 | -s) |
| 38 | SHORT=1 |
| 39 | ;; |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 40 | *) |
| 41 | echo "Unknown argument: '$1'" >&2 |
| 42 | echo "Use the source, Luke!" >&2 |
| 43 | exit 1 |
| 44 | ;; |
| 45 | esac |
| 46 | shift |
| 47 | done |
| 48 | |
| 49 | # remove built files as well as the cmake cache/config |
| 50 | cleanup() |
| 51 | { |
| 52 | make clean |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 53 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 54 | find . -name yotta -prune -o -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+ |
Manuel Pégourié-Gonnard | 7f80997 | 2015-03-09 17:05:11 +0000 | [diff] [blame] | 55 | rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile |
Paul Bakker | fe0984d | 2014-06-13 00:13:45 +0200 | [diff] [blame] | 56 | git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile |
| 57 | git checkout -- Makefile library/Makefile programs/Makefile tests/Makefile |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 58 | |
| 59 | if [ -f "$CONFIG_BAK" ]; then |
| 60 | mv "$CONFIG_BAK" "$CONFIG_H" |
| 61 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 62 | } |
| 63 | |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 64 | trap cleanup INT TERM HUP |
| 65 | |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 66 | msg() |
| 67 | { |
| 68 | echo "" |
| 69 | echo "******************************************************************" |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 70 | echo "* $1 " |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 71 | printf "* "; date |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 72 | echo "******************************************************************" |
| 73 | } |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 74 | |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 75 | # The test ordering tries to optimize for the following criteria: |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 76 | # 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] | 77 | # and/or are more likely to fail than others (eg I use Clang most of the |
| 78 | # time, so start with a GCC build). |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 79 | # 2. Minimize total running time, by avoiding useless rebuilds |
| 80 | # |
| 81 | # Indicative running times are given for reference. |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 82 | |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 83 | msg "test: recursion.pl" # < 1s |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 84 | tests/scripts/recursion.pl library/*.c |
Manuel Pégourié-Gonnard | ea29d15 | 2014-11-20 17:32:33 +0100 | [diff] [blame] | 85 | |
Manuel Pégourié-Gonnard | b3b8e43 | 2015-02-13 14:52:19 +0000 | [diff] [blame] | 86 | msg "test: freshness of generated source files" # < 1s |
| 87 | tests/scripts/check-generated-files.sh |
| 88 | |
Manuel Pégourié-Gonnard | d09a6b5 | 2015-04-09 17:19:23 +0200 | [diff] [blame] | 89 | msg "test: doxygen markup outside doxygen blocks" # < 1s |
| 90 | tests/scripts/check-doxy-blocks.pl |
| 91 | |
Manuel Pégourié-Gonnard | a687baf | 2015-04-09 11:09:03 +0200 | [diff] [blame] | 92 | msg "test/build: declared and exported names" # < 3s |
| 93 | cleanup |
| 94 | tests/scripts/check-names.sh |
| 95 | |
Manuel Pégourié-Gonnard | 1d552e7 | 2016-01-04 16:49:09 +0100 | [diff] [blame] | 96 | if which doxygen >/dev/null; then |
| 97 | msg "test: doxygen warnings" # ~ 3s |
| 98 | cleanup |
| 99 | tests/scripts/doxygen.sh |
| 100 | fi |
| 101 | |
Manuel Pégourié-Gonnard | 77d56bb | 2015-07-28 15:00:37 +0200 | [diff] [blame] | 102 | msg "build: create and build yotta module" # ~ 30s |
| 103 | cleanup |
| 104 | tests/scripts/yotta-build.sh |
| 105 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 106 | msg "build: cmake, gcc, ASan" # ~ 1 min 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 107 | cleanup |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 108 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 109 | make |
| 110 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 111 | msg "test: main suites and selftest (ASan build)" # ~ 50s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 112 | make test |
| 113 | programs/test/selftest |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 114 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 115 | msg "test: ssl-opt.sh (ASan build)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 116 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 117 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 118 | msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 119 | tests/scripts/test-ref-configs.pl |
| 120 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 121 | # Most frequent issues are likely to be caught at this point |
Manuel Pégourié-Gonnard | 259b08a | 2016-01-08 16:27:41 +0100 | [diff] [blame] | 122 | if [ $SHORT -eq 1 ]; then |
| 123 | msg "Done, cleaning up" |
| 124 | cleanup |
| 125 | exit 0 |
| 126 | fi |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 127 | |
| 128 | msg "build: with ASan (rebuild after ref-configs)" # ~ 1 min |
| 129 | make |
| 130 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 131 | msg "test: compat.sh (ASan build)" # ~ 6 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 132 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 133 | |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 134 | msg "build: Default + SSLv3 (ASan build)" # ~ 6 min |
| 135 | cleanup |
Simon Butcher | f413b6f | 2016-03-14 22:32:42 +0000 | [diff] [blame^] | 136 | cp "$CONFIG_H" "$CONFIG_BAK" |
Simon Butcher | 3ea7f52 | 2016-03-07 23:22:10 +0000 | [diff] [blame] | 137 | scripts/config.pl set MBEDTLS_SSL_PROTO_SSL3 |
| 138 | CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 139 | make |
| 140 | |
| 141 | msg "test: SSLv3 - main suites and selftest (ASan build)" # ~ 50s |
| 142 | make test |
| 143 | programs/test/selftest |
| 144 | |
| 145 | msg "build: SSLv3 - compat.sh (ASan build)" # ~ 6 min |
| 146 | tests/compat.sh -m 'ssl3 tls1 tls1_1 tls1_2 dtls1 dtls1_2' |
| 147 | |
| 148 | msg "build: SSLv3 - ssl-opt.sh (ASan build)" # ~ 6 min |
| 149 | tests/ssl-opt.sh |
| 150 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 151 | msg "build: cmake, full config, clang" # ~ 50s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 152 | cleanup |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 153 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 154 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 155 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Check . |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 156 | make |
| 157 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 158 | msg "test: main suites (full config)" # ~ 5s |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 159 | make test |
| 160 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 161 | msg "test: ssl-opt.sh default (full config)" # ~ 1s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 162 | tests/ssl-opt.sh -f Default |
Manuel Pégourié-Gonnard | e73b263 | 2014-07-12 04:00:00 +0200 | [diff] [blame] | 163 | |
Manuel Pégourié-Gonnard | ea0920f | 2015-03-24 09:50:15 +0100 | [diff] [blame] | 164 | msg "test: compat.sh RC4, DES & NULL (full config)" # ~ 2 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 165 | 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] | 166 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 167 | msg "test/build: curves.pl (gcc)" # ~ 4 min |
Manuel Pégourié-Gonnard | 246978d | 2014-11-20 13:29:53 +0100 | [diff] [blame] | 168 | cleanup |
| 169 | cmake -D CMAKE_BUILD_TYPE:String=Debug . |
| 170 | tests/scripts/curves.pl |
| 171 | |
Manuel Pégourié-Gonnard | 503a5ef | 2015-10-23 09:04:45 +0200 | [diff] [blame] | 172 | msg "test/build: key-exchanges (gcc)" # ~ 1 min |
| 173 | cleanup |
| 174 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
| 175 | tests/scripts/key-exchanges.pl |
| 176 | |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 177 | msg "build: Unix make, -Os (gcc)" # ~ 30s |
Manuel Pégourié-Gonnard | 3895f5a | 2014-03-27 14:44:04 +0100 | [diff] [blame] | 178 | cleanup |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 179 | CC=gcc CFLAGS='-Werror -Os' make |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 180 | |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 181 | # this is meant to cath missing #define mbedtls_printf etc |
Manuel Pégourié-Gonnard | 981732b | 2015-02-17 15:46:45 +0000 | [diff] [blame] | 182 | # disable fsio to catch some more missing #include <stdio.h> |
Manuel Pégourié-Gonnard | 757ca00 | 2015-03-23 15:24:07 +0100 | [diff] [blame] | 183 | msg "build: full config except platform/fsio, make, gcc" # ~ 30s |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 184 | cleanup |
| 185 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 186 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 187 | scripts/config.pl unset MBEDTLS_PLATFORM_C |
| 188 | scripts/config.pl unset MBEDTLS_PLATFORM_MEMORY |
Manuel Pégourié-Gonnard | 3d4755b | 2015-06-03 14:03:17 +0100 | [diff] [blame] | 189 | scripts/config.pl unset MBEDTLS_PLATFORM_PRINTF_ALT |
| 190 | scripts/config.pl unset MBEDTLS_PLATFORM_FPRINTF_ALT |
| 191 | scripts/config.pl unset MBEDTLS_PLATFORM_SNPRINTF_ALT |
| 192 | scripts/config.pl unset MBEDTLS_PLATFORM_EXIT_ALT |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 193 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C |
| 194 | scripts/config.pl unset MBEDTLS_FS_IO |
Manuel Pégourié-Gonnard | 61fe8b0 | 2015-03-13 14:33:16 +0000 | [diff] [blame] | 195 | CC=gcc CFLAGS='-Werror -O0' make |
Manuel Pégourié-Gonnard | a71780e | 2015-02-13 13:56:55 +0000 | [diff] [blame] | 196 | |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 197 | # catch compile bugs in _uninit functions |
| 198 | msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s |
| 199 | cleanup |
| 200 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 201 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 7ee5ddd | 2015-06-03 10:33:55 +0100 | [diff] [blame] | 202 | scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS |
Manuel Pégourié-Gonnard | dccb80b | 2015-06-03 10:20:33 +0100 | [diff] [blame] | 203 | CC=gcc CFLAGS='-Werror -O0' make |
| 204 | |
Manuel Pégourié-Gonnard | 66b8e95 | 2015-05-20 11:13:56 +0200 | [diff] [blame] | 205 | msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s |
| 206 | cleanup |
| 207 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 208 | scripts/config.pl full |
| 209 | scripts/config.pl unset MBEDTLS_SSL_SRV_C |
| 210 | CC=gcc CFLAGS='-Werror -O0' make |
| 211 | |
| 212 | msg "build: full config except ssl_cli.c, make, gcc" # ~ 30s |
| 213 | cleanup |
| 214 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 215 | scripts/config.pl full |
| 216 | scripts/config.pl unset MBEDTLS_SSL_CLI_C |
| 217 | CC=gcc CFLAGS='-Werror -O0' make |
| 218 | |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 219 | msg "build: full config except net.c, make, gcc -std=c99 -pedantic" # ~ 30s |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 220 | cleanup |
| 221 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 222 | scripts/config.pl full |
Manuel Pégourié-Gonnard | f78e4de | 2015-05-29 10:52:14 +0200 | [diff] [blame] | 223 | scripts/config.pl unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
| 224 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
Manuel Pégourié-Gonnard | 7185936 | 2015-06-02 16:39:22 +0100 | [diff] [blame] | 225 | CC=gcc CFLAGS='-Werror -O0 -std=c99 -pedantic' make lib |
Manuel Pégourié-Gonnard | 009a264 | 2015-05-29 10:31:13 +0200 | [diff] [blame] | 226 | |
Manuel Pégourié-Gonnard | 9b06abe | 2015-06-25 09:56:07 +0200 | [diff] [blame] | 227 | if uname -a | grep -F Linux >/dev/null; then |
| 228 | msg "build/test: make shared" # ~ 40s |
| 229 | cleanup |
| 230 | make SHARED=1 all check |
| 231 | fi |
| 232 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 233 | if uname -a | grep -F x86_64 >/dev/null; then |
| 234 | msg "build: i386, make, gcc" # ~ 30s |
| 235 | cleanup |
| 236 | CC=gcc CFLAGS='-Werror -m32' make |
| 237 | fi # x86_64 |
| 238 | |
| 239 | if which arm-none-eabi-gcc >/dev/null; then |
| 240 | msg "build: arm-none-eabi-gcc, make" # ~ 10s |
| 241 | cleanup |
| 242 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 243 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 244 | scripts/config.pl unset MBEDTLS_NET_C |
| 245 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 246 | scripts/config.pl unset MBEDTLS_FS_IO |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 247 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 248 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 249 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 250 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 251 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 252 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 253 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Manuel Pégourié-Gonnard | e058ea2 | 2015-06-25 09:04:13 +0200 | [diff] [blame] | 254 | CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS=-Werror make lib |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 255 | fi # arm-gcc |
| 256 | |
Manuel Pégourié-Gonnard | 6dc2651 | 2015-06-25 10:48:24 +0200 | [diff] [blame] | 257 | if which armcc >/dev/null && armcc --help >/dev/null 2>&1; then |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 258 | msg "build: armcc, make" |
| 259 | cleanup |
| 260 | cp "$CONFIG_H" "$CONFIG_BAK" |
| 261 | scripts/config.pl full |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 262 | scripts/config.pl unset MBEDTLS_NET_C |
| 263 | scripts/config.pl unset MBEDTLS_TIMING_C |
| 264 | scripts/config.pl unset MBEDTLS_FS_IO |
| 265 | scripts/config.pl unset MBEDTLS_HAVE_TIME |
Manuel Pégourié-Gonnard | bbc60db | 2015-06-22 14:31:50 +0200 | [diff] [blame] | 266 | scripts/config.pl unset MBEDTLS_HAVE_TIME_DATE |
Simon Butcher | bc6a486 | 2016-03-07 17:35:59 +0000 | [diff] [blame] | 267 | scripts/config.pl set MBEDTLS_NO_PLATFORM_ENTROPY |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 268 | # following things are not in the default config |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 269 | scripts/config.pl unset MBEDTLS_DEPRECATED_WARNING |
| 270 | scripts/config.pl unset MBEDTLS_HAVEGE_C # depends on timing.c |
| 271 | scripts/config.pl unset MBEDTLS_THREADING_PTHREAD |
| 272 | scripts/config.pl unset MBEDTLS_THREADING_C |
| 273 | scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h |
| 274 | scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit |
Manuel Pégourié-Gonnard | 3551901 | 2016-01-07 13:06:51 +0100 | [diff] [blame] | 275 | CC=armcc AR=armar WARNING_CFLAGS= make lib 2> armcc.stderr |
Manuel Pégourié-Gonnard | 129e413 | 2015-03-13 17:29:18 +0100 | [diff] [blame] | 276 | if [ -s armcc.stderr ]; then |
| 277 | cat armcc.stderr |
| 278 | exit 1; |
| 279 | fi |
Manuel Pégourié-Gonnard | c5c5939 | 2015-02-10 17:38:54 +0100 | [diff] [blame] | 280 | rm armcc.stderr |
| 281 | fi # armcc |
| 282 | |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 283 | if which i686-w64-mingw32-gcc >/dev/null; then |
| 284 | msg "build: cross-mingw64, make" # ~ 30s |
| 285 | cleanup |
Manuel Pégourié-Gonnard | e058ea2 | 2015-06-25 09:04:13 +0200 | [diff] [blame] | 286 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 make |
Manuel Pégourié-Gonnard | 52fa38a | 2015-06-23 14:29:58 +0200 | [diff] [blame] | 287 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | e33316c | 2015-08-07 13:17:23 +0200 | [diff] [blame] | 288 | CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS=-Werror WINDOWS_BUILD=1 SHARED=1 make |
| 289 | WINDOWS_BUILD=1 make clean |
Manuel Pégourié-Gonnard | 6448bce | 2015-02-16 17:18:36 +0100 | [diff] [blame] | 290 | fi |
| 291 | |
Manuel Pégourié-Gonnard | edb2dc9 | 2015-02-10 14:36:31 +0000 | [diff] [blame] | 292 | # MemSan currently only available on Linux 64 bits |
| 293 | if uname -a | grep 'Linux.*x86_64' >/dev/null; then |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 294 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 295 | msg "build: MSan (clang)" # ~ 1 min 20s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 296 | cleanup |
| 297 | cp "$CONFIG_H" "$CONFIG_BAK" |
Manuel Pégourié-Gonnard | 2cf5a7c | 2015-04-08 12:49:31 +0200 | [diff] [blame] | 298 | scripts/config.pl unset MBEDTLS_AESNI_C # memsan doesn't grok asm |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 299 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan . |
| 300 | make |
Manuel Pégourié-Gonnard | 4a9dc2a | 2014-05-09 13:46:59 +0200 | [diff] [blame] | 301 | |
Manuel Pégourié-Gonnard | 89d69b3 | 2014-11-20 13:48:53 +0100 | [diff] [blame] | 302 | msg "test: main suites (MSan)" # ~ 10s |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 303 | make test |
| 304 | |
| 305 | msg "test: ssl-opt.sh (MSan)" # ~ 1 min |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 306 | tests/ssl-opt.sh |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 307 | |
| 308 | # Optional part(s) |
| 309 | |
| 310 | if [ "$MEMORY" -gt 0 ]; then |
| 311 | msg "test: compat.sh (MSan)" # ~ 6 min 20s |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 312 | tests/compat.sh |
Manuel Pégourié-Gonnard | 57255b1 | 2014-06-09 11:21:49 +0200 | [diff] [blame] | 313 | fi |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 314 | |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 315 | else # no MemSan |
| 316 | |
| 317 | msg "build: Release (clang)" |
| 318 | cleanup |
| 319 | CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release . |
| 320 | make |
| 321 | |
| 322 | msg "test: main suites valgrind (Release)" |
Manuel Pégourié-Gonnard | 9afdc83 | 2015-08-04 17:15:13 +0200 | [diff] [blame] | 323 | make memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 324 | |
| 325 | # Optional part(s) |
| 326 | # Currently broken, programs don't seem to receive signals |
| 327 | # under valgrind on OS X |
| 328 | |
| 329 | if [ "$MEMORY" -gt 0 ]; then |
| 330 | msg "test: ssl-opt.sh --memcheck (Release)" |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 331 | tests/ssl-opt.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 332 | fi |
| 333 | |
| 334 | if [ "$MEMORY" -gt 1 ]; then |
| 335 | msg "test: compat.sh --memcheck (Release)" |
Manuel Pégourié-Gonnard | 3d404b4 | 2015-07-08 21:59:16 +0100 | [diff] [blame] | 336 | tests/compat.sh --memcheck |
Manuel Pégourié-Gonnard | 392d3dd | 2015-01-26 14:03:56 +0000 | [diff] [blame] | 337 | fi |
| 338 | |
| 339 | fi # MemSan |
| 340 | |
Manuel Pégourié-Gonnard | 9bda9b3 | 2014-11-20 13:10:22 +0100 | [diff] [blame] | 341 | msg "Done, cleaning up" |
Manuel Pégourié-Gonnard | 80955ee | 2014-03-19 18:29:01 +0100 | [diff] [blame] | 342 | cleanup |
| 343 | |