diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-05 18:13:29 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-05 18:13:29 +0000 |
commit | b053cab093896ec765294a3ed109670f94063036 (patch) | |
tree | 82a19ef7eb7ac7bff15959397191fc25c27a3a25 | |
parent | 2009-08-05 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-b053cab093896ec765294a3ed109670f94063036.tar.bz2 |
2009-08-05 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add a test to exercise an odd case in
_POSIX_signals_Clear_signals.
* psxsignal05/.cvsignore, psxsignal05/Makefile.am, psxsignal05/init.c,
psxsignal05/psxsignal05.doc, psxsignal05/psxsignal05.scn: New files.
-rw-r--r-- | testsuites/psxtests/ChangeLog | 7 | ||||
-rw-r--r-- | testsuites/psxtests/Makefile.am | 4 | ||||
-rw-r--r-- | testsuites/psxtests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/psxtests/psxsignal05/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxsignal05/Makefile.am | 29 | ||||
-rw-r--r-- | testsuites/psxtests/psxsignal05/init.c | 95 | ||||
-rw-r--r-- | testsuites/psxtests/psxsignal05/psxsignal05.doc | 30 | ||||
-rw-r--r-- | testsuites/psxtests/psxsignal05/psxsignal05.scn | 4 |
8 files changed, 170 insertions, 2 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index e5e1388bd7..d55f9d371e 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,10 @@ +2009-08-05 Joel Sherrill <joel.sherrill@OARcorp.com> + + * Makefile.am, configure.ac: Add a test to exercise an odd case in + _POSIX_signals_Clear_signals. + * psxsignal05/.cvsignore, psxsignal05/Makefile.am, psxsignal05/init.c, + psxsignal05/psxsignal05.doc, psxsignal05/psxsignal05.scn: New files. + 2009-08-05 Joel Sherrill <joel.sherrill@oarcorp.com> * psxmsgq04/init.c: Correct typo in configuration so test does as diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index f74c610b0f..927f54372b 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -9,8 +9,8 @@ SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \ psxcancel psxcleanup psxcond01 psxenosys psxkey01 psxkey02 psxkey03 \ psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 psxmutexattr01 psxobj01 \ psxrwlock01 psxsem01 psxsignal01 psxsignal02 psxsignal03 psxsignal04 \ - psxspin01 psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 psxualarm \ - psxfatal01 psxfatal02 \ + psxsignal05 psxspin01 psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 \ + psxualarm psxfatal01 psxfatal02 \ psxintrcritical01 ## File IO tests diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac index c986537ce8..a449ae7a04 100644 --- a/testsuites/psxtests/configure.ac +++ b/testsuites/psxtests/configure.ac @@ -72,6 +72,7 @@ psxsignal01/Makefile psxsignal02/Makefile psxsignal03/Makefile psxsignal04/Makefile +psxsignal05/Makefile psxspin01/Makefile psxspin02/Makefile psxstat/Makefile diff --git a/testsuites/psxtests/psxsignal05/.cvsignore b/testsuites/psxtests/psxsignal05/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtests/psxsignal05/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtests/psxsignal05/Makefile.am b/testsuites/psxtests/psxsignal05/Makefile.am new file mode 100644 index 0000000000..9c04045670 --- /dev/null +++ b/testsuites/psxtests/psxsignal05/Makefile.am @@ -0,0 +1,29 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxsignal05 +psxsignal05_SOURCES = init.c ../include/pmacros.h + +dist_rtems_tests_DATA = psxsignal05.scn +dist_rtems_tests_DATA += psxsignal05.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +psxsignal05_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxsignal05_OBJECTS) $(psxsignal05_LDADD) +LINK_LIBS = $(psxsignal05_LDLIBS) + +psxsignal05$(EXEEXT): $(psxsignal05_OBJECTS) $(psxsignal05_DEPENDENCIES) + @rm -f psxsignal05$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxsignal05/init.c b/testsuites/psxtests/psxsignal05/init.c new file mode 100644 index 0000000000..c328d96c72 --- /dev/null +++ b/testsuites/psxtests/psxsignal05/init.c @@ -0,0 +1,95 @@ +/* + * 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. + * + * $Id$ + */ + +#define TEST_NAME "05" +#define TEST_STRING "User Signals" +#define SIGNAL_ONE SIGUSR1 +#define SIGNAL_TWO SIGUSR2 + +#include <pmacros.h> +#include <signal.h> +#include <errno.h> +#include <errno.h> +#include <rtems/posix/psignal.h> + +void Signal_handler( + int signo, + siginfo_t *info, + void *arg +) +{ + puts( "Signal handler hit" ); + rtems_test_exit(0); +} + +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 *POSIX_Init( + void *argument +) +{ + struct sigaction act; + siginfo_t info; + bool bc; + + puts( "\n\n*** POSIX TEST SIGNAL " TEST_NAME " ***" ); + + act.sa_handler = NULL; + act.sa_sigaction = Signal_handler; + act.sa_flags = SA_SIGINFO; + sigaction( SIGNAL_ONE, &act, NULL ); + sigaction( SIGNAL_TWO, &act, NULL ); + + printf( + "Init - _POSIX_signals_Clear_signals when signals pending but\n" + "Init - not queued on SA_SIGINFO configured signal.\n" + ); + + /* cheat and put signal directly in */ + _POSIX_signals_Pending |= signo_to_mask( SIGUSR1 ); + + bc = _POSIX_signals_Clear_signals( + _Thread_Executing->API_Extensions[ THREAD_API_POSIX ], + SIGNAL_ONE, + &info, + true, /* is_global */ + false /* check_blocked */ + ); + assert( bc ); + + puts( "*** END OF POSIX TEST SIGNAL " TEST_NAME " ***" ); + rtems_test_exit(0); + + return NULL; /* just so the compiler thinks we returned something */ +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT +#include <rtems/confdefs.h> diff --git a/testsuites/psxtests/psxsignal05/psxsignal05.doc b/testsuites/psxtests/psxsignal05/psxsignal05.doc new file mode 100644 index 0000000000..c3928b3f37 --- /dev/null +++ b/testsuites/psxtests/psxsignal05/psxsignal05.doc @@ -0,0 +1,30 @@ +# +# $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: psxsignal05 + +directives: + + sigemptyset + sigaddset + sigwaitinfo + +concepts: + + ++ Ensure if _POSIX_signals_Clear_signals is called to clear a process wide + SA_SIGINFO signal which is pending but there is not a queued SA_SIGINFO + structure, then things happen correctly. + +NOTE: This case may be impossible to hit in real code but until that is + proven we need to be defensive and protect against it. diff --git a/testsuites/psxtests/psxsignal05/psxsignal05.scn b/testsuites/psxtests/psxsignal05/psxsignal05.scn new file mode 100644 index 0000000000..210c515afa --- /dev/null +++ b/testsuites/psxtests/psxsignal05/psxsignal05.scn @@ -0,0 +1,4 @@ +*** POSIX TEST SIGNAL 05 *** +Init - _POSIX_signals_Clear_signals when signals pending but +Init - not queued on SA_SIGINFO configured signal. +*** END OF POSIX TEST SIGNAL 05 *** |