summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-09-28 23:10:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-09-28 23:10:15 +0000
commitbfd225e917517a10dc697f15d5fb216c386433f4 (patch)
tree20ec20068e10775f65935b0f9412a936c9501a36 /testsuites
parent2009-09-28 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-bfd225e917517a10dc697f15d5fb216c386433f4.tar.bz2
2009-09-28 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add new test for calling pthread_cancel() from an ISR. * psxcancel01/.cvsignore, psxcancel01/Makefile.am, psxcancel01/init.c, psxcancel01/psxcancel01.doc, psxcancel01/psxcancel01.scn: New files.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/ChangeLog7
-rw-r--r--testsuites/psxtests/Makefile.am10
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psxcancel01/.cvsignore2
-rw-r--r--testsuites/psxtests/psxcancel01/Makefile.am29
-rw-r--r--testsuites/psxtests/psxcancel01/init.c85
-rw-r--r--testsuites/psxtests/psxcancel01/psxcancel01.doc22
-rw-r--r--testsuites/psxtests/psxcancel01/psxcancel01.scn4
8 files changed, 155 insertions, 5 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 6427fd58cf..aae293f998 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,3 +1,10 @@
+2009-09-28 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * Makefile.am, configure.ac: Add new test for calling pthread_cancel()
+ from an ISR.
+ * psxcancel01/.cvsignore, psxcancel01/Makefile.am, psxcancel01/init.c,
+ psxcancel01/psxcancel01.doc, psxcancel01/psxcancel01.scn: New files.
+
2009-09-26 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxfatal_support/init.c, psxfatal_support/system.h: Eliminate use of
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 388df43c27..6a934bcae0 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -8,11 +8,11 @@ SUBDIRS = psxclock
if HAS_POSIX
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 psxsignal04 \
- psxsignal05 psxspin01 psxspin02 psxsysconf psxtime psxtimer01 psxtimer02 \
- psxualarm psxfatal01 psxfatal02 \
+ psxcancel psxcancel01 psxcleanup psxcond01 psxenosys psxkey01 psxkey02 \
+ psxkey03 psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 \
+ psxmutexattr01 psxobj01 psxrwlock01 psxsem01 psxsignal01 psxsignal02 \
+ psxsignal03 psxsignal04 psxsignal05 psxspin01 psxspin02 psxsysconf \
+ psxtime psxtimer01 psxtimer02 psxualarm psxfatal01 psxfatal02 \
psxintrcritical01 psxstack01
endif
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 8ce7d1fc8e..2be98b2ae4 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -47,6 +47,7 @@ psxautoinit01/Makefile
psxautoinit02/Makefile
psxbarrier01/Makefile
psxcancel/Makefile
+psxcancel01/Makefile
psxchroot01/Makefile
psxcleanup/Makefile
psxclock/Makefile
diff --git a/testsuites/psxtests/psxcancel01/.cvsignore b/testsuites/psxtests/psxcancel01/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxcancel01/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxcancel01/Makefile.am b/testsuites/psxtests/psxcancel01/Makefile.am
new file mode 100644
index 0000000000..60225ab7b5
--- /dev/null
+++ b/testsuites/psxtests/psxcancel01/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxcancel01
+psxcancel01_SOURCES = init.c ../include/pmacros.h
+
+dist_rtems_tests_DATA = psxcancel01.scn
+dist_rtems_tests_DATA += psxcancel01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxcancel01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxcancel01_OBJECTS) $(psxcancel01_LDADD)
+LINK_LIBS = $(psxcancel01_LDLIBS)
+
+psxcancel01$(EXEEXT): $(psxcancel01_OBJECTS) $(psxcancel01_DEPENDENCIES)
+ @rm -f psxcancel01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxcancel01/init.c b/testsuites/psxtests/psxcancel01/init.c
new file mode 100644
index 0000000000..437fd93588
--- /dev/null
+++ b/testsuites/psxtests/psxcancel01/init.c
@@ -0,0 +1,85 @@
+/*
+ * COPYRIGHT (c) 1989-1999.
+ * 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$
+ */
+
+#include <pmacros.h>
+#include <errno.h>
+
+volatile int Cancel_occurred;
+volatile int Cancel_status;
+
+rtems_timer_service_routine Cancel_duringISR_TSR(
+ rtems_id ignored_id,
+ void *ignored_address
+)
+{
+ Cancel_status = pthread_cancel( pthread_self() );
+ Cancel_occurred = 1;
+}
+
+
+void *POSIX_Init(
+ void *argument
+)
+{
+ int status;
+ rtems_interval start;
+ rtems_interval end;
+ rtems_id timer_id;
+
+ puts( "\n\n*** POSIX TEST CANCEL 01 ***" );
+
+ status = rtems_timer_create(
+ rtems_build_name( 'T', 'M', '1', ' ' ),
+ &timer_id
+ );
+ assert( !status );
+
+ Cancel_occurred = 0;
+ Cancel_status = 0;
+
+ puts( "Init: schedule pthread_cancel from a TSR" );
+ status = rtems_timer_fire_after( timer_id, 10, Cancel_duringISR_TSR, NULL );
+ assert( !status );
+
+ /* cancel occurs during sleep */
+
+ do {
+ end = rtems_clock_get_ticks_since_boot();
+ } while ( !Cancel_occurred && ((end - start) <= 800));
+
+ if ( !Cancel_occurred ) {
+ puts( "Cancel did not occur" );
+ rtems_test_exit(0);
+ }
+ if ( Cancel_status != EPROTO ) {
+ printf( "Cancel returned %s\n", strerror(Cancel_status) );
+ rtems_test_exit(0);
+ }
+ puts( "pthread_cancel - from ISR returns EPROTO - OK" );
+
+
+ puts( "*** END OF POSIX TEST CANCEL 01 ***" );
+ 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_TIMERS 1
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxcancel01/psxcancel01.doc b/testsuites/psxtests/psxcancel01/psxcancel01.doc
new file mode 100644
index 0000000000..7cb06372f0
--- /dev/null
+++ b/testsuites/psxtests/psxcancel01/psxcancel01.doc
@@ -0,0 +1,22 @@
+#
+# $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: psxcancel01
+
+directives:
+
+ pthread_cancel
+
+concepts:
+
++ Ensure that invoking pthread_cancel() from an ISR returns the proper error.
diff --git a/testsuites/psxtests/psxcancel01/psxcancel01.scn b/testsuites/psxtests/psxcancel01/psxcancel01.scn
new file mode 100644
index 0000000000..ad1dae753e
--- /dev/null
+++ b/testsuites/psxtests/psxcancel01/psxcancel01.scn
@@ -0,0 +1,4 @@
+*** POSIX TEST CANCEL 01 ***
+Init: schedule pthread_cancel from a TSR
+pthread_cancel - from ISR returns EPROTO - OK
+*** END OF POSIX TEST CANCEL 01 ***