Changeset 76117f2b in rtems
- Timestamp:
- 08/09/96 19:20:54 (27 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- c03aeaf
- Parents:
- 1406a4b
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/tests/psxtests/psx05/init.c
r1406a4b r76117f2b 97 97 /* basic checkout of mutex attributes */ 98 98 99 puts( "Init: Initializing mutex attributes" );99 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 100 100 status = pthread_mutexattr_init( &attr ); 101 101 assert( !status ); … … 128 128 empty_line(); 129 129 130 puts( "Init: Creating a mutex" );130 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 131 131 status = pthread_mutex_init( &Mutex_id, &attr ); 132 132 if ( status ) … … 134 134 assert( !status ); 135 135 136 puts( "Init: pthread_mutex_trylock successfully" );136 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 137 137 status = pthread_mutex_trylock( &Mutex_id ); 138 138 if ( status ) … … 140 140 assert( !status ); 141 141 142 puts( "Init: pthread_mutex_trylock already locked" );142 puts( "Init: pthread_mutex_trylock - EDEADLK (already locked)" ); 143 143 status = pthread_mutex_trylock( &Mutex_id ); 144 144 if ( status != EDEADLK ) … … 146 146 assert( status == EDEADLK ); 147 147 148 puts( "Init: pthread_mutex_lock already locked" );148 puts( "Init: pthread_mutex_lock - EDEADLK (already locked)" ); 149 149 status = pthread_mutex_lock( &Mutex_id ); 150 150 if ( status != EDEADLK ) … … 158 158 /* switch to task 1 */ 159 159 160 puts( "Init: pthread_mutex_unlock successfully" );160 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 161 161 status = pthread_mutex_unlock( &Mutex_id ); 162 162 if ( status ) … … 164 164 assert( !status ); 165 165 166 puts( "Init: pthread_mutex_unlock not owner" );166 puts( "Init: pthread_mutex_unlock - EPERM (not owner)" ); 167 167 status = pthread_mutex_unlock( &Mutex_id ); 168 168 if ( status != EPERM ) … … 172 172 times.tv_sec = 0; 173 173 times.tv_nsec = 500000000; 174 puts( "Init: pthread_mutex_timedlock time out in 1/2 second" );174 puts( "Init: pthread_mutex_timedlock - time out in 1/2 second" ); 175 175 status = pthread_mutex_timedlock( &Mutex_id, × ); 176 176 if ( status != EAGAIN ) … … 180 180 /* switch to idle */ 181 181 182 puts( "Init: correctly timed out waiting for mutex" );182 puts( "Init: pthread_mutex_timedlock - EAGAIN (timeout)" ); 183 183 184 184 /* destroy a mutex */ … … 186 186 empty_line(); 187 187 188 puts( "Init: Creating a mutex" );188 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 189 189 status = pthread_mutex_init( &Mutex2_id, &attr ); 190 190 if ( status ) … … 192 192 assert( !status ); 193 193 194 puts( "Init: pthread_mutexattr_destroy " );194 puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" ); 195 195 status = pthread_mutexattr_destroy( &attr ); 196 196 assert( !status ); 197 197 198 puts( "Init: pthread_mutex_destroy " );198 puts( "Init: pthread_mutex_destroy - SUCCESSFUL" ); 199 199 status = pthread_mutex_destroy( &Mutex2_id ); 200 200 assert( !status ); … … 204 204 empty_line(); 205 205 206 puts( "Init: Initializing mutex attributes" );207 status = pthread_mutexattr_init( &attr ); 208 assert( !status ); 209 210 puts( "Init: Creating a mutex" );206 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 207 status = pthread_mutexattr_init( &attr ); 208 assert( !status ); 209 210 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 211 211 status = pthread_mutex_init( &Mutex2_id, &attr ); 212 212 assert( !status ); 213 213 214 puts( "Init: pthread_mutex_trylock successfully" );214 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 215 215 status = pthread_mutex_trylock( &Mutex2_id ); 216 216 if ( status ) … … 218 218 assert( !status ); 219 219 220 puts( "Init: pthread_mutex_destroy - EBUSY (already locked)" ); 220 221 status = pthread_mutex_destroy( &Mutex2_id ); 221 222 if ( status != EBUSY ) 222 223 printf( "status = %d\n", status ); 223 224 assert( status == EBUSY ); 224 puts( "Init: pthread_mutex_destroy - EBUSY" ); 225 226 puts( "Init: pthread_mutex_unlock successfully" ); 225 226 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 227 227 status = pthread_mutex_unlock( &Mutex2_id ); 228 228 assert( !status ); 229 229 230 puts( "Init: pthread_mutex_destroy " );230 puts( "Init: pthread_mutex_destroy - SUCCESSFUL" ); 231 231 status = pthread_mutex_destroy( &Mutex2_id ); 232 232 assert( !status ); … … 236 236 empty_line(); 237 237 238 puts( "Init: Initializing mutex attributes" ); 239 status = pthread_mutexattr_init( &attr ); 240 assert( !status ); 241 242 puts( "Init: Setting PTHREAD_PRIO_INHERIT attribute" ); 238 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 239 status = pthread_mutexattr_init( &attr ); 240 assert( !status ); 241 242 puts( 243 "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_INHERIT)" 244 ); 243 245 status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT ); 244 246 assert( !status ); 245 247 246 puts( "Init: Creating a mutex" );248 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 247 249 status = pthread_mutex_init( &Mutex2_id, &attr ); 248 250 assert( !status ); 249 251 250 puts( "Init: pthread_mutex_trylock successfully" );252 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 251 253 status = pthread_mutex_trylock( &Mutex2_id ); 252 254 assert( !status ); … … 261 263 param.sched_priority = 255; 262 264 263 puts( "Init: Setting Task2 priority to highest" );265 puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" ); 264 266 status = pthread_setschedparam( Task2_id, SCHED_FIFO, ¶m ); 265 267 assert( !status ); … … 269 271 status = pthread_getschedparam( pthread_self(), &policy, ¶m ); 270 272 assert( !status ); 271 printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority);272 273 puts( "Init: pthread_mutex_unlock successfully" );273 printf( "Init: pthread_getschedparam - priority = %d\n", param.sched_priority); 274 275 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 274 276 status = pthread_mutex_unlock( &Mutex2_id ); 275 277 assert( !status ); 276 278 277 puts( "Init: pthread_mutexattr_destroy " );279 puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" ); 278 280 status = pthread_mutexattr_destroy( &attr ); 279 281 assert( !status ); 280 282 281 puts( "Init: pthread_mutex_destroy " );283 puts( "Init: pthread_mutex_destroy - SUCCESSFUL" ); 282 284 status = pthread_mutex_destroy( &Mutex2_id ); 283 285 assert( !status ); … … 287 289 empty_line(); 288 290 289 puts( "Init: Initializing mutex attributes" ); 290 status = pthread_mutexattr_init( &attr ); 291 assert( !status ); 292 293 puts( "Init: Setting PTHREAD_PRIO_PROTECT attribute" ); 291 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 292 status = pthread_mutexattr_init( &attr ); 293 assert( !status ); 294 295 puts( 296 "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_PROTECT)" 297 ); 294 298 status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT ); 295 299 assert( !status ); 296 300 297 puts( "Init: Creating a mutex" );301 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 298 302 status = pthread_mutex_init( &Mutex2_id, &attr ); 299 303 assert( !status ); … … 301 305 status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling ); 302 306 assert( !status ); 303 printf( "Init: priority ceiling = %d\n", ceiling ); 304 307 printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling ); 308 309 puts( "Init: pthread_mutex_setprioceiling - new ceiling = 200" ); 305 310 status = pthread_mutex_setprioceiling( &Mutex2_id, 200, &old_ceiling ); 306 311 assert( !status ); 307 printf( "Init: Set ceiling = 200 old priority ceiling = %d\n",old_ceiling ); 312 printf( 313 "Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling 314 ); 308 315 309 316 status = pthread_getschedparam( pthread_self(), &policy, ¶m ); 310 317 assert( !status ); 311 printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority ); 312 313 puts( "Init: pthread_mutex_trylock successfully" ); 318 printf( 319 "Init: pthread_getschedparam - priority = %d\n", param.sched_priority 320 ); 321 322 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 314 323 status = pthread_mutex_trylock( &Mutex2_id ); 315 324 assert( !status ); … … 317 326 status = pthread_getschedparam( pthread_self(), &policy, ¶m ); 318 327 assert( !status ); 319 printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority ); 328 printf( 329 "Init: pthread_getschedparam - priority = %d\n", param.sched_priority 330 ); 320 331 321 332 /* create a thread at a higher priority */ … … 330 341 status = pthread_setschedparam( Task3_id, SCHED_FIFO, ¶m ); 331 342 assert( !status ); 332 puts( "Init: Set Task3 priority to highest" );343 puts( "Init: pthread_setschedparam - set Task3 priority to highest" ); 333 344 334 345 /* DOES NOT SWITCH to Task3 */ … … 340 351 /* switch to task 3 */ 341 352 342 puts( "Init: pthread_mutex_unlock successfully" );353 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 343 354 status = pthread_mutex_unlock( &Mutex2_id ); 344 355 assert( !status ); … … 346 357 status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling ); 347 358 assert( !status ); 348 printf( "Init: p riorityceiling = %d\n", ceiling );359 printf( "Init: pthread_mutex_getprioceiling- ceiling = %d\n", ceiling ); 349 360 350 361 /* set priority of Init to highest priority */ … … 354 365 status = pthread_setschedparam( Init_id, SCHED_FIFO, ¶m ); 355 366 assert( !status ); 356 puts( "Init: Set Init priority to highest" ); 357 367 puts( "Init: pthread_setschedparam - set Init priority to highest" ); 368 369 puts( "Init: pthread_mutex_lock - EINVAL (priority ceiling violation)" ); 358 370 status = pthread_mutex_lock( &Mutex2_id ); 359 371 if ( status != EDEADLK ) 360 372 printf( "status = %d\n", status ); 361 373 assert( status == EINVAL ); 362 puts( "Init: pthread_mutex_lock EINVAL (priority ceiling violation)" );363 374 364 375 puts( "*** END OF POSIX TEST 5 ***" ); -
testsuites/psxtests/psx05/init.c
r1406a4b r76117f2b 97 97 /* basic checkout of mutex attributes */ 98 98 99 puts( "Init: Initializing mutex attributes" );99 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 100 100 status = pthread_mutexattr_init( &attr ); 101 101 assert( !status ); … … 128 128 empty_line(); 129 129 130 puts( "Init: Creating a mutex" );130 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 131 131 status = pthread_mutex_init( &Mutex_id, &attr ); 132 132 if ( status ) … … 134 134 assert( !status ); 135 135 136 puts( "Init: pthread_mutex_trylock successfully" );136 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 137 137 status = pthread_mutex_trylock( &Mutex_id ); 138 138 if ( status ) … … 140 140 assert( !status ); 141 141 142 puts( "Init: pthread_mutex_trylock already locked" );142 puts( "Init: pthread_mutex_trylock - EDEADLK (already locked)" ); 143 143 status = pthread_mutex_trylock( &Mutex_id ); 144 144 if ( status != EDEADLK ) … … 146 146 assert( status == EDEADLK ); 147 147 148 puts( "Init: pthread_mutex_lock already locked" );148 puts( "Init: pthread_mutex_lock - EDEADLK (already locked)" ); 149 149 status = pthread_mutex_lock( &Mutex_id ); 150 150 if ( status != EDEADLK ) … … 158 158 /* switch to task 1 */ 159 159 160 puts( "Init: pthread_mutex_unlock successfully" );160 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 161 161 status = pthread_mutex_unlock( &Mutex_id ); 162 162 if ( status ) … … 164 164 assert( !status ); 165 165 166 puts( "Init: pthread_mutex_unlock not owner" );166 puts( "Init: pthread_mutex_unlock - EPERM (not owner)" ); 167 167 status = pthread_mutex_unlock( &Mutex_id ); 168 168 if ( status != EPERM ) … … 172 172 times.tv_sec = 0; 173 173 times.tv_nsec = 500000000; 174 puts( "Init: pthread_mutex_timedlock time out in 1/2 second" );174 puts( "Init: pthread_mutex_timedlock - time out in 1/2 second" ); 175 175 status = pthread_mutex_timedlock( &Mutex_id, × ); 176 176 if ( status != EAGAIN ) … … 180 180 /* switch to idle */ 181 181 182 puts( "Init: correctly timed out waiting for mutex" );182 puts( "Init: pthread_mutex_timedlock - EAGAIN (timeout)" ); 183 183 184 184 /* destroy a mutex */ … … 186 186 empty_line(); 187 187 188 puts( "Init: Creating a mutex" );188 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 189 189 status = pthread_mutex_init( &Mutex2_id, &attr ); 190 190 if ( status ) … … 192 192 assert( !status ); 193 193 194 puts( "Init: pthread_mutexattr_destroy " );194 puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" ); 195 195 status = pthread_mutexattr_destroy( &attr ); 196 196 assert( !status ); 197 197 198 puts( "Init: pthread_mutex_destroy " );198 puts( "Init: pthread_mutex_destroy - SUCCESSFUL" ); 199 199 status = pthread_mutex_destroy( &Mutex2_id ); 200 200 assert( !status ); … … 204 204 empty_line(); 205 205 206 puts( "Init: Initializing mutex attributes" );207 status = pthread_mutexattr_init( &attr ); 208 assert( !status ); 209 210 puts( "Init: Creating a mutex" );206 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 207 status = pthread_mutexattr_init( &attr ); 208 assert( !status ); 209 210 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 211 211 status = pthread_mutex_init( &Mutex2_id, &attr ); 212 212 assert( !status ); 213 213 214 puts( "Init: pthread_mutex_trylock successfully" );214 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 215 215 status = pthread_mutex_trylock( &Mutex2_id ); 216 216 if ( status ) … … 218 218 assert( !status ); 219 219 220 puts( "Init: pthread_mutex_destroy - EBUSY (already locked)" ); 220 221 status = pthread_mutex_destroy( &Mutex2_id ); 221 222 if ( status != EBUSY ) 222 223 printf( "status = %d\n", status ); 223 224 assert( status == EBUSY ); 224 puts( "Init: pthread_mutex_destroy - EBUSY" ); 225 226 puts( "Init: pthread_mutex_unlock successfully" ); 225 226 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 227 227 status = pthread_mutex_unlock( &Mutex2_id ); 228 228 assert( !status ); 229 229 230 puts( "Init: pthread_mutex_destroy " );230 puts( "Init: pthread_mutex_destroy - SUCCESSFUL" ); 231 231 status = pthread_mutex_destroy( &Mutex2_id ); 232 232 assert( !status ); … … 236 236 empty_line(); 237 237 238 puts( "Init: Initializing mutex attributes" ); 239 status = pthread_mutexattr_init( &attr ); 240 assert( !status ); 241 242 puts( "Init: Setting PTHREAD_PRIO_INHERIT attribute" ); 238 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 239 status = pthread_mutexattr_init( &attr ); 240 assert( !status ); 241 242 puts( 243 "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_INHERIT)" 244 ); 243 245 status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT ); 244 246 assert( !status ); 245 247 246 puts( "Init: Creating a mutex" );248 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 247 249 status = pthread_mutex_init( &Mutex2_id, &attr ); 248 250 assert( !status ); 249 251 250 puts( "Init: pthread_mutex_trylock successfully" );252 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 251 253 status = pthread_mutex_trylock( &Mutex2_id ); 252 254 assert( !status ); … … 261 263 param.sched_priority = 255; 262 264 263 puts( "Init: Setting Task2 priority to highest" );265 puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" ); 264 266 status = pthread_setschedparam( Task2_id, SCHED_FIFO, ¶m ); 265 267 assert( !status ); … … 269 271 status = pthread_getschedparam( pthread_self(), &policy, ¶m ); 270 272 assert( !status ); 271 printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority);272 273 puts( "Init: pthread_mutex_unlock successfully" );273 printf( "Init: pthread_getschedparam - priority = %d\n", param.sched_priority); 274 275 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 274 276 status = pthread_mutex_unlock( &Mutex2_id ); 275 277 assert( !status ); 276 278 277 puts( "Init: pthread_mutexattr_destroy " );279 puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" ); 278 280 status = pthread_mutexattr_destroy( &attr ); 279 281 assert( !status ); 280 282 281 puts( "Init: pthread_mutex_destroy " );283 puts( "Init: pthread_mutex_destroy - SUCCESSFUL" ); 282 284 status = pthread_mutex_destroy( &Mutex2_id ); 283 285 assert( !status ); … … 287 289 empty_line(); 288 290 289 puts( "Init: Initializing mutex attributes" ); 290 status = pthread_mutexattr_init( &attr ); 291 assert( !status ); 292 293 puts( "Init: Setting PTHREAD_PRIO_PROTECT attribute" ); 291 puts( "Init: pthread_mutexattr_init - SUCCESSFUL" ); 292 status = pthread_mutexattr_init( &attr ); 293 assert( !status ); 294 295 puts( 296 "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_PROTECT)" 297 ); 294 298 status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT ); 295 299 assert( !status ); 296 300 297 puts( "Init: Creating a mutex" );301 puts( "Init: pthread_mutex_init - SUCCESSFUL" ); 298 302 status = pthread_mutex_init( &Mutex2_id, &attr ); 299 303 assert( !status ); … … 301 305 status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling ); 302 306 assert( !status ); 303 printf( "Init: priority ceiling = %d\n", ceiling ); 304 307 printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling ); 308 309 puts( "Init: pthread_mutex_setprioceiling - new ceiling = 200" ); 305 310 status = pthread_mutex_setprioceiling( &Mutex2_id, 200, &old_ceiling ); 306 311 assert( !status ); 307 printf( "Init: Set ceiling = 200 old priority ceiling = %d\n",old_ceiling ); 312 printf( 313 "Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling 314 ); 308 315 309 316 status = pthread_getschedparam( pthread_self(), &policy, ¶m ); 310 317 assert( !status ); 311 printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority ); 312 313 puts( "Init: pthread_mutex_trylock successfully" ); 318 printf( 319 "Init: pthread_getschedparam - priority = %d\n", param.sched_priority 320 ); 321 322 puts( "Init: pthread_mutex_trylock - SUCCESSFUL" ); 314 323 status = pthread_mutex_trylock( &Mutex2_id ); 315 324 assert( !status ); … … 317 326 status = pthread_getschedparam( pthread_self(), &policy, ¶m ); 318 327 assert( !status ); 319 printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority ); 328 printf( 329 "Init: pthread_getschedparam - priority = %d\n", param.sched_priority 330 ); 320 331 321 332 /* create a thread at a higher priority */ … … 330 341 status = pthread_setschedparam( Task3_id, SCHED_FIFO, ¶m ); 331 342 assert( !status ); 332 puts( "Init: Set Task3 priority to highest" );343 puts( "Init: pthread_setschedparam - set Task3 priority to highest" ); 333 344 334 345 /* DOES NOT SWITCH to Task3 */ … … 340 351 /* switch to task 3 */ 341 352 342 puts( "Init: pthread_mutex_unlock successfully" );353 puts( "Init: pthread_mutex_unlock - SUCCESSFUL" ); 343 354 status = pthread_mutex_unlock( &Mutex2_id ); 344 355 assert( !status ); … … 346 357 status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling ); 347 358 assert( !status ); 348 printf( "Init: p riorityceiling = %d\n", ceiling );359 printf( "Init: pthread_mutex_getprioceiling- ceiling = %d\n", ceiling ); 349 360 350 361 /* set priority of Init to highest priority */ … … 354 365 status = pthread_setschedparam( Init_id, SCHED_FIFO, ¶m ); 355 366 assert( !status ); 356 puts( "Init: Set Init priority to highest" ); 357 367 puts( "Init: pthread_setschedparam - set Init priority to highest" ); 368 369 puts( "Init: pthread_mutex_lock - EINVAL (priority ceiling violation)" ); 358 370 status = pthread_mutex_lock( &Mutex2_id ); 359 371 if ( status != EDEADLK ) 360 372 printf( "status = %d\n", status ); 361 373 assert( status == EINVAL ); 362 puts( "Init: pthread_mutex_lock EINVAL (priority ceiling violation)" );363 374 364 375 puts( "*** END OF POSIX TEST 5 ***" );
Note: See TracChangeset
for help on using the changeset viewer.