1######################################
2Adding partitions for regression tests
3######################################
4
5************
6Introduction
7************
8
9Some test group may need specific test services. These test services may support
10one or more groups thus developers shall determine the proper test scope.
11Currently, TF-M test services are located under ``tf-m-tests/test/secure_fw``.
12
13+---------------------------------------+---------------------------------------------------------------+
14| Folder name                           | Description                                                   |
15+=======================================+===============================================================+
16| test/secure_fw/suites/<suite>/service | Test service divided into corresponding suite subdirectories. |
17+---------------------------------------+---------------------------------------------------------------+
18| test/secure_fw/common_test_services   | Common test services.                                         |
19+---------------------------------------+---------------------------------------------------------------+
20
21**************
22Implementation
23**************
24
25Adding a test partition to provide test services is same as adding a secure
26partition, generally the process can be referenced from the document
27`Adding Secure Partition <https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_secure_partition_addition.html>`_.
28
29Test Partition Specific Manifest Attributes
30===========================================
31
32Each test service must have resource requirements declared in a manifest file,
33the contents of test services are the same as secure partitions, but their
34locations are different. Test service manifests shall be set in
35``tf-m-tests/test/secure_fw/tfm_test_manifest_list.yaml``.
36
37There are some test purpose attributes in Secure Partition manifests that are
38**NOT** compatible with FF-M.
39They should be used in Test Partitions only.
40
41weak_dependencies
42-----------------
43A TF-M regression test Partition calls other RoT services for test. But it
44can still run other tests if some of the RoT services are disabled.
45TF-M defines a ``"weak_dependencies"`` attribute in partition manifests of
46regression test partitions to describe test service access to other RoT
47services. It *shall* be only used for TF-M regression test services.
48
49model
50-----
51A TF-M regression test Partition may support both the SFN and IPC model.
52The actual model being used follows the SPM backend enabled.
53
54The TF-M build system supports this by allowing Secure Partitions to set
55the ``model`` attribute to ``dual``.
56The manifest tool will then change it to the corresponding value according
57to the current backend selected.
58
59The Test Partitions use the following definitions to know what model is being
60built:
61
62- ``<<partition_name>>_MODEL_IPC``, ``1`` if IPC model is used.
63- ``<<partition_name>>_MODEL_SFN``, ``1`` if SFN model is used.
64
65Test service implementation
66===========================
67
68Test service of individual test
69-------------------------------
70
71An individual test dedicated test service should be put under the corresponding
72test folder ``test/secure_fw/suites/<test_name>``.
73
74``add_subdirectory(suites/<test_name>/<service_dir>)`` shall be added into
75``tf-m-tests/test/secure_fw/secure_tests.cmake`` to make sure that the test
76service is built with secure side configuration.
77
78Common test service
79-------------------
80
81If a new test service is required by multiple test suites, the code should be
82put under ``test/secure_fw/common_test_services``. If the new test suite relies
83on a common test service, please make sure that the build implementation of the
84test service is linked correctly, including the header files and libraries.
85
86--------------
87
88*Copyright (c) 2022, Arm Limited. All rights reserved.*
89