Changeset f5119be4 in rtems


Ignore:
Timestamp:
Jul 18, 2008, 6:47:30 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, master
Children:
e620c55
Parents:
acb4bed0
Message:

2008-07-18 Joel Sherrill <joel.sherrill@…>

PR 1291/cpukit

  • psx05/init.c, psxmsgq01/init.c: As part of addressing timeouts and POSIX services taking relative instead of absolute time for timeouts, these tests were updated.
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    racb4bed0 rf5119be4  
     12008-07-18      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        PR 1291/cpukit
     4        * psx05/init.c, psxmsgq01/init.c: As part of addressing timeouts and
     5        POSIX services taking relative instead of absolute time for timeouts,
     6        these tests were updated.
     7
    182008-07-17      Joel Sherrill <joel.sherrill@oarcorp.com>
    29
  • testsuites/psxtests/psx05/init.c

    racb4bed0 rf5119be4  
    11/*
    2  *  COPYRIGHT (c) 1989-1999.
     2 *  COPYRIGHT (c) 1989-2008.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    7373}
    7474
     75void calculate_abstimeout(
     76  struct timespec *times,
     77  uint32_t         seconds,
     78  uint32_t         nanoseconds
     79)
     80{
     81  struct timeval       tv1;
     82  struct timezone      tz1;
     83
     84  gettimeofday( &tv1, &tz1 );
     85
     86  times->tv_sec  = seconds     + tv1.tv_sec;
     87  times->tv_nsec = nanoseconds + (tv1.tv_usec * 1000);
     88
     89  while ( times->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) {
     90    times->tv_sec++;
     91    times->tv_nsec - TOD_NANOSECONDS_PER_SECOND;
     92  }
     93
     94}
     95
    7596void *POSIX_Init(
    7697  void *argument
     
    344365  assert( status == EPERM );
    345366
    346   times.tv_sec = 0;
    347   times.tv_nsec = 500000000;
    348367  puts( "Init: pthread_mutex_timedlock - time out in 1/2 second" );
     368  calculate_abstimeout( &times, 0, (TOD_NANOSECONDS_PER_SECOND / 2) );
     369
    349370  status = pthread_mutex_timedlock( &Mutex_id, &times );
    350   if ( status != EAGAIN )
    351     printf( "status = %d\n", status );
    352   assert( status == EAGAIN );
     371  if ( status != ETIMEDOUT )
     372    printf( "status = %d\n", status );
     373  assert( status == ETIMEDOUT );
    353374
    354375     /* switch to idle */
  • testsuites/psxtests/psxmsgq01/init.c

    racb4bed0 rf5119be4  
    745745  char            *msg;
    746746
    747   timeout.tv_sec  = 1;
    748   timeout.tv_nsec = 0;
    749 
    750747  printf( "Init: mq_timedsend - on queue %s ", Test_q[que].name);
    751748  len = Predefined_Msgs[MAXMSG].size;
    752749  msg = Predefined_Msgs[MAXMSG].msg;
     750
    753751  gettimeofday( &tv1, &tz1 );
     752  timeout.tv_sec  = tv1.tv_sec + 1;
     753  timeout.tv_nsec = tv1.tv_usec * 1000;
     754
    754755  status = mq_timedsend( Test_q[que].mq, msg, len , 0, &timeout );
     756
    755757  gettimeofday( &tv2, &tz2 );
    756758  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
     
    758760
    759761  if ( is_blocking ) { /* Don't verify the non-blocking queue */
    760     fatal_int_service_status( status, -1, "mq_timedsend status");
    761     fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT");
    762   }
    763 
    764   printf("Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    765 
    766   if ( is_blocking ) /* non-blocking queue */
    767     assert( tv3.tv_sec == 1 );
    768   else
    769     assert( tv3.tv_sec == 0 );
     762    fatal_int_service_status( status, -1, "mq_timedsend status" );
     763    fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT" );
     764  }
     765
     766  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    770767
    771768  if ( que == DEFAULT_RW )
     
    800797  int              status;
    801798
    802   tm.tv_sec  = 1;
    803   tm.tv_nsec = 0;
    804 
    805   printf( "Init: %s mq_timedreceive - on queue %s ", task_name, Test_q[que].name);
     799  printf(
     800    "Init: %s mq_timedreceive - on queue %s ",
     801    task_name,
     802    Test_q[que].name
     803  );
    806804
    807805  gettimeofday( &tv1, &tz1 );
     806  tm.tv_sec  = tv1.tv_sec + 1;
     807  tm.tv_nsec = tv1.tv_usec * 1000;
     808
    808809  status = mq_timedreceive( Test_q[ que ].mq, message, 100, &priority, &tm );
     810
    809811  gettimeofday( &tv2, &tz2 );
    810812  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
     
    816818  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    817819
    818   if ( is_blocking )
    819     assert( tv3.tv_sec == 1 );
    820   else
    821     assert( tv3.tv_sec == 0 );
    822 }
    823 
    824 
     820}
    825821
    826822void verify_timed_receive()
Note: See TracChangeset for help on using the changeset viewer.