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