2 * Copyright (c) 2015-2020 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * -----------------------------------------------------------------------------
20 * Project: CMSIS-Driver Validation
21 * Title: Test framework
23 * -----------------------------------------------------------------------------
28 #include "DV_Framework.h"
30 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
32 \defgroup dv_framework Framework
33 \brief Framework configuration and functions
36 \defgroup framework_funcs Functions
42 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
44 \brief Close the debug session.
46 Debug session dead end - debug script should close session here. This function is called by \ref cmsis_dv.
48 void closeDebug(void);
50 #ifndef __DOXYGEN__ // Exclude form the documentation
51 void __attribute__((noinline)) closeDebug(void){
58 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
60 \brief This is the entry point of the test framework.
63 -# Test report is initialized
64 -# For each test group following steps are executed:
65 -# Test group initialization is called (custom test group initialization)
66 -# Test group header is written to standard output
67 -# All tests in a group are executed as follows:
68 - Test statistics are initialized
69 - Test report header is written to the standard output
70 - Test function is executed
71 - Test results are written to the standard output
72 - Test report footer is written to the standard output
73 -# Test group footer is written to standard output
74 -# Test group uninitialization is called (custom test group uninitialization)
75 -# Debug session ends when closeDebug function is reached
77 void cmsis_dv (void *argument) {
83 if (tg_cnt != 0U) { /* If at least 1 test is enabled */
85 ritf.tr_Init (); /* Init test report */
87 for (i = 0U; i < tg_cnt; i++) {
89 /* Init test group report */
90 ritf.tg_Init(ts[i].ReportTitle, /* Write test group title */
91 ts[i].Date, /* Write test group compilation date */
92 ts[i].Time, /* Write test group compilation time */
93 ts[i].FileName); /* Write test group module file name */
95 if (ts[i].Init != NULL) {
96 ts[i].Init(); /* Init test group (group setup) */
99 ritf.tg_InfoDone(); /* Test group info done */
101 /* Execute all tests in a group */
102 for (tc = 0U; tc < ts[i].NumOfTC; tc++) {
103 no = tc + 1U; /* Test number */
104 fn = ts[i].TC[tc].TFName; /* Test function name string */
105 ritf.tc_Init (no, fn); /* Init test report #(Base + TC) */
106 if (ts[i].TC[tc].TestFunc != NULL) {
107 ts[i].TC[tc].TestFunc(); /* Execute test func if enabled */
109 ritf.tc_Uninit (); /* Uninit test report */
112 ritf.tg_Uninit (); /* Uninit test group report */
114 if (ts[i].Uninit != NULL) {
115 ts[i].Uninit(); /* Uninit test group (group teardown) */
119 ritf.tr_Uninit(); /* Uninit test report */
122 closeDebug(); /* Close debug session */
128 // end of group framework_funcs