aboutsummaryrefslogtreecommitdiffstats
path: root/test/rt/source/test/rt_test_sequence_001.c
blob: 31e2979388dce8d771eb66046f6065f6e322b993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/*
    ChibiOS - Copyright (C) 2006..2017 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 "rt_test_root.h"

/**
 * @file    rt_test_sequence_001.c
 * @brief   Test Sequence 001 code.
 *
 * @page rt_test_sequence_001 [1] Information
 *
 * File: @ref rt_test_sequence_001.c
 *
 * <h2>Description</h2>
 * This sequence reports configuration and version information about
 * the RT kernel.
 *
 * <h2>Test Cases</h2>
 * - @subpage rt_test_001_001
 * - @subpage rt_test_001_002
 * - @subpage rt_test_001_003
 * .
 */

/****************************************************************************
 * Shared code.
 ****************************************************************************/

#include "ch.h"

/****************************************************************************
 * Test cases.
 ****************************************************************************/

/**
 * @page rt_test_001_001 [1.1] Port Info
 *
 * <h2>Description</h2>
 * Port-related info are reported.
 *
 * <h2>Test Steps</h2>
 * - [1.1.1] Prints the version string.
 * .
 */

static void rt_test_001_001_execute(void) {

  /* [1.1.1] Prints the version string.*/
  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
  }
}

static const testcase_t rt_test_001_001 = {
  "Port Info",
  NULL,
  NULL,
  rt_test_001_001_execute
};

/**
 * @page rt_test_001_002 [1.2] Kernel Info
 *
 * <h2>Description</h2>
 * The version numbers are reported.
 *
 * <h2>Test Steps</h2>
 * - [1.2.1] Prints the version string.
 * .
 */

static void rt_test_001_002_execute(void) {

  /* [1.2.1] Prints the version string.*/
  test_set_step(1);
  {
    test_println("--- Product:                            ChibiOS/RT");
    test_print("--- Stable Flag:                        ");
    test_printn(CH_KERNEL_STABLE);
    test_println("");
    test_print("--- Version String:                     ");
    test_println(CH_KERNEL_VERSION);
    test_print("--- Major Number:                       ");
    test_printn(CH_KERNEL_MAJOR);
    test_println("");
    test_print("--- Minor Number:                       ");
    test_printn(CH_KERNEL_MINOR);
    test_println("");
    test_print("--- Patch Number:                       ");
    test_printn(CH_KERNEL_PATCH);
    test_println("");
  }
}

static const testcase_t rt_test_001_002 = {
  "Kernel Info",
  NULL,
  NULL,
  rt_test_001_002_execute
};

/**
 * @page rt_test_001_003 [1.3] Kernel Settings
 *
 * <h2>Description</h2>
 * The static kernel settings are reported.
 *
 * <h2>Test Steps</h2>
 * - [1.3.1] Prints the configuration options settings.
 * .
 */

static void rt_test_001_003_execute(void) {

  /* [1.3.1] Prints the configuration options settings.*/
  test_set_step(1);
  {
    test_print("--- CH_CFG_ST_RESOLUTION:               ");
    test_printn(CH_CFG_ST_RESOLUTION);
    test_println("");
    test_print("--- CH_CFG_ST_FREQUENCY:                ");
    test_printn(CH_CFG_ST_FREQUENCY);
    test_println("");
    test_print("--- CH_CFG_INTERVALS_SIZE:              ");
    test_printn(CH_CFG_INTERVALS_SIZE);
    test_println("");
    test_print("--- CH_CFG_TIME_TYPES_SIZE:             ");
    test_printn(CH_CFG_TIME_TYPES_SIZE);
    test_println("");
    test_print("--- CH_CFG_ST_TIMEDELTA:                ");
    test_printn(CH_CFG_ST_TIMEDELTA);
    test_println("");
    test_print("--- CH_CFG_TIME_QUANTUM:                ");
    test_printn(CH_CFG_TIME_QUANTUM);
    test_println("");
    test_print("--- CH_CFG_MEMCORE_SIZE:                ");
    test_printn(CH_CFG_MEMCORE_SIZE);
    test_println("");
    test_print("--- CH_CFG_NO_IDLE_THREAD:              ");
    test_printn(CH_CFG_NO_IDLE_THREAD);
    test_println("");
    test_print("--- CH_CFG_OPTIMIZE_SPEED:              ");
    test_printn(CH_CFG_OPTIMIZE_SPEED);
    test_println("");
    test_print("--- CH_CFG_USE_TM:                      ");
    test_printn(CH_CFG_USE_TM);
    test_println("");
    test_print("--- CH_CFG_USE_REGISTRY:                ");
    test_printn(CH_CFG_USE_REGISTRY);
    test_println("");
    test_print("--- CH_CFG_USE_WAITEXIT:                ");
    test_printn(CH_CFG_USE_WAITEXIT);
    test_println("");
    test_print("--- CH_CFG_USE_SEMAPHORES:              ");
    test_printn(CH_CFG_USE_SEMAPHORES);
    test_println("");
    test_print("--- CH_CFG_USE_SEMAPHORES_PRI:          ");
    test_printn(CH_CFG_USE_SEMAPHORES_PRIORITY);
    test_println("");
    test_print("--- CH_CFG_USE_MUTEXES:                 ");
    test_printn(CH_CFG_USE_MUTEXES);
    test_println("");
    test_print("--- CH_CFG_USE_MUTEXES_RECURS:          ");
    test_printn(CH_CFG_USE_MUTEXES_RECURSIVE);
    test_println("");   
    test_print("--- CH_CFG_USE_CONDVARS:                ");
    test_printn(CH_CFG_USE_CONDVARS);
    test_println("");
    test_print("--- CH_CFG_USE_CONDVARS_TIMEO:          ");
    test_printn(CH_CFG_USE_CONDVARS_TIMEOUT);
    test_println("");
    test_print("--- CH_CFG_USE_EVENTS:                  ");
    test_printn(CH_CFG_USE_EVENTS);
    test_println("");
    test_print("--- CH_CFG_USE_EVENTS_TIMEOUT:          ");
    test_printn(CH_CFG_USE_EVENTS_TIMEOUT);
    test_println("");
    test_print("--- CH_CFG_USE_MESSAGES:                ");
    test_printn(CH_CFG_USE_MESSAGES);
    test_println("");
    test_print("--- CH_CFG_USE_MESSAGES_PRI:            ");
    test_printn(CH_CFG_USE_MESSAGES_PRIORITY);
    test_println("");
    test_print("--- CH_CFG_USE_MAILBOXES:               ");
    test_printn(CH_CFG_USE_MAILBOXES);
    test_println("");
    test_print("--- CH_CFG_USE_MEMCORE:                 ");
    test_printn(CH_CFG_USE_MEMCORE);
    test_println("");
    test_print("--- CH_CFG_USE_HEAP:                    ");
    test_printn(CH_CFG_USE_HEAP);
    test_println("");
    test_print("--- CH_CFG_USE_MEMPOOLS:                ");
    test_printn(CH_CFG_USE_MEMPOOLS);
    test_println("");
    test_print("--- CH_CFG_USE_OBJ_FIFOS:               ");
    test_printn(CH_CFG_USE_OBJ_FIFOS);
    test_println("");
    test_print("--- CH_CFG_USE_DYNAMIC:                 ");
    test_printn(CH_CFG_USE_DYNAMIC);
    test_println("");
    test_print("--- CH_CFG_USE_FACTORY:                 ");
    test_printn(CH_CFG_USE_FACTORY);
    test_println("");
    test_print("--- CH_CFG_FACTORY_MAX_NAMES_LENGTH:    ");
    test_printn(CH_CFG_FACTORY_MAX_NAMES_LENGTH);
    test_println("");
    test_print("--- CH_CFG_FACTORY_OBJECTS_REGISTRY:    ");
    test_printn(CH_CFG_FACTORY_OBJECTS_REGISTRY);
    test_println("");
    test_print("--- CH_CFG_FACTORY_GENERIC_BUFFERS:     ");
    test_printn(CH_CFG_FACTORY_GENERIC_BUFFERS);
    test_println("");
    test_print("--- CH_CFG_FACTORY_SEMAPHORES:          ");
    test_printn(CH_CFG_FACTORY_SEMAPHORES);
    test_println("");
    test_print("--- CH_CFG_FACTORY_MAILBOXES:           ");
    test_printn(CH_CFG_FACTORY_MAILBOXES);
    test_println("");
    test_print("--- CH_CFG_FACTORY_OBJ_FIFOS:           ");
    test_printn(CH_CFG_FACTORY_OBJ_FIFOS);
    test_println("");
    test_print("--- CH_DBG_STATISTICS:                  ");
    test_printn(CH_DBG_STATISTICS);
    test_println("");
    test_print("--- CH_DBG_SYSTEM_STATE_CHECK:          ");
    test_printn(CH_DBG_SYSTEM_STATE_CHECK);
    test_println("");
    test_print("--- CH_DBG_ENABLE_CHECKS:               ");
    test_printn(CH_DBG_ENABLE_CHECKS);
    test_println("");
    test_print("--- CH_DBG_ENABLE_ASSERTS:              ");
    test_printn(CH_DBG_ENABLE_ASSERTS);
    test_println("");
    test_print("--- CH_DBG_TRACE_MASK:                  ");
    test_printn(CH_DBG_TRACE_MASK);
    test_println("");
    test_print("--- CH_DBG_TRACE_BUFFER_SIZE:           ");
    test_printn(CH_DBG_TRACE_BUFFER_SIZE);
    test_println("");
    test_print("--- CH_DBG_ENABLE_STACK_CHECK:          ");
    test_printn(CH_DBG_ENABLE_STACK_CHECK);
    test_println("");
    test_print("--- CH_DBG_FILL_THREADS:                ");
    test_printn(CH_DBG_FILL_THREADS);
    test_println("");
    test_print("--- CH_DBG_THREADS_PROFILING:           ");
    test_printn(CH_DBG_THREADS_PROFILING);
    test_println("");
  }
}

static const testcase_t rt_test_001_003 = {
  "Kernel Settings",
  NULL,
  NULL,
  rt_test_001_003_execute
};

/****************************************************************************
 * Exported data.
 ****************************************************************************/

/**
 * @brief   Array of test cases.
 */
const testcase_t * const rt_test_sequence_001_array[] = {
  &rt_test_001_001,
  &rt_test_001_002,
  &rt_test_001_003,
  NULL
};

/**
 * @brief   Information.
 */
const testsequence_t rt_test_sequence_001 = {
  "Information",
  rt_test_sequence_001_array
};