summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuites/psxtests/ChangeLog9
-rw-r--r--testsuites/psxtests/Makefile.am4
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psxsignal03/Makefile.am1
-rw-r--r--testsuites/psxtests/psxsignal03/init.c66
-rw-r--r--testsuites/psxtests/psxsignal03/psxsignal03.doc2
-rw-r--r--testsuites/psxtests/psxsignal04/.cvsignore2
-rw-r--r--testsuites/psxtests/psxsignal04/Makefile.am30
-rw-r--r--testsuites/psxtests/psxsignal04/psxsignal04.doc31
-rw-r--r--testsuites/psxtests/psxsignal04/psxsignal04.scn18
10 files changed, 144 insertions, 20 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index f81b0a49d3..53469f4ff0 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -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
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 7012f85032..5d18b84410 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -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
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index cd0f3b3092..c986537ce8 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -71,6 +71,7 @@ psxsem01/Makefile
psxsignal01/Makefile
psxsignal02/Makefile
psxsignal03/Makefile
+psxsignal04/Makefile
psxspin01/Makefile
psxspin02/Makefile
psxstat/Makefile
diff --git a/testsuites/psxtests/psxsignal03/Makefile.am b/testsuites/psxtests/psxsignal03/Makefile.am
index 9b2bc70a20..eb45b3dddf 100644
--- a/testsuites/psxtests/psxsignal03/Makefile.am
+++ b/testsuites/psxtests/psxsignal03/Makefile.am
@@ -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)
diff --git a/testsuites/psxtests/psxsignal03/init.c b/testsuites/psxtests/psxsignal03/init.c
index 9b457aecae..89328c7fed 100644
--- a/testsuites/psxtests/psxsignal03/init.c
+++ b/testsuites/psxtests/psxsignal03/init.c
@@ -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 */
diff --git a/testsuites/psxtests/psxsignal03/psxsignal03.doc b/testsuites/psxtests/psxsignal03/psxsignal03.doc
index 2e06dd4b72..440acd25cf 100644
--- a/testsuites/psxtests/psxsignal03/psxsignal03.doc
+++ b/testsuites/psxtests/psxsignal03/psxsignal03.doc
@@ -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.
diff --git a/testsuites/psxtests/psxsignal04/.cvsignore b/testsuites/psxtests/psxsignal04/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxsignal04/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxsignal04/Makefile.am b/testsuites/psxtests/psxsignal04/Makefile.am
new file mode 100644
index 0000000000..e451ce72ee
--- /dev/null
+++ b/testsuites/psxtests/psxsignal04/Makefile.am
@@ -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
diff --git a/testsuites/psxtests/psxsignal04/psxsignal04.doc b/testsuites/psxtests/psxsignal04/psxsignal04.doc
new file mode 100644
index 0000000000..328ac9f4d8
--- /dev/null
+++ b/testsuites/psxtests/psxsignal04/psxsignal04.doc
@@ -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.
diff --git a/testsuites/psxtests/psxsignal04/psxsignal04.scn b/testsuites/psxtests/psxsignal04/psxsignal04.scn
new file mode 100644
index 0000000000..7e4f72e767
--- /dev/null
+++ b/testsuites/psxtests/psxsignal04/psxsignal04.scn
@@ -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 ***