blob: ba8ab331d2059b292e5a8745dad85b0f097a03b0 [file] [log] [blame]
Minos Galanakis96bf1822024-07-26 20:32:04 +01001# components-psasim.sh
2#
3# Copyright The Mbed TLS Contributors
4# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
5
Minos Galanakis609f7492024-07-31 16:39:28 +01006# This file contains test components that are executed by all.sh
Minos Galanakis96bf1822024-07-26 20:32:04 +01007
8################################################################
9#### Remote Procedure Call PSA Testing
10################################################################
11
12# Helper function for controlling (start & stop) the psasim server.
Valerio Setti2016d662024-08-05 15:57:43 +020013helper_psasim_server() {
Minos Galanakis96bf1822024-07-26 20:32:04 +010014 OPERATION=$1
15 if [ "$OPERATION" == "start" ]; then
Minos Galanakis96bf1822024-07-26 20:32:04 +010016 msg "start server in tests"
Valerio Setti2016d662024-08-05 15:57:43 +020017 (
18 cd tests
19 ../$PSASIM_PATH/test/start_server.sh
20 )
Minos Galanakis96bf1822024-07-26 20:32:04 +010021 msg "start server in tf-psa-crypto/tests"
Valerio Setti2016d662024-08-05 15:57:43 +020022 (
23 cd tf-psa-crypto/tests
24 ../../$PSASIM_PATH/test/start_server.sh
25 )
Minos Galanakis96bf1822024-07-26 20:32:04 +010026 else
Valerio Setti2016d662024-08-05 15:57:43 +020027 msg "terminate server in tests"
28 (
29 # This will kill both servers and clean up all the message queues,
30 # and clear temporary files in tests
31 cd tests
32 ../$PSASIM_PATH/test/kill_servers.sh
33 )
34 msg "terminate server in tf-psa-crypto/tests"
35 (
36 # This just clears temporary files in tf-psa-crypto/tests
37 cd tf-psa-crypto/tests
38 ../../$PSASIM_PATH/test/kill_servers.sh
39 )
Minos Galanakis96bf1822024-07-26 20:32:04 +010040 fi
41}
42
Valerio Setti2016d662024-08-05 15:57:43 +020043component_test_psasim() {
Minos Galanakis96bf1822024-07-26 20:32:04 +010044 msg "build server library and application"
45 scripts/config.py crypto
46 helper_psasim_config server
47 helper_psasim_build server
48
49 helper_psasim_cleanup_before_client
50
51 msg "build library for client"
52 helper_psasim_config client
53 helper_psasim_build client
54
55 msg "build basic psasim client"
Valerio Setti2016d662024-08-05 15:57:43 +020056 make -C $PSASIM_PATH CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_base
Minos Galanakis96bf1822024-07-26 20:32:04 +010057 msg "test basic psasim client"
Valerio Setti2016d662024-08-05 15:57:43 +020058 $PSASIM_PATH/test/run_test.sh psa_client_base
Minos Galanakis96bf1822024-07-26 20:32:04 +010059
60 msg "build full psasim client"
Valerio Setti2016d662024-08-05 15:57:43 +020061 make -C $PSASIM_PATH CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_full
Minos Galanakis96bf1822024-07-26 20:32:04 +010062 msg "test full psasim client"
Valerio Setti2016d662024-08-05 15:57:43 +020063 $PSASIM_PATH/test/run_test.sh psa_client_full
Minos Galanakis96bf1822024-07-26 20:32:04 +010064
Valerio Setti2016d662024-08-05 15:57:43 +020065 helper_psasim_server kill
66 make -C $PSASIM_PATH clean
Minos Galanakis96bf1822024-07-26 20:32:04 +010067}
68
Valerio Setti2016d662024-08-05 15:57:43 +020069component_test_suite_with_psasim()
70{
Minos Galanakis96bf1822024-07-26 20:32:04 +010071 msg "build server library and application"
72 helper_psasim_config server
73 # Modify server's library configuration here (if needed)
74 helper_psasim_build server
75
76 helper_psasim_cleanup_before_client
77
78 msg "build client library"
79 helper_psasim_config client
80 # PAKE functions are still unsupported from PSASIM
81 scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_JPAKE
82 scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
83 helper_psasim_build client
84
85 msg "build test suites"
86 make PSASIM=1 CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" tests
87
Minos Galanakis96bf1822024-07-26 20:32:04 +010088 helper_psasim_server start
89
90 # psasim takes an extremely long execution time on some test suites so we
91 # exclude them from the list.
92 SKIP_TEST_SUITES="constant_time_hmac,lmots,lms"
93 export SKIP_TEST_SUITES
94
95 msg "run test suites"
96 make PSASIM=1 test
97
98 helper_psasim_server kill
99}