1 /*-----------------------------------------------------------------------------
3 * Purpose: Test framework
4 *----------------------------------------------------------------------------
5 * Copyright(c) KEIL - An ARM Company
6 *----------------------------------------------------------------------------*/
9 #include "DV_Framework.h"
11 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
13 \defgroup framework_funcs Framework Functions
14 \brief Functions in the Framework software component
20 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
22 \brief Close the debug session.
24 Debug session dead end - debug script should close session here. This function is called by \ref cmsis_dv.
26 void closeDebug(void);
27 void __attribute__((noinline)) closeDebug(void){
33 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
35 \brief This is the entry point of the test framework.
38 -# Test report is initialized
39 -# For each test group following steps are executed:
40 -# Test group initialization is called (custom test group initialization)
41 -# Test group header is written to standard output
42 -# All tests in a group are executed as follows:
43 - Test case statistics are initialized
44 - Test case report header is written to the standard output
45 - Test case is executed
46 - Test case results are written to the standard output
47 - Test case report footer is written to the standard output
48 -# Test group footer is written to standard output
49 -# Test group uninitialization is called (custom test group uninitialization)
50 -# Debug session ends when closeDebug function is reached
52 void cmsis_dv (void __attribute__((unused)) *argument) {
56 if (tg_cnt != 0) { /* If at least 1 test is enabled */
58 ritf.tr_Init (); /* Init test report */
60 for (i = 0U; i < tg_cnt; i++) {
63 ts[i].Init(); /* Init test group (group setup) */
65 /* Init test group report */
66 ritf.tg_Init(ts[i].ReportTitle, /* Write test group title */
67 ts[i].Date, /* Write test group compilation date */
68 ts[i].Time, /* Write test group compilation time */
69 ts[i].FileName); /* Write test group module file name */
71 /* Execute all test cases in a group */
72 for (tc = 0; tc < ts[i].NumOfTC; tc++) {
73 no = ts[i].TCBaseNum+tc; /* Test case number */
74 fn = ts[i].TC[tc].TFName; /* Test function name string */
75 ritf.tc_Init (no, fn); /* Init test case report #(Base + TC) */
76 if (ts[i].TC[tc].TestFunc != NULL) {
77 ts[i].TC[tc].TestFunc(); /* Execute test case if enabled */
79 ritf.tc_Uninit (); /* Uninit test case report */
82 ritf.tg_Uninit (); /* Uninit test group report */
85 ts[i].Uninit(); /* Uninit test group (group teardown) */
89 ritf.tr_Uninit(); /* Uninit test report */
92 closeDebug(); /* Close debug session */
98 // end of group framework_funcs