1 /*-----------------------------------------------------------------------------
2 * Name: cv_framework.c
3 * Purpose: Test framework entry point
4 *----------------------------------------------------------------------------
5 * Copyright (c) 2017 ARM Limited. All rights reserved.
6 *----------------------------------------------------------------------------*/
7 #include "CV_Framework.h"
8 #include "cmsis_cv.h"
9
10 /* Prototypes */
11 void ts_cmsis_cv(void);
12 void closeDebug(void);
13
14 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
15 /**
16 \defgroup framework_funcs Framework Functions
17 \brief Functions in the Framework software component
18 \details
19
20 @{
21 */
22
23 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
24 /**
25 \brief Close the debug session.
26 \details
27 Debug session dead end - debug script should close session here.
28 */
closeDebug(void)29 void closeDebug(void) {
30 __NOP();
31 // Test completed
32 }
33
34
35 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
36
37 /**
38 \brief This is CORE Validation test suite.
39 \details
40 Program flow:
41 -# Test report statistics is initialized
42 -# Test report headers are written to the standard output
43 -# All defined test cases are executed:
44 - Test case statistics is initialized
45 - Test case report header is written to the standard output
46 - Test case is executed
47 - Test case results are written to the standard output
48 - Test case report footer is written to the standard output
49 - Test case is closed
50 -# Test report footer is written to the standard output
51 -# Debug session ends in dead loop
52 */
ts_cmsis_cv()53 void ts_cmsis_cv () {
54 const char *fn;
55 uint32_t tc, no;
56 (void)ritf.Init (); /* Init test report */
57 (void)ritf.Open (ts.ReportTitle, /* Write test report title */
58 ts.Date, /* Write compilation date */
59 ts.Time, /* Write compilation time */
60 ts.FileName); /* Write module file name */
61
62 /* Execute all test cases */
63 for (tc = 0; tc < ts.NumOfTC; tc++) {
64 no = ts.TCBaseNum+tc; /* Test case number */
65 fn = ts.TC[tc].TFName; /* Test function name string */
66 (void)ritf.Open_TC (no, fn); /* Open test case #(Base + TC) */
67 if (ts.TC[tc].en != 0U) {
68 ts.TC[tc].TestFunc(); /* Execute test case if enabled */
69 }
70 (void)ritf.Close_TC (); /* Close test case */
71 }
72 (void)ritf.Close (); /* Close test report */
73
74 closeDebug(); /* Close debug session */
75 }
76
77 /**
78 \brief This is the entry point of the test framework.
79 \details
80 Program flow:
81 -# Hardware is first initialized if Init callback function is provided
82 -# Main thread is initialized
83 */
cmsis_cv(void)84 void cmsis_cv (void) {
85
86 /* Init test suite */
87 if (ts.Init != NULL) {
88 ts.Init(); /* Init hardware */
89 }
90
91 ts_cmsis_cv();
92 }
93
cmsis_cv_abort(const char * fn,uint32_t ln,char * desc)94 void cmsis_cv_abort (const char *fn, uint32_t ln, char *desc) {
95 (void)__set_result(fn, ln, FAILED, desc);
96 (void)ritf.Close_TC();
97 (void)ritf.Close();
98 closeDebug();
99 }
100
101 /**
102 @}
103 */
104 // end of group framework_funcs
105