[d0c39838] | 1 | /* |
---|
[4c7b18e3] | 2 | * Copyright (c) 2015, 2018 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, |
---|
[3d36164f] | 128 | ROOT_FILESYSTEM_PRE, |
---|
| 129 | ROOT_FILESYSTEM_POST, |
---|
[36b86d7] | 130 | BSP_PRE_DRIVERS_PRE, |
---|
| 131 | BSP_PRE_DRIVERS_POST, |
---|
| 132 | DEVICE_DRIVERS_PRE, |
---|
| 133 | DEVICE_DRIVERS_POST, |
---|
[1ff8eca] | 134 | CLASSIC_USER_TASKS_PRE, |
---|
| 135 | CLASSIC_USER_TASKS_POST, |
---|
[4210114] | 136 | POSIX_USER_THREADS_PRE, |
---|
| 137 | POSIX_USER_THREADS_POST, |
---|
[ca4602e] | 138 | STD_FILE_DESCRIPTORS_PRE, |
---|
| 139 | STD_FILE_DESCRIPTORS_POST, |
---|
[bc47ec1c] | 140 | LAST_FIRST, |
---|
| 141 | LAST_SECOND, |
---|
| 142 | LAST_THIRD, |
---|
| 143 | LAST_FOURTH, |
---|
| 144 | LAST_FIFTH, |
---|
| 145 | LAST_SIXTH, |
---|
| 146 | LAST_SEVENTH, |
---|
| 147 | LAST_EIGHTH, |
---|
| 148 | LAST_NINETH, |
---|
| 149 | LAST_TENTH, |
---|
| 150 | LAST_MIDDLE, |
---|
| 151 | LAST_LAST, |
---|
[36b86d7] | 152 | INIT_TASK, |
---|
| 153 | DONE |
---|
| 154 | } init_step; |
---|
| 155 | |
---|
[d0c39838] | 156 | #define FIRST(x) \ |
---|
| 157 | static void x##_first(void); \ |
---|
| 158 | RTEMS_SYSINIT_ITEM( \ |
---|
| 159 | x##_first, \ |
---|
| 160 | x, \ |
---|
| 161 | RTEMS_SYSINIT_ORDER_FIRST \ |
---|
| 162 | ); \ |
---|
| 163 | static void x##_first(void) |
---|
| 164 | |
---|
| 165 | #define LAST(x) \ |
---|
| 166 | static void x##_last(void); \ |
---|
| 167 | RTEMS_SYSINIT_ITEM( \ |
---|
| 168 | x##_last, \ |
---|
| 169 | x, \ |
---|
| 170 | RTEMS_SYSINIT_ORDER_LAST \ |
---|
| 171 | ); \ |
---|
| 172 | static void x##_last(void) |
---|
| 173 | |
---|
[bc47ec1c] | 174 | #define LAST_STEP(x) \ |
---|
| 175 | static void last_##x(void) \ |
---|
| 176 | { \ |
---|
| 177 | next_step(LAST_##x); \ |
---|
| 178 | } \ |
---|
| 179 | RTEMS_SYSINIT_ITEM( \ |
---|
| 180 | last_##x, \ |
---|
| 181 | RTEMS_SYSINIT_LAST, \ |
---|
| 182 | RTEMS_SYSINIT_ORDER_##x \ |
---|
| 183 | ) |
---|
| 184 | |
---|
[36b86d7] | 185 | static init_step step; |
---|
[d0c39838] | 186 | |
---|
[36b86d7] | 187 | static void next_step(init_step expected) |
---|
[d0c39838] | 188 | { |
---|
| 189 | assert(step == expected); |
---|
| 190 | step = expected + 1; |
---|
| 191 | } |
---|
| 192 | |
---|
[21275b58] | 193 | static bool info_not_init(const Objects_Information *info) |
---|
| 194 | { |
---|
| 195 | return _Chain_Is_empty(&info->Inactive); |
---|
| 196 | } |
---|
| 197 | |
---|
| 198 | static bool info_is_init(const Objects_Information *info, size_t count) |
---|
| 199 | { |
---|
| 200 | return _Chain_Node_count_unprotected(&info->Inactive) == count; |
---|
| 201 | } |
---|
| 202 | |
---|
[eea21eac] | 203 | FIRST(RTEMS_SYSINIT_WORKSPACE) |
---|
[d0c39838] | 204 | { |
---|
| 205 | assert(_Workspace_Area.area_begin == 0); |
---|
[eea21eac] | 206 | next_step(WORKSPACE_PRE); |
---|
[d0c39838] | 207 | } |
---|
| 208 | |
---|
[eea21eac] | 209 | LAST(RTEMS_SYSINIT_WORKSPACE) |
---|
[d0c39838] | 210 | { |
---|
| 211 | assert(_Workspace_Area.area_begin != 0); |
---|
[eea21eac] | 212 | next_step(WORKSPACE_POST); |
---|
[d0c39838] | 213 | } |
---|
| 214 | |
---|
| 215 | FIRST(RTEMS_SYSINIT_BSP_START) |
---|
| 216 | { |
---|
| 217 | /* |
---|
| 218 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
| 219 | * and post conditions. |
---|
| 220 | */ |
---|
[36b86d7] | 221 | next_step(BSP_START_PRE); |
---|
[d0c39838] | 222 | } |
---|
| 223 | |
---|
| 224 | LAST(RTEMS_SYSINIT_BSP_START) |
---|
| 225 | { |
---|
[6a6a225] | 226 | /* |
---|
| 227 | * Some BSPs initialize the printk() support in bsp_start(). So, print begin |
---|
| 228 | * of test after bsp_start(). |
---|
| 229 | */ |
---|
| 230 | TEST_BEGIN(); |
---|
| 231 | |
---|
[36b86d7] | 232 | next_step(BSP_START_POST); |
---|
[d0c39838] | 233 | } |
---|
| 234 | |
---|
[4c7b18e3] | 235 | FIRST(RTEMS_SYSINIT_CPU_COUNTER) |
---|
| 236 | { |
---|
| 237 | /* |
---|
| 238 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
| 239 | * and post conditions. |
---|
| 240 | */ |
---|
| 241 | next_step(CPU_COUNTER_PRE); |
---|
| 242 | } |
---|
| 243 | |
---|
| 244 | LAST(RTEMS_SYSINIT_CPU_COUNTER) |
---|
| 245 | { |
---|
| 246 | next_step(CPU_COUNTER_POST); |
---|
| 247 | } |
---|
| 248 | |
---|
[a853c851] | 249 | FIRST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
| 250 | { |
---|
| 251 | assert(_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
| 252 | next_step(INITIAL_EXTENSIONS_PRE); |
---|
| 253 | } |
---|
| 254 | |
---|
| 255 | LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
| 256 | { |
---|
| 257 | assert(!_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
| 258 | next_step(INITIAL_EXTENSIONS_POST); |
---|
| 259 | } |
---|
| 260 | |
---|
[d0c39838] | 261 | FIRST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
| 262 | { |
---|
[21275b58] | 263 | assert(info_not_init(&_Thread_Information.Objects)); |
---|
[36b86d7] | 264 | next_step(DATA_STRUCTURES_PRE); |
---|
[d0c39838] | 265 | } |
---|
| 266 | |
---|
| 267 | LAST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
[36b86d7] | 268 | { |
---|
[21275b58] | 269 | assert(info_is_init(&_Thread_Information.Objects, 1)); |
---|
[36b86d7] | 270 | next_step(DATA_STRUCTURES_POST); |
---|
| 271 | } |
---|
| 272 | |
---|
[92bb345] | 273 | FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
| 274 | { |
---|
[21275b58] | 275 | assert(info_not_init(&_Extension_Information)); |
---|
[92bb345] | 276 | next_step(USER_EXTENSIONS_PRE); |
---|
| 277 | } |
---|
| 278 | |
---|
| 279 | LAST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
| 280 | { |
---|
[21275b58] | 281 | assert(info_is_init(&_Extension_Information, 1)); |
---|
[92bb345] | 282 | next_step(USER_EXTENSIONS_POST); |
---|
| 283 | } |
---|
| 284 | |
---|
[565672a] | 285 | FIRST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
| 286 | { |
---|
[21275b58] | 287 | assert(info_not_init(&_RTEMS_tasks_Information.Objects)); |
---|
[565672a] | 288 | next_step(CLASSIC_TASKS_PRE); |
---|
| 289 | } |
---|
| 290 | |
---|
| 291 | LAST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
| 292 | { |
---|
[21275b58] | 293 | assert(info_is_init(&_RTEMS_tasks_Information.Objects, 2)); |
---|
[565672a] | 294 | next_step(CLASSIC_TASKS_POST); |
---|
| 295 | } |
---|
| 296 | |
---|
[26335844] | 297 | FIRST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
| 298 | { |
---|
[21275b58] | 299 | assert(info_not_init(&_Timer_Information)); |
---|
[26335844] | 300 | next_step(CLASSIC_TIMER_PRE); |
---|
| 301 | } |
---|
| 302 | |
---|
| 303 | LAST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
| 304 | { |
---|
[21275b58] | 305 | assert(info_is_init(&_Timer_Information, 1)); |
---|
[26335844] | 306 | next_step(CLASSIC_TIMER_POST); |
---|
| 307 | } |
---|
| 308 | |
---|
[ed8b00e6] | 309 | FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
| 310 | { |
---|
[21275b58] | 311 | assert(info_not_init(&_Message_queue_Information)); |
---|
[ed8b00e6] | 312 | next_step(CLASSIC_MESSAGE_QUEUE_PRE); |
---|
| 313 | } |
---|
| 314 | |
---|
| 315 | LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
| 316 | { |
---|
[21275b58] | 317 | assert(info_is_init(&_Message_queue_Information, 1)); |
---|
[ed8b00e6] | 318 | next_step(CLASSIC_MESSAGE_QUEUE_POST); |
---|
| 319 | } |
---|
| 320 | |
---|
[cbaac1f7] | 321 | FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
| 322 | { |
---|
[21275b58] | 323 | assert(_Semaphore_Information.initial_objects[0].id == 0); |
---|
[cbaac1f7] | 324 | next_step(CLASSIC_SEMAPHORE_PRE); |
---|
| 325 | } |
---|
| 326 | |
---|
| 327 | LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
| 328 | { |
---|
[21275b58] | 329 | assert(_Semaphore_Information.initial_objects[0].id != 0); |
---|
[cbaac1f7] | 330 | next_step(CLASSIC_SEMAPHORE_POST); |
---|
| 331 | } |
---|
| 332 | |
---|
[fd3cc36f] | 333 | FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
| 334 | { |
---|
[21275b58] | 335 | assert(info_not_init(&_Partition_Information)); |
---|
[fd3cc36f] | 336 | next_step(CLASSIC_PARTITION_PRE); |
---|
| 337 | } |
---|
| 338 | |
---|
| 339 | LAST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
| 340 | { |
---|
[21275b58] | 341 | assert(info_is_init(&_Partition_Information, 1)); |
---|
[fd3cc36f] | 342 | next_step(CLASSIC_PARTITION_POST); |
---|
| 343 | } |
---|
| 344 | |
---|
[365456cc] | 345 | FIRST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
| 346 | { |
---|
[21275b58] | 347 | assert(info_not_init(&_Region_Information)); |
---|
[365456cc] | 348 | next_step(CLASSIC_REGION_PRE); |
---|
| 349 | } |
---|
| 350 | |
---|
| 351 | LAST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
| 352 | { |
---|
[21275b58] | 353 | assert(info_is_init(&_Region_Information, 1)); |
---|
[365456cc] | 354 | next_step(CLASSIC_REGION_POST); |
---|
| 355 | } |
---|
| 356 | |
---|
[af12278] | 357 | FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
| 358 | { |
---|
[21275b58] | 359 | assert(info_not_init(&_Dual_ported_memory_Information)); |
---|
[af12278] | 360 | next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); |
---|
| 361 | } |
---|
| 362 | |
---|
| 363 | LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
| 364 | { |
---|
[21275b58] | 365 | assert(info_is_init(&_Dual_ported_memory_Information, 1)); |
---|
[af12278] | 366 | next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); |
---|
| 367 | } |
---|
| 368 | |
---|
[b377e3f] | 369 | FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
| 370 | { |
---|
[21275b58] | 371 | assert(info_not_init(&_Rate_monotonic_Information)); |
---|
[b377e3f] | 372 | next_step(CLASSIC_RATE_MONOTONIC_PRE); |
---|
| 373 | } |
---|
| 374 | |
---|
| 375 | LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
| 376 | { |
---|
[21275b58] | 377 | assert(info_is_init(&_Rate_monotonic_Information, 1)); |
---|
[b377e3f] | 378 | next_step(CLASSIC_RATE_MONOTONIC_POST); |
---|
| 379 | } |
---|
| 380 | |
---|
[97d94ff] | 381 | FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
| 382 | { |
---|
[21275b58] | 383 | assert(info_not_init(&_Barrier_Information)); |
---|
[97d94ff] | 384 | next_step(CLASSIC_BARRIER_PRE); |
---|
| 385 | } |
---|
| 386 | |
---|
| 387 | LAST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
| 388 | { |
---|
[21275b58] | 389 | assert(info_is_init(&_Barrier_Information, 1)); |
---|
[97d94ff] | 390 | next_step(CLASSIC_BARRIER_POST); |
---|
| 391 | } |
---|
| 392 | |
---|
[04436ae7] | 393 | #ifdef RTEMS_POSIX_API |
---|
| 394 | FIRST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
| 395 | { |
---|
| 396 | assert( |
---|
| 397 | memcmp( |
---|
| 398 | &_POSIX_signals_Vectors, |
---|
| 399 | _POSIX_signals_Default_vectors, |
---|
| 400 | sizeof(_POSIX_signals_Vectors) |
---|
| 401 | ) != 0 |
---|
| 402 | ); |
---|
| 403 | next_step(POSIX_SIGNALS_PRE); |
---|
| 404 | } |
---|
| 405 | |
---|
| 406 | LAST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
| 407 | { |
---|
| 408 | assert( |
---|
| 409 | memcmp( |
---|
| 410 | &_POSIX_signals_Vectors, |
---|
| 411 | _POSIX_signals_Default_vectors, |
---|
| 412 | sizeof(_POSIX_signals_Vectors) |
---|
| 413 | ) == 0 |
---|
| 414 | ); |
---|
| 415 | next_step(POSIX_SIGNALS_POST); |
---|
| 416 | } |
---|
[bb3484c9] | 417 | #endif /* RTEMS_POSIX_API */ |
---|
[04436ae7] | 418 | |
---|
[ef1a985f] | 419 | FIRST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
| 420 | { |
---|
[21275b58] | 421 | assert(info_not_init(&_POSIX_Threads_Information.Objects)); |
---|
[ef1a985f] | 422 | next_step(POSIX_THREADS_PRE); |
---|
| 423 | } |
---|
| 424 | |
---|
| 425 | LAST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
| 426 | { |
---|
[21275b58] | 427 | assert(info_is_init(&_POSIX_Threads_Information.Objects, 1)); |
---|
[ef1a985f] | 428 | next_step(POSIX_THREADS_POST); |
---|
| 429 | } |
---|
| 430 | |
---|
[3015ed64] | 431 | FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
| 432 | { |
---|
[21275b58] | 433 | assert(info_not_init(&_POSIX_Message_queue_Information)); |
---|
[3015ed64] | 434 | next_step(POSIX_MESSAGE_QUEUE_PRE); |
---|
| 435 | } |
---|
| 436 | |
---|
| 437 | LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
| 438 | { |
---|
[21275b58] | 439 | assert(info_is_init(&_POSIX_Message_queue_Information, 1)); |
---|
[3015ed64] | 440 | next_step(POSIX_MESSAGE_QUEUE_POST); |
---|
| 441 | } |
---|
| 442 | |
---|
[2189b3e] | 443 | FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
| 444 | { |
---|
[21275b58] | 445 | assert(info_not_init(&_POSIX_Semaphore_Information)); |
---|
[2189b3e] | 446 | next_step(POSIX_SEMAPHORE_PRE); |
---|
| 447 | } |
---|
| 448 | |
---|
| 449 | LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
| 450 | { |
---|
[21275b58] | 451 | assert(info_is_init(&_POSIX_Semaphore_Information, 1)); |
---|
[2189b3e] | 452 | next_step(POSIX_SEMAPHORE_POST); |
---|
| 453 | } |
---|
| 454 | |
---|
[bb3484c9] | 455 | #ifdef RTEMS_POSIX_API |
---|
[6c678557] | 456 | FIRST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
| 457 | { |
---|
[21275b58] | 458 | assert(info_not_init(&_POSIX_Timer_Information)); |
---|
[6c678557] | 459 | next_step(POSIX_TIMER_PRE); |
---|
| 460 | } |
---|
| 461 | |
---|
| 462 | LAST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
| 463 | { |
---|
[21275b58] | 464 | assert(info_is_init(&_POSIX_Timer_Information, 1)); |
---|
[6c678557] | 465 | next_step(POSIX_TIMER_POST); |
---|
| 466 | } |
---|
[bb3484c9] | 467 | #endif /* RTEMS_POSIX_API */ |
---|
[6c678557] | 468 | |
---|
[ba776282] | 469 | FIRST(RTEMS_SYSINIT_POSIX_SHM) |
---|
| 470 | { |
---|
[21275b58] | 471 | assert(info_not_init(&_POSIX_Shm_Information)); |
---|
[ba776282] | 472 | next_step(POSIX_SHM_PRE); |
---|
| 473 | } |
---|
| 474 | |
---|
| 475 | LAST(RTEMS_SYSINIT_POSIX_SHM) |
---|
| 476 | { |
---|
[21275b58] | 477 | assert(info_is_init(&_POSIX_Shm_Information, 1)); |
---|
[ba776282] | 478 | next_step(POSIX_SHM_POST); |
---|
| 479 | } |
---|
| 480 | |
---|
[cef5675] | 481 | static size_t user_extensions_pre_posix_cleanup; |
---|
| 482 | |
---|
| 483 | FIRST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
| 484 | { |
---|
| 485 | user_extensions_pre_posix_cleanup = |
---|
[bdf6cc2] | 486 | _Chain_Node_count_unprotected(&_User_extensions_List.Active); |
---|
[cef5675] | 487 | next_step(POSIX_CLEANUP_PRE); |
---|
| 488 | } |
---|
| 489 | |
---|
| 490 | LAST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
| 491 | { |
---|
| 492 | assert( |
---|
| 493 | user_extensions_pre_posix_cleanup + 1 == |
---|
[bdf6cc2] | 494 | _Chain_Node_count_unprotected(&_User_extensions_List.Active) |
---|
[cef5675] | 495 | ); |
---|
| 496 | next_step(POSIX_CLEANUP_POST); |
---|
| 497 | } |
---|
| 498 | |
---|
[2605a489] | 499 | FIRST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
| 500 | { |
---|
[21275b58] | 501 | assert(info_not_init(&_POSIX_Keys_Information)); |
---|
[2605a489] | 502 | next_step(POSIX_KEYS_PRE); |
---|
| 503 | } |
---|
| 504 | |
---|
| 505 | LAST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
| 506 | { |
---|
[21275b58] | 507 | assert(info_is_init(&_POSIX_Keys_Information, 2)); |
---|
[2605a489] | 508 | next_step(POSIX_KEYS_POST); |
---|
| 509 | } |
---|
| 510 | |
---|
[36b86d7] | 511 | FIRST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
| 512 | { |
---|
| 513 | assert(_System_state_Is_before_initialization(_System_state_Get())); |
---|
| 514 | next_step(IDLE_THREADS_PRE); |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | LAST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
[d0c39838] | 518 | { |
---|
| 519 | assert(_System_state_Is_before_multitasking(_System_state_Get())); |
---|
[36b86d7] | 520 | next_step(IDLE_THREADS_POST); |
---|
[d0c39838] | 521 | } |
---|
| 522 | |
---|
[ca4602e] | 523 | FIRST(RTEMS_SYSINIT_LIBIO) |
---|
[d0c39838] | 524 | { |
---|
[bc5b56a] | 525 | assert(rtems_libio_iop_free_head == NULL); |
---|
[ca4602e] | 526 | next_step(LIBIO_PRE); |
---|
[d0c39838] | 527 | } |
---|
| 528 | |
---|
[ca4602e] | 529 | LAST(RTEMS_SYSINIT_LIBIO) |
---|
[d0c39838] | 530 | { |
---|
[bc5b56a] | 531 | assert(rtems_libio_iop_free_head == &rtems_libio_iops[0]); |
---|
[ca4602e] | 532 | next_step(LIBIO_POST); |
---|
[d0c39838] | 533 | } |
---|
| 534 | |
---|
[3d36164f] | 535 | FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
| 536 | { |
---|
| 537 | struct stat st; |
---|
| 538 | int rv; |
---|
| 539 | |
---|
| 540 | rv = stat("/", &st); |
---|
| 541 | assert(rv == -1); |
---|
| 542 | next_step(ROOT_FILESYSTEM_PRE); |
---|
| 543 | } |
---|
| 544 | |
---|
| 545 | LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
| 546 | { |
---|
| 547 | struct stat st; |
---|
| 548 | int rv; |
---|
| 549 | |
---|
| 550 | rv = stat("/", &st); |
---|
| 551 | assert(rv == 0); |
---|
| 552 | next_step(ROOT_FILESYSTEM_POST); |
---|
| 553 | } |
---|
| 554 | |
---|
[d0c39838] | 555 | FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
| 556 | { |
---|
| 557 | /* |
---|
| 558 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
| 559 | * and post conditions. |
---|
| 560 | */ |
---|
[36b86d7] | 561 | next_step(BSP_PRE_DRIVERS_PRE); |
---|
[d0c39838] | 562 | } |
---|
| 563 | |
---|
| 564 | LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
| 565 | { |
---|
[36b86d7] | 566 | next_step(BSP_PRE_DRIVERS_POST); |
---|
[d0c39838] | 567 | } |
---|
| 568 | |
---|
| 569 | FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
| 570 | { |
---|
| 571 | assert(!_IO_All_drivers_initialized); |
---|
[36b86d7] | 572 | next_step(DEVICE_DRIVERS_PRE); |
---|
[d0c39838] | 573 | } |
---|
| 574 | |
---|
| 575 | LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
| 576 | { |
---|
| 577 | assert(_IO_All_drivers_initialized); |
---|
[36b86d7] | 578 | next_step(DEVICE_DRIVERS_POST); |
---|
[d0c39838] | 579 | } |
---|
| 580 | |
---|
[1ff8eca] | 581 | FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
| 582 | { |
---|
[1db9567] | 583 | _Objects_Allocator_lock(); |
---|
[1ff8eca] | 584 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0); |
---|
[1db9567] | 585 | _Objects_Allocator_unlock(); |
---|
[1ff8eca] | 586 | next_step(CLASSIC_USER_TASKS_PRE); |
---|
| 587 | } |
---|
| 588 | |
---|
| 589 | LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
| 590 | { |
---|
[1db9567] | 591 | _Objects_Allocator_lock(); |
---|
[1ff8eca] | 592 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1); |
---|
[1db9567] | 593 | _Objects_Allocator_unlock(); |
---|
[1ff8eca] | 594 | next_step(CLASSIC_USER_TASKS_POST); |
---|
| 595 | } |
---|
| 596 | |
---|
[4210114] | 597 | FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
| 598 | { |
---|
[1db9567] | 599 | _Objects_Allocator_lock(); |
---|
[4210114] | 600 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0); |
---|
[1db9567] | 601 | _Objects_Allocator_unlock(); |
---|
[4210114] | 602 | next_step(POSIX_USER_THREADS_PRE); |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | LAST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
| 606 | { |
---|
[1db9567] | 607 | _Objects_Allocator_lock(); |
---|
[4210114] | 608 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1); |
---|
[1db9567] | 609 | _Objects_Allocator_unlock(); |
---|
[4210114] | 610 | next_step(POSIX_USER_THREADS_POST); |
---|
| 611 | } |
---|
| 612 | |
---|
[ca4602e] | 613 | FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
[d0c39838] | 614 | { |
---|
[ca4602e] | 615 | struct stat st; |
---|
| 616 | int rv; |
---|
| 617 | |
---|
| 618 | rv = fstat(0, &st); |
---|
| 619 | assert(rv == -1); |
---|
| 620 | next_step(STD_FILE_DESCRIPTORS_PRE); |
---|
[d0c39838] | 621 | } |
---|
| 622 | |
---|
[ca4602e] | 623 | LAST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
[d0c39838] | 624 | { |
---|
[ca4602e] | 625 | struct stat st; |
---|
| 626 | int rv; |
---|
| 627 | |
---|
| 628 | rv = fstat(0, &st); |
---|
| 629 | assert(rv == 0); |
---|
| 630 | next_step(STD_FILE_DESCRIPTORS_POST); |
---|
[d0c39838] | 631 | } |
---|
| 632 | |
---|
[bc47ec1c] | 633 | LAST_STEP(FIRST); |
---|
| 634 | LAST_STEP(SECOND); |
---|
| 635 | LAST_STEP(THIRD); |
---|
| 636 | LAST_STEP(FOURTH); |
---|
| 637 | LAST_STEP(FIFTH); |
---|
| 638 | LAST_STEP(SIXTH); |
---|
| 639 | LAST_STEP(SEVENTH); |
---|
| 640 | LAST_STEP(EIGHTH); |
---|
| 641 | LAST_STEP(NINETH); |
---|
| 642 | LAST_STEP(TENTH); |
---|
| 643 | LAST_STEP(MIDDLE); |
---|
| 644 | LAST_STEP(LAST); |
---|
| 645 | |
---|
[21275b58] | 646 | static void do_barrier_create(void) |
---|
| 647 | { |
---|
| 648 | rtems_status_code sc; |
---|
| 649 | rtems_id id; |
---|
| 650 | |
---|
| 651 | sc = rtems_barrier_create( |
---|
| 652 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 653 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 654 | 1, |
---|
| 655 | &id |
---|
| 656 | ); |
---|
| 657 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 658 | |
---|
| 659 | sc = rtems_barrier_delete(id); |
---|
| 660 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 661 | } |
---|
| 662 | |
---|
| 663 | static void do_extensions_create(void) |
---|
| 664 | { |
---|
| 665 | rtems_status_code sc; |
---|
| 666 | rtems_id id; |
---|
| 667 | rtems_extensions_table table; |
---|
| 668 | |
---|
| 669 | memset(&table, 0, sizeof(table)); |
---|
| 670 | sc = rtems_extension_create( |
---|
| 671 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 672 | &table, |
---|
| 673 | &id |
---|
| 674 | ); |
---|
| 675 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 676 | |
---|
| 677 | sc = rtems_extension_delete(id); |
---|
| 678 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 679 | } |
---|
| 680 | |
---|
| 681 | static void do_message_queue_create(void) |
---|
| 682 | { |
---|
| 683 | rtems_status_code sc; |
---|
| 684 | rtems_id id; |
---|
| 685 | |
---|
| 686 | sc = rtems_message_queue_create( |
---|
| 687 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 688 | 1, |
---|
| 689 | 1, |
---|
| 690 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 691 | &id |
---|
| 692 | ); |
---|
| 693 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 694 | |
---|
| 695 | sc = rtems_message_queue_delete(id); |
---|
| 696 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 697 | } |
---|
| 698 | |
---|
| 699 | static void do_partition_create(void) |
---|
| 700 | { |
---|
| 701 | rtems_status_code sc; |
---|
| 702 | rtems_id id; |
---|
| 703 | long buf[32]; |
---|
| 704 | |
---|
| 705 | sc = rtems_partition_create( |
---|
| 706 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 707 | buf, |
---|
| 708 | sizeof(buf), |
---|
| 709 | sizeof(buf), |
---|
| 710 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 711 | &id |
---|
| 712 | ); |
---|
| 713 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 714 | |
---|
| 715 | sc = rtems_partition_delete(id); |
---|
| 716 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 717 | } |
---|
| 718 | |
---|
| 719 | static void do_period_create(void) |
---|
| 720 | { |
---|
| 721 | rtems_status_code sc; |
---|
| 722 | rtems_id id; |
---|
| 723 | |
---|
| 724 | sc = rtems_rate_monotonic_create( |
---|
| 725 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 726 | &id |
---|
| 727 | ); |
---|
| 728 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 729 | |
---|
| 730 | sc = rtems_rate_monotonic_delete(id); |
---|
| 731 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 732 | } |
---|
| 733 | |
---|
| 734 | static void do_port_create(void) |
---|
| 735 | { |
---|
| 736 | rtems_status_code sc; |
---|
| 737 | rtems_id id; |
---|
| 738 | |
---|
| 739 | sc = rtems_port_create( |
---|
| 740 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 741 | NULL, |
---|
| 742 | NULL, |
---|
| 743 | 1, |
---|
| 744 | &id |
---|
| 745 | ); |
---|
| 746 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 747 | |
---|
| 748 | sc = rtems_port_delete(id); |
---|
| 749 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 750 | } |
---|
| 751 | |
---|
| 752 | static void do_region_create(void) |
---|
| 753 | { |
---|
| 754 | rtems_status_code sc; |
---|
| 755 | rtems_id id; |
---|
| 756 | long buf[32]; |
---|
| 757 | |
---|
| 758 | sc = rtems_region_create( |
---|
| 759 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 760 | buf, |
---|
| 761 | sizeof(buf), |
---|
| 762 | 1, |
---|
| 763 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 764 | &id |
---|
| 765 | ); |
---|
| 766 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 767 | |
---|
| 768 | sc = rtems_region_delete(id); |
---|
| 769 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 770 | } |
---|
| 771 | |
---|
| 772 | static void do_semaphore_create(void) |
---|
| 773 | { |
---|
| 774 | rtems_status_code sc; |
---|
| 775 | rtems_id id; |
---|
| 776 | |
---|
| 777 | sc = rtems_semaphore_create( |
---|
| 778 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 779 | 0, |
---|
| 780 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 781 | 0, |
---|
| 782 | &id |
---|
| 783 | ); |
---|
| 784 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 785 | |
---|
| 786 | sc = rtems_semaphore_delete(id); |
---|
| 787 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 788 | } |
---|
| 789 | |
---|
| 790 | static void do_task_create(void) |
---|
| 791 | { |
---|
| 792 | rtems_status_code sc; |
---|
| 793 | rtems_id id; |
---|
| 794 | |
---|
| 795 | sc = rtems_task_create( |
---|
| 796 | rtems_build_name('T', 'E', 'S', 'T'), |
---|
| 797 | 1, |
---|
| 798 | RTEMS_MINIMUM_STACK_SIZE, |
---|
| 799 | RTEMS_DEFAULT_MODES, |
---|
| 800 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 801 | &id |
---|
| 802 | ); |
---|
| 803 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 804 | |
---|
| 805 | sc = rtems_task_delete(id); |
---|
| 806 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 807 | } |
---|
| 808 | |
---|
| 809 | static void do_timer_create(void) |
---|
| 810 | { |
---|
| 811 | rtems_status_code sc; |
---|
| 812 | rtems_id id; |
---|
| 813 | |
---|
| 814 | sc = rtems_timer_create(rtems_build_name('T', 'E', 'S', 'T'), &id); |
---|
| 815 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 816 | |
---|
| 817 | sc = rtems_timer_delete(id); |
---|
| 818 | rtems_test_assert(sc == RTEMS_SUCCESSFUL); |
---|
| 819 | } |
---|
| 820 | |
---|
| 821 | static void do_cleanup_push_pop(void) |
---|
[d0c39838] | 822 | { |
---|
[cef5675] | 823 | pthread_cleanup_push(NULL, NULL); |
---|
| 824 | pthread_cleanup_pop(0); |
---|
[21275b58] | 825 | } |
---|
| 826 | |
---|
| 827 | static void do_posix_mq_open(void) |
---|
| 828 | { |
---|
| 829 | struct mq_attr attr; |
---|
| 830 | mqd_t mq; |
---|
| 831 | int rv; |
---|
| 832 | |
---|
| 833 | memset(&attr, 0, sizeof(attr)); |
---|
| 834 | attr.mq_maxmsg = 1; |
---|
| 835 | attr.mq_msgsize = 1; |
---|
| 836 | mq = mq_open("mq", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, &attr); |
---|
| 837 | rtems_test_assert(mq != (mqd_t) -1); |
---|
| 838 | |
---|
| 839 | rv = mq_close(mq); |
---|
| 840 | rtems_test_assert(rv == 0); |
---|
| 841 | |
---|
| 842 | rv = mq_unlink("mq"); |
---|
| 843 | rtems_test_assert(rv == 0); |
---|
| 844 | } |
---|
| 845 | |
---|
| 846 | static void do_posix_sem_open(void) |
---|
| 847 | { |
---|
| 848 | sem_t *sem; |
---|
| 849 | int rv; |
---|
| 850 | |
---|
| 851 | sem = sem_open("sem", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); |
---|
| 852 | rtems_test_assert(sem != SEM_FAILED); |
---|
| 853 | |
---|
| 854 | rv = sem_close(sem); |
---|
| 855 | rtems_test_assert(rv == 0); |
---|
| 856 | |
---|
| 857 | rv = sem_unlink("sem"); |
---|
| 858 | rtems_test_assert(rv == 0); |
---|
| 859 | } |
---|
| 860 | |
---|
| 861 | static void do_posix_shm_open(void) |
---|
| 862 | { |
---|
| 863 | int fd; |
---|
| 864 | int rv; |
---|
| 865 | |
---|
| 866 | fd = shm_open("/shm", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); |
---|
| 867 | rtems_test_assert(fd >= 0); |
---|
| 868 | |
---|
| 869 | rv = close(fd); |
---|
| 870 | rtems_test_assert(rv == 0); |
---|
| 871 | |
---|
| 872 | rv = shm_unlink("/shm"); |
---|
| 873 | rtems_test_assert(rv == 0); |
---|
| 874 | } |
---|
| 875 | |
---|
| 876 | static void do_posix_timer_create(void) |
---|
| 877 | { |
---|
| 878 | #ifdef RTEMS_POSIX_API |
---|
| 879 | int rv; |
---|
| 880 | timer_t timer; |
---|
| 881 | |
---|
| 882 | rv = timer_create(CLOCK_REALTIME, NULL, &timer); |
---|
| 883 | rtems_test_assert(rv == 0); |
---|
| 884 | |
---|
| 885 | rv = timer_delete(timer); |
---|
| 886 | rtems_test_assert(rv == 0); |
---|
| 887 | #endif /* RTEMS_POSIX_API */ |
---|
| 888 | } |
---|
| 889 | |
---|
| 890 | static void Init(rtems_task_argument arg) |
---|
| 891 | { |
---|
[36b86d7] | 892 | next_step(INIT_TASK); |
---|
[21275b58] | 893 | do_barrier_create(); |
---|
| 894 | do_extensions_create(); |
---|
| 895 | do_message_queue_create(); |
---|
| 896 | do_partition_create(); |
---|
| 897 | do_period_create(); |
---|
| 898 | do_port_create(); |
---|
| 899 | do_region_create(); |
---|
| 900 | do_semaphore_create(); |
---|
| 901 | do_task_create(); |
---|
| 902 | do_timer_create(); |
---|
| 903 | do_cleanup_push_pop(); |
---|
| 904 | do_posix_mq_open(); |
---|
| 905 | do_posix_sem_open(); |
---|
| 906 | do_posix_shm_open(); |
---|
| 907 | do_posix_timer_create(); |
---|
[24d0ee57] | 908 | TEST_END(); |
---|
[d0c39838] | 909 | exit(0); |
---|
| 910 | } |
---|
| 911 | |
---|
[4210114] | 912 | static void *POSIX_Init(void *arg) |
---|
| 913 | { |
---|
| 914 | return NULL; |
---|
| 915 | } |
---|
| 916 | |
---|
[d0c39838] | 917 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
[21275b58] | 918 | |
---|
[c4b8b147] | 919 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
[d0c39838] | 920 | |
---|
[3cec2df] | 921 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 4 |
---|
[21275b58] | 922 | |
---|
[92bb345] | 923 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
| 924 | |
---|
[97d94ff] | 925 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
| 926 | |
---|
[ed8b00e6] | 927 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
| 928 | |
---|
[fd3cc36f] | 929 | #define CONFIGURE_MAXIMUM_PARTITIONS 1 |
---|
| 930 | |
---|
[b377e3f] | 931 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
---|
| 932 | |
---|
[af12278] | 933 | #define CONFIGURE_MAXIMUM_PORTS 1 |
---|
| 934 | |
---|
[365456cc] | 935 | #define CONFIGURE_MAXIMUM_REGIONS 1 |
---|
| 936 | |
---|
[cbaac1f7] | 937 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
| 938 | |
---|
[21275b58] | 939 | #define CONFIGURE_MAXIMUM_TASKS 2 |
---|
[d0c39838] | 940 | |
---|
[26335844] | 941 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
| 942 | |
---|
[3015ed64] | 943 | #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 |
---|
| 944 | |
---|
[2189b3e] | 945 | #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1 |
---|
| 946 | |
---|
[ba776282] | 947 | #define CONFIGURE_MAXIMUM_POSIX_SHMS 1 |
---|
| 948 | |
---|
[bb3484c9] | 949 | #ifdef RTEMS_POSIX_API |
---|
[6c678557] | 950 | #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 |
---|
[bb3484c9] | 951 | #endif /* RTEMS_POSIX_API */ |
---|
[6c678557] | 952 | |
---|
[ef1a985f] | 953 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
| 954 | |
---|
[4210114] | 955 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
| 956 | |
---|
[2605a489] | 957 | #define CONFIGURE_MAXIMUM_POSIX_KEYS 1 |
---|
| 958 | |
---|
[21275b58] | 959 | #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ |
---|
| 960 | CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1) |
---|
| 961 | |
---|
[d0c39838] | 962 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
| 963 | |
---|
[a853c851] | 964 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
| 965 | |
---|
[d0c39838] | 966 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
| 967 | |
---|
| 968 | #define CONFIGURE_INIT |
---|
| 969 | |
---|
| 970 | #include <rtems/confdefs.h> |
---|