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