Lines Matching +full:unit +full:- +full:tests
3 # basic-build-test.sh
6 # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
13 # The tests include:
14 # * Unit tests - executed using tests/scripts/run-test-suite.pl
15 # * Self-tests - executed using the test suites above
16 # * System tests - executed using tests/ssl-opt.sh
17 # * Interoperability tests - executed using tests/compat.sh
19 # The tests focus on functionality and do not consider performance.
21 # Note the tests self-adapt due to configurations in include/mbedtls/mbedtls_config.h
22 # which can lead to some tests being skipped, and can cause the number of
23 # available tests to fluctuate.
27 # Usage: basic-build-test.sh
31 set -eu
33 if [ -d library -a -d include -a -d tests ]; then :; else
40 : ${GNUTLS_CLI:="gnutls-cli"}
41 : ${GNUTLS_SERV:="gnutls-serv"}
45 # Used to make ssl-opt.sh deterministic.
48 # in sync. If you change the value here because it breaks some tests, you'll
53 # if MAKEFLAGS is not set add the -j option to speed up invocations of make
54 if [ -z "${MAKEFLAGS+set}" ]; then
55 export MAKEFLAGS="-j"
58 # To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh
67 # Step 0 - print build environment info
77 # Step 1 - Make and instrumented build for code coverage
78 export CFLAGS=' --coverage -g3 -O0 '
79 export LDFLAGS=' --coverage'
86 # Step 2 - Execute the tests
88 cd tests
89 if [ ! -f "seedfile" ]; then
94 # Step 2a - Unit Tests (keep going even if some tests fail)
95 echo '################ Unit tests ################'
96 perl scripts/run-test-suites.pl -v 2 |tee unit-test-$TEST_OUTPUT
97 echo '^^^^^^^^^^^^^^^^ Unit tests ^^^^^^^^^^^^^^^^'
100 # Step 2b - System Tests (keep going even if some tests fail)
102 echo '################ ssl-opt.sh ################'
103 echo "ssl-opt.sh will use SEED=$SEED for udp_proxy"
104 sh ssl-opt.sh |tee sys-test-$TEST_OUTPUT
105 echo '^^^^^^^^^^^^^^^^ ssl-opt.sh ^^^^^^^^^^^^^^^^'
108 # Step 2c - Compatibility tests (keep going even if some tests fail)
118 sh compat.sh -e '^$' -f 'NULL'
122 OPENSSL="$OPENSSL_NEXT" sh compat.sh -e '^$' -f 'ARIA\|CHACHA'
124 } | tee compat-test-$TEST_OUTPUT
128 # Step 3 - Process the coverage report
133 } | tee tests/cov-$TEST_OUTPUT
135 if [ "$(tail -n1 tests/cov-$TEST_OUTPUT)" != "SUCCESS" ]; then
141 # Step 4 - Summarise the test report
147 # A failure of the left-hand side of a pipe is ignored (this is a limitation
150 rm -f "tests/basic-build-test-$$.ok"
154 cd tests
156 # Step 4a - Unit tests
157 echo "Unit tests - tests/scripts/run-test-suites.pl"
159 …PASSED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/test cases passed :[\t]*\([0-9]*\)/\1/…
160 …SKIPPED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/skipped :[ \t]*\([0-9]*\)/\1/p'| tr -…
161 …TOTAL_SUITES=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) .*, [0-9]* tests run)/\…
162 …FAILED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/failed :[\t]*\([0-9]*\)/\1/p' |tr -d '…
168 echo "Total exec'd tests : $(($PASSED_TESTS + $FAILED_TESTS))"
169 echo "Total avail tests : $(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS))"
178 # Step 4b - TLS Options tests
179 echo "TLS Options tests - tests/ssl-opt.sh"
181 …PASSED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* …
182 …SKIPPED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\)…
183 …TOTAL_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* s…
184 FAILED_TESTS=$(($TOTAL_TESTS - $PASSED_TESTS))
189 echo "Total exec'd tests : $TOTAL_TESTS"
190 echo "Total avail tests : $(($TOTAL_TESTS + $SKIPPED_TESTS))"
200 # Step 4c - System Compatibility tests
201 echo "System/Compatibility tests - tests/compat.sh"
203 …PASSED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* …
204 …SKIPPED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\)…
205 …EXED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* sk…
206 FAILED_TESTS=$(($EXED_TESTS - $PASSED_TESTS))
211 echo "Total exec'd tests : $EXED_TESTS"
212 echo "Total avail tests : $(($EXED_TESTS + $SKIPPED_TESTS))"
222 # Step 4d - Grand totals
223 echo "-------------------------------------------------------------------------"
224 echo "Total tests"
229 echo "Total exec'd tests : $TOTAL_EXED"
230 echo "Total avail tests : $TOTAL_AVAIL"
234 # Step 4e - Coverage report
236 sed -n '1,/^Overall coverage/d; /%/p' cov-$TEST_OUTPUT
239 rm unit-test-$TEST_OUTPUT
240 rm sys-test-$TEST_OUTPUT
241 rm compat-test-$TEST_OUTPUT
242 rm cov-$TEST_OUTPUT
246 touch "basic-build-test-$$.ok"
247 } | tee coverage-summary.txt
251 if [ -f "$CONFIG_BAK" ]; then
258 rm "tests/basic-build-test-$$.ok"