aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-10-16 17:25:58 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-10-16 17:25:58 +0000
commit3aafb1ec45b251b45a6a52a7492b649b1ee5c41d (patch)
tree234a06a1cbaf2f90ff15bdd32ede3814e4efecbb /tools
parenteb6b6685f09fbc4822492a1db9eaa367f46c657c (diff)
downloadChibiOS-3aafb1ec45b251b45a6a52a7492b649b1ee5c41d.tar.gz
ChibiOS-3aafb1ec45b251b45a6a52a7492b649b1ee5c41d.tar.bz2
ChibiOS-3aafb1ec45b251b45a6a52a7492b649b1ee5c41d.zip
Updated templates for multi-testing.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10836 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ftl/processors/unittest/test/test_root.c.ftl16
-rwxr-xr-xtools/ftl/processors/unittest/test/test_root.h.ftl18
-rwxr-xr-xtools/ftl/processors/unittest/test/test_sequence.c.ftl34
-rwxr-xr-xtools/ftl/processors/unittest/test/test_sequence.h.ftl14
4 files changed, 45 insertions, 37 deletions
diff --git a/tools/ftl/processors/unittest/test/test_root.c.ftl b/tools/ftl/processors/unittest/test/test_root.c.ftl
index 6751ef56d..b92883a55 100755
--- a/tools/ftl/processors/unittest/test/test_root.c.ftl
+++ b/tools/ftl/processors/unittest/test/test_root.c.ftl
@@ -1,13 +1,15 @@
[#ftl]
[#import "/@ftllibs/libutils.ftl" as utils /]
-[@pp.dropOutputFile /]
-[@pp.changeOutputFile name="test_root.c" /]
[#list conf.*.application.instances.instance as inst]
[#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"]
[#assign instance = inst /]
[#break]
[/#if]
[/#list]
+[#assign prefix_lower = instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /]
+[#assign prefix_upper = instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /]
+[@pp.dropOutputFile /]
+[@pp.changeOutputFile name=prefix_lower+"test_root.c" /]
[@utils.EmitIndentedCCode "" 2 instance.description.copyright.value[0] /]
/**
@@ -24,7 +26,7 @@
* <h2>Test Sequences</h2>
[#if instance.sequences.sequence?size > 0]
[#list instance.sequences.sequence as sequence]
- * - @subpage test_sequence_${(sequence_index + 1)?string("000")}
+ * - @subpage ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}
[/#list]
* .
[#else]
@@ -33,13 +35,13 @@
*/
/**
- * @file test_root.c
+ * @file ${prefix_lower}test_root.c
* @brief Test Suite root structures code.
*/
#include "hal.h"
#include "ch_test.h"
-#include "test_root.h"
+#include "${prefix_lower}test_root.h"
#if !defined(__DOXYGEN__)
@@ -50,12 +52,12 @@
/**
* @brief Array of all the test sequences.
*/
-const testcase_t * const *test_suite[] = {
+const testcase_t * const *${prefix_lower}test_suite[] = {
[#list instance.sequences.sequence as sequence]
[#if sequence.condition.value[0]?trim?length > 0]
#if (${sequence.condition.value[0]}) || defined(__DOXYGEN__)
[/#if]
- test_sequence_${(sequence_index + 1)?string("000")},
+ ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")},
[#if sequence.condition.value[0]?trim?length > 0]
#endif
[/#if]
diff --git a/tools/ftl/processors/unittest/test/test_root.h.ftl b/tools/ftl/processors/unittest/test/test_root.h.ftl
index 930a676cc..8ec0a1c9d 100755
--- a/tools/ftl/processors/unittest/test/test_root.h.ftl
+++ b/tools/ftl/processors/unittest/test/test_root.h.ftl
@@ -1,25 +1,27 @@
[#ftl]
[#import "/@ftllibs/libutils.ftl" as utils /]
-[@pp.dropOutputFile /]
-[@pp.changeOutputFile name="test_root.h" /]
[#list conf.*.application.instances.instance as inst]
[#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"]
[#assign instance = inst /]
[#break]
[/#if]
[/#list]
+[#assign prefix_lower = instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /]
+[#assign prefix_upper = instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /]
+[@pp.dropOutputFile /]
+[@pp.changeOutputFile name=prefix_lower+"test_root.h" /]
[@utils.EmitIndentedCCode "" 2 instance.description.copyright.value[0] /]
/**
- * @file test_root.h
+ * @file ${prefix_lower}test_root.h
* @brief Test Suite root structures header.
*/
-#ifndef TEST_ROOT_H
-#define TEST_ROOT_H
+#ifndef ${prefix_upper}TEST_ROOT_H
+#define ${prefix_upper}TEST_ROOT_H
[#list instance.sequences.sequence as sequence]
-#include "test_sequence_${(sequence_index + 1)?string("000")}.h"
+#include "${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}.h"
[/#list]
#if !defined(__DOXYGEN__)
@@ -28,7 +30,7 @@
/* External declarations. */
/*===========================================================================*/
-extern const testcase_t * const *test_suite[];
+extern const testcase_t * const *${prefix_lower}test_suite[];
#ifdef __cplusplus
extern "C" {
@@ -47,4 +49,4 @@ extern "C" {
[/#if]
#endif /* !defined(__DOXYGEN__) */
-#endif /* TEST_ROOT_H */
+#endif /* ${prefix_upper}TEST_ROOT_H */
diff --git a/tools/ftl/processors/unittest/test/test_sequence.c.ftl b/tools/ftl/processors/unittest/test/test_sequence.c.ftl
index 7be0c58f2..1eb66db90 100755
--- a/tools/ftl/processors/unittest/test/test_sequence.c.ftl
+++ b/tools/ftl/processors/unittest/test/test_sequence.c.ftl
@@ -7,21 +7,23 @@
[#break]
[/#if]
[/#list]
+[#assign prefix_lower = instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /]
+[#assign prefix_upper = instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /]
[#list instance.sequences.sequence as sequence]
- [@pp.changeOutputFile name="test_sequence_" + (sequence_index + 1)?string("000") + ".c" /]
+ [@pp.changeOutputFile name=prefix_lower+"test_sequence_" + (sequence_index + 1)?string("000") + ".c" /]
[@utils.EmitIndentedCCode "" 2 instance.description.copyright.value[0] /]
#include "hal.h"
#include "ch_test.h"
-#include "test_root.h"
+#include "${prefix_lower}test_root.h"
/**
- * @file test_sequence_${(sequence_index + 1)?string("000")}.c
+ * @file ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}.c
* @brief Test Sequence ${(sequence_index + 1)?string("000")} code.
*
- * @page test_sequence_${(sequence_index + 1)?string("000")} [${(sequence_index + 1)?string}] ${utils.WithoutDot(sequence.brief.value[0]?string)}
+ * @page ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")} [${(sequence_index + 1)?string}] ${utils.WithoutDot(sequence.brief.value[0]?string)}
*
- * File: @ref test_sequence_${(sequence_index + 1)?string("000")}.c
+ * File: @ref ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}.c
*
* <h2>Description</h2>
[@utils.FormatStringAsText " * "
@@ -40,7 +42,7 @@
* <h2>Test Cases</h2>
[#if sequence.cases.case?size > 0]
[#list sequence.cases.case as case]
- * - @subpage test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}
+ * - @subpage ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}
[/#list]
* .
[#else]
@@ -78,7 +80,7 @@
[/#if]
[#-- Header generation.--]
/**
- * @page test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")} [${(sequence_index + 1)?string}.${(case_index + 1)?string}] ${utils.WithoutDot(case.brief.value[0])}
+ * @page ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")} [${(sequence_index + 1)?string}.${(case_index + 1)?string}] ${utils.WithoutDot(case.brief.value[0])}
*
* <h2>Description</h2>
[@utils.FormatStringAsText " * "
@@ -121,18 +123,18 @@
*/
[#if case.various_code.setup_code.value[0]?trim?length > 0]
-static void test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_setup(void) {
+static void ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_setup(void) {
[@utils.EmitIndentedCCode " " 2 case.various_code.setup_code.value[0] /]
}
[/#if]
[#if case.various_code.teardown_code.value[0]?trim?length > 0]
-static void test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_teardown(void) {
+static void ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_teardown(void) {
[@utils.EmitIndentedCCode " " 2 case.various_code.teardown_code.value[0] /]
}
[/#if]
-static void test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_execute(void) {
+static void ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_execute(void) {
[#if case.various_code.local_variables.value[0]?trim?length > 0]
[@utils.EmitIndentedCCode " " 2 case.various_code.local_variables.value[0] /]
[/#if]
@@ -165,19 +167,19 @@ static void test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string
[/#list]
}
-static const testcase_t test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")} = {
+static const testcase_t ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")} = {
"${utils.WithoutDot(case.brief.value[0]?string)}",
[#if case.various_code.setup_code.value[0]?trim?length > 0]
- test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_setup,
+ ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_setup,
[#else]
NULL,
[/#if]
[#if case.various_code.teardown_code.value[0]?trim?length > 0]
- test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_teardown,
+ ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_teardown,
[#else]
NULL,
[/#if]
- test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_execute
+ ${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")}_execute
};
[#if case.condition.value[0]?trim?length > 0]
#endif /* ${case.condition.value[0]?trim} */
@@ -191,12 +193,12 @@ static const testcase_t test_${(sequence_index + 1)?string("000")}_${(case_index
/**
* @brief ${utils.WithDot(sequence.brief.value[0]?string)}
*/
-const testcase_t * const test_sequence_${(sequence_index + 1)?string("000")}[] = {
+const testcase_t * const ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}[] = {
[#list sequence.cases.case as case]
[#if case.condition.value[0]?trim?length > 0]
#if (${case.condition.value[0]?trim}) || defined(__DOXYGEN__)
[/#if]
- &test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")},
+ &${prefix_lower}test_${(sequence_index + 1)?string("000")}_${(case_index + 1)?string("000")},
[#if case.condition.value[0]?trim?length > 0]
#endif
[/#if]
diff --git a/tools/ftl/processors/unittest/test/test_sequence.h.ftl b/tools/ftl/processors/unittest/test/test_sequence.h.ftl
index eb3911888..088c6c44a 100755
--- a/tools/ftl/processors/unittest/test/test_sequence.h.ftl
+++ b/tools/ftl/processors/unittest/test/test_sequence.h.ftl
@@ -7,19 +7,21 @@
[#break]
[/#if]
[/#list]
+[#assign prefix_lower = instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /]
+[#assign prefix_upper = instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /]
[#list instance.sequences.sequence as sequence]
- [@pp.changeOutputFile name="test_sequence_" + (sequence_index + 1)?string("000") + ".h" /]
+ [@pp.changeOutputFile name=prefix_lower+"test_sequence_" + (sequence_index + 1)?string("000") + ".h" /]
[@utils.EmitIndentedCCode "" 2 instance.description.copyright.value[0] /]
/**
- * @file test_sequence_${(sequence_index + 1)?string("000")}.h
+ * @file ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}.h
* @brief Test Sequence ${(sequence_index + 1)?string("000")} header.
*/
-#ifndef TEST_SEQUENCE_${(sequence_index + 1)?string("000")}_H
-#define TEST_SEQUENCE_${(sequence_index + 1)?string("000")}_H
+#ifndef ${prefix_upper}TEST_SEQUENCE_${(sequence_index + 1)?string("000")}_H
+#define ${prefix_upper}TEST_SEQUENCE_${(sequence_index + 1)?string("000")}_H
-extern const testcase_t * const test_sequence_${(sequence_index + 1)?string("000")}[];
+extern const testcase_t * const ${prefix_lower}test_sequence_${(sequence_index + 1)?string("000")}[];
-#endif /* TEST_SEQUENCE_${(sequence_index + 1)?string("000")}_H */
+#endif /* ${prefix_upper}TEST_SEQUENCE_${(sequence_index + 1)?string("000")}_H */
[/#list]