test_root.c.ftl 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. [#ftl]
  2. [#--
  3. ChibiOS/RT - Copyright (C) 2006..2018 Giovanni Di Sirio
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. --]
  14. [#import "/@ftllibs/libutils.ftl" as utils /]
  15. [#list xml.*.application.instances.instance as inst]
  16. [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"]
  17. [#assign instance = inst /]
  18. [#break]
  19. [/#if]
  20. [/#list]
  21. [#assign conf = {"instance":instance} /]
  22. [#assign prefix_lower = conf.instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /]
  23. [#assign prefix_upper = conf.instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /]
  24. [@pp.dropOutputFile /]
  25. [@pp.changeOutputFile name=prefix_lower+"test_root.c" /]
  26. [@utils.EmitIndentedCCode "" 2 conf.instance.description.copyright.value[0] /]
  27. /**
  28. * @mainpage Test Suite Specification
  29. [#if conf.instance.description.introduction.value[0]?trim != ""]
  30. [@utils.FormatStringAsText " * "
  31. " * "
  32. utils.WithDot(conf.instance.description.introduction.value[0]?trim?cap_first)
  33. 72 /]
  34. [#else]
  35. * No introduction.
  36. [/#if]
  37. *
  38. * <h2>Test Sequences</h2>
  39. [#if conf.instance.sequences.sequence?size > 0]
  40. [#list conf.instance.sequences.sequence as sequence]
  41. * - @subpage ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}
  42. [/#list]
  43. * .
  44. [#else]
  45. * No test sequences defined in the test suite.
  46. [/#if]
  47. */
  48. /**
  49. * @file ${prefix_lower}test_root.c
  50. * @brief Test Suite root structures code.
  51. */
  52. #include "hal.h"
  53. #include "${prefix_lower}test_root.h"
  54. #if !defined(__DOXYGEN__)
  55. /*===========================================================================*/
  56. /* Module exported variables. */
  57. /*===========================================================================*/
  58. /**
  59. * @brief Array of test sequences.
  60. */
  61. const testsequence_t * const ${prefix_lower}test_suite_array[] = {
  62. [#list conf.instance.sequences.sequence as sequence]
  63. [#if sequence.condition.value[0]?trim?length > 0]
  64. #if (${sequence.condition.value[0]}) || defined(__DOXYGEN__)
  65. [/#if]
  66. &${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")},
  67. [#if sequence.condition.value[0]?trim?length > 0]
  68. #endif
  69. [/#if]
  70. [/#list]
  71. NULL
  72. };
  73. /**
  74. * @brief Test suite root structure.
  75. */
  76. const testsuite_t ${prefix_lower}test_suite = {
  77. "${utils.WithoutDot(conf.instance.description.brief.value[0]?trim)}",
  78. ${prefix_lower}test_suite_array
  79. };
  80. /*===========================================================================*/
  81. /* Shared code. */
  82. /*===========================================================================*/
  83. [#if conf.instance.global_data_and_code.global_code.value[0]?trim?length > 0]
  84. [@utils.EmitIndentedCCode "" 2 conf.instance.global_data_and_code.global_code.value[0] /]
  85. [/#if]
  86. #endif /* !defined(__DOXYGEN__) */