Changeset 70a66ca in rtems


Ignore:
Timestamp:
Aug 2, 2009, 2:41:46 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
307b6b9
Parents:
770db69
Message:

2009-08-02 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac, psxsignal03/Makefile.am, psxsignal03/init.c, psxsignal03/psxsignal03.doc: Add new test variation which focused on real-time signals rather than user signals.
  • psxsignal04/.cvsignore, psxsignal04/Makefile.am, psxsignal04/psxsignal04.doc, psxsignal04/psxsignal04.scn: New files.
Location:
testsuites/psxtests
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r770db69 r70a66ca  
     12009-08-02      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile.am, configure.ac, psxsignal03/Makefile.am,
     4        psxsignal03/init.c, psxsignal03/psxsignal03.doc: Add new test
     5        variation which focused on real-time signals rather than user
     6        signals.
     7        * psxsignal04/.cvsignore, psxsignal04/Makefile.am,
     8        psxsignal04/psxsignal04.doc, psxsignal04/psxsignal04.scn: New files.
     9
    1102009-08-01      Joel Sherrill <joel.sherrill@oarcorp.com>
    211
  • testsuites/psxtests/Makefile.am

    r770db69 r70a66ca  
    99    psxcancel psxcleanup psxcond01 psxenosys psxkey01 psxkey02 psxkey03 \
    1010    psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 psxmutexattr01 psxobj01 \
    11     psxrwlock01 psxsem01 psxsignal01 psxsignal02 psxsignal03 psxspin01 \
    12     psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 psxualarm \
     11    psxrwlock01 psxsem01 psxsignal01 psxsignal02 psxsignal03 psxsignal03 \
     12    psxspin01 psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 psxualarm \
    1313    psxfatal01 psxfatal02 \
    1414    psxintrcritical01
  • testsuites/psxtests/configure.ac

    r770db69 r70a66ca  
    7272psxsignal02/Makefile
    7373psxsignal03/Makefile
     74psxsignal04/Makefile
    7475psxspin01/Makefile
    7576psxspin02/Makefile
  • testsuites/psxtests/psxsignal03/Makefile.am

    r770db69 r70a66ca  
    1919AM_CPPFLAGS += -I$(top_srcdir)/include
    2020AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     21AM_CPPFLAGS += -DUSE_USER_SIGNALS
    2122
    2223LINK_OBJS = $(psxsignal03_OBJECTS) $(psxsignal03_LDADD)
  • testsuites/psxtests/psxsignal03/init.c

    r770db69 r70a66ca  
    1010 */
    1111
     12#if defined(USE_USER_SIGNALS)
     13  #define TEST_NAME                "01"
     14  #define TEST_STRING              "User Signals"
     15  #define SIGNAL_ONE               SIGUSR1
     16  #define SIGNAL_TWO               SIGUSR2
     17
     18#elif defined(USE_REAL_TIME_SIGNALS)
     19  #define TEST_NAME                "02"
     20  #define TEST_STRING              "Real-Time Signals"
     21  #define SIGNAL_ONE               SIGRTMIN
     22  #define SIGNAL_TWO               SIGRTMAX
     23
     24#else
     25  #error "Test Mode not defined"
     26
     27#endif
    1228
    1329#include <pmacros.h>
     
    2844  Signal_occurred = true;
    2945  Signal_thread   = pthread_self();
     46}
     47
     48const char *signal_name(int signo)
     49{
     50  if (signo == SIGUSR1)
     51    return "SIGUSR1";
     52  if (signo == SIGUSR2)
     53    return "SIGUSR2";
     54  if (signo == SIGRTMIN)
     55    return "SIGRTMIN";
     56  if (signo == SIGRTMAX)
     57    return "SIGRTMAX";
     58  return "unknown-signal";
    3059}
    3160
     
    5079  assert( !sc );
    5180
    52   printf( "%s - Unblock SIGUSR1\n", name );
    53   sc = sigaddset( &mask, SIGUSR1 );
     81  printf( "%s - Unblock %s\n", name, signal_name(SIGNAL_ONE) );
     82  sc = sigaddset( &mask, SIGNAL_ONE );
    5483  assert( !sc );
    5584
    5685  if ( !blocked ) {
    57     printf( "%s - Unblock SIGUSR2\n", name );
    58     sc = sigaddset( &mask, SIGUSR2 );
     86    printf( "%s - Unblock %s\n", name, signal_name(SIGNAL_TWO) );
     87    sc = sigaddset( &mask, SIGNAL_TWO );
    5988    assert( !sc );
    6089  }
     
    6897  assert( !sc );
    6998
    70   sc = sigaddset( &wait_mask, SIGUSR1 );
     99  sc = sigaddset( &wait_mask, SIGNAL_ONE );
    71100  assert( !sc );
    72101
     
    74103  memset( &info, 0, sizeof(info) );
    75104
    76   printf( "%s - Wait for SIGUSR1 unblocked\n", name );
     105  printf( "%s - Wait for %s unblocked\n", signal_name(SIGNAL_ONE) );
    77106  sigwaitinfo( &wait_mask, &info );
    78107  assert( !sc );
     
    82111  printf( "%s - siginfo.si_value=0x%08x\n", name, info.si_value );
    83112
    84   assert( info.si_signo == SIGUSR2 );
     113  assert( info.si_signo == SIGNAL_TWO );
    85114  assert( info.si_code == SI_USER );
    86115
     
    100129  bool                falseArg = false;
    101130
    102   puts( "\n\n*** POSIX TEST SIGNAL 03 ***" );
     131  puts( "\n\n*** POSIX TEST SIGNAL " TEST_NAME " ***" );
     132  puts( "Init - Variation is: " TEST_STRING );
    103133
    104134  Signal_occurred = false;
     
    107137  act.sa_sigaction = Signal_handler;
    108138  act.sa_flags   = SA_SIGINFO;
    109   sigaction( SIGUSR1, &act, NULL );
    110   sigaction( SIGUSR2, &act, NULL );
     139  sigaction( SIGNAL_ONE, &act, NULL );
     140  sigaction( SIGNAL_TWO, &act, NULL );
    111141
    112142  /* create threads */
     
    123153  usleep(500000);
    124154
    125   puts( "Init - sending SIGUSR2 - deliver to one thread" );
    126   sc =  kill( getpid(), SIGUSR2 );
     155  printf( "Init - sending %s - deliver to one thread\n",
     156          signal_name(SIGNAL_TWO));
     157  sc =  kill( getpid(), SIGNAL_TWO );
    127158  assert( !sc );
    128159
    129   puts( "Init - sending SIGUSR2 - deliver to other thread" );
    130   sc =  kill( getpid(), SIGUSR2 );
     160  printf( "Init - sending %s - deliver to other thread\n",
     161          signal_name(SIGNAL_TWO));
     162  sc =  kill( getpid(), SIGNAL_TWO );
    131163  assert( !sc );
    132164
    133   puts( "Init - sending SIGUSR2 - expect EAGAIN" );
    134   sc =  kill( getpid(), SIGUSR2 );
     165  printf( "Init - sending %s - expect EAGAIN\n", signal_name(SIGNAL_TWO) );
     166  sc =  kill( getpid(), SIGNAL_TWO );
    135167  assert( sc == -1 );
    136168  assert( errno == EAGAIN );
     
    142174  assert( Signal_occurred == true );
    143175
    144   puts( "*** END OF POSIX TEST SIGNAL 03 ***" );
     176  puts( "*** END OF POSIX TEST SIGNAL " TEST_NAME " ***" );
    145177  rtems_test_exit(0);
    146178
Note: See TracChangeset for help on using the changeset viewer.