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