Changeset 157354e9 in rtems


Ignore:
Timestamp:
Oct 11, 2009, 2:44:00 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
f46fddfc
Parents:
6aa3ce3
Message:

2009-10-11 Joel Sherrill <joel.sherrill@…>

  • psxtimer01/psxtimer.c: Make sure we have null and not-null as return parameter to timer_settime().
Location:
testsuites/psxtests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r6aa3ce3 r157354e9  
     12009-10-11      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * psxtimer01/psxtimer.c: Make sure we have null and not-null as return
     4        parameter to timer_settime().
     5
    162009-10-10      Joel Sherrill <joel.sherrill@oarcorp.com>
    27
  • testsuites/psxtests/psxtimer01/psxtimer.c

    r6aa3ce3 r157354e9  
    6464)
    6565{
    66    /*
    67     *  We do not care about the old value.  And this is a path
    68     *  that needs to be exercised anyway.
    69     */
    70    timerdata->it_value.tv_sec  = 0;
    71    timerdata->it_value.tv_nsec  = 0;
    72    if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,timerdata,NULL) == -1) {
    73      perror ("Error in timer setting\n");
    74      pthread_exit ((void *) -1);
    75    }
     66  static int         firstTime = 1;
     67  struct itimerspec *pOld;
     68  struct itimerspec  odata;
     69
     70  /*
     71   *  We do not care about the old value.  But we need to exercise
     72   *  getting and not getting the return value back.
     73   */
     74  pOld = (firstTime == 1) ? NULL : &odata;
     75  firstTime = 0;
     76
     77  timerdata->it_value.tv_sec  = 0;
     78  timerdata->it_value.tv_nsec  = 0;
     79  if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,timerdata,NULL) == -1) {
     80    perror ("Error in timer setting\n");
     81    rtems_test_exit(0);
     82  }
    7683}
    7784 
     
    98105   if (timer_create (CLOCK_REALTIME, &event, &timer_id) == -1) {
    99106      perror ("Error in timer creation\n");
    100       pthread_exit ((void *) -1);
     107      rtems_test_exit(0);
    101108    }
    102109
     
    112119   if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,&timerdata,&timergetdata) == -1) {
    113120     perror ("Error in timer setting\n");
    114      pthread_exit ((void *) -1);
     121     rtems_test_exit(0);
    115122   }
    116123   printf(
     
    128135     if (timer_gettime(timer_id, &timerdata) == -1) {
    129136       perror ("Error in timer_gettime\n");
    130        pthread_exit ((void *) -1);
     137       rtems_test_exit(0);
    131138     }
    132139     if (! _Timespec_Equal_to( &timerdata.it_value, &my_period )){
     
    166173   if (timer_create (CLOCK_REALTIME, &event, &timer_id) == -1) {
    167174      perror ("Error in timer creation\n");
    168       pthread_exit ((void *) -1);
     175      rtems_test_exit(0);
    169176    }
    170177
     
    181188   if (timer_settime(timer_id,TIMER_ABSTIME,&timerdata,NULL) == -1) {
    182189     perror ("Error in timer setting\n");
    183      pthread_exit ((void *) -1);
     190     rtems_test_exit(0);
    184191   }     
    185192
     
    188195     if (sigwait(&set,&received_sig) == -1) {
    189196       perror ("Error in sigwait\n");
    190        pthread_exit ((void *) -1);
     197       rtems_test_exit(0);
    191198     }
    192199 
    193200     if (timer_gettime(timer_id, &timerdata) == -1) {
    194201       perror ("Error in timer_gettime\n");
    195        pthread_exit ((void *) -1);
    196      }
    197      if (! _Timespec_Equal_to( &timerdata.it_value, &my_period) ){
     202       rtems_test_exit(0);
     203     }
     204     if ( !_Timespec_Equal_to( &timerdata.it_value, &my_period) ){
    198205       perror ("Error in Task B timer_gettime\n");
     206       rtems_test_exit(0);
    199207     }
    200208
     
    238246   if (timer_create (CLOCK_REALTIME, &event, &timer_id) == -1) {
    239247      perror ("Error in timer creation\n");
    240       pthread_exit ((void *) -1);
     248      rtems_test_exit(0);
    241249    }
    242250
     
    252260   if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,&timerdata,NULL) == -1) {
    253261     perror ("Error in timer setting\n");
    254      pthread_exit ((void *) -1);
     262     rtems_test_exit(0);
    255263   }
    256264
     
    259267      if (sigwait(&set,&received_sig) == -1) {
    260268       perror ("Error in sigwait\n");
    261        pthread_exit ((void *) -1);
     269       rtems_test_exit(0);
    262270     }
    263271     if (timer_gettime(timer_id, &timerdata) == -1) {
    264272       perror ("Error in timer_gettime\n");
    265        pthread_exit ((void *) -1);
     273       rtems_test_exit(0);
    266274     }
    267275     if (! _Timespec_Equal_to( &timerdata.it_value, &my_period) ){
     
    285293       if (timer_gettime(timer_id, &timergetdata) == -1) {
    286294         perror ("Error in timer setting\n");
    287          pthread_exit ((void *) -1);
     295         rtems_test_exit(0);
    288296       }
    289297       printf(
Note: See TracChangeset for help on using the changeset viewer.