Changeset 1016b77 in rtems


Ignore:
Timestamp:
Jul 22, 2008, 5:21:59 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.8
Children:
7f46d43d
Parents:
e5c0540
Message:

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

PR 1291/cpukit

  • psx05/init.c, psxmsgq01/init.c: Update tests to reflect absolute time.
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    re5c0540 r1016b77  
     12008-07-22      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        PR 1291/cpukit
     4        * psx05/init.c, psxmsgq01/init.c: Update tests to reflect absolute
     5        time.
     6
    172007-11-27      Glenn Humphrey <glenn.humphrey@OARcorp.com>
    28
  • testsuites/psxtests/psx05/init.c

    re5c0540 r1016b77  
    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

    re5c0540 r1016b77  
    751751  char            *msg;
    752752
    753   timeout.tv_sec  = 1;
    754   timeout.tv_nsec = 0;
    755 
    756753  printf( "Init: mq_timedsend - on queue %s ", Test_q[que].name);
    757754  len = Predefined_Msgs[MAXMSG].size;
    758755  msg = Predefined_Msgs[MAXMSG].msg;
     756
    759757  gettimeofday( &tv1, &tz1 );
     758  timeout.tv_sec  = tv1.tv_sec + 1;
     759  timeout.tv_nsec = tv1.tv_usec * 1000;
     760
    760761  status = mq_timedsend( Test_q[que].mq, msg, len , 0, &timeout );
     762
    761763  gettimeofday( &tv2, &tz2 );
    762764  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
     
    764766
    765767  if ( is_blocking ) { /* Don't verify the non-blocking queue */
    766     fatal_int_service_status( status, -1, "mq_timedsend status");
    767     fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT");
    768   }
    769 
    770   printf("Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    771 
    772   if ( is_blocking ) /* non-blocking queue */
    773     assert( tv3.tv_sec == 1 );
    774   else
    775     assert( tv3.tv_sec == 0 );
     768    fatal_int_service_status( status, -1, "mq_timedsend status" );
     769    fatal_posix_service_status( errno, ETIMEDOUT,  "errno ETIMEDOUT" );
     770  }
     771
     772  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    776773
    777774  if ( que == DEFAULT_RW )
     
    806803  int              status;
    807804
    808   tm.tv_sec  = 1;
    809   tm.tv_nsec = 0;
    810 
    811   printf( "Init: %s mq_timedreceive - on queue %s ", task_name, Test_q[que].name);
     805  printf(
     806    "Init: %s mq_timedreceive - on queue %s ",
     807    task_name,
     808    Test_q[que].name
     809  );
    812810
    813811  gettimeofday( &tv1, &tz1 );
     812  tm.tv_sec  = tv1.tv_sec + 1;
     813  tm.tv_nsec = tv1.tv_usec * 1000;
     814
    814815  status = mq_timedreceive( Test_q[ que ].mq, message, 100, &priority, &tm );
     816
    815817  gettimeofday( &tv2, &tz2 );
    816818  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
     
    822824  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
    823825
    824   if ( is_blocking )
    825     assert( tv3.tv_sec == 1 );
    826   else
    827     assert( tv3.tv_sec == 0 );
    828 }
    829 
    830 
     826}
    831827
    832828void verify_timed_receive()
Note: See TracChangeset for help on using the changeset viewer.