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