Changeset e492f910 in rtems


Ignore:
Timestamp:
Dec 2, 1999, 5:34:50 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
43283456
Parents:
3a96054
Message:

Jennifer added initial test code. Conditional'ed out until she has
the opportunity to work with it.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/psxtests/psxmsgq01/init.c

    r3a96054 re492f910  
    1818)
    1919{
     20  int             status;
     21  int             value;
     22  int             i;
     23  mqd_t           mqs[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES];
     24  mqd_t           mq2;
     25  mqd_t           *n_mq1;
     26  mqd_t           *n_mq2;
     27  struct timespec waittime;
     28  char            failure_msg[80];
     29
    2030
    2131  puts( "\n\n*** POSIX MESSAGE QUEUE TEST ***" );
    2232
     33#if 0
     34  /* Modes are currently unsupported */
     35
     36  /*
     37   * Validate all mq_open return paths.
     38   */
     39
     40  puts( "Init: mq_open - mq1 SUCCESSFUL" );
     41  n_mq1 = mq_open( "mq1", O_CREAT, 00777, 1 );
     42  assert( n_mq1 != SEM_FAILED );
     43
     44  puts( "Init: mq_open - Create an Existing mq (EEXIST)" );
     45  n_mq2 = mq_open("mq1", O_CREAT | O_EXCL, 00777, 1);
     46  fatal_directive_status(
     47    (int) n_mq2, (int ) SEM_FAILED, "mq_open error return status" );
     48  fatal_directive_status( errno, EEXIST,  "mq_open errno EEXIST");
     49
     50  puts( "Init: mq_open - Open new mq without create flag (ENOENT)" );
     51  n_mq2 = mq_open("mq3", O_EXCL, 00777, 1);
     52  fatal_directive_status(
     53    (int) n_mq2, (int ) SEM_FAILED, "mq_open error return status" );
     54  fatal_directive_status( errno, ENOENT,  "mq_open errno EEXIST");
     55
     56  /*
     57   * XXX - Could not hit the following errors:
     58   *   E_POSIX_Semaphore_Create_support only fails if
     59   *     ENOSYS - When semaphore is shared between processes.
     60   *     ENOSPC - When out of memory.
     61   */
     62
     63  /*
     64   * Validate we can wait on a message queue opened with mq_open.
     65   */
     66
     67  puts( "Init: mq_wait on mq1" );
     68  status = mq_receive(n_mq1);
     69  fatal_directive_status( status, 0, "mq_wait opened message queue");
     70
     71  /*
     72   * Validate a second open returns the same message queue.
     73   */
     74
     75  puts( "Init: mq_open - Open an existing mq ( same id )" );
     76  n_mq2 = mq_open("mq1", 0 );
     77  fatal_directive_status(
     78    (int) n_mq2, (int ) n_mq1, "mq_open error return status" );
     79 
     80  /*
     81   * Unlink the message queue, then verify an open of the same name produces a
     82   * different message queue.
     83   */
     84
     85  puts( "Init: mq_unlink - mq1 SUCCESSFUL" );
     86  status = mq_unlink( "mq1" );
     87  fatal_directive_status( status, 0, "mq_unlink locked message queue");
     88
     89  puts( "Init: mq_open - Reopen mq1 SUCCESSFUL with a different id" );
     90  n_mq2 = mq_open( "mq1", O_CREAT | O_EXCL, 00777, 1);
     91  assert( n_mq2 != SEM_FAILED );
     92  assert( n_mq2 != n_mq1 );
     93
     94  /*
     95   * Validate we can call close on a message queue opened with mq_open.
     96   */
     97
     98  puts( "Init: mq_close (1) - SUCCESSFUL" );
     99  status = mq_close( n_mq1 );
     100  fatal_directive_status( status, 0, "mq_close message queue");
     101
     102
     103  /*
     104   * Validate it n_mq2 (the last open for mq1 name can be
     105   * correctly closed and unlinked.
     106   */
     107
     108  puts( "Init: mq_close (2) - SUCCESSFUL" );
     109  status = mq_close( n_mq2 );
     110  fatal_directive_status( status, 0, "mq_close message queue");
     111
     112  puts( "Init: mq_unlink - mq1 (2) SUCCESSFUL" );
     113  status = mq_unlink( "mq1" );
     114  fatal_directive_status( status, 0, "mq_unlink locked message queue");
     115
     116  puts( "Init: mq_close - UNSUCCESSFUL (EINVAL)" );
     117  status = mq_close(n_mq2);
     118  fatal_directive_status( status, -1, "mq_close error return status");
     119  fatal_directive_status( errno, EINVAL, "mq_close errno EINVAL");
     120
     121  puts( "Init: mq_unlink - UNSUCCESSFUL (ENOENT)" );
     122  status = mq_unlink("mq1");
     123  fatal_directive_status( status, -1, "mq_unlink error return status");
     124  fatal_directive_status( errno, ENOENT, "mq_close errno EINVAL");
     125
     126
     127  /*
     128   * Validate we can unlink (2)
     129   */
     130
     131  puts( "Init: mq_unlink (NULL) - EINVAL" );
     132  status = mq_unlink( NULL );
     133  fatal_directive_status( status, -1, "mq_unlink error return status");
     134  fatal_directive_status( errno, EINVAL, "mq_unlink errno value");
     135
     136  puts( "Init: mq_unlink (\"\") - EINVAL" );
     137  status = mq_unlink( "" );
     138  fatal_directive_status( status, -1, "mq_unlink error return status");
     139  fatal_directive_status( errno, EINVAL, "mq_unlink errno value");
     140
     141  /*
     142   * XXX - Cant' create location OBJECTS_ERROR or OBJECTS_REMOTE.
     143   *       mq_close and mq_unlink.
     144   */
     145
     146  puts( "Init: mq_unlink - UNSUCCESSFUL (ENOENT)" );
     147  status = mq_unlink("mq2");
     148  fatal_directive_status( status, -1, "mq_unlink error return status");
     149  fatal_directive_status( errno, ENOENT, "mq_unlink errno ENOENT");
     150  assert( (status == -1) && (errno == ENOENT) );
     151
     152#endif
    23153  puts( "*** END OF POSIX MESSAGE QUEUE TEST ***" );
    24154  exit( 0 );
  • testsuites/psxtests/psxmsgq01/init.c

    r3a96054 re492f910  
    1818)
    1919{
     20  int             status;
     21  int             value;
     22  int             i;
     23  mqd_t           mqs[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES];
     24  mqd_t           mq2;
     25  mqd_t           *n_mq1;
     26  mqd_t           *n_mq2;
     27  struct timespec waittime;
     28  char            failure_msg[80];
     29
    2030
    2131  puts( "\n\n*** POSIX MESSAGE QUEUE TEST ***" );
    2232
     33#if 0
     34  /* Modes are currently unsupported */
     35
     36  /*
     37   * Validate all mq_open return paths.
     38   */
     39
     40  puts( "Init: mq_open - mq1 SUCCESSFUL" );
     41  n_mq1 = mq_open( "mq1", O_CREAT, 00777, 1 );
     42  assert( n_mq1 != SEM_FAILED );
     43
     44  puts( "Init: mq_open - Create an Existing mq (EEXIST)" );
     45  n_mq2 = mq_open("mq1", O_CREAT | O_EXCL, 00777, 1);
     46  fatal_directive_status(
     47    (int) n_mq2, (int ) SEM_FAILED, "mq_open error return status" );
     48  fatal_directive_status( errno, EEXIST,  "mq_open errno EEXIST");
     49
     50  puts( "Init: mq_open - Open new mq without create flag (ENOENT)" );
     51  n_mq2 = mq_open("mq3", O_EXCL, 00777, 1);
     52  fatal_directive_status(
     53    (int) n_mq2, (int ) SEM_FAILED, "mq_open error return status" );
     54  fatal_directive_status( errno, ENOENT,  "mq_open errno EEXIST");
     55
     56  /*
     57   * XXX - Could not hit the following errors:
     58   *   E_POSIX_Semaphore_Create_support only fails if
     59   *     ENOSYS - When semaphore is shared between processes.
     60   *     ENOSPC - When out of memory.
     61   */
     62
     63  /*
     64   * Validate we can wait on a message queue opened with mq_open.
     65   */
     66
     67  puts( "Init: mq_wait on mq1" );
     68  status = mq_receive(n_mq1);
     69  fatal_directive_status( status, 0, "mq_wait opened message queue");
     70
     71  /*
     72   * Validate a second open returns the same message queue.
     73   */
     74
     75  puts( "Init: mq_open - Open an existing mq ( same id )" );
     76  n_mq2 = mq_open("mq1", 0 );
     77  fatal_directive_status(
     78    (int) n_mq2, (int ) n_mq1, "mq_open error return status" );
     79 
     80  /*
     81   * Unlink the message queue, then verify an open of the same name produces a
     82   * different message queue.
     83   */
     84
     85  puts( "Init: mq_unlink - mq1 SUCCESSFUL" );
     86  status = mq_unlink( "mq1" );
     87  fatal_directive_status( status, 0, "mq_unlink locked message queue");
     88
     89  puts( "Init: mq_open - Reopen mq1 SUCCESSFUL with a different id" );
     90  n_mq2 = mq_open( "mq1", O_CREAT | O_EXCL, 00777, 1);
     91  assert( n_mq2 != SEM_FAILED );
     92  assert( n_mq2 != n_mq1 );
     93
     94  /*
     95   * Validate we can call close on a message queue opened with mq_open.
     96   */
     97
     98  puts( "Init: mq_close (1) - SUCCESSFUL" );
     99  status = mq_close( n_mq1 );
     100  fatal_directive_status( status, 0, "mq_close message queue");
     101
     102
     103  /*
     104   * Validate it n_mq2 (the last open for mq1 name can be
     105   * correctly closed and unlinked.
     106   */
     107
     108  puts( "Init: mq_close (2) - SUCCESSFUL" );
     109  status = mq_close( n_mq2 );
     110  fatal_directive_status( status, 0, "mq_close message queue");
     111
     112  puts( "Init: mq_unlink - mq1 (2) SUCCESSFUL" );
     113  status = mq_unlink( "mq1" );
     114  fatal_directive_status( status, 0, "mq_unlink locked message queue");
     115
     116  puts( "Init: mq_close - UNSUCCESSFUL (EINVAL)" );
     117  status = mq_close(n_mq2);
     118  fatal_directive_status( status, -1, "mq_close error return status");
     119  fatal_directive_status( errno, EINVAL, "mq_close errno EINVAL");
     120
     121  puts( "Init: mq_unlink - UNSUCCESSFUL (ENOENT)" );
     122  status = mq_unlink("mq1");
     123  fatal_directive_status( status, -1, "mq_unlink error return status");
     124  fatal_directive_status( errno, ENOENT, "mq_close errno EINVAL");
     125
     126
     127  /*
     128   * Validate we can unlink (2)
     129   */
     130
     131  puts( "Init: mq_unlink (NULL) - EINVAL" );
     132  status = mq_unlink( NULL );
     133  fatal_directive_status( status, -1, "mq_unlink error return status");
     134  fatal_directive_status( errno, EINVAL, "mq_unlink errno value");
     135
     136  puts( "Init: mq_unlink (\"\") - EINVAL" );
     137  status = mq_unlink( "" );
     138  fatal_directive_status( status, -1, "mq_unlink error return status");
     139  fatal_directive_status( errno, EINVAL, "mq_unlink errno value");
     140
     141  /*
     142   * XXX - Cant' create location OBJECTS_ERROR or OBJECTS_REMOTE.
     143   *       mq_close and mq_unlink.
     144   */
     145
     146  puts( "Init: mq_unlink - UNSUCCESSFUL (ENOENT)" );
     147  status = mq_unlink("mq2");
     148  fatal_directive_status( status, -1, "mq_unlink error return status");
     149  fatal_directive_status( errno, ENOENT, "mq_unlink errno ENOENT");
     150  assert( (status == -1) && (errno == ENOENT) );
     151
     152#endif
    23153  puts( "*** END OF POSIX MESSAGE QUEUE TEST ***" );
    24154  exit( 0 );
Note: See TracChangeset for help on using the changeset viewer.