From 2033af9d9495e4c066fa1a73f64136a89e033124 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 9 Jun 2021 10:15:13 +0000 Subject: [PATCH] Added corebmk experiment. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14521 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- demos/STM32/RT-STM32G474RE-NUCLEO64/.cproject | 2 +- test/core_benchmarks/configuration.xml | 180 +++++++++--------- .../source/test/corebmk_test_root.c | 64 +++++++ .../source/test/corebmk_test_root.h | 52 +++++ .../source/test/corebmk_test_sequence_001.c | 123 ++++++++++++ .../source/test/corebmk_test_sequence_001.h | 27 +++ .../processors/unittest/test/test_root.c.ftl | 16 +- .../processors/unittest/test/test_root.h.ftl | 16 +- .../unittest/test/test_sequence.c.ftl | 16 +- .../unittest/test/test_sequence.h.ftl | 16 +- 10 files changed, 394 insertions(+), 118 deletions(-) create mode 100644 test/core_benchmarks/source/test/corebmk_test_root.c create mode 100644 test/core_benchmarks/source/test/corebmk_test_root.h create mode 100644 test/core_benchmarks/source/test/corebmk_test_sequence_001.c create mode 100644 test/core_benchmarks/source/test/corebmk_test_sequence_001.h diff --git a/demos/STM32/RT-STM32G474RE-NUCLEO64/.cproject b/demos/STM32/RT-STM32G474RE-NUCLEO64/.cproject index 61add3198..06459ba68 100644 --- a/demos/STM32/RT-STM32G474RE-NUCLEO64/.cproject +++ b/demos/STM32/RT-STM32G474RE-NUCLEO64/.cproject @@ -51,4 +51,4 @@ - + \ No newline at end of file diff --git a/test/core_benchmarks/configuration.xml b/test/core_benchmarks/configuration.xml index d6c6e1a48..2c0b5739c 100644 --- a/test/core_benchmarks/configuration.xml +++ b/test/core_benchmarks/configuration.xml @@ -1,19 +1,12 @@ - - - - Test Specification for ChibiOS/NIL. - - - - - - - - - ChibiOS/NIL Test Suite. - - - + + + ChibiOS/NIL Test Suite. + + + - - - Test suite for core benchmarks. The purpose of this suite is to perform general benchmarks in order to assess performance of cores and/or compilers. - - - - - corebmk - - - + + Test suite for core benchmarks. The purpose of this suite + is to perform general benchmarks in order to assess + performance of cores and/or compilers. + + + + + + corebmk_ + + + - - - + + - - - - - - Internal Tests - - - Information. - - - This sequence reports configuration and version information about execution environment. - - - - - - + + + + + Internal Tests + + + Information. + + + This sequence reports configuration and version + information about execution environment. + + + + + + + - - - - - Environment Info. - - - Environment-related info are reported. - - - - - - - - - - - - - - - - - - - Architecture and Compiler information. - - - - - - + + + + Environment Info. + + + Environment-related info are reported. + + + + + + + + + + + + + + + + + + + Architecture and Compiler information. + + + + + + - - - - - - - - - - - - + + + + + + + + diff --git a/test/core_benchmarks/source/test/corebmk_test_root.c b/test/core_benchmarks/source/test/corebmk_test_root.c new file mode 100644 index 000000000..aa28efe20 --- /dev/null +++ b/test/core_benchmarks/source/test/corebmk_test_root.c @@ -0,0 +1,64 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @mainpage Test Suite Specification + * Test suite for core benchmarks. The purpose of this suite is to + * perform general benchmarks in order to assess performance of cores + * and/or compilers. + * + *

Test Sequences

+ * - @subpage corebmk_test_sequence_001 + * . + */ + +/** + * @file corebmk_test_root.c + * @brief Test Suite root structures code. + */ + +#include "hal.h" +#include "corebmk_test_root.h" + +#if !defined(__DOXYGEN__) + +/*===========================================================================*/ +/* Module exported variables. */ +/*===========================================================================*/ + +/** + * @brief Array of test sequences. + */ +const testsequence_t * const corebmk_test_suite_array[] = { + &corebmk_test_sequence_001, + NULL +}; + +/** + * @brief Test suite root structure. + */ +const testsuite_t corebmk_test_suite = { + "ChibiOS/NIL Test Suite", + corebmk_test_suite_array +}; + +/*===========================================================================*/ +/* Shared code. */ +/*===========================================================================*/ + +/**/ + +#endif /* !defined(__DOXYGEN__) */ diff --git a/test/core_benchmarks/source/test/corebmk_test_root.h b/test/core_benchmarks/source/test/corebmk_test_root.h new file mode 100644 index 000000000..ee4025b14 --- /dev/null +++ b/test/core_benchmarks/source/test/corebmk_test_root.h @@ -0,0 +1,52 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file corebmk_test_root.h + * @brief Test Suite root structures header. + */ + +#ifndef COREBMK_TEST_ROOT_H +#define COREBMK_TEST_ROOT_H + +#include "ch_test.h" + +#include "corebmk_test_sequence_001.h" + +#if !defined(__DOXYGEN__) + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +extern const testsuite_t corebmk_test_suite; + +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif + +/*===========================================================================*/ +/* Shared definitions. */ +/*===========================================================================*/ + +/**/ + +#endif /* !defined(__DOXYGEN__) */ + +#endif /* COREBMK_TEST_ROOT_H */ diff --git a/test/core_benchmarks/source/test/corebmk_test_sequence_001.c b/test/core_benchmarks/source/test/corebmk_test_sequence_001.c new file mode 100644 index 000000000..dbcaad153 --- /dev/null +++ b/test/core_benchmarks/source/test/corebmk_test_sequence_001.c @@ -0,0 +1,123 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "hal.h" +#include "corebmk_test_root.h" + +/** + * @file corebmk_test_sequence_001.c + * @brief Test Sequence 001 code. + * + * @page corebmk_test_sequence_001 [1] Information + * + * File: @ref corebmk_test_sequence_001.c + * + *

Description

+ * This sequence reports configuration and version information about + * execution environment. + * + *

Test Cases

+ * - @subpage corebmk_test_001_001 + * . + */ + +/**************************************************************************** + * Shared code. + ****************************************************************************/ + +#include "ch.h" + +/**************************************************************************** + * Test cases. + ****************************************************************************/ + +/** + * @page corebmk_test_001_001 [1.1] Environment Info + * + *

Description

+ * Environment-related info are reported. + * + *

Test Steps

+ * - [1.1.1] Architecture and Compiler information. + * . + */ + +static void corebmk_test_001_001_execute(void) { + + /* [1.1.1] Architecture and Compiler information.*/ + test_set_step(1); + { +#if defined(PORT_ARCHITECTURE_NAME) + test_print("--- Architecture: "); + test_println(PORT_ARCHITECTURE_NAME); +#endif +#if defined(PORT_CORE_VARIANT_NAME) + test_print("--- Core Variant: "); + test_println(PORT_CORE_VARIANT_NAME); +#endif +#if defined(PORT_COMPILER_NAME) + test_print("--- Compiler: "); + test_println(PORT_COMPILER_NAME); +#endif +#if defined(PORT_INFO) + test_print("--- Port Info: "); + test_println(PORT_INFO); +#endif +#if defined(PORT_NATURAL_ALIGN) + test_print("--- Natural alignment: "); + test_printn(PORT_NATURAL_ALIGN); + test_println(""); +#endif +#if defined(PORT_STACK_ALIGN) + test_print("--- Stack alignment: "); + test_printn(PORT_STACK_ALIGN); + test_println(""); +#endif +#if defined(PORT_WORKING_AREA_ALIGN) + test_print("--- Working area alignment: "); + test_printn(PORT_WORKING_AREA_ALIGN); + test_println(""); +#endif + } + test_end_step(1); +} + +static const testcase_t corebmk_test_001_001 = { + "Environment Info", + NULL, + NULL, + corebmk_test_001_001_execute +}; + +/**************************************************************************** + * Exported data. + ****************************************************************************/ + +/** + * @brief Array of test cases. + */ +const testcase_t * const corebmk_test_sequence_001_array[] = { + &corebmk_test_001_001, + NULL +}; + +/** + * @brief Information. + */ +const testsequence_t corebmk_test_sequence_001 = { + "Information", + corebmk_test_sequence_001_array +}; diff --git a/test/core_benchmarks/source/test/corebmk_test_sequence_001.h b/test/core_benchmarks/source/test/corebmk_test_sequence_001.h new file mode 100644 index 000000000..1e5403cb9 --- /dev/null +++ b/test/core_benchmarks/source/test/corebmk_test_sequence_001.h @@ -0,0 +1,27 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file corebmk_test_sequence_001.h + * @brief Test Sequence 001 header. + */ + +#ifndef COREBMK_TEST_SEQUENCE_001_H +#define COREBMK_TEST_SEQUENCE_001_H + +extern const testsequence_t corebmk_test_sequence_001; + +#endif /* COREBMK_TEST_SEQUENCE_001_H */ diff --git a/tools/ftl/processors/unittest/test/test_root.c.ftl b/tools/ftl/processors/unittest/test/test_root.c.ftl index 9b82be5b9..825a72f71 100755 --- a/tools/ftl/processors/unittest/test/test_root.c.ftl +++ b/tools/ftl/processors/unittest/test/test_root.c.ftl @@ -15,12 +15,16 @@ limitations under the License. --] [#import "/@ftllibs/libutils.ftl" as utils /] -[#list xml.*.application.instances.instance as inst] - [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] - [#assign instance = inst /] - [#break] - [/#if] -[/#list] +[#if xml.instance[0]??] + [#assign instance = xml.instance /] +[#else] + [#list xml.*.application.instances.instance as inst] + [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] + [#assign instance = inst /] + [#break] + [/#if] + [/#list] +[/#if] [#assign conf = {"instance":instance} /] [#assign prefix_lower = conf.instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /] [#assign prefix_upper = conf.instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /] diff --git a/tools/ftl/processors/unittest/test/test_root.h.ftl b/tools/ftl/processors/unittest/test/test_root.h.ftl index 036bb2b02..45e391c40 100755 --- a/tools/ftl/processors/unittest/test/test_root.h.ftl +++ b/tools/ftl/processors/unittest/test/test_root.h.ftl @@ -15,12 +15,16 @@ limitations under the License. --] [#import "/@ftllibs/libutils.ftl" as utils /] -[#list xml.*.application.instances.instance as inst] - [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] - [#assign instance = inst /] - [#break] - [/#if] -[/#list] +[#if xml.instance[0]??] + [#assign instance = xml.instance /] +[#else] + [#list xml.*.application.instances.instance as inst] + [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] + [#assign instance = inst /] + [#break] + [/#if] + [/#list] +[/#if] [#assign conf = {"instance":instance} /] [#assign prefix_lower = conf.instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /] [#assign prefix_upper = conf.instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /] diff --git a/tools/ftl/processors/unittest/test/test_sequence.c.ftl b/tools/ftl/processors/unittest/test/test_sequence.c.ftl index abbbc174f..cd0940e1e 100755 --- a/tools/ftl/processors/unittest/test/test_sequence.c.ftl +++ b/tools/ftl/processors/unittest/test/test_sequence.c.ftl @@ -16,12 +16,16 @@ --] [#import "/@ftllibs/libutils.ftl" as utils /] [@pp.dropOutputFile /] -[#list xml.*.application.instances.instance as inst] - [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] - [#assign instance = inst /] - [#break] - [/#if] -[/#list] +[#if xml.instance[0]??] + [#assign instance = xml.instance /] +[#else] + [#list xml.*.application.instances.instance as inst] + [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] + [#assign instance = inst /] + [#break] + [/#if] + [/#list] +[/#if] [#assign conf = {"instance":instance} /] [#assign prefix_lower = conf.instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /] [#assign prefix_upper = conf.instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /] diff --git a/tools/ftl/processors/unittest/test/test_sequence.h.ftl b/tools/ftl/processors/unittest/test/test_sequence.h.ftl index 65397d84e..c8d85a04b 100755 --- a/tools/ftl/processors/unittest/test/test_sequence.h.ftl +++ b/tools/ftl/processors/unittest/test/test_sequence.h.ftl @@ -16,12 +16,16 @@ --] [#import "/@ftllibs/libutils.ftl" as utils /] [@pp.dropOutputFile /] -[#list xml.*.application.instances.instance as inst] - [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] - [#assign instance = inst /] - [#break] - [/#if] -[/#list] +[#if xml.instance[0]??] + [#assign instance = xml.instance /] +[#else] + [#list xml.*.application.instances.instance as inst] + [#if inst.@id?string == "org.chibios.spc5.components.portable.chibios_unitary_tests_engine"] + [#assign instance = inst /] + [#break] + [/#if] + [/#list] +[/#if] [#assign conf = {"instance":instance} /] [#assign prefix_lower = conf.instance.global_data_and_code.code_prefix.value[0]?trim?lower_case /] [#assign prefix_upper =conf. instance.global_data_and_code.code_prefix.value[0]?trim?upper_case /]