forked from Imagelibrary/rtems
2009-08-02 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2009-08-02 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* psx07/init.c, psx07/psx07.scn, psx07/task.c: Add test for budget and
|
||||
|
||||
@@ -8,8 +8,8 @@ SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
|
||||
psx10 psx11 psx12 psx13 psx14 psxautoinit01 psxautoinit02 psxbarrier01 \
|
||||
psxcancel psxcleanup psxcond01 psxenosys psxkey01 psxkey02 psxkey03 \
|
||||
psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 psxmutexattr01 psxobj01 \
|
||||
psxrwlock01 psxsem01 psxsignal01 psxsignal02 psxsignal03 psxspin01 \
|
||||
psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 psxualarm \
|
||||
psxrwlock01 psxsem01 psxsignal01 psxsignal02 psxsignal03 psxsignal03 \
|
||||
psxspin01 psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 psxualarm \
|
||||
psxfatal01 psxfatal02 \
|
||||
psxintrcritical01
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ psxsem01/Makefile
|
||||
psxsignal01/Makefile
|
||||
psxsignal02/Makefile
|
||||
psxsignal03/Makefile
|
||||
psxsignal04/Makefile
|
||||
psxspin01/Makefile
|
||||
psxspin02/Makefile
|
||||
psxstat/Makefile
|
||||
|
||||
@@ -18,6 +18,7 @@ psxsignal03_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
|
||||
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||
AM_CPPFLAGS += -DUSE_USER_SIGNALS
|
||||
|
||||
LINK_OBJS = $(psxsignal03_OBJECTS) $(psxsignal03_LDADD)
|
||||
LINK_LIBS = $(psxsignal03_LDLIBS)
|
||||
|
||||
@@ -9,6 +9,22 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if defined(USE_USER_SIGNALS)
|
||||
#define TEST_NAME "01"
|
||||
#define TEST_STRING "User Signals"
|
||||
#define SIGNAL_ONE SIGUSR1
|
||||
#define SIGNAL_TWO SIGUSR2
|
||||
|
||||
#elif defined(USE_REAL_TIME_SIGNALS)
|
||||
#define TEST_NAME "02"
|
||||
#define TEST_STRING "Real-Time Signals"
|
||||
#define SIGNAL_ONE SIGRTMIN
|
||||
#define SIGNAL_TWO SIGRTMAX
|
||||
|
||||
#else
|
||||
#error "Test Mode not defined"
|
||||
|
||||
#endif
|
||||
|
||||
#include <pmacros.h>
|
||||
#include <signal.h>
|
||||
@@ -29,6 +45,19 @@ void Signal_handler(
|
||||
Signal_thread = pthread_self();
|
||||
}
|
||||
|
||||
const char *signal_name(int signo)
|
||||
{
|
||||
if (signo == SIGUSR1)
|
||||
return "SIGUSR1";
|
||||
if (signo == SIGUSR2)
|
||||
return "SIGUSR2";
|
||||
if (signo == SIGRTMIN)
|
||||
return "SIGRTMIN";
|
||||
if (signo == SIGRTMAX)
|
||||
return "SIGRTMAX";
|
||||
return "unknown-signal";
|
||||
}
|
||||
|
||||
void *Test_Thread(void *arg)
|
||||
{
|
||||
bool blocked = *((bool *)arg);
|
||||
@@ -49,13 +78,13 @@ void *Test_Thread(void *arg)
|
||||
sc = sigemptyset( &mask );
|
||||
assert( !sc );
|
||||
|
||||
printf( "%s - Unblock SIGUSR1\n", name );
|
||||
sc = sigaddset( &mask, SIGUSR1 );
|
||||
printf( "%s - Unblock %s\n", name, signal_name(SIGNAL_ONE) );
|
||||
sc = sigaddset( &mask, SIGNAL_ONE );
|
||||
assert( !sc );
|
||||
|
||||
if ( !blocked ) {
|
||||
printf( "%s - Unblock SIGUSR2\n", name );
|
||||
sc = sigaddset( &mask, SIGUSR2 );
|
||||
printf( "%s - Unblock %s\n", name, signal_name(SIGNAL_TWO) );
|
||||
sc = sigaddset( &mask, SIGNAL_TWO );
|
||||
assert( !sc );
|
||||
}
|
||||
|
||||
@@ -67,13 +96,13 @@ void *Test_Thread(void *arg)
|
||||
sc = sigemptyset( &wait_mask );
|
||||
assert( !sc );
|
||||
|
||||
sc = sigaddset( &wait_mask, SIGUSR1 );
|
||||
sc = sigaddset( &wait_mask, SIGNAL_ONE );
|
||||
assert( !sc );
|
||||
|
||||
/* wait for a signal */
|
||||
memset( &info, 0, sizeof(info) );
|
||||
|
||||
printf( "%s - Wait for SIGUSR1 unblocked\n", name );
|
||||
printf( "%s - Wait for %s unblocked\n", signal_name(SIGNAL_ONE) );
|
||||
sigwaitinfo( &wait_mask, &info );
|
||||
assert( !sc );
|
||||
|
||||
@@ -81,7 +110,7 @@ void *Test_Thread(void *arg)
|
||||
printf( "%s - siginfo.si_code=%d\n", name, info.si_code );
|
||||
printf( "%s - siginfo.si_value=0x%08x\n", name, info.si_value );
|
||||
|
||||
assert( info.si_signo == SIGUSR2 );
|
||||
assert( info.si_signo == SIGNAL_TWO );
|
||||
assert( info.si_code == SI_USER );
|
||||
|
||||
printf( "%s - exiting\n", name );
|
||||
@@ -99,15 +128,16 @@ void *POSIX_Init(
|
||||
bool trueArg = true;
|
||||
bool falseArg = false;
|
||||
|
||||
puts( "\n\n*** POSIX TEST SIGNAL 03 ***" );
|
||||
puts( "\n\n*** POSIX TEST SIGNAL " TEST_NAME " ***" );
|
||||
puts( "Init - Variation is: " TEST_STRING );
|
||||
|
||||
Signal_occurred = false;
|
||||
|
||||
act.sa_handler = NULL;
|
||||
act.sa_sigaction = Signal_handler;
|
||||
act.sa_flags = SA_SIGINFO;
|
||||
sigaction( SIGUSR1, &act, NULL );
|
||||
sigaction( SIGUSR2, &act, NULL );
|
||||
sigaction( SIGNAL_ONE, &act, NULL );
|
||||
sigaction( SIGNAL_TWO, &act, NULL );
|
||||
|
||||
/* create threads */
|
||||
sc = pthread_create( &id, NULL, Test_Thread, &falseArg );
|
||||
@@ -122,16 +152,18 @@ void *POSIX_Init(
|
||||
puts( "Init - sleep - SignalBlocked thread settle - OK" );
|
||||
usleep(500000);
|
||||
|
||||
puts( "Init - sending SIGUSR2 - deliver to one thread" );
|
||||
sc = kill( getpid(), SIGUSR2 );
|
||||
printf( "Init - sending %s - deliver to one thread\n",
|
||||
signal_name(SIGNAL_TWO));
|
||||
sc = kill( getpid(), SIGNAL_TWO );
|
||||
assert( !sc );
|
||||
|
||||
puts( "Init - sending SIGUSR2 - deliver to other thread" );
|
||||
sc = kill( getpid(), SIGUSR2 );
|
||||
printf( "Init - sending %s - deliver to other thread\n",
|
||||
signal_name(SIGNAL_TWO));
|
||||
sc = kill( getpid(), SIGNAL_TWO );
|
||||
assert( !sc );
|
||||
|
||||
puts( "Init - sending SIGUSR2 - expect EAGAIN" );
|
||||
sc = kill( getpid(), SIGUSR2 );
|
||||
printf( "Init - sending %s - expect EAGAIN\n", signal_name(SIGNAL_TWO) );
|
||||
sc = kill( getpid(), SIGNAL_TWO );
|
||||
assert( sc == -1 );
|
||||
assert( errno == EAGAIN );
|
||||
|
||||
@@ -141,7 +173,7 @@ void *POSIX_Init(
|
||||
/* we are just sigwait'ing the signal, not delivering it */
|
||||
assert( Signal_occurred == true );
|
||||
|
||||
puts( "*** END OF POSIX TEST SIGNAL 03 ***" );
|
||||
puts( "*** END OF POSIX TEST SIGNAL " TEST_NAME " ***" );
|
||||
rtems_test_exit(0);
|
||||
|
||||
return NULL; /* just so the compiler thinks we returned something */
|
||||
|
||||
@@ -28,4 +28,4 @@ concepts:
|
||||
|
||||
+ Ensure the the algorithm in killinfo.c which decides which
|
||||
thread waiting on a signal is given a process wide signal to
|
||||
dispatch.
|
||||
dispatch. This variation focuses on the user signals.
|
||||
|
||||
2
testsuites/psxtests/psxsignal04/.cvsignore
Normal file
2
testsuites/psxtests/psxsignal04/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
30
testsuites/psxtests/psxsignal04/Makefile.am
Normal file
30
testsuites/psxtests/psxsignal04/Makefile.am
Normal file
@@ -0,0 +1,30 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
rtems_tests_PROGRAMS = psxsignal04
|
||||
psxsignal04_SOURCES = ../psxsignal03/init.c ../include/pmacros.h
|
||||
|
||||
dist_rtems_tests_DATA = psxsignal04.scn
|
||||
dist_rtems_tests_DATA += psxsignal04.doc
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../automake/compile.am
|
||||
include $(top_srcdir)/../automake/leaf.am
|
||||
|
||||
psxsignal04_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
|
||||
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||
AM_CPPFLAGS += -DUSE_REAL_TIME_SIGNALS
|
||||
|
||||
LINK_OBJS = $(psxsignal04_OBJECTS) $(psxsignal04_LDADD)
|
||||
LINK_LIBS = $(psxsignal04_LDLIBS)
|
||||
|
||||
psxsignal04$(EXEEXT): $(psxsignal04_OBJECTS) $(psxsignal04_DEPENDENCIES)
|
||||
@rm -f psxsignal04$(EXEEXT)
|
||||
$(make-exe)
|
||||
|
||||
include $(top_srcdir)/../automake/local.am
|
||||
31
testsuites/psxtests/psxsignal04/psxsignal04.doc
Normal file
31
testsuites/psxtests/psxsignal04/psxsignal04.doc
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-2009.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.rtems.com/license/LICENSE.
|
||||
#
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
|
||||
test set name: psxsignal04
|
||||
|
||||
directives:
|
||||
|
||||
sigemptyset
|
||||
sigaddset
|
||||
pthread_sigmask
|
||||
sigwaitinfo
|
||||
sigaction
|
||||
pthread_create
|
||||
kill
|
||||
kill
|
||||
|
||||
concepts:
|
||||
|
||||
+ Ensure the the algorithm in killinfo.c which decides which
|
||||
thread waiting on a signal is given a process wide signal to
|
||||
dispatch. This variation focuses on the real-time signals.
|
||||
18
testsuites/psxtests/psxsignal04/psxsignal04.scn
Normal file
18
testsuites/psxtests/psxsignal04/psxsignal04.scn
Normal file
@@ -0,0 +1,18 @@
|
||||
*** POSIX TEST SIGNAL 02 ***
|
||||
Init - Variation is: Real-Time Signals
|
||||
Init - sleep - let threads settle - OK
|
||||
SignalNotBlocked - Unblock SIGRTMIN
|
||||
SignalNotBlocked - Unblock SIGRTMAX
|
||||
SIGRTMIN - Wait for SIGRTMAX unblocked
|
||||
SignalBlocked - Unblock SIGRTMIN
|
||||
SIGRTMIN - Wait for SIGRTMIN unblocked
|
||||
Init - sleep - SignalBlocked thread settle - OK
|
||||
Init - sending SIGRTMAX - deliver to one thread
|
||||
Init - sending SIGRTMAX - deliver to other thread
|
||||
Init - sending SIGRTMAX - expect EAGAIN
|
||||
Init - sleep - let thread report if it unblocked - OK
|
||||
SignalNotBlocked - siginfo.si_signo=31
|
||||
SignalNotBlocked - siginfo.si_code=1
|
||||
SignalNotBlocked - siginfo.si_value=0x02027fe4
|
||||
SignalNotBlocked - exiting
|
||||
*** END OF POSIX TEST SIGNAL 02 ***
|
||||
Reference in New Issue
Block a user