summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-07 15:07:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-07 15:07:47 +0000
commitfa9889742a14b5095e03cb63a02b2caf12d11494 (patch)
treee69583e12d9258985ebcac5dedb6cf0dfba11a5f /testsuites/sptests
parent2008-01-05 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-fa9889742a14b5095e03cb63a02b2caf12d11494.tar.bz2
2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Added sp38 and sp39. * sp38/.cvsignore, sp38/Makefile.am, sp38/init.c, sp38/sp38.scn, sp38/system.h, sp39/.cvsignore, sp39/Makefile.am, sp39/init.c, sp39/sp39.scn, sp39/system.h: New files.
Diffstat (limited to 'testsuites/sptests')
-rw-r--r--testsuites/sptests/ChangeLog7
-rw-r--r--testsuites/sptests/Makefile.am2
-rw-r--r--testsuites/sptests/configure.ac2
-rw-r--r--testsuites/sptests/sp38/.cvsignore2
-rw-r--r--testsuites/sptests/sp38/Makefile.am27
-rw-r--r--testsuites/sptests/sp38/init.c93
-rw-r--r--testsuites/sptests/sp38/sp38.scn4
-rw-r--r--testsuites/sptests/sp38/system.h36
-rw-r--r--testsuites/sptests/sp39/.cvsignore2
-rw-r--r--testsuites/sptests/sp39/Makefile.am27
-rw-r--r--testsuites/sptests/sp39/init.c161
-rw-r--r--testsuites/sptests/sp39/sp39.scn6
-rw-r--r--testsuites/sptests/sp39/system.h38
13 files changed, 406 insertions, 1 deletions
diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog
index 6611bc67c8..7bc1154d39 100644
--- a/testsuites/sptests/ChangeLog
+++ b/testsuites/sptests/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, configure.ac: Added sp38 and sp39.
+ * sp38/.cvsignore, sp38/Makefile.am, sp38/init.c, sp38/sp38.scn,
+ sp38/system.h, sp39/.cvsignore, sp39/Makefile.am, sp39/init.c,
+ sp39/sp39.scn, sp39/system.h: New files.
+
2007-12-21 Joel Sherrill <joel.sherrill@OARcorp.com>
* sp36/strict_order_mut.c: New file.
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 2f5c12c9cf..e471c7f892 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
## spfatal is not included for now
SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
- sp30 sp31 sp32 sp33 sp34 sp35 sp36 sp37 spsize
+ sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 spsize
DIST_SUBDIRS = $(SUBDIRS) spfatal
include $(top_srcdir)/../automake/subdirs.am
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 95333af8d6..a84286a8d3 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -62,6 +62,8 @@ sp34/Makefile
sp35/Makefile
sp36/Makefile
sp37/Makefile
+sp38/Makefile
+sp39/Makefile
spsize/Makefile
spfatal/Makefile
])
diff --git a/testsuites/sptests/sp38/.cvsignore b/testsuites/sptests/sp38/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/sptests/sp38/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/sptests/sp38/Makefile.am b/testsuites/sptests/sp38/Makefile.am
new file mode 100644
index 0000000000..6cf4f24e27
--- /dev/null
+++ b/testsuites/sptests/sp38/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = sp38.exe
+sp38_exe_SOURCES = init.c system.h
+
+dist_rtems_tests_DATA = sp38.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+sp38_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp38_exe_OBJECTS) $(sp38_exe_LDADD)
+LINK_LIBS = $(sp38_exe_LDLIBS)
+
+sp38.exe$(EXEEXT): $(sp38_exe_OBJECTS) $(sp38_exe_DEPENDENCIES)
+ @rm -f sp38.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp38/init.c b/testsuites/sptests/sp38/init.c
new file mode 100644
index 0000000000..2a5108b779
--- /dev/null
+++ b/testsuites/sptests/sp38/init.c
@@ -0,0 +1,93 @@
+/*
+ * Classic API Signal to Task from ISR
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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_INIT
+#include "system.h"
+
+volatile boolean signal_sent;
+volatile boolean signal_processed;
+
+rtems_id main_task;
+
+void signal_handler(
+ rtems_signal_set signals
+)
+{
+ signal_processed = TRUE;
+}
+
+rtems_timer_service_routine test_signal_from_isr(
+ rtems_id timer,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ status = rtems_signal_send( main_task, 0x0a0b0c0d );
+ directive_failed_with_level( status, "rtems_signal_send", 1 );
+
+ signal_sent = TRUE;
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id timer;
+ rtems_interval start;
+ rtems_interval now;
+
+ puts( "\n\n*** TEST 38 ***" );
+
+ main_task = rtems_task_self();
+
+ /*
+ * Timer used in multiple ways
+ */
+ status = rtems_timer_create( 1, &timer );
+ directive_failed( status, "rtems_timer_create" );
+
+ /*
+ * Get starting time
+ */
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start );
+ directive_failed( status, "rtems_clock_get start" );
+
+ status = rtems_signal_catch( signal_handler, RTEMS_DEFAULT_MODES );
+ directive_failed( status, "rtems_signal_catch" );
+ puts( "rtems_signal_catch - handler installed" );
+
+ /*
+ * Test Signal from ISR
+ */
+ signal_sent = FALSE;
+
+ status = rtems_timer_fire_after( timer, 10, test_signal_from_isr, NULL );
+ directive_failed( status, "timer_fire_after failed" );
+
+ while (1) {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now );
+ directive_failed( status, "rtems_clock_get now" );
+ if ( (now-start) > 100 ) {
+ puts( "Signal from ISR did not get processed\n" );
+ rtems_test_exit( 0 );
+ }
+ if ( signal_processed )
+ break;
+ }
+
+ puts( "Signal sent from ISR has been processed" );
+ puts( "*** END OF TEST 38 ***" );
+ rtems_test_exit( 0 );
+}
diff --git a/testsuites/sptests/sp38/sp38.scn b/testsuites/sptests/sp38/sp38.scn
new file mode 100644
index 0000000000..fce980dedc
--- /dev/null
+++ b/testsuites/sptests/sp38/sp38.scn
@@ -0,0 +1,4 @@
+*** TEST 38 ***
+rtems_signal_catch - handler installed
+Signal sent from ISR has been processed
+*** END OF TEST 38 ***
diff --git a/testsuites/sptests/sp38/system.h b/testsuites/sptests/sp38/system.h
new file mode 100644
index 0000000000..84b7ab8614
--- /dev/null
+++ b/testsuites/sptests/sp38/system.h
@@ -0,0 +1,36 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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 <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/sptests/sp39/.cvsignore b/testsuites/sptests/sp39/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/sptests/sp39/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/sptests/sp39/Makefile.am b/testsuites/sptests/sp39/Makefile.am
new file mode 100644
index 0000000000..ea19315aa9
--- /dev/null
+++ b/testsuites/sptests/sp39/Makefile.am
@@ -0,0 +1,27 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = sp39.exe
+sp39_exe_SOURCES = init.c system.h
+
+dist_rtems_tests_DATA = sp39.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+sp39_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp39_exe_OBJECTS) $(sp39_exe_LDADD)
+LINK_LIBS = $(sp39_exe_LDLIBS)
+
+sp39.exe$(EXEEXT): $(sp39_exe_OBJECTS) $(sp39_exe_DEPENDENCIES)
+ @rm -f sp39.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp39/init.c b/testsuites/sptests/sp39/init.c
new file mode 100644
index 0000000000..6ee567580c
--- /dev/null
+++ b/testsuites/sptests/sp39/init.c
@@ -0,0 +1,161 @@
+/*
+ * Classic API Signal to Task from ISR
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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_INIT
+#include "system.h"
+
+volatile boolean case_hit;
+
+rtems_id main_task;
+rtems_id other_task;
+
+rtems_timer_service_routine test_event_from_isr(
+ rtems_id timer,
+ void *arg
+)
+{
+ rtems_status_code status;
+
+ status = rtems_event_send( main_task, 0x01 );
+
+ if ( _Event_Sync_state == EVENT_SYNC_SATISFIED )
+ case_hit = TRUE;
+}
+
+rtems_timer_service_routine test_timeout_from_isr(
+ rtems_id timer,
+ void *arg
+)
+{
+ if ( _Event_Sync_state != EVENT_SYNC_NOTHING_HAPPENED )
+ return;
+
+ /*
+ * The main task should have timed out and we are in the
+ * event synchronization critical section with "timeout".
+ */
+
+ /*
+ * This event send hits the critical section but sends to
+ * another task so doesn't impact this critical section.
+ */
+ rtems_event_send( other_task, 0x02 );
+
+ /*
+ * This event send hits the main task but doesn't satisfy
+ * it's blocking condition so it will still time out.
+ */
+ rtems_event_send( main_task, 0x02 );
+
+ /*
+ * This event send should cancel the main task's time out
+ * and deliver the interrupt because both occurred simultaneously.
+ */
+ rtems_event_send( main_task, 0x01 );
+
+
+ case_hit = TRUE;
+}
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ rtems_status_code status;
+ rtems_id timer;
+ rtems_event_set out;
+ int i;
+ int max;
+ int iterations = 0;
+
+ puts( "\n\n*** TEST 39 ***" );
+
+ main_task = rtems_task_self();
+
+ /*
+ * Timer used in multiple ways
+ */
+ status = rtems_timer_create( 1, &timer );
+ directive_failed( status, "rtems_timer_create" );
+
+ status = rtems_task_create(
+ 0xa5a5a5a5,
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &other_task
+ );
+ directive_failed( status, "rtems_task_create" );
+
+ /*
+ * Test Event send successful from ISR
+ */
+ case_hit = FALSE;
+ max = 1;
+
+ while (1) {
+ if ( case_hit )
+ break;
+ status = rtems_timer_fire_after( timer, 1, test_event_from_isr, NULL );
+ directive_failed( status, "timer_fire_after failed" );
+
+ for (i=0 ; i<max ; i++ )
+ if ( _Event_Sync_state == EVENT_SYNC_SATISFIED )
+ break;
+
+ status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 0, &out );
+ directive_failed( status, "rtems_event_receive" );
+ if ( case_hit == TRUE )
+ break;
+ max += 2;
+ if ( ++iterations >= 0x10000 )
+ break;
+ }
+
+ printf(
+ "Event sent from ISR hitting synchronization point has %soccurred\n",
+ (( case_hit == TRUE ) ? "" : "NOT ")
+ );
+
+ /*
+ * Now try for a timeout case
+ */
+ case_hit = FALSE;
+ max = 1;
+
+ while (1) {
+ status = rtems_timer_fire_after( timer, 1, test_timeout_from_isr, NULL );
+ directive_failed( status, "timer_fire_after failed" );
+
+
+ for (i=0 ; i<max ; i++ )
+ if ( case_hit )
+ break;
+
+ status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 1, &out );
+ if ( status == RTEMS_SUCCESSFUL ) {
+ break;
+ }
+ fatal_directive_status( status, RTEMS_TIMEOUT, "event_receive timeout" );
+ max += 1;
+ }
+
+ printf(
+ "Event timeout hitting synchronization point has %soccurred\n",
+ (( case_hit == TRUE ) ? "" : "NOT ")
+ );
+
+ puts( "*** END OF TEST 39 ***" );
+ rtems_test_exit( 0 );
+}
diff --git a/testsuites/sptests/sp39/sp39.scn b/testsuites/sptests/sp39/sp39.scn
new file mode 100644
index 0000000000..721a5610ec
--- /dev/null
+++ b/testsuites/sptests/sp39/sp39.scn
@@ -0,0 +1,6 @@
+
+
+*** TEST 39 ***
+Event sent from ISR hitting synchronization point has occurred
+Event timeout hitting synchronization point has occurred
+*** END OF TEST 39 ***
diff --git a/testsuites/sptests/sp39/system.h b/testsuites/sptests/sp39/system.h
new file mode 100644
index 0000000000..a7580fc9b9
--- /dev/null
+++ b/testsuites/sptests/sp39/system.h
@@ -0,0 +1,38 @@
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * 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 <tmacros.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 250
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_TIMERS 1
+
+#include <rtems/confdefs.h>
+
+/* end of include file */