Changeset 7a67dfbc in rtems


Ignore:
Timestamp:
May 17, 2009, 8:59:23 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
b7681c6b
Parents:
5b469b7
Message:

2009-05-17 Joel Sherrill <joel.sherrill@…>

  • psxsem01/Makefile.am, psxsem01/init.c, psxsem01/psxsem01.scn, psxtimer01/psxtimer.c, psxtimer01/system.h, psxtimer02/psxtimer.c: Improved so coverage is better.
Location:
testsuites/psxtests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r5b469b7 r7a67dfbc  
     12009-05-17      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * psxsem01/Makefile.am, psxsem01/init.c, psxsem01/psxsem01.scn,
     4        psxtimer01/psxtimer.c, psxtimer01/system.h, psxtimer02/psxtimer.c:
     5        Improved so coverage is better.
     6
    172009-05-17      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • testsuites/psxtests/psxsem01/Makefile.am

    r5b469b7 r7a67dfbc  
    66
    77rtems_tests_PROGRAMS = psxsem01
    8 psxsem01_SOURCES = init.c system.h ../include/pmacros.h
     8psxsem01_SOURCES = init.c system.h ../include/pmacros.h \
     9     ../../support/src/test_support.c
    910
    1011dist_rtems_tests_DATA = psxsem01.scn
  • testsuites/psxtests/psxsem01/init.c

    r5b469b7 r7a67dfbc  
    55#include <time.h>
    66#include <tmacros.h>
     7#include "test_support.h"
    78
    89void *POSIX_Init(
     
    2223  puts( "\n\n*** POSIX SEMAPHORE MANAGER TEST 1 ***" );
    2324
     25  puts( "Init: sem_init - UNSUCCESSFUL (EINVAL)" );
     26  status = sem_init(NULL, 0, 1);
     27  fatal_posix_service_status( status, -1, "sem_init error return status");
     28  fatal_posix_service_status( errno, EINVAL, "sem_init errorno EINVAL" );
     29
    2430  puts( "Init: sem_init - SUCCESSFUL" );
    2531  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
     
    113119  status = sem_timedwait(&sems[2], &waittime);
    114120  fatal_posix_service_status( status, -1, "sem_timedwait error return status");
    115   fatal_posix_service_status( errno, ETIMEDOUT, "sem_timedwait errno ETIMEDOUT");
     121  fatal_posix_service_status(
     122    errno, ETIMEDOUT, "sem_timedwait errno ETIMEDOUT");
    116123
    117124  /*
     
    149156   */
    150157
     158  puts( "Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)" );
     159  status = sem_open(Get_Too_Long_Name(), O_CREAT, 0777, 1 );
     160  fatal_posix_service_status( status, -1, "sem_open error return status");
     161  fatal_posix_service_status(
     162    errno, ENAMETOOLONG, "sem_open errorno ENAMETOOLONG" );
     163
    151164  puts( "Init: sem_open - sem1 SUCCESSFUL" );
    152   n_sem1 = sem_open( "sem1", O_CREAT, 00777, 1 );
     165  n_sem1 = sem_open( "sem1",O_CREAT, 0777, 1 );
    153166  assert( n_sem1 != SEM_FAILED );
    154167
     168  puts( "Init: sem_destroy - named sem1 - EINVAL" );
     169  status = sem_destroy(n_sem1);
     170  fatal_posix_service_status( status, -1, "sem_destroy named semaphore");
     171  fatal_posix_service_status( errno, EINVAL,  "sem_destroy named semaphore");
     172
    155173  puts( "Init: sem_open - Create an Existing sem (EEXIST)" );
    156   n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 00777, 1);
     174  n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 0777, 1);
    157175  fatal_posix_service_status(
    158176    (int) n_sem2, (int ) SEM_FAILED, "sem_open error return status" );
     
    160178
    161179  puts( "Init: sem_open - Open new sem without create flag (ENOENT)" );
    162   n_sem2 = sem_open("sem3", O_EXCL, 00777, 1);
     180  n_sem2 = sem_open("sem3", O_EXCL, 0777, 1);
    163181  fatal_posix_service_status(
    164182    (int) n_sem2, (int ) SEM_FAILED, "sem_open error return status" );
     
    199217
    200218  puts( "Init: sem_open - Reopen sem1 SUCCESSFUL with a different id" );
    201   n_sem2 = sem_open( "sem1", O_CREAT | O_EXCL, 00777, 1);
     219  n_sem2 = sem_open( "sem1", O_CREAT | O_EXCL, 0777, 1);
    202220  assert( n_sem2 != SEM_FAILED );
    203221  assert( n_sem2 != n_sem1 );
  • testsuites/psxtests/psxsem01/psxsem01.scn

    r5b469b7 r7a67dfbc  
    11*** POSIX SEMAPHORE MANAGER TEST 1 ***
     2Init: sem_init - UNSUCCESSFUL (EINVAL)
    23Init: sem_init - SUCCESSFUL
    34Init: sem_init - UNSUCCESSFUL (ENOSPC)
     
    1920Init: sem_post - UNSUCCESSFUL (EINVAL)
    2021Init: sem_destroy - SUCCESSFUL
     22Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)
    2123Init: sem_open - sem1 SUCCESSFUL
     24Init: sem_destroy - named sem1 - EINVAL
    2225Init: sem_open - Create an Existing sem (EEXIST)
    2326Init: sem_open - Open new sem without create flag (ENOENT)
  • testsuites/psxtests/psxtimer01/psxtimer.c

    r5b469b7 r7a67dfbc  
    6464)
    6565{
     66   struct   itimerspec prev;
     67
    6668   timerdata->it_value.tv_sec  = 0;
    6769   timerdata->it_value.tv_nsec  = 0;
    68    if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,timerdata,NULL) == -1) {
     70   if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,timerdata,&prev) == -1) {
    6971     perror ("Error in timer setting\n");
    7072     pthread_exit ((void *) -1);
     
    308310   pthread_condattr_t  condattr;     /* condition attributes */
    309311   pthread_attr_t attr;              /* task attributes */
    310    pthread_t ta,tb,tc;               /* threads */
     312   pthread_t ta,tb,tc, tc1;          /* threads */
    311313   sigset_t  set;                    /* signals */
    312314
    313315   struct sched_param sch_param;     /* schedule parameters */
    314    struct periodic_params params_a, params_b, params_c;
     316   struct periodic_params params_a, params_b, params_c, params_c1;
    315317
    316318   puts( "\n\n*** POSIX Timers Test 01 ***" );
     
    413415   }
    414416
    415 
    416417   /* execute 25 seconds and finish */
    417418   sleep (25);
     419
     420   puts( "starting C again with 0.5 second periodicity" );
     421   /* Temporal parameters (0.5 sec. periodicity) */
     422   params_c1.period.tv_sec  = 0;         /* seconds */
     423   params_c1.period.tv_nsec = 500000000; /* nanoseconds */
     424   params_c1.count          = 6;
     425   params_c1.signo = SIGALRM;
     426   if (pthread_create (&tc1, &attr, task_c, &params_c1) != 0) {
     427     perror ("Error in thread create for task c1\n");
     428   }
     429
     430   sleep(5);
     431
    418432   puts( "*** END OF POSIX Timers Test 01 ***" );
    419433   rtems_test_exit (0);
  • testsuites/psxtests/psxtimer01/system.h

    r5b469b7 r7a67dfbc  
    4242#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    4343
    44 #define CONFIGURE_MAXIMUM_POSIX_THREADS             4
    45 #define CONFIGURE_MAXIMUM_POSIX_TIMERS              4
     44#define CONFIGURE_MAXIMUM_POSIX_THREADS             5
     45#define CONFIGURE_MAXIMUM_POSIX_TIMERS              5
    4646#define CONFIGURE_MAXIMUM_TIMERS                    4
    4747#define CONFIGURE_MAXIMUM_POSIX_MUTEXES             2
  • testsuites/psxtests/psxtimer02/psxtimer.c

    r5b469b7 r7a67dfbc  
    104104  fatal_posix_service_status_errno( status, EINVAL, "bad itimer value #3" );
    105105
     106  clock_gettime( CLOCK_REALTIME, &now );
     107  itimer.it_value = now;
     108  itimer.it_value.tv_sec = itimer.it_value.tv_sec + 1;
     109  puts( "timer_settime - bad id - EINVAL" );
     110  status = timer_settime( timer1, TIMER_ABSTIME, &itimer, NULL );
     111  fatal_posix_service_status_errno( status, EINVAL, "bad id" );
     112
    106113  itimer.it_value.tv_nsec = 0;
    107114  puts( "timer_settime - bad clock value - EINVAL" );
Note: See TracChangeset for help on using the changeset viewer.