CV_Framework.c 3.5 KB

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