]> begriffs open source - cmsis-driver-validation/blob - Source/DV_Framework.c
Added simplified (relaxed) WiFi tests (for simplifying SDK based drivers)
[cmsis-driver-validation] / Source / DV_Framework.c
1 /*-----------------------------------------------------------------------------
2  *      Name:         framework.c
3  *      Purpose:      Test framework entry point
4  *----------------------------------------------------------------------------
5  *      Copyright(c) KEIL - An ARM Company
6  *----------------------------------------------------------------------------*/
7 #include "cmsis_dv.h" 
8 #include "DV_Framework.h"
9
10 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
11 /**
12 \defgroup framework_funcs Framework Functions
13 \brief Functions in the Framework software component
14 \details
15
16 @{
17 */
18
19 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
20 /**
21 \brief Close the debug session.
22 \details
23 Debug session dead end - debug script should close session here. This function is called by \ref cmsis_dv.
24 */
25 void closeDebug(void);
26 void __attribute__((noinline)) closeDebug(void){
27   __NOP();
28   // Test completed
29 }
30
31
32 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
33 /**
34 \brief This is the entry point of the test framework.
35 \details
36 Program flow:
37   -# Hardware is first initialized if Init callback function is provided
38   -# Test report statistics is initialized
39   -# Test report headers are written to the standard output
40   -# All defined test cases are executed:
41       - Test case statistics is initialized
42       - Test case report header is written to the standard output
43       - Test case is executed
44       - Test case results are written to the standard output
45       - Test case report footer is written to the standard output
46       - Test case is closed
47   -# Test report footer is written to the standard output
48   -# Debug session ends in dead loop
49 */
50 void cmsis_dv (void __attribute__((unused)) *argument) {
51   const char *fn;
52   uint32_t tc, no;
53   
54   /* Init test suite */
55   if (ts.Init) {
56     ts.Init();                            /* Init hardware                    */
57   }
58
59   ritf.Init ();                           /* Init test report                 */
60   ritf.Open (ts.ReportTitle,              /* Write test report title          */
61              ts.Date,                     /* Write compilation date           */
62              ts.Time,                     /* Write compilation time           */
63              ts.FileName);                /* Write module file name           */
64
65   /* Execute all test cases */
66   for (tc = 0; tc < ts.NumOfTC; tc++) {
67     no = ts.TCBaseNum+tc;                 /* Test case number                 */
68     fn = ts.TC[tc].TFName;                /* Test function name string        */
69     ritf.Open_TC (no, fn);                /* Open test case #(Base + TC)      */
70     if (ts.TC[tc].en) 
71       ts.TC[tc].TestFunc();               /* Execute test case if enabled     */
72     ritf.Close_TC ();                     /* Close test case                  */
73   }
74   ritf.Close ();                          /* Close test report                */
75
76   closeDebug();                           /* Close debug session              */
77 }
78
79 /**
80 @}
81 */ 
82 // end of group framework_funcs