[6e315132] | 1 | /* |
---|
| 2 | * Exercise Object Manager Services |
---|
| 3 | * |
---|
[b84f1fdc] | 4 | * COPYRIGHT (c) 1989-2009. |
---|
[6e315132] | 5 | * On-Line Applications Research Corporation (OAR). |
---|
| 6 | * |
---|
| 7 | * The license and distribution terms for this file may be |
---|
| 8 | * found in the file LICENSE in this distribution or at |
---|
| 9 | * http://www.rtems.com/license/LICENSE. |
---|
| 10 | * |
---|
| 11 | * $Id$ |
---|
| 12 | */ |
---|
| 13 | |
---|
[0c5a8be8] | 14 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
[2186ba80] | 15 | #define CONFIGURE_INIT |
---|
[6e315132] | 16 | #include "system.h" |
---|
| 17 | |
---|
| 18 | #undef rtems_build_id |
---|
| 19 | #undef rtems_build_name |
---|
| 20 | #undef rtems_object_id_api_maximum |
---|
| 21 | #undef rtems_object_id_api_minimum |
---|
| 22 | #undef rtems_object_id_get_api |
---|
| 23 | #undef rtems_object_id_get_class |
---|
| 24 | #undef rtems_object_id_get_index |
---|
| 25 | #undef rtems_object_id_get_node |
---|
| 26 | |
---|
[b84f1fdc] | 27 | void print_class_info( |
---|
| 28 | uint32_t api, |
---|
| 29 | uint32_t class, |
---|
| 30 | rtems_object_api_class_information *info |
---|
| 31 | ); |
---|
| 32 | void change_name( |
---|
| 33 | rtems_id id, |
---|
| 34 | const char *newName, |
---|
| 35 | bool printable |
---|
| 36 | ); |
---|
| 37 | |
---|
[403c507] | 38 | rtems_id main_task; |
---|
| 39 | rtems_name main_name; |
---|
| 40 | |
---|
[6e315132] | 41 | void print_class_info( |
---|
| 42 | uint32_t api, |
---|
| 43 | uint32_t class, |
---|
| 44 | rtems_object_api_class_information *info |
---|
| 45 | ) |
---|
| 46 | { |
---|
| 47 | printf( |
---|
| 48 | "%s API %s Information\n" |
---|
| 49 | " minimum id : 0x%08x maximum id: 0x%08x\n" |
---|
| 50 | " maximum : %7d available : %d\n" |
---|
| 51 | " auto_extend : %s\n", |
---|
| 52 | rtems_object_get_api_name(api), |
---|
| 53 | rtems_object_get_api_class_name(api, class), |
---|
| 54 | info->minimum_id, |
---|
| 55 | info->maximum_id, |
---|
| 56 | info->maximum, |
---|
| 57 | info->unallocated, |
---|
| 58 | ((info->auto_extend) ? "yes" : "no") |
---|
| 59 | ); |
---|
| 60 | } |
---|
| 61 | |
---|
[403c507] | 62 | void change_name( |
---|
[60735a30] | 63 | rtems_id id, |
---|
[916b0f30] | 64 | const char *newName, |
---|
[f0157b8] | 65 | bool printable |
---|
[403c507] | 66 | ) |
---|
| 67 | { |
---|
[cd4884a] | 68 | rtems_status_code sc; |
---|
[403c507] | 69 | char name[ 5 ]; |
---|
| 70 | char *ptr; |
---|
[916b0f30] | 71 | const char *c; |
---|
| 72 | |
---|
| 73 | printf( "rtems_object_set_name - change name of init task to " ); |
---|
| 74 | if ( printable ) |
---|
| 75 | printf( "(%s)\n", newName ); |
---|
| 76 | else { |
---|
| 77 | printf( "(" ); |
---|
| 78 | for (c=newName ; *c ; ) { |
---|
[4f6bb5b] | 79 | if (isprint(*c)) printf( "%c", *c ); |
---|
| 80 | else printf( "0x%02x", *c ); |
---|
[916b0f30] | 81 | c++; |
---|
| 82 | if ( *c ) |
---|
| 83 | printf( "-" ); |
---|
| 84 | } |
---|
| 85 | printf( ")\n" ); |
---|
| 86 | } |
---|
[403c507] | 87 | |
---|
[cd4884a] | 88 | sc = rtems_object_set_name( id, newName ); |
---|
| 89 | directive_failed( sc, "rtems_object_set_name" ); |
---|
[403c507] | 90 | |
---|
[cd4884a] | 91 | sc = rtems_object_get_classic_name( id, &main_name ); |
---|
| 92 | directive_failed( sc, "rtems_object_get_classic_name" ); |
---|
[403c507] | 93 | put_name( main_name, FALSE ); |
---|
| 94 | puts( " - name returned by rtems_object_get_classic_name" ); |
---|
| 95 | |
---|
[60735a30] | 96 | ptr = rtems_object_get_name( id, 5, name ); |
---|
[403c507] | 97 | rtems_test_assert(ptr != NULL); |
---|
| 98 | printf( "rtems_object_get_name returned (%s) for init task\n", ptr ); |
---|
| 99 | } |
---|
| 100 | |
---|
[6e315132] | 101 | rtems_task Init( |
---|
| 102 | rtems_task_argument argument |
---|
| 103 | ) |
---|
| 104 | { |
---|
[cd4884a] | 105 | rtems_status_code sc; |
---|
[6e315132] | 106 | rtems_id tmpId; |
---|
| 107 | rtems_name tmpName; |
---|
| 108 | char name[5]; |
---|
| 109 | char *ptr; |
---|
| 110 | const char newName[5] = "New1"; |
---|
[916b0f30] | 111 | char tmpNameString[5]; |
---|
[6e315132] | 112 | uint32_t part; |
---|
| 113 | rtems_object_api_class_information info; |
---|
| 114 | |
---|
| 115 | puts( "\n\n*** TEST 43 ***" ); |
---|
| 116 | |
---|
[03b655aa] | 117 | printf( "RTEMS Version: %s\n", rtems_get_version_string() ); |
---|
| 118 | |
---|
[6e315132] | 119 | main_task = rtems_task_self(); |
---|
| 120 | |
---|
| 121 | puts( "rtems_object_get_classic_name - INVALID_ADDRESS" ); |
---|
[cd4884a] | 122 | sc = rtems_object_get_classic_name( main_task, NULL ); |
---|
[6e315132] | 123 | fatal_directive_status( |
---|
[cd4884a] | 124 | sc, |
---|
[6e315132] | 125 | RTEMS_INVALID_ADDRESS, |
---|
[403c507] | 126 | "rtems_object_get_classic_name #1" |
---|
| 127 | ); |
---|
| 128 | |
---|
| 129 | puts( "rtems_object_get_classic_name - INVALID_ID (bad index)" ); |
---|
[cd4884a] | 130 | sc = rtems_object_get_classic_name( main_task + 5, &main_name ); |
---|
[403c507] | 131 | fatal_directive_status( |
---|
[cd4884a] | 132 | sc, |
---|
[403c507] | 133 | RTEMS_INVALID_ID, |
---|
| 134 | "rtems_object_get_classic_name #2" |
---|
| 135 | ); |
---|
| 136 | |
---|
| 137 | puts( "rtems_object_get_classic_name - INVALID_ID (unallocated index)" ); |
---|
[cd4884a] | 138 | sc = rtems_object_get_classic_name( main_task + 1, &main_name ); |
---|
[403c507] | 139 | fatal_directive_status( |
---|
[cd4884a] | 140 | sc, |
---|
[403c507] | 141 | RTEMS_INVALID_ID, |
---|
| 142 | "rtems_object_get_classic_name #4" |
---|
[6e315132] | 143 | ); |
---|
| 144 | |
---|
[403c507] | 145 | puts( "rtems_object_get_classic_name - INVALID_ID (bad API)" ); |
---|
| 146 | tmpId = rtems_build_id( 0xff, OBJECTS_RTEMS_TASKS, 1, 1 ), |
---|
[cd4884a] | 147 | sc = rtems_object_get_classic_name( tmpId, &main_name ); |
---|
[6e315132] | 148 | fatal_directive_status( |
---|
[cd4884a] | 149 | sc, |
---|
[6e315132] | 150 | RTEMS_INVALID_ID, |
---|
[403c507] | 151 | "rtems_object_get_classic_name #5" |
---|
[6e315132] | 152 | ); |
---|
| 153 | |
---|
[cd4884a] | 154 | sc = rtems_object_get_classic_name( main_task, &main_name ); |
---|
| 155 | directive_failed( sc, "rtems_object_get_classic_name" ); |
---|
[6e315132] | 156 | put_name( main_name, FALSE ); |
---|
[60735a30] | 157 | puts( " - name returned by rtems_object_get_classic_name for Init task id" ); |
---|
| 158 | |
---|
[cd4884a] | 159 | sc = rtems_object_get_classic_name( RTEMS_SELF, &main_name ); |
---|
| 160 | directive_failed( sc, "rtems_object_get_classic_name" ); |
---|
[60735a30] | 161 | put_name( main_name, FALSE ); |
---|
| 162 | puts( " - name returned by rtems_object_get_classic_name for RTEMS_SELF" ); |
---|
[6e315132] | 163 | |
---|
| 164 | tmpName = rtems_build_name( 'T', 'E', 'M', 'P' ); |
---|
| 165 | put_name( tmpName, FALSE ); |
---|
| 166 | puts( " - rtems_build_name for TEMP" ); |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | /* |
---|
| 170 | * rtems_object_get_name - cases |
---|
| 171 | */ |
---|
| 172 | puts( "rtems_object_get_name - bad id for class with instances" ); |
---|
| 173 | ptr = rtems_object_get_name( main_task + 5, 5, name ); |
---|
| 174 | rtems_test_assert(ptr == NULL); |
---|
| 175 | |
---|
| 176 | puts( "rtems_object_get_name - bad id for class without instances" ); |
---|
| 177 | ptr = rtems_object_get_name( |
---|
| 178 | rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 1 ), |
---|
| 179 | 5, |
---|
| 180 | name |
---|
| 181 | ); |
---|
| 182 | rtems_test_assert(ptr == NULL); |
---|
| 183 | |
---|
| 184 | puts( "rtems_object_get_name - bad length" ); |
---|
| 185 | ptr = rtems_object_get_name( main_task, 0, name ); |
---|
| 186 | rtems_test_assert(ptr == NULL); |
---|
| 187 | |
---|
| 188 | puts( "rtems_object_get_name - bad pointer" ); |
---|
| 189 | ptr = rtems_object_get_name( main_task, 5, NULL ); |
---|
| 190 | rtems_test_assert(ptr == NULL); |
---|
| 191 | |
---|
| 192 | ptr = rtems_object_get_name( main_task, 5, name ); |
---|
| 193 | rtems_test_assert(ptr != NULL); |
---|
[60735a30] | 194 | printf( "rtems_object_get_name returned (%s) for init task id\n", ptr ); |
---|
| 195 | |
---|
| 196 | ptr = rtems_object_get_name( RTEMS_SELF, 5, name ); |
---|
| 197 | rtems_test_assert(ptr != NULL); |
---|
| 198 | printf( "rtems_object_get_name returned (%s) for RTEMS_SELF\n", ptr ); |
---|
[6e315132] | 199 | |
---|
| 200 | /* |
---|
[403c507] | 201 | * rtems_object_set_name - errors |
---|
[6e315132] | 202 | */ |
---|
| 203 | |
---|
[403c507] | 204 | puts( "rtems_object_set_name - INVALID_ID (bad API)" ); |
---|
| 205 | tmpId = rtems_build_id( 0xff, OBJECTS_RTEMS_TASKS, 1, 1 ), |
---|
[cd4884a] | 206 | sc = rtems_object_set_name( tmpId, newName ); |
---|
[403c507] | 207 | fatal_directive_status( |
---|
[cd4884a] | 208 | sc, |
---|
[403c507] | 209 | RTEMS_INVALID_ID, |
---|
| 210 | "rtems_object_set_name #1" |
---|
| 211 | ); |
---|
[6e315132] | 212 | |
---|
[403c507] | 213 | puts( "rtems_object_set_name - INVALID_ID (bad index)" ); |
---|
[cd4884a] | 214 | sc = rtems_object_set_name( main_task + 10, newName ); |
---|
[403c507] | 215 | fatal_directive_status( |
---|
[cd4884a] | 216 | sc, |
---|
[403c507] | 217 | RTEMS_INVALID_ID, |
---|
| 218 | "rtems_object_set_name #2" |
---|
| 219 | ); |
---|
[6e315132] | 220 | |
---|
[403c507] | 221 | /* |
---|
| 222 | * rtems_object_set_name - change name of init task in various ways. |
---|
| 223 | * |
---|
| 224 | * This is strange but pushes the SuperCore code to do different things. |
---|
| 225 | */ |
---|
| 226 | |
---|
[60735a30] | 227 | change_name( main_task, "New1", TRUE ); |
---|
| 228 | change_name( main_task, "Ne1", TRUE ); |
---|
| 229 | change_name( main_task, "N1", TRUE ); |
---|
| 230 | change_name( main_task, "N", TRUE ); |
---|
| 231 | change_name( main_task, "", TRUE ); |
---|
[916b0f30] | 232 | tmpNameString[0] = 'N'; |
---|
| 233 | tmpNameString[1] = 0x07; |
---|
| 234 | tmpNameString[2] = 0x09; |
---|
| 235 | tmpNameString[3] = '1'; |
---|
| 236 | tmpNameString[4] = '\0'; |
---|
[60735a30] | 237 | change_name( main_task, tmpNameString, FALSE ); |
---|
| 238 | |
---|
| 239 | /* |
---|
| 240 | * Change object name using SELF ID |
---|
| 241 | */ |
---|
| 242 | |
---|
| 243 | change_name( RTEMS_SELF, "SELF", TRUE ); |
---|
| 244 | |
---|
| 245 | ptr = rtems_object_get_name( main_task, 5, name ); |
---|
| 246 | rtems_test_assert(ptr != NULL); |
---|
| 247 | printf( "rtems_object_get_name returned (%s) for init task id\n", ptr ); |
---|
| 248 | |
---|
[6e315132] | 249 | |
---|
| 250 | /* |
---|
| 251 | * Exercise id build and extraction routines |
---|
| 252 | */ |
---|
| 253 | |
---|
| 254 | puts( "rtems_build_id - build an id to match init task" ); |
---|
| 255 | tmpId = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 1 ), |
---|
| 256 | assert( tmpId == main_task ); |
---|
| 257 | |
---|
| 258 | puts( "rtems_object_id_get_api - OK" ); |
---|
| 259 | part = rtems_object_id_get_api( main_task ); |
---|
| 260 | assert( part == OBJECTS_CLASSIC_API ); |
---|
| 261 | |
---|
| 262 | puts( "rtems_object_id_get_class - OK" ); |
---|
| 263 | part = rtems_object_id_get_class( main_task ); |
---|
| 264 | assert( part == OBJECTS_RTEMS_TASKS ); |
---|
| 265 | |
---|
| 266 | puts( "rtems_object_id_get_node - OK" ); |
---|
| 267 | part = rtems_object_id_get_node( main_task ); |
---|
| 268 | assert( part == 1 ); |
---|
| 269 | |
---|
| 270 | puts( "rtems_object_id_get_index - OK" ); |
---|
| 271 | part = rtems_object_id_get_index( main_task ); |
---|
| 272 | assert( part == 1 ); |
---|
| 273 | |
---|
| 274 | /* |
---|
| 275 | * Start another screen and do the API/Class min/max routines |
---|
| 276 | */ |
---|
| 277 | rtems_test_pause(); |
---|
| 278 | |
---|
| 279 | printf( "rtems_object_id_api_minimum returned %d\n", |
---|
| 280 | rtems_object_id_api_minimum() ); |
---|
| 281 | printf( "rtems_object_id_api_maximum returned %d\n", |
---|
| 282 | rtems_object_id_api_maximum() ); |
---|
| 283 | |
---|
| 284 | printf( "rtems_object_api_minimum_class(0) returned %d\n", |
---|
| 285 | rtems_object_api_minimum_class(0) ); |
---|
| 286 | printf( "rtems_object_api_maximum_class(0) returned %d\n", |
---|
| 287 | rtems_object_api_maximum_class(0) ); |
---|
| 288 | |
---|
| 289 | printf( "rtems_object_api_minimum_class(0) returned %d\n", |
---|
| 290 | rtems_object_api_minimum_class(0) ); |
---|
| 291 | printf( "rtems_object_api_maximum_class(0) returned %d\n", |
---|
| 292 | rtems_object_api_maximum_class(0) ); |
---|
[403c507] | 293 | printf( "rtems_object_api_minimum_class(255) returned %d\n", |
---|
| 294 | rtems_object_api_minimum_class(255) ); |
---|
| 295 | printf( "rtems_object_api_maximum_class(255) returned %d\n", |
---|
| 296 | rtems_object_api_maximum_class(255) ); |
---|
[6e315132] | 297 | |
---|
| 298 | printf( "rtems_object_api_minimum_class(OBJECTS_INTERNAL_API) returned %d\n", |
---|
| 299 | rtems_object_api_minimum_class(OBJECTS_INTERNAL_API) ); |
---|
| 300 | printf( "rtems_object_api_maximum_class(OBJECTS_INTERNAL_API) returned %d\n", |
---|
| 301 | rtems_object_api_maximum_class(OBJECTS_INTERNAL_API) ); |
---|
| 302 | |
---|
| 303 | printf( "rtems_object_api_minimum_class(OBJECTS_CLASSIC_API) returned %d\n", |
---|
| 304 | rtems_object_api_minimum_class(OBJECTS_CLASSIC_API) ); |
---|
| 305 | printf( "rtems_object_api_maximum_class(OBJECTS_CLASSIC_API) returned %d\n", |
---|
| 306 | rtems_object_api_maximum_class(OBJECTS_CLASSIC_API) ); |
---|
| 307 | |
---|
| 308 | printf( "rtems_object_api_minimum_class(OBJECTS_ITRON_API) returned %d\n", |
---|
| 309 | rtems_object_api_minimum_class(OBJECTS_ITRON_API) ); |
---|
| 310 | printf( "rtems_object_api_maximum_class(OBJECTS_ITRON_API) returned %d\n", |
---|
| 311 | rtems_object_api_maximum_class(OBJECTS_ITRON_API) ); |
---|
| 312 | |
---|
| 313 | /* |
---|
| 314 | * Another screen break for the API and class name tests |
---|
| 315 | */ |
---|
| 316 | rtems_test_pause(); |
---|
| 317 | |
---|
| 318 | printf( "rtems_object_get_api_name(0) = %s\n", rtems_object_get_api_name(0) ); |
---|
[403c507] | 319 | printf( "rtems_object_get_api_name(255) = %s\n", |
---|
| 320 | rtems_object_get_api_name(255)); |
---|
[6e315132] | 321 | |
---|
| 322 | printf( "rtems_object_get_api_name(INTERNAL_API) = %s\n", |
---|
| 323 | rtems_object_get_api_name(OBJECTS_INTERNAL_API) ); |
---|
| 324 | printf( "rtems_object_get_api_name(CLASSIC_API) = %s\n", |
---|
| 325 | rtems_object_get_api_name(OBJECTS_CLASSIC_API) ); |
---|
| 326 | printf( "rtems_object_get_api_name(ITRON_API) = %s\n", |
---|
| 327 | rtems_object_get_api_name(OBJECTS_ITRON_API) ); |
---|
| 328 | |
---|
| 329 | printf( "rtems_object_get_api_class_name(0, RTEMS_TASKS) = %s\n", |
---|
| 330 | rtems_object_get_api_class_name( 0, OBJECTS_RTEMS_TASKS ) ); |
---|
| 331 | printf( "rtems_object_get_api_class_name(CLASSIC_API, 0) = %s\n", |
---|
| 332 | rtems_object_get_api_class_name( OBJECTS_CLASSIC_API, 0 ) ); |
---|
[403c507] | 333 | printf("rtems_object_get_api_class_name(INTERNAL_API, MUTEXES) = %s\n", |
---|
| 334 | rtems_object_get_api_class_name( |
---|
| 335 | OBJECTS_INTERNAL_API, OBJECTS_INTERNAL_MUTEXES)); |
---|
| 336 | printf("rtems_object_get_api_class_name(CLASSIC_API, RTEMS_BARRIERS) = %s\n", |
---|
| 337 | rtems_object_get_api_class_name( |
---|
| 338 | OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS)); |
---|
[6e315132] | 339 | |
---|
| 340 | /* |
---|
| 341 | * Another screen break for the information |
---|
| 342 | */ |
---|
| 343 | |
---|
| 344 | rtems_test_pause(); |
---|
| 345 | |
---|
| 346 | puts( "rtems_object_get_class_information - INVALID_ADDRESS" ); |
---|
[cd4884a] | 347 | sc = rtems_object_get_class_information( |
---|
[6e315132] | 348 | OBJECTS_INTERNAL_API, OBJECTS_INTERNAL_THREADS, NULL ); |
---|
| 349 | fatal_directive_status( |
---|
[cd4884a] | 350 | sc, |
---|
[6e315132] | 351 | RTEMS_INVALID_ADDRESS, |
---|
| 352 | "rtems_object_get_class_information" |
---|
| 353 | ); |
---|
| 354 | |
---|
| 355 | puts( "rtems_object_get_class_information - INVALID_NUMBER (bad API)" ); |
---|
[cd4884a] | 356 | sc = |
---|
[403c507] | 357 | rtems_object_get_class_information(0, OBJECTS_INTERNAL_THREADS, &info); |
---|
[6e315132] | 358 | fatal_directive_status( |
---|
[cd4884a] | 359 | sc, |
---|
[6e315132] | 360 | RTEMS_INVALID_NUMBER, |
---|
| 361 | "rtems_object_get_class_information (API)" |
---|
| 362 | ); |
---|
| 363 | |
---|
[67d6947] | 364 | puts( "rtems_object_get_class_information - INVALID_NUMBER (api=0xff)" ); |
---|
[cd4884a] | 365 | sc = rtems_object_get_class_information( 0xff, 1, &info ); |
---|
[6e315132] | 366 | fatal_directive_status( |
---|
[cd4884a] | 367 | sc, |
---|
[6e315132] | 368 | RTEMS_INVALID_NUMBER, |
---|
[67d6947] | 369 | "rtems_object_get_class_information (api=0xff)" |
---|
| 370 | ); |
---|
| 371 | |
---|
| 372 | puts( "rtems_object_get_class_information - INVALID_NUMBER (class=0)" ); |
---|
[cd4884a] | 373 | sc = rtems_object_get_class_information( |
---|
[67d6947] | 374 | OBJECTS_INTERNAL_API, 0, &info ); |
---|
| 375 | fatal_directive_status( |
---|
[cd4884a] | 376 | sc, |
---|
[67d6947] | 377 | RTEMS_INVALID_NUMBER, |
---|
| 378 | "rtems_object_get_class_information (class=0)" |
---|
| 379 | ); |
---|
| 380 | |
---|
| 381 | puts( |
---|
| 382 | "rtems_object_get_class_information - INVALID_NUMBER (class too high)" ); |
---|
[cd4884a] | 383 | sc = rtems_object_get_class_information( |
---|
[67d6947] | 384 | OBJECTS_INTERNAL_API, 0xff, &info); |
---|
| 385 | fatal_directive_status( |
---|
[cd4884a] | 386 | sc, |
---|
[67d6947] | 387 | RTEMS_INVALID_NUMBER, |
---|
| 388 | "rtems_object_get_class_information (class #2)" |
---|
[6e315132] | 389 | ); |
---|
| 390 | |
---|
| 391 | puts( "rtems_object_get_class_information - Classic Tasks - OK" ); |
---|
[cd4884a] | 392 | sc = rtems_object_get_class_information( |
---|
[6e315132] | 393 | OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, &info ); |
---|
[cd4884a] | 394 | directive_failed( sc, "rtems_object_get_class_information" ); |
---|
[6e315132] | 395 | print_class_info( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, &info ); |
---|
| 396 | |
---|
| 397 | puts( "rtems_object_get_class_information - Classic Timers - OK" ); |
---|
[cd4884a] | 398 | sc = rtems_object_get_class_information( |
---|
[6e315132] | 399 | OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, &info ); |
---|
[cd4884a] | 400 | directive_failed( sc, "rtems_object_get_class_information" ); |
---|
[6e315132] | 401 | print_class_info( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, &info ); |
---|
| 402 | |
---|
[0c5a8be8] | 403 | /* |
---|
[cd4884a] | 404 | * Ugly hack to force a weird error. |
---|
| 405 | * |
---|
| 406 | * The weird case is that we need to look up a thread Id where the |
---|
| 407 | * thread classes' object information table pointer is NULL. Probably |
---|
| 408 | * impossible to really hit until registration is completely dynamically |
---|
| 409 | * configurable. |
---|
[0c5a8be8] | 410 | */ |
---|
| 411 | { |
---|
| 412 | rtems_task_priority old_priority; |
---|
| 413 | void *tmp; |
---|
| 414 | int class; |
---|
| 415 | int api; |
---|
| 416 | |
---|
| 417 | class = OBJECTS_INTERNAL_API; |
---|
| 418 | api = OBJECTS_INTERNAL_THREADS; |
---|
| 419 | |
---|
| 420 | puts( "rtems_task_set_priority - use valid Idle thread id" ); |
---|
| 421 | sc = rtems_task_set_priority( |
---|
| 422 | rtems_build_id( class, api, 1, 1 ), |
---|
| 423 | RTEMS_CURRENT_PRIORITY, |
---|
| 424 | &old_priority |
---|
| 425 | ); |
---|
| 426 | directive_failed( sc, "rtems_task_set_priority" ); |
---|
| 427 | |
---|
| 428 | /* destroy class pointer */ |
---|
| 429 | puts( "rtems_task_set_priority - clobber internal thread class info" ); |
---|
| 430 | tmp = _Objects_Information_table[ class ][ api ]; |
---|
| 431 | _Objects_Information_table[ class ][ api ] = NULL; |
---|
| 432 | |
---|
| 433 | puts( "rtems_task_set_priority - use valid Idle thread id again" ); |
---|
| 434 | sc = rtems_task_set_priority( |
---|
| 435 | rtems_build_id( class, api, 1, 1 ), |
---|
| 436 | RTEMS_CURRENT_PRIORITY, |
---|
| 437 | &old_priority |
---|
| 438 | ); |
---|
| 439 | fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_task_set_priority" ); |
---|
| 440 | |
---|
| 441 | /* restore pointer */ |
---|
| 442 | puts( "rtems_task_set_priority - restore internal thread class info" ); |
---|
| 443 | _Objects_Information_table[ class ][ api ] = tmp; |
---|
| 444 | } |
---|
[cd4884a] | 445 | |
---|
| 446 | /* |
---|
| 447 | * Bad Id on an object which disables interrupts as part of translating |
---|
| 448 | * the Id into an object pointer. Semaphore is the only object that |
---|
| 449 | * needs this. This is a "good" Id in that is it in range, but bad in |
---|
| 450 | * that it has not been allocated so the local_table pointer is NULL. |
---|
| 451 | */ |
---|
| 452 | puts( "rtems_semaphore_release - good but uncreated ID - INVALID_ID - OK" ); |
---|
| 453 | sc = rtems_semaphore_release( |
---|
| 454 | rtems_build_id( |
---|
| 455 | OBJECTS_CLASSIC_API, |
---|
| 456 | OBJECTS_RTEMS_SEMAPHORES, |
---|
| 457 | 1, |
---|
| 458 | rtems_configuration_get_maximum_semaphores() |
---|
| 459 | ) |
---|
| 460 | ); |
---|
| 461 | fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_semaphore_obtain" ); |
---|
| 462 | |
---|
[6e315132] | 463 | puts( "*** END OF TEST 43 ***" ); |
---|
| 464 | rtems_test_exit( 0 ); |
---|
| 465 | } |
---|