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