1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSTestSuiteTestsuitesValidation0 |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) |
---|
11 | * |
---|
12 | * Redistribution and use in source and binary forms, with or without |
---|
13 | * modification, are permitted provided that the following conditions |
---|
14 | * are met: |
---|
15 | * 1. Redistributions of source code must retain the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer. |
---|
17 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer in the |
---|
19 | * documentation and/or other materials provided with the distribution. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
31 | * POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /* |
---|
35 | * Do not manually edit this file. It is part of the RTEMS quality process |
---|
36 | * and was automatically generated. |
---|
37 | * |
---|
38 | * If you find something that needs to be fixed or worded better please |
---|
39 | * post a report to an RTEMS mailing list or raise a bug report: |
---|
40 | * |
---|
41 | * https://docs.rtems.org/branches/master/user/support/bugs.html |
---|
42 | * |
---|
43 | * For information on updating and regenerating please refer to: |
---|
44 | * |
---|
45 | * https://docs.rtems.org/branches/master/eng/req/howto.html |
---|
46 | */ |
---|
47 | |
---|
48 | #ifdef HAVE_CONFIG_H |
---|
49 | #include "config.h" |
---|
50 | #endif |
---|
51 | |
---|
52 | #include <rtems.h> |
---|
53 | #include <rtems/bspIo.h> |
---|
54 | #include <rtems/sysinit.h> |
---|
55 | #include <rtems/test-info.h> |
---|
56 | #include <rtems/testopts.h> |
---|
57 | |
---|
58 | #include <rtems/test.h> |
---|
59 | |
---|
60 | /** |
---|
61 | * @defgroup RTEMSTestSuiteTestsuitesValidation0 spec:/testsuites/validation-0 |
---|
62 | * |
---|
63 | * @ingroup RTEMSTestSuites |
---|
64 | * |
---|
65 | * @brief This general purpose validation test suite provides enough resources |
---|
66 | * to run basic tests for all specified managers and functions. |
---|
67 | * |
---|
68 | * In SMP configurations, up to three scheduler instances using the SMP EDF |
---|
69 | * scheduler are provided using up to four processors. |
---|
70 | * |
---|
71 | * @{ |
---|
72 | */ |
---|
73 | |
---|
74 | const char rtems_test_name[] = "Validation0"; |
---|
75 | |
---|
76 | static char buffer[ 512 ]; |
---|
77 | |
---|
78 | static const T_action actions[] = { |
---|
79 | T_report_hash_sha256, |
---|
80 | T_check_task_context, |
---|
81 | T_check_rtems_barriers, |
---|
82 | T_check_rtems_extensions, |
---|
83 | T_check_rtems_message_queues, |
---|
84 | T_check_rtems_partitions, |
---|
85 | T_check_rtems_periods, |
---|
86 | T_check_rtems_semaphores, |
---|
87 | T_check_rtems_tasks, |
---|
88 | T_check_rtems_timers |
---|
89 | }; |
---|
90 | |
---|
91 | static const T_config test_config = { |
---|
92 | .name = rtems_test_name, |
---|
93 | .buf = buffer, |
---|
94 | .buf_size = sizeof( buffer ), |
---|
95 | .putchar = rtems_put_char, |
---|
96 | .verbosity = RTEMS_TEST_VERBOSITY, |
---|
97 | .now = T_now_clock, |
---|
98 | .action_count = T_ARRAY_SIZE( actions ), |
---|
99 | .actions = actions |
---|
100 | }; |
---|
101 | |
---|
102 | static void runner_task( rtems_task_argument arg ) |
---|
103 | { |
---|
104 | int exit_code; |
---|
105 | |
---|
106 | (void) arg; |
---|
107 | |
---|
108 | rtems_test_begin( rtems_test_name, TEST_STATE ); |
---|
109 | T_register(); |
---|
110 | exit_code = T_main( &test_config ); |
---|
111 | |
---|
112 | if ( exit_code == 0 ) { |
---|
113 | rtems_test_end( rtems_test_name ); |
---|
114 | } |
---|
115 | |
---|
116 | rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, (uint32_t) exit_code ); |
---|
117 | } |
---|
118 | |
---|
119 | #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT ) |
---|
120 | |
---|
121 | #define ATTRIBUTES RTEMS_FLOATING_POINT |
---|
122 | |
---|
123 | RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) |
---|
124 | static char runner_task_storage[ |
---|
125 | RTEMS_TASK_STORAGE_SIZE( |
---|
126 | MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE, |
---|
127 | ATTRIBUTES |
---|
128 | ) |
---|
129 | ]; |
---|
130 | |
---|
131 | static const rtems_task_config runner_task_config = { |
---|
132 | .name = rtems_build_name( 'R', 'U', 'N', ' ' ), |
---|
133 | .initial_priority = 1, |
---|
134 | .storage_area = runner_task_storage, |
---|
135 | .storage_size = sizeof( runner_task_storage ), |
---|
136 | .maximum_thread_local_storage_size = MAX_TLS_SIZE, |
---|
137 | .initial_modes = RTEMS_DEFAULT_MODES, |
---|
138 | .attributes = ATTRIBUTES |
---|
139 | }; |
---|
140 | |
---|
141 | static void init_runner_task(void) |
---|
142 | { |
---|
143 | rtems_id id; |
---|
144 | rtems_status_code sc; |
---|
145 | |
---|
146 | sc = rtems_task_construct( &runner_task_config, &id ); |
---|
147 | if ( sc != RTEMS_SUCCESSFUL ) { |
---|
148 | rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 ); |
---|
149 | } |
---|
150 | |
---|
151 | sc = rtems_task_start( id, runner_task, 0 ); |
---|
152 | if ( sc != RTEMS_SUCCESSFUL ) { |
---|
153 | rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 ); |
---|
154 | } |
---|
155 | } |
---|
156 | |
---|
157 | RTEMS_SYSINIT_ITEM( |
---|
158 | init_runner_task, |
---|
159 | RTEMS_SYSINIT_CLASSIC_USER_TASKS, |
---|
160 | RTEMS_SYSINIT_ORDER_MIDDLE |
---|
161 | ); |
---|
162 | |
---|
163 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
164 | |
---|
165 | #define CONFIGURE_MAXIMUM_PROCESSORS 4 |
---|
166 | |
---|
167 | #define CONFIGURE_MAXIMUM_BARRIERS 3 |
---|
168 | |
---|
169 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 3 |
---|
170 | |
---|
171 | #define CONFIGURE_MAXIMUM_PARTITIONS 3 |
---|
172 | |
---|
173 | #define CONFIGURE_MAXIMUM_PERIODS 3 |
---|
174 | |
---|
175 | #define CONFIGURE_MAXIMUM_SEMAPHORES 3 |
---|
176 | |
---|
177 | #define CONFIGURE_MAXIMUM_TASKS 3 |
---|
178 | |
---|
179 | #define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE \ |
---|
180 | CONFIGURE_MAXIMUM_TASKS |
---|
181 | |
---|
182 | #define CONFIGURE_MAXIMUM_TIMERS 3 |
---|
183 | |
---|
184 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 3 |
---|
185 | |
---|
186 | #define CONFIGURE_MICROSECONDS_PER_TICK 1000 |
---|
187 | |
---|
188 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0 |
---|
189 | |
---|
190 | #define CONFIGURE_DISABLE_NEWLIB_REENTRANCY |
---|
191 | |
---|
192 | #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM |
---|
193 | |
---|
194 | #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION |
---|
195 | |
---|
196 | #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body |
---|
197 | |
---|
198 | #if defined(RTEMS_SMP) |
---|
199 | |
---|
200 | #define CONFIGURE_SCHEDULER_EDF_SMP |
---|
201 | |
---|
202 | #include <rtems/scheduler.h> |
---|
203 | |
---|
204 | RTEMS_SCHEDULER_EDF_SMP(a); |
---|
205 | |
---|
206 | RTEMS_SCHEDULER_EDF_SMP(b); |
---|
207 | |
---|
208 | RTEMS_SCHEDULER_EDF_SMP(c); |
---|
209 | |
---|
210 | #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ |
---|
211 | RTEMS_SCHEDULER_TABLE_EDF_SMP(a, rtems_build_name('A', ' ', ' ', ' ')), \ |
---|
212 | RTEMS_SCHEDULER_TABLE_EDF_SMP(b, rtems_build_name('B', ' ', ' ', ' ')), \ |
---|
213 | RTEMS_SCHEDULER_TABLE_EDF_SMP(c, rtems_build_name('C', ' ', ' ', ' ')) |
---|
214 | |
---|
215 | #define CONFIGURE_SCHEDULER_ASSIGNMENTS \ |
---|
216 | RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \ |
---|
217 | RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \ |
---|
218 | RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \ |
---|
219 | RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL) |
---|
220 | |
---|
221 | #endif /* RTEMS_SMP */ |
---|
222 | |
---|
223 | #define CONFIGURE_INIT |
---|
224 | |
---|
225 | #include <rtems/confdefs.h> |
---|
226 | |
---|
227 | /** @} */ |
---|