Changeset 5d8b8eb in rtems


Ignore:
Timestamp:
Jul 28, 2009, 1:46:03 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
5eac0853
Parents:
42d57c7
Message:

2009-07-28 Santosh G Vattam <vattam.santosh@…>

  • psxmsgq01/init.c, psxmsgq01/psxmsgq01.scn: Add tests for various mq_timedreceive and mq_timedsend conditions. In particular test timeout in the past.
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r42d57c7 r5d8b8eb  
     12009-07-28      Santosh G Vattam <vattam.santosh@gmail.com>
     2
     3        * psxmsgq01/init.c, psxmsgq01/psxmsgq01.scn: Add tests for various
     4        mq_timedreceive and mq_timedsend conditions. In particular test
     5        timeout in the past.
     6
    172009-07-28      Santosh G Vattam <vattam.santosh@gmail.com>
    28
  • testsuites/psxtests/psxmsgq01/init.c

    r42d57c7 r5d8b8eb  
    11331133}
    11341134
     1135void verify_timedout_mq_timedreceive(
     1136  char *task_name,
     1137  int   que,
     1138  int   is_blocking
     1139)
     1140{
     1141  char message[ 100 ];
     1142  unsigned int priority;
     1143  struct timespec tm;
     1144  struct timeval  tv1, tv2, tv3;
     1145  struct timezone tz1, tz2;
     1146  int              status;
     1147
     1148  printf(
     1149    "Init: %s verify_timedout_mq_timedreceive - on queue %s ",
     1150    task_name,
     1151    Test_q[que].name
     1152  );
     1153
     1154  gettimeofday( &tv1, &tz1 );
     1155  tm.tv_sec  = tv1.tv_sec - 1;
     1156  tm.tv_nsec = tv1.tv_usec * 1000;
     1157
     1158  status = mq_timedreceive( Test_q[ que ].mq, message, 100, &priority, &tm );
     1159
     1160  gettimeofday( &tv2, &tz2 );
     1161  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
     1162  tv3.tv_usec = tv2.tv_usec - tv1.tv_usec;
     1163
     1164  fatal_int_service_status( status, -1, "mq_timedreceive status");
     1165
     1166  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
     1167
     1168}
     1169
     1170void verify_mq_receive()
     1171{
     1172  int  que;
     1173
     1174  Start_Test( "mq_timedout_receive"  );
     1175
     1176  for( que = RW_QUEUE; que < CLOSED; que++ ) {
     1177    if (( que == BLOCKING ) || ( que == DEFAULT_RW ))
     1178      break;
     1179    else
     1180      verify_timedout_mq_timedreceive( "Init:", que, 0 );
     1181  }
     1182}
     1183
     1184void verify_timedout_mq_timedsend(
     1185  int  que,
     1186  int  is_blocking
     1187)
     1188{
     1189  struct timespec timeout;
     1190  struct timeval  tv1, tv2, tv3;
     1191  struct timezone tz1, tz2;
     1192  int              len;
     1193  int              status;
     1194  char            *msg;
     1195
     1196  printf( "Init: verify_timedout_mq_timedsend - on queue %s ", Test_q[que].name);
     1197  len = Predefined_Msgs[MAXMSG].size;
     1198  msg = Predefined_Msgs[MAXMSG].msg;
     1199
     1200  gettimeofday( &tv1, &tz1 );
     1201  timeout.tv_sec  = tv1.tv_sec - 1;
     1202  timeout.tv_nsec = tv1.tv_usec * 1000;
     1203
     1204  status = mq_timedsend( Test_q[que].mq, msg, len , 0, &timeout );
     1205
     1206  gettimeofday( &tv2, &tz2 );
     1207  tv3.tv_sec  = tv2.tv_sec - tv1.tv_sec;
     1208  tv3.tv_usec = tv2.tv_usec - tv1.tv_usec;
     1209
     1210  printf( "Init: %ld sec %ld us\n", (long)tv3.tv_sec, (long)tv3.tv_usec );
     1211
     1212  if ( que == DEFAULT_RW )
     1213    Test_q[que].count++;
     1214}
     1215
     1216void verify_mq_send()
     1217{
     1218  int              que;
     1219
     1220  Start_Test( "verify_timedout_mq_timedsend"  );
     1221
     1222  for( que = RW_QUEUE; que < CLOSED; que++ ) {
     1223    if ( que == BLOCKING )
     1224      verify_timedout_mq_timedsend( que, 1 );
     1225    else
     1226      verify_timedout_mq_timedsend( que, 0 );
     1227  }
     1228}
     1229
    11351230void *POSIX_Init(
    11361231  void *argument
     
    11531248  verify_notify();
    11541249  verify_with_threads();
    1155 
     1250  verify_mq_receive();
     1251  verify_mq_send();
     1252 
    11561253  puts( "*** END OF POSIX MESSAGE QUEUE TEST ***" );
    11571254  rtems_test_exit( 0 );
  • testsuites/psxtests/psxmsgq01/psxmsgq01.scn

    r42d57c7 r5d8b8eb  
    2222Task1:mq_setattr - NULL attributes (EINVAL)
    2323Init: set_attr all queues to blocking
    24 Init: Init: mq_timedreceive - on queue Qnoblock Init: 1 sec 0 us
    25 Init: Init: mq_timedreceive - on queue Qblock Init: 1 sec 0 us
    26 Init: Init: mq_timedreceive - on queue Qdefault Init: 1 sec 0 us
     24Init: Init: mq_timedreceive - on queue Qnoblock Init: 1 sec -12131 us
     25Init: Init: mq_timedreceive - on queue Qblock Init: 1 sec -11843 us
     26Init: Init: mq_timedreceive - on queue Qdefault Init: 0 sec 988133 us
    2727_______________mq_send errors
    2828Init: mq_send - Closed message queue (EBADF)
     
    3838Init: mq_getattr - NULL attributes (EINVAL)
    3939_______________mq_timedsend
    40 Init: mq_timedsend - on queue Qnoblock Init: 0 sec 0 us
    41 Init: mq_timedsend - on queue Qblock Init: 1 sec 0 us
    42 Init: mq_timedsend - on queue Qdefault Init: 0 sec 0 us
     40Init: mq_timedsend - on queue Qnoblock Init: 0 sec 77 us
     41Init: mq_timedsend - on queue Qblock Init: 0 sec 988482 us
     42Init: mq_timedsend - on queue Qdefault Init: 0 sec 101 us
    4343_______________mq_receive errors
    4444Init: mq_receive - Unopened message queue (EBADF)
     
    4949Init: mq_receive - Queue is empty (EAGAIN)
    5050_______________mq_timedreceive
    51 Init: Init: mq_timedreceive - on queue Qnoblock Init: 0 sec 0 us
    52 Init: Init: mq_timedreceive - on queue Qblock Init: 1 sec 0 us
    53 Init: Init: mq_timedreceive - on queue Qdefault Init: 1 sec 0 us
     51Init: Init: mq_timedreceive - on queue Qnoblock Init: 0 sec 83 us
     52Init: Init: mq_timedreceive - on queue Qblock Init: 0 sec 986568 us
     53Init: Init: mq_timedreceive - on queue Qdefault Init: 1 sec -11823 us
    5454_______________mq_open functionality
    5555_______________mq_notify
     
    7171waiting on any signal for 3 seconds.
    7272_______________multi-thread Task 1 Test
    73 Task_1: Fri Jan  1 00:00:20 1988
     73Task_1: Fri Jan  1 00:00:17 1988
    7474Task_1: mq_send -  to Qblock msg: 12345678 priority 31
    7575Task_1: pthread_exit
    76 Init: Fri Jan  1 00:00:20 1988
     76Init: Fri Jan  1 00:00:17 1988
    7777_______________multi-thread Task 2 Test
    7878Init: Verify Queues are empty
     
    8080Init: Verify Queues are full
    8181Init: mq_send -  to Qblock msg: Last priority 32
    82 Task_2: Fri Jan  1 00:00:21 1988
     82Task_2: Fri Jan  1 00:00:17 1988
    8383Task_2: Verify Queues are full
    8484Task_2: pthread_exit
    85 Init: Fri Jan  1 00:00:21 1988
     85Init: Fri Jan  1 00:00:17 1988
    8686Init: Verify Queues are full
    8787Init: Empty all Queues
     
    9191Init: Verify Queues are full
    9292Init: mq_send - Block while thread deletes queue (EBADF)
    93 Task_3: Fri Jan  1 00:00:21 1988
     93Task_3: Fri Jan  1 00:00:18 1988
    9494_______________Unlink and Close All Files
    9595Task_3: pthread_exit
     96_______________mq_timedout_receive
     97Init: Init: verify_timedout_mq_timedreceive - on queue Qnoblock Init: 0 sec 54 us
     98_______________verify_timedout_mq_timedsend
     99Init: verify_timedout_mq_timedsend - on queue Qnoblock Init: 0 sec 54 us
     100Init: verify_timedout_mq_timedsend - on queue Qblock Init: 0 sec 55 us
     101Init: verify_timedout_mq_timedsend - on queue Qdefault Init: 0 sec 78 us
    96102*** END OF POSIX MESSAGE QUEUE TEST ***
    97103
Note: See TracChangeset for help on using the changeset viewer.