Doc: Refine descriptions of test services
There have been some changes in the structure of test services and
test suites. The paths and how to implement a new test service
need to be updated.
Signed-off-by: Jianliang Shen <jianliang.shen@arm.com>
Change-Id: Ic83820d855b2c4cfbbd04cdac28b54904665db53
diff --git a/docs/integration_guide/tfm_test_suites_addition.rst b/docs/integration_guide/tfm_test_suites_addition.rst
index bd4c4a7..ccab714 100644
--- a/docs/integration_guide/tfm_test_suites_addition.rst
+++ b/docs/integration_guide/tfm_test_suites_addition.rst
@@ -22,17 +22,19 @@
TF-M tests source code are located in
`tf-m-tests <https://git.trustedfirmware.org/TF-M/tf-m-tests.git/>`__.
-+----------------+-------------------------------------------------------------+
-| Folder name | Description |
-+================+=============================================================+
-| test/config | The CMAKE test configurations files. |
-+----------------+-------------------------------------------------------------+
-| test/framework | Source code for test framework code, managing test suites. |
-+----------------+-------------------------------------------------------------+
-| test/suites | Test suites divided into subdirectories. |
-+----------------+-------------------------------------------------------------+
-| test/services | Test services divided into subdirectories. |
-+----------------+-------------------------------------------------------------+
++---------------------------------------+---------------------------------------------------------------+
+| Folder name | Description |
++=======================================+===============================================================+
+| test/config | The CMAKE test configurations files. |
++---------------------------------------+---------------------------------------------------------------+
+| test/framework | Source code for test framework code, managing test suites. |
++---------------------------------------+---------------------------------------------------------------+
+| test/secure_fw/suites | Test suites divided into subdirectories. |
++---------------------------------------+---------------------------------------------------------------+
+| test/secure_fw/suites/<suite>/service | Test service divided into corresponding suite subdirectories. |
++---------------------------------------+---------------------------------------------------------------+
+| test/secure_fw/common_test_services | Common test services. |
++---------------------------------------+---------------------------------------------------------------+
Test configuration
==================
@@ -61,10 +63,11 @@
Source code
===========
-The test suite example subdirectory named ``<test_name>`` is located under the path
-``tf-m-tests/test/suites``. If the new test suite includes both non-secure and
-secure parts, the source code shall be divided shared code and specific code.
-An example test suite folder can be organized as the figure below.
+The test suite example subdirectory named ``<test_name>`` is located under the
+path ``tf-m-tests/test/secure_fw/suites``. If the new test suite includes both
+non-secure and secure parts, the source code shall be divided shared code and
+specific code. An example test suite folder can be organized as the figure
+below.
.. code-block:: bash
@@ -143,7 +146,7 @@
===============================
The mission of test configurations is to control the build. They are applied
-in ``test/suites/<test_name>/CMakeLists.txt`` like the example below.
+in ``test/secure_fw/suites/<test_name>/CMakeLists.txt`` like the example below.
.. code-block:: cmake
@@ -218,7 +221,7 @@
On most platforms non-secure tests and secure tests run on the same CPU
core, but dual-core platform is an exception. So secure test library and
secure sevices shall be linked together in the file
- ``tf-m-tests/test/test_services/CMakeLists.txt``. Thus they can be built on
+ ``tf-m-tests/test/secure_fw/secure_tests.cmake``. Thus they can be built on
secure CPU core and non-secure tests library and RTOS are built on
non-secure CPU core.
@@ -245,7 +248,6 @@
TEST_FUN * const test; /*!< Test function to call */
const char *name; /*!< Test name */
const char *desc; /*!< Test description */
- struct test_result_t ret; /*!< Test result */
};
For example, a new test case called ``TFM_NS_<TEST_NAME>_TEST_1001`` is created
@@ -262,7 +264,7 @@
/* Append test cases */
static struct test_t <test_name>_tests[] = {
{&tfm_<test_name>_test_1001, "TFM_NS_<TEST_NAME>_TEST_1001",
- "Example test case", {TEST_PASSED}},
+ "Example test case"},
};
/* Register test case into test suites */
@@ -297,22 +299,30 @@
.. Note::
Each test service must have resource requirements declared in a manifest
- file, the contents of test services are the same as secure partitions,but
+ file, the contents of test services are the same as secure partitions, but
their locations are different. Test service manifests shall be set in
- ``tf-m-tests/test/test_services/tfm_test_manifest_list.yaml``.
+ ``tf-m-tests/test/secure_fw/tfm_test_manifest_list.yaml``.
-Configuration
-=============
+Test service implementation
+===========================
-If the new test service names ``tfm_<test_name>_test_service`` only supports for the
-example test, the configuration in
-``tf-m-tests/test/test_services/CMakeLists.txt`` forms like below.
+Test service of individual test
+-------------------------------
-.. code-block:: cmake
+An individual test dedicated test service should be put under the corresponding
+test folder ``test/secure_fw/suites/<test_name>``.
- if (TEST_S_<TEST_NAME> OR TEST_NS_<TEST_NAME>)
- add_subdirectory(tfm_<test_name>_test_service)
- endif()
+``add_subdirectory(suites/<test_name>/<service_dir>)`` shall be added into
+``tf-m-tests/test/secure_fw/secure_tests.cmake`` to make sure that the test
+service is built with secure side configuration.
+
+Common test service
+-------------------
+
+If a new test service is required by multiple test suites, the code should be
+put under ``test/secure_fw/common_test_services``. If the new test suite relies
+on a common test service, please make sure that the build implementation of the
+test service is linked correctly, including the header files and libraries.
**********************************
Out-of-tree regression test suites
@@ -458,4 +468,4 @@
--------------
-*Copyright (c) 2021, Arm Limited. All rights reserved.*
+*Copyright (c) 2021-2022, Arm Limited. All rights reserved.*