[d0c39838] | 1 | /* |
---|
[e44ae80] | 2 | * Copyright (c) 2015, 2020 embedded brains GmbH. All rights reserved. |
---|
[d0c39838] | 3 | * |
---|
| 4 | * embedded brains GmbH |
---|
| 5 | * Dornierstr. 4 |
---|
| 6 | * 82178 Puchheim |
---|
| 7 | * Germany |
---|
| 8 | * <rtems@embedded-brains.de> |
---|
| 9 | * |
---|
| 10 | * The license and distribution terms for this file may be |
---|
| 11 | * found in the file LICENSE in this distribution or at |
---|
| 12 | * http://www.rtems.com/license/LICENSE. |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #ifdef HAVE_CONFIG_H |
---|
| 16 | #include "config.h" |
---|
| 17 | #endif |
---|
| 18 | |
---|
[24d0ee57] | 19 | #include "tmacros.h" |
---|
| 20 | |
---|
[ca4602e] | 21 | #include <sys/types.h> |
---|
[21275b58] | 22 | #include <sys/mman.h> |
---|
[3d36164f] | 23 | #include <sys/stat.h> |
---|
| 24 | |
---|
[d0c39838] | 25 | #include <assert.h> |
---|
[21275b58] | 26 | #include <fcntl.h> |
---|
| 27 | #include <mqueue.h> |
---|
[cef5675] | 28 | #include <pthread.h> |
---|
[21275b58] | 29 | #include <semaphore.h> |
---|
| 30 | #include <signal.h> |
---|
[d0c39838] | 31 | #include <stdlib.h> |
---|
[21275b58] | 32 | #include <string.h> |
---|
| 33 | #include <time.h> |
---|
[ca4602e] | 34 | #include <unistd.h> |
---|
[d0c39838] | 35 | |
---|
| 36 | #include <rtems.h> |
---|
[18ff889] | 37 | #include <rtems/ioimpl.h> |
---|
[d0c39838] | 38 | #include <rtems/libio_.h> |
---|
| 39 | #include <rtems/sysinit.h> |
---|
| 40 | |
---|
[92bb345] | 41 | #include <rtems/extensionimpl.h> |
---|
[e4e7f14] | 42 | #include <rtems/posix/barrierimpl.h> |
---|
[3015ed64] | 43 | #include <rtems/posix/mqueueimpl.h> |
---|
[9871f5dc] | 44 | #include <rtems/posix/muteximpl.h> |
---|
[bb3484c9] | 45 | #ifdef RTEMS_POSIX_API |
---|
[04436ae7] | 46 | #include <rtems/posix/psignalimpl.h> |
---|
[bb3484c9] | 47 | #endif /* RTEMS_POSIX_API */ |
---|
[ef1a985f] | 48 | #include <rtems/posix/pthreadimpl.h> |
---|
[76a8328] | 49 | #include <rtems/posix/rwlockimpl.h> |
---|
[2189b3e] | 50 | #include <rtems/posix/semaphoreimpl.h> |
---|
[ba776282] | 51 | #include <rtems/posix/shmimpl.h> |
---|
[bb3484c9] | 52 | #ifdef RTEMS_POSIX_API |
---|
[6c678557] | 53 | #include <rtems/posix/timerimpl.h> |
---|
[04436ae7] | 54 | #endif /* RTEMS_POSIX_API */ |
---|
[2605a489] | 55 | #include <rtems/posix/keyimpl.h> |
---|
[97d94ff] | 56 | #include <rtems/rtems/barrierimpl.h> |
---|
[af12278] | 57 | #include <rtems/rtems/dpmemimpl.h> |
---|
[ed8b00e6] | 58 | #include <rtems/rtems/messageimpl.h> |
---|
[fd3cc36f] | 59 | #include <rtems/rtems/partimpl.h> |
---|
[b377e3f] | 60 | #include <rtems/rtems/ratemonimpl.h> |
---|
[365456cc] | 61 | #include <rtems/rtems/regionimpl.h> |
---|
[cbaac1f7] | 62 | #include <rtems/rtems/semimpl.h> |
---|
[565672a] | 63 | #include <rtems/rtems/tasksimpl.h> |
---|
[26335844] | 64 | #include <rtems/rtems/timerimpl.h> |
---|
[36b86d7] | 65 | #include <rtems/score/apimutex.h> |
---|
[cef5675] | 66 | #include <rtems/score/chainimpl.h> |
---|
[d0c39838] | 67 | #include <rtems/score/sysstate.h> |
---|
[a853c851] | 68 | #include <rtems/score/userextimpl.h> |
---|
[d0c39838] | 69 | #include <rtems/score/wkspace.h> |
---|
| 70 | |
---|
| 71 | const char rtems_test_name[] = "SPSYSINIT 1"; |
---|
| 72 | |
---|
[36b86d7] | 73 | typedef enum { |
---|
[eea21eac] | 74 | WORKSPACE_PRE, |
---|
| 75 | WORKSPACE_POST, |
---|
[36b86d7] | 76 | BSP_START_PRE, |
---|
| 77 | BSP_START_POST, |
---|
[4c7b18e3] | 78 | CPU_COUNTER_PRE, |
---|
| 79 | CPU_COUNTER_POST, |
---|
[a853c851] | 80 | INITIAL_EXTENSIONS_PRE, |
---|
| 81 | INITIAL_EXTENSIONS_POST, |
---|
[36b86d7] | 82 | DATA_STRUCTURES_PRE, |
---|
| 83 | DATA_STRUCTURES_POST, |
---|
[92bb345] | 84 | USER_EXTENSIONS_PRE, |
---|
| 85 | USER_EXTENSIONS_POST, |
---|
[565672a] | 86 | CLASSIC_TASKS_PRE, |
---|
| 87 | CLASSIC_TASKS_POST, |
---|
[26335844] | 88 | CLASSIC_TIMER_PRE, |
---|
| 89 | CLASSIC_TIMER_POST, |
---|
[ed8b00e6] | 90 | CLASSIC_MESSAGE_QUEUE_PRE, |
---|
| 91 | CLASSIC_MESSAGE_QUEUE_POST, |
---|
[cbaac1f7] | 92 | CLASSIC_SEMAPHORE_PRE, |
---|
| 93 | CLASSIC_SEMAPHORE_POST, |
---|
[fd3cc36f] | 94 | CLASSIC_PARTITION_PRE, |
---|
| 95 | CLASSIC_PARTITION_POST, |
---|
[365456cc] | 96 | CLASSIC_REGION_PRE, |
---|
| 97 | CLASSIC_REGION_POST, |
---|
[af12278] | 98 | CLASSIC_DUAL_PORTED_MEMORY_PRE, |
---|
| 99 | CLASSIC_DUAL_PORTED_MEMORY_POST, |
---|
[b377e3f] | 100 | CLASSIC_RATE_MONOTONIC_PRE, |
---|
| 101 | CLASSIC_RATE_MONOTONIC_POST, |
---|
[97d94ff] | 102 | CLASSIC_BARRIER_PRE, |
---|
| 103 | CLASSIC_BARRIER_POST, |
---|
[04436ae7] | 104 | #ifdef RTEMS_POSIX_API |
---|
| 105 | POSIX_SIGNALS_PRE, |
---|
| 106 | POSIX_SIGNALS_POST, |
---|
[bb3484c9] | 107 | #endif /* RTEMS_POSIX_API */ |
---|
[ef1a985f] | 108 | POSIX_THREADS_PRE, |
---|
| 109 | POSIX_THREADS_POST, |
---|
[3015ed64] | 110 | POSIX_MESSAGE_QUEUE_PRE, |
---|
| 111 | POSIX_MESSAGE_QUEUE_POST, |
---|
[2189b3e] | 112 | POSIX_SEMAPHORE_PRE, |
---|
| 113 | POSIX_SEMAPHORE_POST, |
---|
[bb3484c9] | 114 | #ifdef RTEMS_POSIX_API |
---|
[6c678557] | 115 | POSIX_TIMER_PRE, |
---|
| 116 | POSIX_TIMER_POST, |
---|
[bb3484c9] | 117 | #endif /* RTEMS_POSIX_API */ |
---|
[ba776282] | 118 | POSIX_SHM_PRE, |
---|
| 119 | POSIX_SHM_POST, |
---|
[2605a489] | 120 | POSIX_KEYS_PRE, |
---|
| 121 | POSIX_KEYS_POST, |
---|
[6f6da82c] | 122 | POSIX_CLEANUP_PRE, |
---|
| 123 | POSIX_CLEANUP_POST, |
---|
[36b86d7] | 124 | IDLE_THREADS_PRE, |
---|
| 125 | IDLE_THREADS_POST, |
---|
[ca4602e] | 126 | LIBIO_PRE, |
---|
| 127 | LIBIO_POST, |
---|
[ba74ebde] | 128 | USER_ENVIRONMENT_PRE, |
---|
| 129 | USER_ENVIRONMENT_POST, |
---|
[3d36164f] | 130 | ROOT_FILESYSTEM_PRE, |
---|
| 131 | ROOT_FILESYSTEM_POST, |
---|
[36b86d7] | 132 | BSP_PRE_DRIVERS_PRE, |
---|
| 133 | BSP_PRE_DRIVERS_POST, |
---|
| 134 | DEVICE_DRIVERS_PRE, |
---|
| 135 | DEVICE_DRIVERS_POST, |
---|
[1ff8eca] | 136 | CLASSIC_USER_TASKS_PRE, |
---|
| 137 | CLASSIC_USER_TASKS_POST, |
---|
[4210114] | 138 | POSIX_USER_THREADS_PRE, |
---|
| 139 | POSIX_USER_THREADS_POST, |
---|
[ca4602e] | 140 | STD_FILE_DESCRIPTORS_PRE, |
---|
| 141 | STD_FILE_DESCRIPTORS_POST, |
---|
[bc47ec1c] | 142 | LAST_FIRST, |
---|
| 143 | LAST_SECOND, |
---|
| 144 | LAST_THIRD, |
---|
| 145 | LAST_FOURTH, |
---|
| 146 | LAST_FIFTH, |
---|
| 147 | LAST_SIXTH, |
---|
| 148 | LAST_SEVENTH, |
---|
| 149 | LAST_EIGHTH, |
---|
| 150 | LAST_NINETH, |
---|
| 151 | LAST_TENTH, |
---|
| 152 | LAST_MIDDLE, |
---|
[f7c5f94] | 153 | LAST_LAST_BUT_9, |
---|
| 154 | LAST_LAST_BUT_8, |
---|
| 155 | LAST_LAST_BUT_7, |
---|
| 156 | LAST_LAST_BUT_6, |
---|
| 157 | LAST_LAST_BUT_5, |
---|
| 158 | LAST_LAST_BUT_4, |
---|
| 159 | LAST_LAST_BUT_3, |
---|
| 160 | LAST_LAST_BUT_2, |
---|
| 161 | LAST_LAST_BUT_1, |
---|
[bc47ec1c] | 162 | LAST_LAST, |
---|
[36b86d7] | 163 | INIT_TASK, |
---|
| 164 | DONE |
---|
| 165 | } init_step; |
---|
| 166 | |
---|
[d0c39838] | 167 | #define FIRST(x) \ |
---|
| 168 | static void x##_first(void); \ |
---|
| 169 | RTEMS_SYSINIT_ITEM( \ |
---|
| 170 | x##_first, \ |
---|
| 171 | x, \ |
---|
| 172 | RTEMS_SYSINIT_ORDER_FIRST \ |
---|
| 173 | ); \ |
---|
| 174 | static void x##_first(void) |
---|
| 175 | |
---|
| 176 | #define LAST(x) \ |
---|
| 177 | static void x##_last(void); \ |
---|
| 178 | RTEMS_SYSINIT_ITEM( \ |
---|
| 179 | x##_last, \ |
---|
| 180 | x, \ |
---|
[e44ae80] | 181 | RTEMS_SYSINIT_ORDER_LAST_BUT_1 \ |
---|
[d0c39838] | 182 | ); \ |
---|
| 183 | static void x##_last(void) |
---|
| 184 | |
---|
[bc47ec1c] | 185 | #define LAST_STEP(x) \ |
---|
| 186 | static void last_##x(void) \ |
---|
| 187 | { \ |
---|
| 188 | next_step(LAST_##x); \ |
---|
| 189 | } \ |
---|
| 190 | RTEMS_SYSINIT_ITEM( \ |
---|
| 191 | last_##x, \ |
---|
| 192 | RTEMS_SYSINIT_LAST, \ |
---|
| 193 | RTEMS_SYSINIT_ORDER_##x \ |
---|
| 194 | ) |
---|
| 195 | |
---|
[36b86d7] | 196 | static init_step step; |
---|
[d0c39838] | 197 | |
---|
[36b86d7] | 198 | static void next_step(init_step expected) |
---|
[d0c39838] | 199 | { |
---|
| 200 | assert(step == expected); |
---|
| 201 | step = expected + 1; |
---|
| 202 | } |
---|
| 203 | |
---|
[21275b58] | 204 | static bool info_not_init(const Objects_Information *info) |
---|
| 205 | { |
---|
| 206 | return _Chain_Is_empty(&info->Inactive); |
---|
| 207 | } |
---|
| 208 | |
---|
| 209 | static bool info_is_init(const Objects_Information *info, size_t count) |
---|
| 210 | { |
---|
| 211 | return _Chain_Node_count_unprotected(&info->Inactive) == count; |
---|
| 212 | } |
---|
| 213 | |
---|
[eea21eac] | 214 | FIRST(RTEMS_SYSINIT_WORKSPACE) |
---|
[d0c39838] | 215 | { |
---|
| 216 | assert(_Workspace_Area.area_begin == 0); |
---|
[eea21eac] | 217 | next_step(WORKSPACE_PRE); |
---|
[d0c39838] | 218 | } |
---|
| 219 | |
---|
[eea21eac] | 220 | LAST(RTEMS_SYSINIT_WORKSPACE) |
---|
[d0c39838] | 221 | { |
---|
| 222 | assert(_Workspace_Area.area_begin != 0); |
---|
[eea21eac] | 223 | next_step(WORKSPACE_POST); |
---|
[d0c39838] | 224 | } |
---|
| 225 | |
---|
| 226 | FIRST(RTEMS_SYSINIT_BSP_START) |
---|
| 227 | { |
---|
| 228 | /* |
---|
| 229 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
| 230 | * and post conditions. |
---|
| 231 | */ |
---|
[36b86d7] | 232 | next_step(BSP_START_PRE); |
---|
[d0c39838] | 233 | } |
---|
| 234 | |
---|
| 235 | LAST(RTEMS_SYSINIT_BSP_START) |
---|
| 236 | { |
---|
[6a6a225] | 237 | /* |
---|
| 238 | * Some BSPs initialize the printk() support in bsp_start(). So, print begin |
---|
| 239 | * of test after bsp_start(). |
---|
| 240 | */ |
---|
| 241 | TEST_BEGIN(); |
---|
| 242 | |
---|
[36b86d7] | 243 | next_step(BSP_START_POST); |
---|
[d0c39838] | 244 | } |
---|
| 245 | |
---|
[4c7b18e3] | 246 | FIRST(RTEMS_SYSINIT_CPU_COUNTER) |
---|
| 247 | { |
---|
| 248 | /* |
---|
| 249 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
| 250 | * and post conditions. |
---|
| 251 | */ |
---|
| 252 | next_step(CPU_COUNTER_PRE); |
---|
| 253 | } |
---|
| 254 | |
---|
| 255 | LAST(RTEMS_SYSINIT_CPU_COUNTER) |
---|
| 256 | { |
---|
| 257 | next_step(CPU_COUNTER_POST); |
---|
| 258 | } |
---|
| 259 | |
---|
[a853c851] | 260 | FIRST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
| 261 | { |
---|
| 262 | assert(_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
| 263 | next_step(INITIAL_EXTENSIONS_PRE); |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
| 267 | { |
---|
| 268 | assert(!_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
| 269 | next_step(INITIAL_EXTENSIONS_POST); |
---|
| 270 | } |
---|
| 271 | |
---|
[d0c39838] | 272 | FIRST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
| 273 | { |
---|
[21275b58] | 274 | assert(info_not_init(&_Thread_Information.Objects)); |
---|
[36b86d7] | 275 | next_step(DATA_STRUCTURES_PRE); |
---|
[d0c39838] | 276 | } |
---|
| 277 | |
---|
| 278 | LAST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
[36b86d7] | 279 | { |
---|
[21275b58] | 280 | assert(info_is_init(&_Thread_Information.Objects, 1)); |
---|
[36b86d7] | 281 | next_step(DATA_STRUCTURES_POST); |
---|
| 282 | } |
---|
| 283 | |
---|
[92bb345] | 284 | FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
| 285 | { |
---|
[21275b58] | 286 | assert(info_not_init(&_Extension_Information)); |
---|
[92bb345] | 287 | next_step(USER_EXTENSIONS_PRE); |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | LAST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
| 291 | { |
---|
[21275b58] | 292 | assert(info_is_init(&_Extension_Information, 1)); |
---|
[92bb345] | 293 | next_step(USER_EXTENSIONS_POST); |
---|
| 294 | } |
---|
| 295 | |
---|
[565672a] | 296 | FIRST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
| 297 | { |
---|
[21275b58] | 298 | assert(info_not_init(&_RTEMS_tasks_Information.Objects)); |
---|
[565672a] | 299 | next_step(CLASSIC_TASKS_PRE); |
---|
| 300 | } |
---|
| 301 | |
---|
| 302 | LAST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
| 303 | { |
---|
[21275b58] | 304 | assert(info_is_init(&_RTEMS_tasks_Information.Objects, 2)); |
---|
[565672a] | 305 | next_step(CLASSIC_TASKS_POST); |
---|
| 306 | } |
---|
| 307 | |
---|
[26335844] | 308 | FIRST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
| 309 | { |
---|
[21275b58] | 310 | assert(info_not_init(&_Timer_Information)); |
---|
[26335844] | 311 | next_step(CLASSIC_TIMER_PRE); |
---|
| 312 | } |
---|
| 313 | |
---|
| 314 | LAST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
| 315 | { |
---|
[21275b58] | 316 | assert(info_is_init(&_Timer_Information, 1)); |
---|
[26335844] | 317 | next_step(CLASSIC_TIMER_POST); |
---|
| 318 | } |
---|
| 319 | |
---|
[ed8b00e6] | 320 | FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
| 321 | { |
---|
[21275b58] | 322 | assert(info_not_init(&_Message_queue_Information)); |
---|
[ed8b00e6] | 323 | next_step(CLASSIC_MESSAGE_QUEUE_PRE); |
---|
| 324 | } |
---|
| 325 | |
---|
| 326 | LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
| 327 | { |
---|
[21275b58] | 328 | assert(info_is_init(&_Message_queue_Information, 1)); |
---|
[ed8b00e6] | 329 | next_step(CLASSIC_MESSAGE_QUEUE_POST); |
---|
| 330 | } |
---|
| 331 | |
---|
[cbaac1f7] | 332 | FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
| 333 | { |
---|
[21275b58] | 334 | assert(_Semaphore_Information.initial_objects[0].id == 0); |
---|
[cbaac1f7] | 335 | next_step(CLASSIC_SEMAPHORE_PRE); |
---|
| 336 | } |
---|
| 337 | |
---|
| 338 | LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
| 339 | { |
---|
[21275b58] | 340 | assert(_Semaphore_Information.initial_objects[0].id != 0); |
---|
[cbaac1f7] | 341 | next_step(CLASSIC_SEMAPHORE_POST); |
---|
| 342 | } |
---|
| 343 | |
---|
[fd3cc36f] | 344 | FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
| 345 | { |
---|
[21275b58] | 346 | assert(info_not_init(&_Partition_Information)); |
---|
[fd3cc36f] | 347 | next_step(CLASSIC_PARTITION_PRE); |
---|
| 348 | } |
---|
| 349 | |
---|
| 350 | LAST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
| 351 | { |
---|
[21275b58] | 352 | assert(info_is_init(&_Partition_Information, 1)); |
---|
[fd3cc36f] | 353 | next_step(CLASSIC_PARTITION_POST); |
---|
| 354 | } |
---|
| 355 | |
---|
[365456cc] | 356 | FIRST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
| 357 | { |
---|
[21275b58] | 358 | assert(info_not_init(&_Region_Information)); |
---|
[365456cc] | 359 | next_step(CLASSIC_REGION_PRE); |
---|
| 360 | } |
---|
| 361 | |
---|
| 362 | LAST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
| 363 | { |
---|
[21275b58] | 364 | assert(info_is_init(&_Region_Information, 1)); |
---|
[365456cc] | 365 | next_step(CLASSIC_REGION_POST); |
---|
| 366 | } |
---|
| 367 | |
---|
[af12278] | 368 | FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
| 369 | { |
---|
[21275b58] | 370 | assert(info_not_init(&_Dual_ported_memory_Information)); |
---|
[af12278] | 371 | next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); |
---|
| 372 | } |
---|
| 373 | |
---|
| 374 | LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
| 375 | { |
---|
[21275b58] | 376 | assert(info_is_init(&_Dual_ported_memory_Information, 1)); |
---|
[af12278] | 377 | next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); |
---|
| 378 | } |
---|
| 379 | |
---|
[b377e3f] | 380 | FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
| 381 | { |
---|
[21275b58] | 382 | assert(info_not_init(&_Rate_monotonic_Information)); |
---|
[b377e3f] | 383 | next_step(CLASSIC_RATE_MONOTONIC_PRE); |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
| 387 | { |
---|
[21275b58] | 388 | assert(info_is_init(&_Rate_monotonic_Information, 1)); |
---|
[b377e3f] | 389 | next_step(CLASSIC_RATE_MONOTONIC_POST); |
---|
| 390 | } |
---|
| 391 | |
---|
[97d94ff] | 392 | FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
| 393 | { |
---|
[21275b58] | 394 | assert(info_not_init(&_Barrier_Information)); |
---|
[97d94ff] | 395 | next_step(CLASSIC_BARRIER_PRE); |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | LAST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
| 399 | { |
---|
[21275b58] | 400 | assert(info_is_init(&_Barrier_Information, 1)); |
---|
[97d94ff] | 401 | next_step(CLASSIC_BARRIER_POST); |
---|
| 402 | } |
---|
| 403 | |
---|
[04436ae7] | 404 | #ifdef RTEMS_POSIX_API |
---|
| 405 | FIRST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
| 406 | { |
---|
| 407 | assert( |
---|
| 408 | memcmp( |
---|
| 409 | &_POSIX_signals_Vectors, |
---|
| 410 | _POSIX_signals_Default_vectors, |
---|
| 411 | sizeof(_POSIX_signals_Vectors) |
---|
| 412 | ) != 0 |
---|
| 413 | ); |
---|
| 414 | next_step(POSIX_SIGNALS_PRE); |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | LAST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
| 418 | { |
---|
| 419 | assert( |
---|
| 420 | memcmp( |
---|
| 421 | &_POSIX_signals_Vectors, |
---|
| 422 | _POSIX_signals_Default_vectors, |
---|
| 423 | sizeof(_POSIX_signals_Vectors) |
---|
| 424 | ) == 0 |
---|
| 425 | ); |
---|
| 426 | next_step(POSIX_SIGNALS_POST); |
---|
| 427 | } |
---|
[bb3484c9] | 428 | #endif /* RTEMS_POSIX_API */ |
---|
[04436ae7] | 429 | |
---|
[ef1a985f] | 430 | FIRST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
| 431 | { |
---|
[21275b58] | 432 | assert(info_not_init(&_POSIX_Threads_Information.Objects)); |
---|
[ef1a985f] | 433 | next_step(POSIX_THREADS_PRE); |
---|
| 434 | } |
---|
| 435 | |
---|
| 436 | LAST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
| 437 | { |
---|
[21275b58] | 438 | assert(info_is_init(&_POSIX_Threads_Information.Objects, 1)); |
---|
[ef1a985f] | 439 | next_step(POSIX_THREADS_POST); |
---|
| 440 | } |
---|
| 441 | |
---|
[3015ed64] | 442 | FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
| 443 | { |
---|
[21275b58] | 444 | assert(info_not_init(&_POSIX_Message_queue_Information)); |
---|
[3015ed64] | 445 | next_step(POSIX_MESSAGE_QUEUE_PRE); |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
| 449 | { |
---|
[21275b58] | 450 | assert(info_is_init(&_POSIX_Message_queue_Information, 1)); |
---|
[3015ed64] | 451 | next_step(POSIX_MESSAGE_QUEUE_POST); |
---|
| 452 | } |
---|
| 453 | |
---|
[2189b3e] | 454 | FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
| 455 | { |
---|
[21275b58] | 456 | assert(info_not_init(&_POSIX_Semaphore_Information)); |
---|
[2189b3e] | 457 | next_step(POSIX_SEMAPHORE_PRE); |
---|
| 458 | } |
---|
| 459 | |
---|
| 460 | LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
| 461 | { |
---|
[21275b58] | 462 | assert(info_is_init(&_POSIX_Semaphore_Information, 1)); |
---|
[2189b3e] | 463 | next_step(POSIX_SEMAPHORE_POST); |
---|
| 464 | } |
---|
| 465 | |
---|
[bb3484c9] | 466 | #ifdef RTEMS_POSIX_API |
---|
[6c678557] | 467 | FIRST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
| 468 | { |
---|
[21275b58] | 469 | assert(info_not_init(&_POSIX_Timer_Information)); |
---|
[6c678557] | 470 | next_step(POSIX_TIMER_PRE); |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | LAST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
| 474 | { |
---|
[21275b58] | 475 | assert(info_is_init(&_POSIX_Timer_Information, 1)); |
---|
[6c678557] | 476 | next_step(POSIX_TIMER_POST); |
---|
| 477 | } |
---|
[bb3484c9] | 478 | #endif /* RTEMS_POSIX_API */ |
---|
[6c678557] | 479 | |
---|
[ba776282] | 480 | FIRST(RTEMS_SYSINIT_POSIX_SHM) |
---|
| 481 | { |
---|
[21275b58] | 482 | assert(info_not_init(&_POSIX_Shm_Information)); |
---|
[ba776282] | 483 | next_step(POSIX_SHM_PRE); |
---|
| 484 | } |
---|
| 485 | |
---|
| 486 | LAST(RTEMS_SYSINIT_POSIX_SHM) |
---|
| 487 | { |
---|
[21275b58] | 488 | assert(info_is_init(&_POSIX_Shm_Information, 1)); |
---|
[ba776282] | 489 | next_step(POSIX_SHM_POST); |
---|
| 490 | } |
---|
| 491 | |
---|
[cef5675] | 492 | static size_t user_extensions_pre_posix_cleanup; |
---|
| 493 | |
---|
| 494 | FIRST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
| 495 | { |
---|
| 496 | user_extensions_pre_posix_cleanup = |
---|
[bdf6cc2] | 497 | _Chain_Node_count_unprotected(&_User_extensions_List.Active); |
---|
[cef5675] | 498 | next_step(POSIX_CLEANUP_PRE); |
---|
| 499 | } |
---|
| 500 | |
---|
| 501 | LAST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
| 502 | { |
---|
| 503 | assert( |
---|
| 504 | user_extensions_pre_posix_cleanup + 1 == |
---|
[bdf6cc2] | 505 | _Chain_Node_count_unprotected(&_User_extensions_List.Active) |
---|
[cef5675] | 506 | ); |
---|
| 507 | next_step(POSIX_CLEANUP_POST); |
---|
| 508 | } |
---|
| 509 | |
---|
[2605a489] | 510 | FIRST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
| 511 | { |
---|
[21275b58] | 512 | assert(info_not_init(&_POSIX_Keys_Information)); |
---|
[2605a489] | 513 | next_step(POSIX_KEYS_PRE); |
---|
| 514 | } |
---|
| 515 | |
---|
| 516 | LAST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
| 517 | { |
---|
[ba74ebde] | 518 | assert(info_is_init(&_POSIX_Keys_Information, 1)); |
---|
[2605a489] | 519 | next_step(POSIX_KEYS_POST); |
---|
| 520 | } |
---|
| 521 | |
---|
[36b86d7] | 522 | FIRST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
| 523 | { |
---|
| 524 | assert(_System_state_Is_before_initialization(_System_state_Get())); |
---|
| 525 | next_step(IDLE_THREADS_PRE); |
---|
| 526 | } |
---|
| 527 | |
---|
| 528 | LAST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
[d0c39838] | 529 | { |
---|
| 530 | assert(_System_state_Is_before_multitasking(_System_state_Get())); |
---|
[36b86d7] | 531 | next_step(IDLE_THREADS_POST); |
---|
[d0c39838] | 532 | } |
---|
| 533 | |
---|
[ca4602e] | 534 | FIRST(RTEMS_SYSINIT_LIBIO) |
---|
[d0c39838] | 535 | { |
---|
[bc5b56a] | 536 | assert(rtems_libio_iop_free_head == NULL); |
---|
[ca4602e] | 537 | next_step(LIBIO_PRE); |
---|
[d0c39838] | 538 | } |
---|
| 539 | |
---|
[ca4602e] | 540 | LAST(RTEMS_SYSINIT_LIBIO) |
---|
[d0c39838] | 541 | { |
---|
[bc5b56a] | 542 | assert(rtems_libio_iop_free_head == &rtems_libio_iops[0]); |
---|
[ca4602e] | 543 | next_step(LIBIO_POST); |
---|
[d0c39838] | 544 | } |
---|
| 545 | |
---|
[ba74ebde] | 546 | static size_t user_extensions_pre_user_env; |
---|
| 547 | |
---|
| 548 | FIRST(RTEMS_SYSINIT_USER_ENVIRONMENT) |
---|
| 549 | { |
---|
| 550 | user_extensions_pre_user_env = |
---|
| 551 | _Chain_Node_count_unprotected(&_User_extensions_List.Active); |
---|
| 552 | next_step(USER_ENVIRONMENT_PRE); |
---|
| 553 | } |
---|
| 554 | |
---|
| 555 | LAST(RTEMS_SYSINIT_USER_ENVIRONMENT) |
---|
| 556 | { |
---|
| 557 | assert( |
---|
| 558 | user_extensions_pre_user_env + 1 == |
---|
| 559 | _Chain_Node_count_unprotected(&_User_extensions_List.Active) |
---|
| 560 | ); |
---|
| 561 | next_step(USER_ENVIRONMENT_POST); |
---|
| 562 | } |
---|
| 563 | |
---|
[3d36164f] | 564 | FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
| 565 | { |
---|
| 566 | struct stat st; |
---|
| 567 | int rv; |
---|
| 568 | |
---|
| 569 | rv = stat("/", &st); |
---|
| 570 | assert(rv == -1); |
---|
| 571 | next_step(ROOT_FILESYSTEM_PRE); |
---|
| 572 | } |
---|
| 573 | |
---|
| 574 | LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
| 575 | { |
---|
| 576 | struct stat st; |
---|
| 577 | int rv; |
---|
| 578 | |
---|
| 579 | rv = stat("/", &st); |
---|
| 580 | assert(rv == 0); |
---|
| 581 | next_step(ROOT_FILESYSTEM_POST); |
---|
| 582 | } |
---|
| 583 | |
---|
[d0c39838] | 584 | FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
| 585 | { |
---|
| 586 | /* |
---|
| 587 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
| 588 | * and post conditions. |
---|
| 589 | */ |
---|
[36b86d7] | 590 | next_step(BSP_PRE_DRIVERS_PRE); |
---|
[d0c39838] | 591 | } |
---|
| 592 | |
---|
| 593 | LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
| 594 | { |
---|
[36b86d7] | 595 | next_step(BSP_PRE_DRIVERS_POST); |
---|
[d0c39838] | 596 | } |
---|
| 597 | |
---|
| 598 | FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
| 599 | { |
---|
| 600 | assert(!_IO_All_drivers_initialized); |
---|
[36b86d7] | 601 | next_step(DEVICE_DRIVERS_PRE); |
---|
[d0c39838] | 602 | } |
---|
| 603 | |
---|
| 604 | LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
| 605 | { |
---|
| 606 | assert(_IO_All_drivers_initialized); |
---|
[36b86d7] | 607 | next_step(DEVICE_DRIVERS_POST); |
---|
[d0c39838] | 608 | } |
---|
| 609 | |
---|
[1ff8eca] | 610 | FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
| 611 | { |
---|
[1db9567] | 612 | _Objects_Allocator_lock(); |
---|
[1ff8eca] | 613 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0); |
---|
[1db9567] | 614 | _Objects_Allocator_unlock(); |
---|
[1ff8eca] | 615 | next_step(CLASSIC_USER_TASKS_PRE); |
---|
| 616 | } |
---|
| 617 | |
---|
| 618 | LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
| 619 | { |
---|
[1db9567] | 620 | _Objects_Allocator_lock(); |
---|
[1ff8eca] | 621 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1); |
---|
[1db9567] | 622 | _Objects_Allocator_unlock(); |
---|
[1ff8eca] | 623 | next_step(CLASSIC_USER_TASKS_POST); |
---|
| 624 | } |
---|
| 625 | |
---|
[4210114] | 626 | FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
| 627 | { |
---|
[1db9567] | 628 | _Objects_Allocator_lock(); |
---|
[4210114] | 629 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0); |
---|
[1db9567] | 630 | _Objects_Allocator_unlock(); |
---|
[4210114] | 631 | next_step(POSIX_USER_THREADS_PRE); |
---|
| 632 | } |
---|
| 633 | |
---|
| 634 | LAST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
| 635 | { |
---|
[1db9567] | 636 | _Objects_Allocator_lock(); |
---|
[4210114] | 637 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1); |
---|
[1db9567] | 638 | _Objects_Allocator_unlock(); |
---|
[4210114] | 639 | next_step(POSIX_USER_THREADS_POST); |
---|
| 640 | } |
---|
| 641 | |
---|
[ca4602e] | 642 | FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
[d0c39838] | 643 | { |
---|
[ca4602e] | 644 | struct stat st; |
---|
| 645 | int rv; |
---|
| 646 | |
---|
| 647 | rv = fstat(0, &st); |
---|
| 648 | assert(rv == -1); |
---|
| 649 | next_step(STD_FILE_DESCRIPTORS_PRE); |
---|
[d0c39838] | 650 | } |
---|
| 651 | |
---|
[ca4602e] | 652 | LAST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
[d0c39838] | 653 | { |
---|
[ca4602e] | 654 | struct stat st; |
---|
| 655 | int rv; |
---|
| 656 | |
---|
| 657 | rv = fstat(0, &st); |
---|
| 658 | assert(rv == 0); |
---|
| 659 | next_step(STD_FILE_DESCRIPTORS_POST); |
---|
[d0c39838] | 660 | } |
---|
| 661 | |
---|
[bc47ec1c] | 662 | LAST_STEP(FIRST); |
---|
| 663 | LAST_STEP(SECOND); |
---|
| 664 | LAST_STEP(THIRD); |
---|
| 665 | LAST_STEP(FOURTH); |
---|
| 666 | LAST_STEP(FIFTH); |
---|
| 667 | LAST_STEP(SIXTH); |
---|
| 668 | LAST_STEP(SEVENTH); |
---|
| 669 | LAST_STEP(EIGHTH); |
---|
| 670 | LAST_STEP(NINETH); |
---|
| 671 | LAST_STEP(TENTH); |
---|
| 672 | LAST_STEP(MIDDLE); |
---|
[f7c5f94] | 673 | LAST_STEP(LAST_BUT_9); |
---|
| 674 | LAST_STEP(LAST_BUT_8); |
---|
| 675 | LAST_STEP(LAST_BUT_7); |
---|
| 676 | LAST_STEP(LAST_BUT_6); |
---|
| 677 | LAST_STEP(LAST_BUT_5); |
---|
| 678 | LAST_STEP(LAST_BUT_4); |
---|
| 679 | LAST_STEP(LAST_BUT_3); |
---|
| 680 | LAST_STEP(LAST_BUT_2); |
---|
| 681 | LAST_STEP(LAST_BUT_1); |
---|
[bc47ec1c] | 682 | LAST_STEP(LAST); |
---|
| 683 | |
---|
[21275b58] | 684 | static void do_barrier_create(void) |
---|
| 685 | { |
---|
| 686 | rtems_status_code sc; |
---|
| 687 | rtems_id id; |
---|
| 688 | |
---|
| 689 | sc = rtems_barrier_create( |
---|
| 690 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 691 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 692 | 1, |
---|
| 693 | &id |
---|
| 694 | ); |
---|
| 695 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 696 | |
---|
| 697 | sc = rtems_barrier_delete(id); |
---|
| 698 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 699 | } |
---|
| 700 | |
---|
| 701 | static void do_extensions_create(void) |
---|
| 702 | { |
---|
| 703 | rtems_status_code sc; |
---|
| 704 | rtems_id id; |
---|
| 705 | rtems_extensions_table table; |
---|
| 706 | |
---|
| 707 | memset(&table, 0, sizeof(table)); |
---|
| 708 | sc = rtems_extension_create( |
---|
| 709 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 710 | &table, |
---|
| 711 | &id |
---|
| 712 | ); |
---|
| 713 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 714 | |
---|
| 715 | sc = rtems_extension_delete(id); |
---|
| 716 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 717 | } |
---|
| 718 | |
---|
| 719 | static void do_message_queue_create(void) |
---|
| 720 | { |
---|
| 721 | rtems_status_code sc; |
---|
| 722 | rtems_id id; |
---|
| 723 | |
---|
| 724 | sc = rtems_message_queue_create( |
---|
| 725 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 726 | 1, |
---|
| 727 | 1, |
---|
| 728 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 729 | &id |
---|
| 730 | ); |
---|
| 731 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 732 | |
---|
| 733 | sc = rtems_message_queue_delete(id); |
---|
| 734 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 735 | } |
---|
| 736 | |
---|
| 737 | static void do_partition_create(void) |
---|
| 738 | { |
---|
| 739 | rtems_status_code sc; |
---|
| 740 | rtems_id id; |
---|
| 741 | long buf[32]; |
---|
| 742 | |
---|
| 743 | sc = rtems_partition_create( |
---|
| 744 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 745 | buf, |
---|
| 746 | sizeof(buf), |
---|
| 747 | sizeof(buf), |
---|
| 748 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 749 | &id |
---|
| 750 | ); |
---|
| 751 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 752 | |
---|
| 753 | sc = rtems_partition_delete(id); |
---|
| 754 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 755 | } |
---|
| 756 | |
---|
| 757 | static void do_period_create(void) |
---|
| 758 | { |
---|
| 759 | rtems_status_code sc; |
---|
| 760 | rtems_id id; |
---|
| 761 | |
---|
| 762 | sc = rtems_rate_monotonic_create( |
---|
| 763 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 764 | &id |
---|
| 765 | ); |
---|
| 766 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 767 | |
---|
| 768 | sc = rtems_rate_monotonic_delete(id); |
---|
| 769 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 770 | } |
---|
| 771 | |
---|
| 772 | static void do_port_create(void) |
---|
| 773 | { |
---|
| 774 | rtems_status_code sc; |
---|
| 775 | rtems_id id; |
---|
| 776 | |
---|
| 777 | sc = rtems_port_create( |
---|
| 778 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 779 | NULL, |
---|
| 780 | NULL, |
---|
| 781 | 1, |
---|
| 782 | &id |
---|
| 783 | ); |
---|
| 784 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 785 | |
---|
| 786 | sc = rtems_port_delete(id); |
---|
| 787 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 788 | } |
---|
| 789 | |
---|
| 790 | static void do_region_create(void) |
---|
| 791 | { |
---|
| 792 | rtems_status_code sc; |
---|
| 793 | rtems_id id; |
---|
| 794 | long buf[32]; |
---|
| 795 | |
---|
| 796 | sc = rtems_region_create( |
---|
| 797 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 798 | buf, |
---|
| 799 | sizeof(buf), |
---|
| 800 | 1, |
---|
| 801 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 802 | &id |
---|
| 803 | ); |
---|
| 804 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 805 | |
---|
| 806 | sc = rtems_region_delete(id); |
---|
| 807 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 808 | } |
---|
| 809 | |
---|
| 810 | static void do_semaphore_create(void) |
---|
| 811 | { |
---|
| 812 | rtems_status_code sc; |
---|
| 813 | rtems_id id; |
---|
| 814 | |
---|
| 815 | sc = rtems_semaphore_create( |
---|
| 816 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 817 | 0, |
---|
| 818 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 819 | 0, |
---|
| 820 | &id |
---|
| 821 | ); |
---|
| 822 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 823 | |
---|
| 824 | sc = rtems_semaphore_delete(id); |
---|
| 825 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 826 | } |
---|
| 827 | |
---|
| 828 | static void do_task_create(void) |
---|
| 829 | { |
---|
| 830 | rtems_status_code sc; |
---|
| 831 | rtems_id id; |
---|
| 832 | |
---|
| 833 | sc = rtems_task_create( |
---|
| 834 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 835 | 1, |
---|
| 836 | RTEMS_MINIMUM_STACK_SIZE, |
---|
| 837 | RTEMS_DEFAULT_MODES, |
---|
| 838 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 839 | &id |
---|
| 840 | ); |
---|
| 841 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 842 | |
---|
| 843 | sc = rtems_task_delete(id); |
---|
| 844 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 845 | } |
---|
| 846 | |
---|
| 847 | static void do_timer_create(void) |
---|
| 848 | { |
---|
| 849 | rtems_status_code sc; |
---|
| 850 | rtems_id id; |
---|
| 851 | |
---|
| 852 | sc = rtems_timer_create(rtems_build_name('T', 'E', 'S', 'T'), &id); |
---|
| 853 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 854 | |
---|
| 855 | sc = rtems_timer_delete(id); |
---|
| 856 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 857 | } |
---|
| 858 | |
---|
| 859 | static void do_cleanup_push_pop(void) |
---|
[d0c39838] | 860 | { |
---|
[cef5675] | 861 | pthread_cleanup_push(NULL, NULL); |
---|
| 862 | pthread_cleanup_pop(0); |
---|
[21275b58] | 863 | } |
---|
| 864 | |
---|
[ba74ebde] | 865 | static void do_posix_key_create(void) |
---|
| 866 | { |
---|
| 867 | pthread_key_t key; |
---|
| 868 | int eno; |
---|
| 869 | |
---|
| 870 | eno = pthread_key_create(&key, NULL); |
---|
| 871 | rtems_test_assert(eno == 0); |
---|
| 872 | |
---|
| 873 | eno = pthread_key_delete(key); |
---|
| 874 | rtems_test_assert(eno == 0); |
---|
| 875 | } |
---|
| 876 | |
---|
[21275b58] | 877 | static void do_posix_mq_open(void) |
---|
| 878 | { |
---|
| 879 | struct mq_attr attr; |
---|
| 880 | mqd_t mq; |
---|
| 881 | int rv; |
---|
| 882 | |
---|
| 883 | memset(&attr, 0, sizeof(attr)); |
---|
| 884 | attr.mq_maxmsg = 1; |
---|
| 885 | attr.mq_msgsize = 1; |
---|
| 886 | mq = mq_open("mq", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, &attr); |
---|
| 887 | rtems_test_assert(mq != (mqd_t) -1); |
---|
| 888 | |
---|
| 889 | rv = mq_close(mq); |
---|
| 890 | rtems_test_assert(rv == 0); |
---|
| 891 | |
---|
| 892 | rv = mq_unlink("mq"); |
---|
| 893 | rtems_test_assert(rv == 0); |
---|
| 894 | } |
---|
| 895 | |
---|
| 896 | static void do_posix_sem_open(void) |
---|
| 897 | { |
---|
| 898 | sem_t *sem; |
---|
| 899 | int rv; |
---|
| 900 | |
---|
| 901 | sem = sem_open("sem", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); |
---|
| 902 | rtems_test_assert(sem != SEM_FAILED); |
---|
| 903 | |
---|
| 904 | rv = sem_close(sem); |
---|
| 905 | rtems_test_assert(rv == 0); |
---|
| 906 | |
---|
| 907 | rv = sem_unlink("sem"); |
---|
| 908 | rtems_test_assert(rv == 0); |
---|
| 909 | } |
---|
| 910 | |
---|
| 911 | static void do_posix_shm_open(void) |
---|
| 912 | { |
---|
| 913 | int fd; |
---|
| 914 | int rv; |
---|
| 915 | |
---|
| 916 | fd = shm_open("/shm", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); |
---|
| 917 | rtems_test_assert(fd >= 0); |
---|
| 918 | |
---|
| 919 | rv = close(fd); |
---|
| 920 | rtems_test_assert(rv == 0); |
---|
| 921 | |
---|
| 922 | rv = shm_unlink("/shm"); |
---|
| 923 | rtems_test_assert(rv == 0); |
---|
| 924 | } |
---|
| 925 | |
---|
| 926 | static void do_posix_timer_create(void) |
---|
| 927 | { |
---|
| 928 | #ifdef RTEMS_POSIX_API |
---|
| 929 | int rv; |
---|
| 930 | timer_t timer; |
---|
| 931 | |
---|
| 932 | rv = timer_create(CLOCK_REALTIME, NULL, &timer); |
---|
| 933 | rtems_test_assert(rv == 0); |
---|
| 934 | |
---|
| 935 | rv = timer_delete(timer); |
---|
| 936 | rtems_test_assert(rv == 0); |
---|
| 937 | #endif /* RTEMS_POSIX_API */ |
---|
| 938 | } |
---|
| 939 | |
---|
[9bdb6aa3] | 940 | static void check_config(void) |
---|
| 941 | { |
---|
| 942 | const rtems_api_configuration_table *config; |
---|
| 943 | |
---|
| 944 | config = rtems_configuration_get_rtems_api_configuration(); |
---|
| 945 | |
---|
| 946 | rtems_test_assert(!config->notepads_enabled); |
---|
| 947 | rtems_test_assert(config->maximum_tasks == 2); |
---|
| 948 | rtems_test_assert(config->maximum_timers == 1); |
---|
| 949 | rtems_test_assert(config->maximum_semaphores == 1); |
---|
| 950 | rtems_test_assert(config->maximum_message_queues == 1); |
---|
| 951 | rtems_test_assert(config->maximum_partitions == 1); |
---|
| 952 | rtems_test_assert(config->maximum_regions == 1); |
---|
| 953 | rtems_test_assert(config->maximum_ports == 1); |
---|
| 954 | rtems_test_assert(config->maximum_periods == 1); |
---|
| 955 | rtems_test_assert(config->maximum_barriers == 1); |
---|
| 956 | rtems_test_assert(config->number_of_initialization_tasks == 1); |
---|
| 957 | rtems_test_assert(config->User_initialization_tasks_table != NULL); |
---|
| 958 | } |
---|
| 959 | |
---|
[ba74ebde] | 960 | static void do_use_global_user_env(void) |
---|
| 961 | { |
---|
| 962 | rtems_libio_use_global_env(); |
---|
| 963 | } |
---|
| 964 | |
---|
[21275b58] | 965 | static void Init(rtems_task_argument arg) |
---|
| 966 | { |
---|
[36b86d7] | 967 | next_step(INIT_TASK); |
---|
[21275b58] | 968 | do_barrier_create(); |
---|
| 969 | do_extensions_create(); |
---|
| 970 | do_message_queue_create(); |
---|
| 971 | do_partition_create(); |
---|
| 972 | do_period_create(); |
---|
| 973 | do_port_create(); |
---|
| 974 | do_region_create(); |
---|
| 975 | do_semaphore_create(); |
---|
| 976 | do_task_create(); |
---|
| 977 | do_timer_create(); |
---|
| 978 | do_cleanup_push_pop(); |
---|
[ba74ebde] | 979 | do_posix_key_create(); |
---|
[21275b58] | 980 | do_posix_mq_open(); |
---|
| 981 | do_posix_sem_open(); |
---|
| 982 | do_posix_shm_open(); |
---|
| 983 | do_posix_timer_create(); |
---|
[ba74ebde] | 984 | do_use_global_user_env(); |
---|
[9bdb6aa3] | 985 | check_config(); |
---|
[24d0ee57] | 986 | TEST_END(); |
---|
[d0c39838] | 987 | exit(0); |
---|
| 988 | } |
---|
| 989 | |
---|
[4210114] | 990 | static void *POSIX_Init(void *arg) |
---|
| 991 | { |
---|
| 992 | return NULL; |
---|
| 993 | } |
---|
| 994 | |
---|
[d0c39838] | 995 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
[21275b58] | 996 | |
---|
[c4b8b147] | 997 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
[d0c39838] | 998 | |
---|
[3cec2df] | 999 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 4 |
---|
[21275b58] | 1000 | |
---|
[92bb345] | 1001 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
| 1002 | |
---|
[97d94ff] | 1003 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
| 1004 | |
---|
[ed8b00e6] | 1005 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
| 1006 | |
---|
[fd3cc36f] | 1007 | #define CONFIGURE_MAXIMUM_PARTITIONS 1 |
---|
| 1008 | |
---|
[b377e3f] | 1009 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
---|
| 1010 | |
---|
[af12278] | 1011 | #define CONFIGURE_MAXIMUM_PORTS 1 |
---|
| 1012 | |
---|
[365456cc] | 1013 | #define CONFIGURE_MAXIMUM_REGIONS 1 |
---|
| 1014 | |
---|
[cbaac1f7] | 1015 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
| 1016 | |
---|
[21275b58] | 1017 | #define CONFIGURE_MAXIMUM_TASKS 2 |
---|
[d0c39838] | 1018 | |
---|
[26335844] | 1019 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
| 1020 | |
---|
[3015ed64] | 1021 | #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 |
---|
| 1022 | |
---|
[2189b3e] | 1023 | #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1 |
---|
| 1024 | |
---|
[ba776282] | 1025 | #define CONFIGURE_MAXIMUM_POSIX_SHMS 1 |
---|
| 1026 | |
---|
[bb3484c9] | 1027 | #ifdef RTEMS_POSIX_API |
---|
[6c678557] | 1028 | #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 |
---|
[bb3484c9] | 1029 | #endif /* RTEMS_POSIX_API */ |
---|
[6c678557] | 1030 | |
---|
[ef1a985f] | 1031 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
| 1032 | |
---|
[4210114] | 1033 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
| 1034 | |
---|
[2605a489] | 1035 | #define CONFIGURE_MAXIMUM_POSIX_KEYS 1 |
---|
| 1036 | |
---|
[21275b58] | 1037 | #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ |
---|
| 1038 | CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1) |
---|
| 1039 | |
---|
[d0c39838] | 1040 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
| 1041 | |
---|
[a853c851] | 1042 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
| 1043 | |
---|
[e44ae80] | 1044 | #define CONFIGURE_VERBOSE_SYSTEM_INITIALIZATION |
---|
| 1045 | |
---|
[d0c39838] | 1046 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
| 1047 | |
---|
| 1048 | #define CONFIGURE_INIT |
---|
| 1049 | |
---|
| 1050 | #include <rtems/confdefs.h> |
---|