blob: 4fe54701bf45bac05cb434ea3311a090e21931f8 [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.
Minos Galanakisf78447f2024-07-26 20:49:51 +010013helper_psasim_server () {
Minos Galanakis96bf1822024-07-26 20:32:04 +010014 OPERATION=$1
15 if [ "$OPERATION" == "start" ]; then
16 (
17 cd tests
18 msg "start server in tests"
19 psa-client-server/psasim/test/start_server.sh
20 msg "start server in tf-psa-crypto/tests"
21 cd ../tf-psa-crypto/tests
22 ../../tests/psa-client-server/psasim/test/start_server.sh
23 )
24 else
25 (
26 msg "terminate servers and cleanup"
27 tests/psa-client-server/psasim//test/kill_servers.sh
28
29 # Remove temporary files and logs
30 cd tests
31 rm -f psa_notify_*
32 rm -f psa_service_*
33 rm -f psa_server.log
34
35 cd ../tf-psa-crypto/tests
36 rm -f psa_notify_*
37 rm -f psa_service_*
38 rm -f psa_server.log
39 )
40 fi
41}
42
43component_test_psasim () {
44 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"
56 make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_base
57 msg "test basic psasim client"
58 tests/psa-client-server/psasim/test/run_test.sh psa_client_base
59
60 msg "build full psasim client"
61 make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_full
62 msg "test full psasim client"
63 tests/psa-client-server/psasim/test/run_test.sh psa_client_full
64
65 make -C tests/psa-client-server/psasim clean
66}
67
68component_test_suite_with_psasim () {
69 msg "build server library and application"
70 helper_psasim_config server
71 # Modify server's library configuration here (if needed)
72 helper_psasim_build server
73
74 helper_psasim_cleanup_before_client
75
76 msg "build client library"
77 helper_psasim_config client
78 # PAKE functions are still unsupported from PSASIM
79 scripts/config.py -f $CRYPTO_CONFIG_H unset PSA_WANT_ALG_JPAKE
80 scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
81 helper_psasim_build client
82
83 msg "build test suites"
84 make PSASIM=1 CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" tests
85
86 helper_psasim_server kill
87 helper_psasim_server start
88
89 # psasim takes an extremely long execution time on some test suites so we
90 # exclude them from the list.
91 SKIP_TEST_SUITES="constant_time_hmac,lmots,lms"
92 export SKIP_TEST_SUITES
93
94 msg "run test suites"
95 make PSASIM=1 test
96
97 helper_psasim_server kill
98}