1.. _tfm_psa_test:
2
3TF-M Platform Security Architecture Test Sample
4###############################################
5
6Overview
7********
8
9Run PSA test suites tests with Zephyr and TFM.
10
11The PSA tests are implemented in the psa-arch-tests repo: https://github.com/ARM-software/psa-arch-tests
12
13This sample is supported for platforms that have a port in psa-arch-tests.
14See sample.yaml for a list of supported platforms.
15
16Building and Running
17********************
18
19You must choose a suite via the CONFIG_TFM_PSA_TEST_* configs.
20
21Only one of these suites can be run at a time, with the test suite set via one
22of the following kconfig options:
23
24* ``CONFIG_TFM_PSA_TEST_CRYPTO``
25* ``CONFIG_TFM_PSA_TEST_PROTECTED_STORAGE``
26* ``CONFIG_TFM_PSA_TEST_INTERNAL_TRUSTED_STORAGE``
27* ``CONFIG_TFM_PSA_TEST_STORAGE``
28* ``CONFIG_TFM_PSA_TEST_INITIAL_ATTESTATION``
29
30You can indicate the desired test suite at build time via a config flag:
31
32   .. code-block:: bash
33
34     $ west build samples/tfm_integration/tfm_psa_test/ \
35       -p -b mps2_an521_ns -t run -- \
36       -DCONFIG_TFM_PSA_TEST_STORAGE=y
37
38Note that not all test suites are valid on all boards.
39
40On Target
41=========
42
43Refer to :ref:`tfm_ipc` for detailed instructions.
44
45On QEMU:
46========
47
48Refer to :ref:`tfm_ipc` for detailed instructions.
49Following is an example based on ``west build``
50
51   .. code-block:: bash
52
53      $ west build samples/tfm_integration/tfm_psa_test/ -p -b mps2_an521_ns -t run -- -DCONFIG_TFM_PSA_TEST_STORAGE=y
54
55Sample Output
56=============
57
58   .. code-block:: console
59
60      *** Booting Zephyr OS build zephyr-v2.5.0-456-g06f4da459a99  ***
61
62      ***** PSA Architecture Test Suite - Version 1.0 *****
63
64      Running.. Storage Suite
65      ******************************************
66
67      TEST: 401 | DESCRIPTION: UID not found check
68      [Info] Executing tests from non-secure
69
70      [Info] Executing ITS tests
71      [Check 1] Call get API for UID 6 which is not set
72      [Check 2] Call get_info API for UID 6 which is not set
73      [Check 3] Call remove API for UID 6 which is not set
74      [Check 4] Call get API for UID 6 which is removed
75      [Check 5] Call get_info API for UID 6 which is removed
76      [Check 6] Call remove API for UID 6 which is removed
77      Set storage for UID 6
78      [Check 7] Call get API for different UID 5
79      [Check 8] Call get_info API for different UID 5
80      [Check 9] Call remove API for different UID 5
81
82      [Info] Executing PS tests
83      [Check 1] Call get API for UID 6 which is not set
84      [Check 2] Call get_info API for UID 6 which is not set
85      [Check 3] Call remove API for UID 6 which is not set
86      [Check 4] Call get API for UID 6 which is removed
87      [Check 5] Call get_info API for UID 6 which is removed
88      [Check 6] Call remove API for UID 6 which is removed
89      Set storage for UID 6
90      [Check 7] Call get API for different UID 5
91      [Check 8] Call get_info API for different UID 5
92      [Check 9] Call remove API for different UID 5
93
94      TEST RESULT: PASSED
95
96      ******************************************
97
98      [...]
99
100      TEST: 417 | DESCRIPTION: Storage assest capacity modification check
101      [Info] Executing tests from non-secure
102
103      [Info] Executing PS tests
104      Test Case skipped as Optional PS APIs not are supported.
105
106      TEST RESULT: SKIPPED (Skip Code=0x0000002B)
107
108      ******************************************
109
110      ************ Storage Suite Report **********
111      TOTAL TESTS     : 17
112      TOTAL PASSED    : 11
113      TOTAL SIM ERROR : 0
114      TOTAL FAILED    : 0
115      TOTAL SKIPPED   : 6
116      ******************************************
117
118      Entering standby..
119