blob: db4a03d070b4c01cf9d695455799f49e6f3abe2b [file] [log] [blame]
Gyorgy Szingc805f112022-11-25 11:53:08 +01001Verification Strategy
2=====================
3
4This page describes verification from a high level concept perspective.
5
6In this context ``source code`` has a wider scope and may mean any text content produced by humans and processed by
7other humans or tools. Examples: C/C++ source code, reST documents, build scripts, etc...
8
9Clean Code
10----------
11
12Clean code aims to counterfeit issues discussed in the following sub-chapters.
13
14Code Readability
15''''''''''''''''
16
17Expressing ideas in a machine readable formats is complicated, and each developer may have a different taste or
18different preferences on how source code should be formatted. Some people may find a specific kind of formatting easier
19to understand than others. If the source code does not follow a consistent look and feel, human processing of the text
20may become error prone. This undermines effectiveness of co-operation and code-review, and may lead to incorrect code.
21The project defines coding style rules to counterfeit these problems. For detail please refer to :ref:`Coding Style &
22Guidelines`
23
24Undefined and Implementation Defined Behavior
25'''''''''''''''''''''''''''''''''''''''''''''
26
27The "standard" defining how to process a specific source code type, may leave some processing behavior to the tool
28to be defined, or allow the tool to behave in an undefined way. Coding constructs relying on such behavior are to be
29avoided, or used in a well defined way. This adds robustness and helps avoiding errors due to using different version
30of the same tool, or different implementations.
31
32The project defines coding guidelines to counterfeit these problems. For detail please refer to
33:ref:`Coding Style & Guidelines`
34
35Security
36''''''''
37
38Security is a complex topic affecting all steps of the development process. Incorrect code may lead to security issues
39and thus "Clean Code" has a vital role in implementing secure software.
40
41Runtime Testing
42---------------
43
44Runtime testing focuses of verifying the behavior of one or multiple build products built from source code. This can be
45done at multiple levels and in multiple execution environment.
46
47
48Unit Test
49'''''''''
50
51Unit tests aim to verify if the internal operation of a module matches the developers expectation. It helps covering all
52code execution paths, and to give confidence on correct operation when code needs to be refactored. Unit tests serve as
53a kind of documentation capturing the expected usage of the code.
54
55Unit-testing allays happen on the "host PC"
56
57Component Test
58''''''''''''''
59
60Component tests aim to verify the API (and ABI) of a component is matching expectations. Components are tested in
61isolation, where the exported APIs are exercised by these code, and APIs the component depends on are implemented by
62test doubles.
63
64System Test
65'''''''''''
66
67System test verifies correct operation of a set of modules configured to fulfill the requirements of a use-case. For TS
68this usually means testing and end-to-end setup on a specific target platform.
69
70Balancing Costs vs Quality
71''''''''''''''''''''''''''
72
73Executing build products on target platforms may have high costs in terms of time, complexity and availability and in
74turn it gives the hights confidence in verification results, or the best quality. In the development phase it may be
75desired to some level of this confidence for lower costs. For this purpose the project defines two main test
76set-up types based on the balance choice between cost and quality.
77
78Testing on a Target Platform
79~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80
81In this environment tests are executed on a target platform. Emulators (e.g. QEMU, FVP) from this aspect are treated
82like targets implemented in silicon.
83
84Testing on the Host Machine
85~~~~~~~~~~~~~~~~~~~~~~~~~~~
86
87In this environment test executables are compiled to execute as a "standard" user-space application running on the
88machine "hosting" the development activity. In most cases these machines are based on a different architecture that the
89ones the project is targeting (e.g. x86-64 vs aarch64). This means this environment relies on the assumption that code
90is portable and behaves architecture and compiler independent. This puts limitations on the features which can be tested
91and lower the confidence level of test output. In turn executing tests int his environment is simple and gives very good
92scalability options.
93
94--------------
95
96*Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.*
97
98SPDX-License-Identifier: BSD-3-Clause