1Build and run PC based tests
2============================
3
4Many components within the Trusted Services project may be built and tested within a native PC environment.
5PC based testing is an important part of the development flow and can provide a straight-forward way to check
6for regressions and debug problems. PC based tests range from small unit tests up to end-to-end service tests.
7All test cases in the Trusted Services project are written for the CppUTest test framework.
8
9The test executables most often used for PC based testing of Trusted Services components are:
10
11  - *component-test* - a PC executable that runs many component level tests.
12  - *ts-service-test* - contains a set of service-level end-to-end tests. For PC build, service providers
13    are included in the libts library.
14  - *psa-api-test* - PSA functional API conformance tests (from external project).
15
16
17Before you start
18----------------
19Before attempting to run any builds, ensure that all necessary tools are installed.  See: :ref:`Software Requirements`
20
21
22Build and run *component-test*
23------------------------------
24
25From the root directory of the checked-out TS project, enter the following::
26
27  cmake -B build-ct -S deployments/component-test/linux-pc
28  make -C build-ct install
29  build-ct/install/linux-pc/bin/component-test -v
30
31
32Build and run *ts-service-test*
33-------------------------------
34
35From the root directory of the checked-out TS project, enter the following::
36
37  cmake -B build-ts -S deployments/ts-service-test/linux-pc
38  make -C build-ts install
39  LD_LIBRARY_PATH=build-ts/install/linux-pc/lib build-ts/install/linux-pc/bin/ts-service-test -v
40
41Build and run *psa-api-test*
42----------------------------
43Tests for each API are built as separate executables. Test are available for the following APIs::
44
45  crypto
46  initial_attestation
47  internal_trusted_storage
48  protected_storage
49
50To build and run tests for the Crypto API, enter the following (use the same flow for other APIs)::
51
52  cmake -B build-pa deployments/psa-api-test/crypto/linux-pc
53  make -C build-pa install
54  LD_LIBRARY_PATH=build-ts/install/linux-pc/lib build-pa/install/linux-pc/bin/psa-crypto-api-test
55
56psa-api test binaries accept the listed command-line arguments:
57
58===========  ====================================================================
59CL argument  Description
60===========  ====================================================================
61-v           verbose mode
62-h           print supported arguments
63-l           print a list of all the available tests
64-t           run only the listed tests with 'test\_' prefix and semicolon postfix
65             e.g: "-t test_201;test_205;test_260;"
66===========  ====================================================================
67
68More information
69----------------
70For more information about deployments and building, see: :ref:`Build Instructions`
71
72PSA functional API conformance tests git location: https://github.com/ARM-software/psa-arch-tests.git
73
74--------------
75
76*Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.*
77
78SPDX-License-Identifier: BSD-3-Clause
79