source: rtems/testsuites/validation/ts-validation-0.c @ 139ffa2

Last change on this file since 139ffa2 was 139ffa2, checked in by Sebastian Huber <sebastian.huber@…>, on 09/11/20 at 08:33:19

validation: Add general purpose test suite

Add a general purpose test suite for validation tests.

This is the first test suite generated from a specification item in the
rtems-central repository.

Update #3959.

  • Property mode set to 100644
File size: 5.9 KB
Line 
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 * This file was automatically generated.  Do not edit it manually.
36 * Please have a look at
37 *
38 * https://docs.rtems.org/branches/master/eng/req/howto.html
39 *
40 * for information how to maintain and re-generate this file.
41 */
42
43#ifdef HAVE_CONFIG_H
44#include "config.h"
45#endif
46
47#include <rtems.h>
48#include <rtems/bspIo.h>
49#include <rtems/sysinit.h>
50
51#include <rtems/test.h>
52
53/**
54 * @defgroup RTEMSTestSuiteTestsuitesValidation0 spec:/testsuites/validation-0
55 *
56 * @ingroup RTEMSTestSuites
57 *
58 * @brief This general purpose validation test suite provides enough resources
59 *   to run basic tests for all specified managers and functions.
60 *
61 * In SMP configurations, up to three scheduler instances using the SMP EDF
62 * scheduler are provided using up to four processors.
63 *
64 * @{
65 */
66
67#include <rtems/test-info.h>
68
69const char rtems_test_name[] = "Validation0";
70
71static char buffer[ 512 ];
72
73static const T_action actions[] = {
74  T_report_hash_sha256,
75  T_check_task_context,
76  T_check_rtems_barriers,
77  T_check_rtems_extensions,
78  T_check_rtems_message_queues,
79  T_check_rtems_partitions,
80  T_check_rtems_periods,
81  T_check_rtems_semaphores,
82  T_check_rtems_tasks,
83  T_check_rtems_timers
84};
85
86static const T_config test_config = {
87  .name = rtems_test_name,
88  .buf = buffer,
89  .buf_size = sizeof( buffer ),
90  .putchar = rtems_put_char,
91  .verbosity = T_VERBOSE,
92  .now = T_now_clock,
93  .action_count = T_ARRAY_SIZE( actions ),
94  .actions = actions
95};
96
97static void runner_task( rtems_task_argument arg )
98{
99  int exit_code;
100
101  (void) arg;
102
103  rtems_test_begin( rtems_test_name, TEST_STATE );
104  T_register();
105  exit_code = T_main( &test_config );
106
107  if ( exit_code == 0 ) {
108    rtems_test_end( rtems_test_name );
109  }
110
111  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, (uint32_t) exit_code );
112}
113
114#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
115
116#define ATTRIBUTES RTEMS_FLOATING_POINT
117
118RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
119static char runner_task_storage[
120  RTEMS_TASK_STORAGE_SIZE(
121    MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
122    ATTRIBUTES
123  )
124];
125
126static const rtems_task_config runner_task_config = {
127  .name = rtems_build_name( 'R', 'U', 'N', ' ' ),
128  .initial_priority = 1,
129  .storage_area = runner_task_storage,
130  .storage_size = sizeof( runner_task_storage ),
131  .maximum_thread_local_storage_size = MAX_TLS_SIZE,
132  .initial_modes = RTEMS_DEFAULT_MODES,
133  .attributes = ATTRIBUTES
134};
135
136static void init_runner_task(void)
137{
138  rtems_id id;
139  rtems_status_code sc;
140
141  sc = rtems_task_construct( &runner_task_config, &id );
142  if ( sc != RTEMS_SUCCESSFUL ) {
143    rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 );
144  }
145
146  sc = rtems_task_start( id, runner_task, 0 );
147  if ( sc != RTEMS_SUCCESSFUL ) {
148    rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 );
149  }
150}
151
152RTEMS_SYSINIT_ITEM(
153  init_runner_task,
154  RTEMS_SYSINIT_CLASSIC_USER_TASKS,
155  RTEMS_SYSINIT_ORDER_MIDDLE
156);
157
158#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
159
160#define CONFIGURE_MAXIMUM_PROCESSORS 4
161
162#define CONFIGURE_MAXIMUM_BARRIERS 3
163
164#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 3
165
166#define CONFIGURE_MAXIMUM_PARTITIONS 3
167
168#define CONFIGURE_MAXIMUM_PERIODS 3
169
170#define CONFIGURE_MAXIMUM_SEMAPHORES 3
171
172#define CONFIGURE_MAXIMUM_TASKS 3
173
174#define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE \
175  CONFIGURE_MAXIMUM_TASKS
176
177#define CONFIGURE_MAXIMUM_TIMERS 3
178
179#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 3
180
181#define CONFIGURE_MICROSECONDS_PER_TICK 1000
182
183#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0
184
185#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
186
187#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
188
189#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
190
191#define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
192
193#if defined(RTEMS_SMP)
194
195#define CONFIGURE_SCHEDULER_EDF_SMP
196
197#include <rtems/scheduler.h>
198
199RTEMS_SCHEDULER_EDF_SMP(a);
200
201RTEMS_SCHEDULER_EDF_SMP(b);
202
203RTEMS_SCHEDULER_EDF_SMP(c);
204
205#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
206  RTEMS_SCHEDULER_TABLE_EDF_SMP(a, rtems_build_name('A', ' ', ' ', ' ')), \
207  RTEMS_SCHEDULER_TABLE_EDF_SMP(b, rtems_build_name('B', ' ', ' ', ' ')), \
208  RTEMS_SCHEDULER_TABLE_EDF_SMP(c, rtems_build_name('C', ' ', ' ', ' '))
209
210#define CONFIGURE_SCHEDULER_ASSIGNMENTS \
211  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
212  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
213  RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
214  RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL)
215
216#endif /* RTEMS_SMP */
217
218#define CONFIGURE_INIT
219
220#include <rtems/confdefs.h>
221
222/** @} */
Note: See TracBrowser for help on using the repository browser.