Changeset 74c15fe6 in rtems


Ignore:
Timestamp:
12/10/13 23:56:22 (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
0b599421
Parents:
0f01de2b
Message:

psxtmcond01: Fix bug where mutex not locked and add EPERM error check

This test formerly had a bug in that it attempted to wait on a
condition variable with a Mutex that was not locked. This is
undefined by POSIX. But a recent change to match GNU/Linux behavior
resulted in finding a bug in the test.

Location:
testsuites/psxtests/psxcond01
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxcond01/init.c

    r0f01de2b r74c15fe6  
    11/*
    2  *  COPYRIGHT (c) 1989-2012.
     2 *  COPYRIGHT (c) 1989-2013.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    2828)
    2929{
     30  int sc;
     31
     32  puts( "BlockingThread - pthread_cond_wait with mutex not locked - EPERM" );
     33  sc = pthread_cond_wait( &Condition, &Mutex1 );
     34  fatal_posix_service_status( sc, EPERM, "mutex1 not locked" );
     35
     36  sc = pthread_mutex_lock( &Mutex1 );
     37  fatal_posix_service_status( sc, 0, "mutex1 lock" );
     38 
    3039  puts( "BlockingThread - pthread_cond_wait on Mutex1 - OK" );
    31   (void) pthread_cond_wait( &Condition, &Mutex1 );
     40  sc = pthread_cond_wait( &Condition, &Mutex1 );
    3241
    33   puts( "ERROR - BlockingThread returned from pthread_cond_wait!" );
     42  printf(
     43    "ERROR - BlockingThread returned from pthread_cond_wait! (rc=%d/%s)\n",
     44    sc,
     45    strerror(sc)
     46  );
    3447  rtems_test_exit( 0 );
    3548
  • testsuites/psxtests/psxcond01/psxcond01.scn

    r0f01de2b r74c15fe6  
    22Init - pthread_mutex_init - Mutex1 - OK
    33Init - pthread_mutex_init - Mutex2 - OK
     4BlockingThread - pthread_cond_wait with mutex not locked - EPERM
    45Init - pthread_cond_init - Condition - OK
    56Init -  pthread_create - OK
Note: See TracChangeset for help on using the changeset viewer.