[PATCH 04/13] sptests: Avoid build system defined defines

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Nov 8 14:02:52 UTC 2019


Update #3818.
---
 testsuites/sptests/Makefile.am                     |  49 ++++---
 testsuites/sptests/sp27/init.c                     | 146 +------------------
 testsuites/sptests/sp27/sp27impl.h                 | 145 +++++++++++++++++++
 testsuites/sptests/sp27a/init.c                    |   2 +
 testsuites/sptests/sp52/init.c                     | 140 +-----------------
 testsuites/sptests/sp52/sp52impl.h                 | 139 ++++++++++++++++++
 testsuites/sptests/sp53/init.c                     |   2 +
 testsuites/sptests/sp65/init.c                     | 154 +-------------------
 testsuites/sptests/sp65/sp65impl.h                 | 153 ++++++++++++++++++++
 testsuites/sptests/sp66/init.c                     |   2 +
 testsuites/sptests/spintrcritical01/init.c         | 157 +--------------------
 .../spintrcritical01/spintrcritical01impl.h        | 155 ++++++++++++++++++++
 testsuites/sptests/spintrcritical02/init.c         |   2 +
 testsuites/sptests/spintrcritical03/init.c         |   2 +
 testsuites/sptests/spintrcritical04/init.c         |   2 +
 testsuites/sptests/spintrcritical05/init.c         |   2 +
 testsuites/sptests/spintrcritical06/init.c         | 149 +------------------
 .../spintrcritical06/spintrcritical06impl.h        | 147 +++++++++++++++++++
 testsuites/sptests/spintrcritical07/init.c         |   2 +
 testsuites/sptests/spintrcritical11/init.c         |  98 +------------
 .../spintrcritical11/spintrcritical11impl.h        |  96 +++++++++++++
 testsuites/sptests/spintrcritical12/init.c         |   2 +
 testsuites/sptests/spintrcritical13/init.c         | 122 +---------------
 .../spintrcritical13/spintrcritical13impl.h        | 120 ++++++++++++++++
 testsuites/sptests/spintrcritical14/init.c         |   2 +
 25 files changed, 1010 insertions(+), 980 deletions(-)
 create mode 100644 testsuites/sptests/sp27/sp27impl.h
 create mode 100644 testsuites/sptests/sp27a/init.c
 create mode 100644 testsuites/sptests/sp52/sp52impl.h
 create mode 100644 testsuites/sptests/sp53/init.c
 create mode 100644 testsuites/sptests/sp65/sp65impl.h
 create mode 100644 testsuites/sptests/sp66/init.c
 create mode 100644 testsuites/sptests/spintrcritical01/spintrcritical01impl.h
 create mode 100644 testsuites/sptests/spintrcritical02/init.c
 create mode 100644 testsuites/sptests/spintrcritical03/init.c
 create mode 100644 testsuites/sptests/spintrcritical04/init.c
 create mode 100644 testsuites/sptests/spintrcritical05/init.c
 create mode 100644 testsuites/sptests/spintrcritical06/spintrcritical06impl.h
 create mode 100644 testsuites/sptests/spintrcritical07/init.c
 create mode 100644 testsuites/sptests/spintrcritical11/spintrcritical11impl.h
 create mode 100644 testsuites/sptests/spintrcritical12/init.c
 create mode 100644 testsuites/sptests/spintrcritical13/spintrcritical13impl.h
 create mode 100644 testsuites/sptests/spintrcritical14/init.c

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 95192a3652..a86b438d61 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -242,9 +242,9 @@ if TEST_sp27a
 sp_tests += sp27a
 sp_screens += sp27a/sp27a.scn
 sp_docs += sp27a/sp27a.doc
-sp27a_SOURCES = sp27/init.c
+sp27a_SOURCES = sp27a/init.c
 sp27a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_sp27a) \
-	$(support_includes) -DUSE_COUNTING_SEMAPHORE
+	$(support_includes)
 endif
 
 if NO_SMP
@@ -430,9 +430,8 @@ if TEST_sp53
 sp_tests += sp53
 sp_screens += sp53/sp53.scn
 sp_docs += sp53/sp53.doc
-sp53_SOURCES = sp52/init.c
-sp53_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_sp53) $(support_includes) \
-	-DUSE_TIMER_SERVER
+sp53_SOURCES = sp53/init.c
+sp53_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_sp53) $(support_includes)
 endif
 
 if TEST_sp54
@@ -529,9 +528,9 @@ if TEST_sp66
 sp_tests += sp66
 sp_screens += sp66/sp66.scn
 sp_docs += sp66/sp66.doc
-sp66_SOURCES = sp65/init.c
+sp66_SOURCES = sp66/init.c
 sp66_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_sp66) $(support_includes) \
-	-I$(top_srcdir)/include -DINHERIT_CEILING
+	-I$(top_srcdir)/include
 endif
 
 if TEST_sp67
@@ -1238,51 +1237,51 @@ spintrcritical01_SOURCES = spintrcritical01/init.c \
 	spintrcritical_support/intrcritical.h
 spintrcritical01_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical01) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DFIFO_NO_TIMEOUT
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical02
 sp_tests += spintrcritical02
 sp_screens += spintrcritical02/spintrcritical02.scn
 sp_docs += spintrcritical02/spintrcritical02.doc
-spintrcritical02_SOURCES = spintrcritical01/init.c \
+spintrcritical02_SOURCES = spintrcritical02/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical02_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical02) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DFIFO_WITH_TIMEOUT
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical03
 sp_tests += spintrcritical03
 sp_screens += spintrcritical03/spintrcritical03.scn
 sp_docs += spintrcritical03/spintrcritical03.doc
-spintrcritical03_SOURCES = spintrcritical01/init.c \
+spintrcritical03_SOURCES = spintrcritical03/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical03_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical03) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DPRIORITY_NO_TIMEOUT
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical04
 sp_tests += spintrcritical04
 sp_screens += spintrcritical04/spintrcritical04.scn
 sp_docs += spintrcritical04/spintrcritical04.doc
-spintrcritical04_SOURCES = spintrcritical01/init.c \
+spintrcritical04_SOURCES = spintrcritical04/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical04_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical04) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DPRIORITY_WITH_TIMEOUT
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical05
 sp_tests += spintrcritical05
 sp_screens += spintrcritical05/spintrcritical05.scn
 sp_docs += spintrcritical05/spintrcritical05.doc
-spintrcritical05_SOURCES = spintrcritical01/init.c \
+spintrcritical05_SOURCES = spintrcritical05/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical05_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical05) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DPRIORITY_NO_TIMEOUT_REVERSE
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical06
@@ -1294,18 +1293,18 @@ spintrcritical06_SOURCES = spintrcritical06/init.c \
 	spintrcritical_support/intrcritical.h
 spintrcritical06_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical06) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DPRIORITY_NO_TIMEOUT_FORWARD
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical07
 sp_tests += spintrcritical07
 sp_screens += spintrcritical07/spintrcritical07.scn
 sp_docs += spintrcritical07/spintrcritical07.doc
-spintrcritical07_SOURCES = spintrcritical06/init.c \
+spintrcritical07_SOURCES = spintrcritical07/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical07_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical07) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DPRIORITY_NO_TIMEOUT_REVERSE
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical08
@@ -1353,18 +1352,18 @@ spintrcritical11_SOURCES = spintrcritical11/init.c \
 	spintrcritical_support/intrcritical.h
 spintrcritical11_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical11) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DEVENT_ANY
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical12
 sp_tests += spintrcritical12
 sp_screens += spintrcritical12/spintrcritical12.scn
 sp_docs += spintrcritical12/spintrcritical12.doc
-spintrcritical12_SOURCES = spintrcritical11/init.c \
+spintrcritical12_SOURCES = spintrcritical12/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical12_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical12) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DEVENT_ALL
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical13
@@ -1376,18 +1375,18 @@ spintrcritical13_SOURCES = spintrcritical13/init.c \
 	spintrcritical_support/intrcritical.h
 spintrcritical13_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical13) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DFIRE_AFTER
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical14
 sp_tests += spintrcritical14
 sp_screens += spintrcritical14/spintrcritical14.scn
 sp_docs += spintrcritical14/spintrcritical14.doc
-spintrcritical14_SOURCES = spintrcritical13/init.c \
+spintrcritical14_SOURCES = spintrcritical14/init.c \
 	spintrcritical_support/intrcritical.c
 spintrcritical14_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_spintrcritical14) $(support_includes) \
-	-I$(top_srcdir)/spintrcritical_support -DSERVER_FIRE_AFTER
+	-I$(top_srcdir)/spintrcritical_support
 endif
 
 if TEST_spintrcritical15
diff --git a/testsuites/sptests/sp27/init.c b/testsuites/sptests/sp27/init.c
index b9522fd364..c1e9ba5996 100644
--- a/testsuites/sptests/sp27/init.c
+++ b/testsuites/sptests/sp27/init.c
@@ -1,145 +1 @@
-/*
- *  Test for rtems_semaphore_flush
- *
- *  COPYRIGHT (c) 1989-2012.
- *  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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <bsp.h>
-#include <tmacros.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-void starttask(int arg);
-rtems_task subtask(rtems_task_argument arg);
-void doTest(void);
-
-#define NTASK 4
-
-#if defined(USE_COUNTING_SEMAPHORE)
-  #define TEST_NAME                 "27a"
-  #define TEST_SEMAPHORE_TYPE       "counting"
-  #define TEST_SEMAPHORE_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
-#else
-  #define TEST_NAME                 "27"
-  #define TEST_SEMAPHORE_TYPE       "binary"
-  #define TEST_SEMAPHORE_ATTRIBUTES (RTEMS_LOCAL| \
-	    RTEMS_BINARY_SEMAPHORE|RTEMS_NO_INHERIT_PRIORITY| \
-	    RTEMS_NO_PRIORITY_CEILING|RTEMS_FIFO)
-#endif
-
-const char rtems_test_name[] = "SP " TEST_NAME;
-
-rtems_id semaphore;
-volatile int flags[NTASK];
-
-rtems_task subtask(
-  rtems_task_argument arg
-)
-{
-  rtems_status_code sc;
-
-  for (;;) {
-    flags[arg]++;
-    sc = rtems_semaphore_obtain(semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
-    if (sc == RTEMS_SUCCESSFUL)
-      puts("Obtained semaphore -- and should not have done so!");
-    else if (sc != RTEMS_UNSATISFIED)
-      printf("Can't get semaphore: %s\n", rtems_status_text(sc));
-  }
-}
-
-void starttask(
-  int arg
-)
-{
-  rtems_id tid;
-  rtems_status_code sc;
-  rtems_task_priority priority;
-
-  rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
-  sc = rtems_task_create(rtems_build_name('S', 'R', 'V', arg + 'A'),
-    priority,
-    RTEMS_MINIMUM_STACK_SIZE,
-    RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
-    RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
-    &tid);
-  directive_failed( sc, "task create" );
-
-  sc = rtems_task_start(tid, subtask, (rtems_task_argument) arg);
-  directive_failed( sc, "task start" );
-}
-
-void doTest(void)
-{
-  rtems_status_code sc;
-  int               pass, i;
-
-  sc = rtems_semaphore_create(
-    rtems_build_name('S', 'E', 'M', 'F'),
-    0,
-    TEST_SEMAPHORE_ATTRIBUTES,
-    0,
-    &semaphore);
-  directive_failed( sc, "semaphore create" );
-
-  for (i = 0 ; i < NTASK ; i++)
-    flags[i] = 0;
-
-  for (i = 0 ; i < NTASK ; i++)
-    starttask(i);
-
-  for (pass = 1 ; pass < 10 ; pass++) {
-    rtems_task_wake_after(1);
-    for (i = 0 ; i < NTASK ; i++) {
-      if (flags[i] != pass)
-        printf("flags[%d] = %d -- expected %d\n", i, flags[i], pass);
-    }
-    sc = rtems_semaphore_flush(semaphore);
-    directive_failed( sc, "semaphore flush" );
-  }
-
-  printf("Flushed all waiting tasks\n" );
-}
-
-rtems_task Init(
-  rtems_task_argument ignored
-)
-{
-  TEST_BEGIN();
-  puts( "Testing " TEST_SEMAPHORE_TYPE " semaphore flush" );
-  doTest();
-  TEST_END();
-
-  rtems_test_exit(0);
-}
-
-/**************** START OF CONFIGURATION INFORMATION ****************/
-
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_TASKS               6
-#define CONFIGURE_MAXIMUM_SEMAPHORES          1
-
-#define CONFIGURE_INIT
-
-#include <rtems/confdefs.h>
-
-/****************  END OF CONFIGURATION INFORMATION  ****************/
-
+#include "sp27impl.h"
diff --git a/testsuites/sptests/sp27/sp27impl.h b/testsuites/sptests/sp27/sp27impl.h
new file mode 100644
index 0000000000..b9522fd364
--- /dev/null
+++ b/testsuites/sptests/sp27/sp27impl.h
@@ -0,0 +1,145 @@
+/*
+ *  Test for rtems_semaphore_flush
+ *
+ *  COPYRIGHT (c) 1989-2012.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <bsp.h>
+#include <tmacros.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+void starttask(int arg);
+rtems_task subtask(rtems_task_argument arg);
+void doTest(void);
+
+#define NTASK 4
+
+#if defined(USE_COUNTING_SEMAPHORE)
+  #define TEST_NAME                 "27a"
+  #define TEST_SEMAPHORE_TYPE       "counting"
+  #define TEST_SEMAPHORE_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
+#else
+  #define TEST_NAME                 "27"
+  #define TEST_SEMAPHORE_TYPE       "binary"
+  #define TEST_SEMAPHORE_ATTRIBUTES (RTEMS_LOCAL| \
+	    RTEMS_BINARY_SEMAPHORE|RTEMS_NO_INHERIT_PRIORITY| \
+	    RTEMS_NO_PRIORITY_CEILING|RTEMS_FIFO)
+#endif
+
+const char rtems_test_name[] = "SP " TEST_NAME;
+
+rtems_id semaphore;
+volatile int flags[NTASK];
+
+rtems_task subtask(
+  rtems_task_argument arg
+)
+{
+  rtems_status_code sc;
+
+  for (;;) {
+    flags[arg]++;
+    sc = rtems_semaphore_obtain(semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+    if (sc == RTEMS_SUCCESSFUL)
+      puts("Obtained semaphore -- and should not have done so!");
+    else if (sc != RTEMS_UNSATISFIED)
+      printf("Can't get semaphore: %s\n", rtems_status_text(sc));
+  }
+}
+
+void starttask(
+  int arg
+)
+{
+  rtems_id tid;
+  rtems_status_code sc;
+  rtems_task_priority priority;
+
+  rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
+  sc = rtems_task_create(rtems_build_name('S', 'R', 'V', arg + 'A'),
+    priority,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
+    RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL,
+    &tid);
+  directive_failed( sc, "task create" );
+
+  sc = rtems_task_start(tid, subtask, (rtems_task_argument) arg);
+  directive_failed( sc, "task start" );
+}
+
+void doTest(void)
+{
+  rtems_status_code sc;
+  int               pass, i;
+
+  sc = rtems_semaphore_create(
+    rtems_build_name('S', 'E', 'M', 'F'),
+    0,
+    TEST_SEMAPHORE_ATTRIBUTES,
+    0,
+    &semaphore);
+  directive_failed( sc, "semaphore create" );
+
+  for (i = 0 ; i < NTASK ; i++)
+    flags[i] = 0;
+
+  for (i = 0 ; i < NTASK ; i++)
+    starttask(i);
+
+  for (pass = 1 ; pass < 10 ; pass++) {
+    rtems_task_wake_after(1);
+    for (i = 0 ; i < NTASK ; i++) {
+      if (flags[i] != pass)
+        printf("flags[%d] = %d -- expected %d\n", i, flags[i], pass);
+    }
+    sc = rtems_semaphore_flush(semaphore);
+    directive_failed( sc, "semaphore flush" );
+  }
+
+  printf("Flushed all waiting tasks\n" );
+}
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  TEST_BEGIN();
+  puts( "Testing " TEST_SEMAPHORE_TYPE " semaphore flush" );
+  doTest();
+  TEST_END();
+
+  rtems_test_exit(0);
+}
+
+/**************** START OF CONFIGURATION INFORMATION ****************/
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS               6
+#define CONFIGURE_MAXIMUM_SEMAPHORES          1
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
+/****************  END OF CONFIGURATION INFORMATION  ****************/
+
diff --git a/testsuites/sptests/sp27a/init.c b/testsuites/sptests/sp27a/init.c
new file mode 100644
index 0000000000..23a5033dd7
--- /dev/null
+++ b/testsuites/sptests/sp27a/init.c
@@ -0,0 +1,2 @@
+#define USE_COUNTING_SEMAPHORE
+#include "../sp27/sp27impl.h"
diff --git a/testsuites/sptests/sp52/init.c b/testsuites/sptests/sp52/init.c
index 801a0b8754..6cf79eb97f 100644
--- a/testsuites/sptests/sp52/init.c
+++ b/testsuites/sptests/sp52/init.c
@@ -1,139 +1 @@
-/*
- *  Based upon test code posted on the RTEMS User's Mailing List
- *  by Sergio Faustino <sergio.faustino at edisoft.pt>:
- *
- *    http://www.rtems.org/pipermail/rtems-users/2009-June/005540.html
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#if defined(USE_TIMER_SERVER)
-   #define TEST_NUMBER      "53"
-   #define TSR_MODE         "Server"
-   #define FIRE_WHEN        rtems_timer_server_fire_when
-   #define FIRE_WHEN_STRING "rtems_timer_server_fire_when"
-#else
-   #define TEST_NUMBER      "52"
-   #define TSR_MODE         "Interrupt"
-   #define FIRE_WHEN        rtems_timer_fire_when
-   #define FIRE_WHEN_STRING "rtems_timer_fire_when"
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tmacros.h>
-#include <string.h>
-
-const char rtems_test_name[] = "SP " TEST_NUMBER;
-
-#define INITIAL_YEAR 2009
-
-static bool _timer_passage;
-
-static rtems_time_of_day time_to_fire;
-
-/*timer Routine*/
-static rtems_timer_service_routine TIMER_service_routine(
-  rtems_id  ignored_id,
-  void     *user_data
-)
-{
-  rtems_status_code status;
-  rtems_time_of_day now;
-
-  _timer_passage = true;
-
-  memset( &now, 0, sizeof( now ) );
-
-  status = rtems_clock_get_tod( &now );
-  rtems_test_assert( status == RTEMS_SUCCESSFUL );
-  rtems_test_assert( memcmp( &now, &time_to_fire, sizeof( now ) ) == 0 );
-}
-
-static rtems_task Init(
-  rtems_task_argument argument
-)
-{
-  rtems_status_code status;
-  rtems_id          timer_id;
-  rtems_name        timer_name;
-
-  rtems_time_of_day global_time;
-
-  TEST_BEGIN();
-
-  /* build timer name*/
-  timer_name = rtems_build_name('T', 'M', '1', ' ');
-
-  /* create Timer */
-  status = rtems_timer_create(timer_name, &timer_id);
-  directive_failed( status, "rtems_timer_create" );
-
-  #if defined(USE_TIMER_SERVER)
-    /* initiate timer server */
-    status = rtems_timer_initiate_server(
-      RTEMS_MINIMUM_PRIORITY,
-      RTEMS_MINIMUM_STACK_SIZE,
-      RTEMS_DEFAULT_ATTRIBUTES
-    );
-    directive_failed( status, "rtems_timer_initiate_server" );
-  #endif
-
-  /* Set system clock  */
-  build_time(&global_time, 6, 8, INITIAL_YEAR, 16, 5, 13, 0);
-  status = rtems_clock_set(&global_time);
-  directive_failed( status, "rtems_clock_set" );
-
-  /* Set Timer to Fire */
-  /* build fire times */
-  time_to_fire = global_time;
-
-  /* only diferent second */
-  time_to_fire.year = INITIAL_YEAR + 5;
-
-  status = FIRE_WHEN(
-    timer_id,
-    &time_to_fire,
-    TIMER_service_routine,
-    (void*) NULL
-  );
-  directive_failed( status, FIRE_WHEN_STRING );
-
-  /* Set system clock FORWARD */
-  global_time.year = time_to_fire.year;
-  status = rtems_clock_set(&global_time);
-
-  if (!_timer_passage) {
-    puts( TSR_MODE " Timer FAILED to fire after setting time forward");
-    rtems_test_exit(0);
-  }
-
-  puts( TSR_MODE " Timer fired after setting time forward -- OK");
-
-  TEST_END();
-  rtems_test_exit(0);
-}
-
-/* configuration stuff */
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MICROSECONDS_PER_TICK 50000
-
-#define CONFIGURE_MAXIMUM_TASKS              2
-#define CONFIGURE_MAXIMUM_TIMERS             1
-
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_INIT_TASK_PRIORITY (RTEMS_MINIMUM_PRIORITY + 1)
-#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
-
-#define CONFIGURE_INIT
-#include <rtems/confdefs.h>
+#include "sp52impl.h"
diff --git a/testsuites/sptests/sp52/sp52impl.h b/testsuites/sptests/sp52/sp52impl.h
new file mode 100644
index 0000000000..801a0b8754
--- /dev/null
+++ b/testsuites/sptests/sp52/sp52impl.h
@@ -0,0 +1,139 @@
+/*
+ *  Based upon test code posted on the RTEMS User's Mailing List
+ *  by Sergio Faustino <sergio.faustino at edisoft.pt>:
+ *
+ *    http://www.rtems.org/pipermail/rtems-users/2009-June/005540.html
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#if defined(USE_TIMER_SERVER)
+   #define TEST_NUMBER      "53"
+   #define TSR_MODE         "Server"
+   #define FIRE_WHEN        rtems_timer_server_fire_when
+   #define FIRE_WHEN_STRING "rtems_timer_server_fire_when"
+#else
+   #define TEST_NUMBER      "52"
+   #define TSR_MODE         "Interrupt"
+   #define FIRE_WHEN        rtems_timer_fire_when
+   #define FIRE_WHEN_STRING "rtems_timer_fire_when"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include <string.h>
+
+const char rtems_test_name[] = "SP " TEST_NUMBER;
+
+#define INITIAL_YEAR 2009
+
+static bool _timer_passage;
+
+static rtems_time_of_day time_to_fire;
+
+/*timer Routine*/
+static rtems_timer_service_routine TIMER_service_routine(
+  rtems_id  ignored_id,
+  void     *user_data
+)
+{
+  rtems_status_code status;
+  rtems_time_of_day now;
+
+  _timer_passage = true;
+
+  memset( &now, 0, sizeof( now ) );
+
+  status = rtems_clock_get_tod( &now );
+  rtems_test_assert( status == RTEMS_SUCCESSFUL );
+  rtems_test_assert( memcmp( &now, &time_to_fire, sizeof( now ) ) == 0 );
+}
+
+static rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+  rtems_id          timer_id;
+  rtems_name        timer_name;
+
+  rtems_time_of_day global_time;
+
+  TEST_BEGIN();
+
+  /* build timer name*/
+  timer_name = rtems_build_name('T', 'M', '1', ' ');
+
+  /* create Timer */
+  status = rtems_timer_create(timer_name, &timer_id);
+  directive_failed( status, "rtems_timer_create" );
+
+  #if defined(USE_TIMER_SERVER)
+    /* initiate timer server */
+    status = rtems_timer_initiate_server(
+      RTEMS_MINIMUM_PRIORITY,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_ATTRIBUTES
+    );
+    directive_failed( status, "rtems_timer_initiate_server" );
+  #endif
+
+  /* Set system clock  */
+  build_time(&global_time, 6, 8, INITIAL_YEAR, 16, 5, 13, 0);
+  status = rtems_clock_set(&global_time);
+  directive_failed( status, "rtems_clock_set" );
+
+  /* Set Timer to Fire */
+  /* build fire times */
+  time_to_fire = global_time;
+
+  /* only diferent second */
+  time_to_fire.year = INITIAL_YEAR + 5;
+
+  status = FIRE_WHEN(
+    timer_id,
+    &time_to_fire,
+    TIMER_service_routine,
+    (void*) NULL
+  );
+  directive_failed( status, FIRE_WHEN_STRING );
+
+  /* Set system clock FORWARD */
+  global_time.year = time_to_fire.year;
+  status = rtems_clock_set(&global_time);
+
+  if (!_timer_passage) {
+    puts( TSR_MODE " Timer FAILED to fire after setting time forward");
+    rtems_test_exit(0);
+  }
+
+  puts( TSR_MODE " Timer fired after setting time forward -- OK");
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+/* configuration stuff */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 50000
+
+#define CONFIGURE_MAXIMUM_TASKS              2
+#define CONFIGURE_MAXIMUM_TIMERS             1
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_PRIORITY (RTEMS_MINIMUM_PRIORITY + 1)
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/sptests/sp53/init.c b/testsuites/sptests/sp53/init.c
new file mode 100644
index 0000000000..3ff09bcb7f
--- /dev/null
+++ b/testsuites/sptests/sp53/init.c
@@ -0,0 +1,2 @@
+#define USE_TIMER_SERVER
+#include "../sp52/sp52impl.h"
diff --git a/testsuites/sptests/sp65/init.c b/testsuites/sptests/sp65/init.c
index a557ede775..8360add865 100644
--- a/testsuites/sptests/sp65/init.c
+++ b/testsuites/sptests/sp65/init.c
@@ -1,153 +1 @@
-/*
- *  COPYRIGHT (c) 1989-2012.
- *  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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tmacros.h>
-#include <unistd.h>
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_task Task_1(rtems_task_argument arg);
-
-#if defined(INHERIT_CEILING)
-  #define TEST_NAME                "66"
-  #define TASK_PRIORITY            2
-#else
-  #define TEST_NAME                "65"
-  #define TASK_PRIORITY            1
-#endif
-
-const char rtems_test_name[] = "SP " TEST_NAME;
-
-static void assert_priority(rtems_task_priority expected)
-{
-  rtems_status_code sc;
-  rtems_task_priority prio;
-
-  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio);
-  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-
-  rtems_test_assert(prio == expected);
-}
-
-rtems_task Init(
-  rtems_task_argument ignored
-)
-{
-  int                  status;
-  rtems_id             Mutex_id, Task_id;
-
-  TEST_BEGIN();
-
-  /*
-   * Verify that an initially locked priority ceiling mutex elevates the
-   * priority of the creating task.
-   */
-
-  status = rtems_semaphore_create(
-    rtems_build_name( 's','e','m','1' ),
-    0,
-    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
-    1,
-    &Mutex_id
-  );
-  rtems_test_assert(status == RTEMS_SUCCESSFUL);
-
-  assert_priority(1);
-
-  status = rtems_semaphore_release(Mutex_id);
-  rtems_test_assert(status == RTEMS_SUCCESSFUL);
-
-  assert_priority(TASK_PRIORITY);
-
-  status = rtems_semaphore_delete(Mutex_id);
-  rtems_test_assert(status == RTEMS_SUCCESSFUL);
-
-  /*
-   *  Create binary semaphore (a.k.a. Mutex) with Priority Ceiling
-   *  attribute.
-   */
-
-  puts( "Creating semaphore" );
-  status = rtems_semaphore_create(
-    rtems_build_name( 's','e','m','1' ),
-    1,
-    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
-    1,
-    &Mutex_id
-  );
-  directive_failed( status, "rtems_semaphore_create" );
-
-  puts( "Calling rtems_semaphore_obtain" );
-  status = rtems_semaphore_obtain( Mutex_id, RTEMS_DEFAULT_OPTIONS, 0 );
-  directive_failed( status, "rtems_semaphore_obtain" );
-
-  puts( "Calling rtems_task_create" );
-  status = rtems_task_create( rtems_build_name( 'T', 'A', 'S', '1' ),
-    TASK_PRIORITY,
-    RTEMS_MINIMUM_STACK_SIZE,
-    RTEMS_DEFAULT_MODES,
-    RTEMS_DEFAULT_ATTRIBUTES,
-    &Task_id
-  );
-  directive_failed( status, "rtems_task_create" );
-
-  puts( "Calling rtems_task_start" );
-  status = rtems_task_start( Task_id, Task_1, (rtems_task_argument)&Mutex_id );
-  directive_failed( status, "rtems_task_start" );
-
-  sleep(1);
-
-  puts( "Calling semaphore release" );
-  status = rtems_semaphore_release( Mutex_id );
-  directive_failed( status, "rtems_semaphore_release" );
-
-  TEST_END();
-
-  rtems_test_exit(0);
-}
-
-rtems_task Task_1(
-  rtems_task_argument arg
-)
-{
-  int status_in_task;
-  rtems_id *Mutex_id = (rtems_id *)arg;
-
-  puts( "Init Task_1: Obtaining semaphore" );
-  status_in_task = rtems_semaphore_obtain(
-    *Mutex_id,
-    RTEMS_DEFAULT_OPTIONS,
-    0
-  );
-  directive_failed( status_in_task, "Task_1 rtems_semaphore_obtain" );
-  return;
-}
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_TASKS         2
-#define CONFIGURE_MAXIMUM_SEMAPHORES    1
-#define CONFIGURE_INIT_TASK_PRIORITY    TASK_PRIORITY
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_DISABLE_SMP_CONFIGURATION
-
-#define CONFIGURE_INIT
-#include <rtems/confdefs.h>
-
-/* global variables */
+#include "sp65impl.h"
diff --git a/testsuites/sptests/sp65/sp65impl.h b/testsuites/sptests/sp65/sp65impl.h
new file mode 100644
index 0000000000..a557ede775
--- /dev/null
+++ b/testsuites/sptests/sp65/sp65impl.h
@@ -0,0 +1,153 @@
+/*
+ *  COPYRIGHT (c) 1989-2012.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include <unistd.h>
+
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+rtems_task Task_1(rtems_task_argument arg);
+
+#if defined(INHERIT_CEILING)
+  #define TEST_NAME                "66"
+  #define TASK_PRIORITY            2
+#else
+  #define TEST_NAME                "65"
+  #define TASK_PRIORITY            1
+#endif
+
+const char rtems_test_name[] = "SP " TEST_NAME;
+
+static void assert_priority(rtems_task_priority expected)
+{
+  rtems_status_code sc;
+  rtems_task_priority prio;
+
+  sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio);
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  rtems_test_assert(prio == expected);
+}
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  int                  status;
+  rtems_id             Mutex_id, Task_id;
+
+  TEST_BEGIN();
+
+  /*
+   * Verify that an initially locked priority ceiling mutex elevates the
+   * priority of the creating task.
+   */
+
+  status = rtems_semaphore_create(
+    rtems_build_name( 's','e','m','1' ),
+    0,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
+    1,
+    &Mutex_id
+  );
+  rtems_test_assert(status == RTEMS_SUCCESSFUL);
+
+  assert_priority(1);
+
+  status = rtems_semaphore_release(Mutex_id);
+  rtems_test_assert(status == RTEMS_SUCCESSFUL);
+
+  assert_priority(TASK_PRIORITY);
+
+  status = rtems_semaphore_delete(Mutex_id);
+  rtems_test_assert(status == RTEMS_SUCCESSFUL);
+
+  /*
+   *  Create binary semaphore (a.k.a. Mutex) with Priority Ceiling
+   *  attribute.
+   */
+
+  puts( "Creating semaphore" );
+  status = rtems_semaphore_create(
+    rtems_build_name( 's','e','m','1' ),
+    1,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
+    1,
+    &Mutex_id
+  );
+  directive_failed( status, "rtems_semaphore_create" );
+
+  puts( "Calling rtems_semaphore_obtain" );
+  status = rtems_semaphore_obtain( Mutex_id, RTEMS_DEFAULT_OPTIONS, 0 );
+  directive_failed( status, "rtems_semaphore_obtain" );
+
+  puts( "Calling rtems_task_create" );
+  status = rtems_task_create( rtems_build_name( 'T', 'A', 'S', '1' ),
+    TASK_PRIORITY,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &Task_id
+  );
+  directive_failed( status, "rtems_task_create" );
+
+  puts( "Calling rtems_task_start" );
+  status = rtems_task_start( Task_id, Task_1, (rtems_task_argument)&Mutex_id );
+  directive_failed( status, "rtems_task_start" );
+
+  sleep(1);
+
+  puts( "Calling semaphore release" );
+  status = rtems_semaphore_release( Mutex_id );
+  directive_failed( status, "rtems_semaphore_release" );
+
+  TEST_END();
+
+  rtems_test_exit(0);
+}
+
+rtems_task Task_1(
+  rtems_task_argument arg
+)
+{
+  int status_in_task;
+  rtems_id *Mutex_id = (rtems_id *)arg;
+
+  puts( "Init Task_1: Obtaining semaphore" );
+  status_in_task = rtems_semaphore_obtain(
+    *Mutex_id,
+    RTEMS_DEFAULT_OPTIONS,
+    0
+  );
+  directive_failed( status_in_task, "Task_1 rtems_semaphore_obtain" );
+  return;
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS         2
+#define CONFIGURE_MAXIMUM_SEMAPHORES    1
+#define CONFIGURE_INIT_TASK_PRIORITY    TASK_PRIORITY
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_DISABLE_SMP_CONFIGURATION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* global variables */
diff --git a/testsuites/sptests/sp66/init.c b/testsuites/sptests/sp66/init.c
new file mode 100644
index 0000000000..f2bf46d049
--- /dev/null
+++ b/testsuites/sptests/sp66/init.c
@@ -0,0 +1,2 @@
+#define INHERIT_CEILING
+#include "../sp65/sp65impl.h"
diff --git a/testsuites/sptests/spintrcritical01/init.c b/testsuites/sptests/spintrcritical01/init.c
index 5c480b4bb3..0df5160c8f 100644
--- a/testsuites/sptests/spintrcritical01/init.c
+++ b/testsuites/sptests/spintrcritical01/init.c
@@ -1,155 +1,2 @@
-/*
- *  COPYRIGHT (c) 1989-2012.
- *  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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tmacros.h>
-#include <intrcritical.h>
-
-#include <rtems/score/threadimpl.h>
-
-#if defined(FIFO_NO_TIMEOUT)
-  #define TEST_NAME                "1"
-  #define TEST_STRING              "FIFO/Without Timeout"
-  #define SEMAPHORE_OBTAIN_TIMEOUT 0
-  #define SEMAPHORE_ATTRIBUTES     RTEMS_DEFAULT_ATTRIBUTES
-
-#elif defined(FIFO_WITH_TIMEOUT)
-  #define TEST_NAME                "2"
-  #define TEST_STRING              "FIFO/With Timeout"
-  #define SEMAPHORE_OBTAIN_TIMEOUT 10
-  #define SEMAPHORE_ATTRIBUTES     RTEMS_DEFAULT_ATTRIBUTES
-
-#elif defined(PRIORITY_NO_TIMEOUT)
-  #define TEST_NAME                "3"
-  #define TEST_STRING              "Priority/Without Timeout"
-  #define SEMAPHORE_OBTAIN_TIMEOUT 0
-  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
-
-#elif defined(PRIORITY_WITH_TIMEOUT)
-  #define TEST_NAME                "4"
-  #define TEST_STRING              "Priority/With Timeout"
-  #define SEMAPHORE_OBTAIN_TIMEOUT 10
-  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
-
-#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
-  #define TEST_NAME                "5"
-  #define TEST_STRING              "Priority/Without Timeout (Reverse)"
-  #define SEMAPHORE_OBTAIN_TIMEOUT 0
-  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
-
-#else
-
-  #error "Test Mode not defined"
-#endif
-
-const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
-
-static Thread_Control *thread;
-
-static rtems_id Semaphore;
-
-static bool case_hit;
-
-static bool interrupts_blocking_op(void)
-{
-  Thread_Wait_flags flags = _Thread_Wait_flags_get( thread );
-
-  return
-    flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK );
-}
-
-static rtems_timer_service_routine test_release_from_isr(
-  rtems_id  timer,
-  void     *arg
-)
-{
-  rtems_status_code     status;
-
-  if ( interrupts_blocking_op() ) {
-    case_hit = true;
-  }
-
-  status = rtems_semaphore_release( Semaphore );
-  directive_failed_with_level( status, "release", -1 );
-}
-
-
-static bool test_body( void *arg )
-{
-  rtems_status_code status;
-
-  (void) arg;
-
-  status = rtems_semaphore_obtain(
-    Semaphore,
-    RTEMS_DEFAULT_OPTIONS,
-    SEMAPHORE_OBTAIN_TIMEOUT
-  );
-  directive_failed( status, "rtems_semaphore_obtain" );
-
-  return case_hit;
-}
-
-static rtems_task Init(
-  rtems_task_argument ignored
-)
-{
-  rtems_status_code     status;
-
-  TEST_BEGIN();
-
-  thread = _Thread_Get_executing();
-
-  puts( "Init - Trying to generate semaphore release from ISR while blocking" );
-  puts( "Init - Variation is: " TEST_STRING );
-  status = rtems_semaphore_create(
-    rtems_build_name( 'S', 'M', '1', ' ' ),
-    0,
-    SEMAPHORE_ATTRIBUTES,
-    RTEMS_NO_PRIORITY,
-    &Semaphore
-  );
-  directive_failed( status, "rtems_semaphore_create of SM1" );
-
-  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
-
-  if ( case_hit ) {
-    puts( "Init - Case hit" );
-    TEST_END();
-  } else
-    puts( "Init - Case not hit - ran too long" );
-
-  rtems_test_exit(0);
-}
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_TASKS       1
-#define CONFIGURE_MAXIMUM_TIMERS      1
-#define CONFIGURE_MAXIMUM_SEMAPHORES  1
-#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
-#define CONFIGURE_MICROSECONDS_PER_TICK  1000
-#if defined(PRIORITY_NO_TIMEOUT_REVERSE)
-  #define CONFIGURE_INIT_TASK_PRIORITY   250
-#endif
-#define CONFIGURE_MICROSECONDS_PER_TICK  1000
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_INIT
-#include <rtems/confdefs.h>
-
-/* global variables */
+#define FIFO_NO_TIMEOUT
+#include "spintrcritical01impl.h"
diff --git a/testsuites/sptests/spintrcritical01/spintrcritical01impl.h b/testsuites/sptests/spintrcritical01/spintrcritical01impl.h
new file mode 100644
index 0000000000..5c480b4bb3
--- /dev/null
+++ b/testsuites/sptests/spintrcritical01/spintrcritical01impl.h
@@ -0,0 +1,155 @@
+/*
+ *  COPYRIGHT (c) 1989-2012.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include <intrcritical.h>
+
+#include <rtems/score/threadimpl.h>
+
+#if defined(FIFO_NO_TIMEOUT)
+  #define TEST_NAME                "1"
+  #define TEST_STRING              "FIFO/Without Timeout"
+  #define SEMAPHORE_OBTAIN_TIMEOUT 0
+  #define SEMAPHORE_ATTRIBUTES     RTEMS_DEFAULT_ATTRIBUTES
+
+#elif defined(FIFO_WITH_TIMEOUT)
+  #define TEST_NAME                "2"
+  #define TEST_STRING              "FIFO/With Timeout"
+  #define SEMAPHORE_OBTAIN_TIMEOUT 10
+  #define SEMAPHORE_ATTRIBUTES     RTEMS_DEFAULT_ATTRIBUTES
+
+#elif defined(PRIORITY_NO_TIMEOUT)
+  #define TEST_NAME                "3"
+  #define TEST_STRING              "Priority/Without Timeout"
+  #define SEMAPHORE_OBTAIN_TIMEOUT 0
+  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
+
+#elif defined(PRIORITY_WITH_TIMEOUT)
+  #define TEST_NAME                "4"
+  #define TEST_STRING              "Priority/With Timeout"
+  #define SEMAPHORE_OBTAIN_TIMEOUT 10
+  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
+
+#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
+  #define TEST_NAME                "5"
+  #define TEST_STRING              "Priority/Without Timeout (Reverse)"
+  #define SEMAPHORE_OBTAIN_TIMEOUT 0
+  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
+
+#else
+
+  #error "Test Mode not defined"
+#endif
+
+const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
+
+static Thread_Control *thread;
+
+static rtems_id Semaphore;
+
+static bool case_hit;
+
+static bool interrupts_blocking_op(void)
+{
+  Thread_Wait_flags flags = _Thread_Wait_flags_get( thread );
+
+  return
+    flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK );
+}
+
+static rtems_timer_service_routine test_release_from_isr(
+  rtems_id  timer,
+  void     *arg
+)
+{
+  rtems_status_code     status;
+
+  if ( interrupts_blocking_op() ) {
+    case_hit = true;
+  }
+
+  status = rtems_semaphore_release( Semaphore );
+  directive_failed_with_level( status, "release", -1 );
+}
+
+
+static bool test_body( void *arg )
+{
+  rtems_status_code status;
+
+  (void) arg;
+
+  status = rtems_semaphore_obtain(
+    Semaphore,
+    RTEMS_DEFAULT_OPTIONS,
+    SEMAPHORE_OBTAIN_TIMEOUT
+  );
+  directive_failed( status, "rtems_semaphore_obtain" );
+
+  return case_hit;
+}
+
+static rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_status_code     status;
+
+  TEST_BEGIN();
+
+  thread = _Thread_Get_executing();
+
+  puts( "Init - Trying to generate semaphore release from ISR while blocking" );
+  puts( "Init - Variation is: " TEST_STRING );
+  status = rtems_semaphore_create(
+    rtems_build_name( 'S', 'M', '1', ' ' ),
+    0,
+    SEMAPHORE_ATTRIBUTES,
+    RTEMS_NO_PRIORITY,
+    &Semaphore
+  );
+  directive_failed( status, "rtems_semaphore_create of SM1" );
+
+  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
+
+  if ( case_hit ) {
+    puts( "Init - Case hit" );
+    TEST_END();
+  } else
+    puts( "Init - Case not hit - ran too long" );
+
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS       1
+#define CONFIGURE_MAXIMUM_TIMERS      1
+#define CONFIGURE_MAXIMUM_SEMAPHORES  1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_MICROSECONDS_PER_TICK  1000
+#if defined(PRIORITY_NO_TIMEOUT_REVERSE)
+  #define CONFIGURE_INIT_TASK_PRIORITY   250
+#endif
+#define CONFIGURE_MICROSECONDS_PER_TICK  1000
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* global variables */
diff --git a/testsuites/sptests/spintrcritical02/init.c b/testsuites/sptests/spintrcritical02/init.c
new file mode 100644
index 0000000000..2559eea587
--- /dev/null
+++ b/testsuites/sptests/spintrcritical02/init.c
@@ -0,0 +1,2 @@
+#define FIFO_WITH_TIMEOUT
+#include "../spintrcritical01/spintrcritical01impl.h"
diff --git a/testsuites/sptests/spintrcritical03/init.c b/testsuites/sptests/spintrcritical03/init.c
new file mode 100644
index 0000000000..46e8bbb8e9
--- /dev/null
+++ b/testsuites/sptests/spintrcritical03/init.c
@@ -0,0 +1,2 @@
+#define PRIORITY_NO_TIMEOUT
+#include "../spintrcritical01/spintrcritical01impl.h"
diff --git a/testsuites/sptests/spintrcritical04/init.c b/testsuites/sptests/spintrcritical04/init.c
new file mode 100644
index 0000000000..16d07528f1
--- /dev/null
+++ b/testsuites/sptests/spintrcritical04/init.c
@@ -0,0 +1,2 @@
+#define PRIORITY_WITH_TIMEOUT
+#include "../spintrcritical01/spintrcritical01impl.h"
diff --git a/testsuites/sptests/spintrcritical05/init.c b/testsuites/sptests/spintrcritical05/init.c
new file mode 100644
index 0000000000..d77a683e19
--- /dev/null
+++ b/testsuites/sptests/spintrcritical05/init.c
@@ -0,0 +1,2 @@
+#define PRIORITY_NO_TIMEOUT_REVERSE
+#include "../spintrcritical01/spintrcritical01impl.h"
diff --git a/testsuites/sptests/spintrcritical06/init.c b/testsuites/sptests/spintrcritical06/init.c
index 161f0502de..d8fedae772 100644
--- a/testsuites/sptests/spintrcritical06/init.c
+++ b/testsuites/sptests/spintrcritical06/init.c
@@ -1,147 +1,2 @@
-/*
- *  COPYRIGHT (c) 1989-2012.
- *  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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tmacros.h>
-#include <intrcritical.h>
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
-rtems_task Secondary_task(rtems_task_argument arg);
-
-/* common parameters */
-#define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
-
-#if defined(PRIORITY_NO_TIMEOUT_FORWARD)
-  #define TEST_NAME          "6"
-  #define TEST_STRING        "Priority/Restart Search Task (Forward)"
-
-  #define INIT_PRIORITY      2
-  #define BLOCKER_PRIORITY   1
-  #define SEMAPHORE_OBTAIN_TIMEOUT 2
-
-#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
-  #define TEST_NAME          "7"
-  #define TEST_STRING        "Priority/Restart Search Task (Backward)"
-  #define INIT_PRIORITY      126
-  #define BLOCKER_PRIORITY   127
-  #define SEMAPHORE_OBTAIN_TIMEOUT 0
-
-#else
-
-  #error "Test Mode not defined"
-#endif
-
-const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
-
-rtems_id Secondary_task_id;
-rtems_id Semaphore;
-
-rtems_timer_service_routine test_release_from_isr(
-  rtems_id  timer,
-  void     *arg
-)
-{
-  (void) rtems_task_restart( Secondary_task_id, 1 );
-}
-
-rtems_task Secondary_task(
-  rtems_task_argument arg
-)
-{
-  if ( arg )
-    (void) rtems_semaphore_flush( Semaphore );
-
-  (void) rtems_semaphore_obtain(
-    Semaphore,
-    RTEMS_DEFAULT_OPTIONS,
-    RTEMS_NO_TIMEOUT
-  );
-
-  rtems_test_assert(0);
-}
-
-static bool test_body( void *arg )
-{
-  (void) arg;
-
-  rtems_semaphore_obtain(
-    Semaphore,
-    RTEMS_DEFAULT_OPTIONS,
-    SEMAPHORE_OBTAIN_TIMEOUT
-  );
-
-  return false;
-}
-
-rtems_task Init(
-  rtems_task_argument ignored
-)
-{
-  rtems_status_code     status;
-
-  TEST_BEGIN();
-
-  puts( "Init - Trying to generate semaphore release from ISR while blocking" );
-  puts( "Init - There is no way for the test to know if it hits the case" );
-  puts( "Init - Variation is: " TEST_STRING );
-  status = rtems_semaphore_create(
-    rtems_build_name( 'S', 'M', '1', ' ' ),
-    0,
-    SEMAPHORE_ATTRIBUTES,
-    RTEMS_NO_PRIORITY,
-    &Semaphore
-  );
-  directive_failed( status, "rtems_semaphore_create of SM1" );
-
-  status = rtems_task_create(
-    rtems_build_name( 'B', 'L', 'C', 'K' ),
-    BLOCKER_PRIORITY,
-    RTEMS_MINIMUM_STACK_SIZE,
-    RTEMS_NO_PREEMPT,
-    RTEMS_DEFAULT_ATTRIBUTES,
-    &Secondary_task_id
-  );
-  directive_failed( status, "rtems_task_create" );
-
-  status = rtems_task_start( Secondary_task_id, Secondary_task, 0 );
-  directive_failed( status, "rtems_task_start" );
-
-  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
-
-  TEST_END();
-  rtems_test_exit(0);
-}
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_TASKS       2
-#define CONFIGURE_MAXIMUM_TIMERS      1
-#define CONFIGURE_MAXIMUM_SEMAPHORES  1
-#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
-#define CONFIGURE_INIT_TASK_PRIORITY  INIT_PRIORITY
-#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
-#define CONFIGURE_MICROSECONDS_PER_TICK  2000
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_DISABLE_SMP_CONFIGURATION
-
-#define CONFIGURE_INIT
-#include <rtems/confdefs.h>
-
-/* global variables */
+#define PRIORITY_NO_TIMEOUT_FORWARD
+#include "spintrcritical06impl.h"
diff --git a/testsuites/sptests/spintrcritical06/spintrcritical06impl.h b/testsuites/sptests/spintrcritical06/spintrcritical06impl.h
new file mode 100644
index 0000000000..161f0502de
--- /dev/null
+++ b/testsuites/sptests/spintrcritical06/spintrcritical06impl.h
@@ -0,0 +1,147 @@
+/*
+ *  COPYRIGHT (c) 1989-2012.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include <intrcritical.h>
+
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
+rtems_task Secondary_task(rtems_task_argument arg);
+
+/* common parameters */
+#define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
+
+#if defined(PRIORITY_NO_TIMEOUT_FORWARD)
+  #define TEST_NAME          "6"
+  #define TEST_STRING        "Priority/Restart Search Task (Forward)"
+
+  #define INIT_PRIORITY      2
+  #define BLOCKER_PRIORITY   1
+  #define SEMAPHORE_OBTAIN_TIMEOUT 2
+
+#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
+  #define TEST_NAME          "7"
+  #define TEST_STRING        "Priority/Restart Search Task (Backward)"
+  #define INIT_PRIORITY      126
+  #define BLOCKER_PRIORITY   127
+  #define SEMAPHORE_OBTAIN_TIMEOUT 0
+
+#else
+
+  #error "Test Mode not defined"
+#endif
+
+const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
+
+rtems_id Secondary_task_id;
+rtems_id Semaphore;
+
+rtems_timer_service_routine test_release_from_isr(
+  rtems_id  timer,
+  void     *arg
+)
+{
+  (void) rtems_task_restart( Secondary_task_id, 1 );
+}
+
+rtems_task Secondary_task(
+  rtems_task_argument arg
+)
+{
+  if ( arg )
+    (void) rtems_semaphore_flush( Semaphore );
+
+  (void) rtems_semaphore_obtain(
+    Semaphore,
+    RTEMS_DEFAULT_OPTIONS,
+    RTEMS_NO_TIMEOUT
+  );
+
+  rtems_test_assert(0);
+}
+
+static bool test_body( void *arg )
+{
+  (void) arg;
+
+  rtems_semaphore_obtain(
+    Semaphore,
+    RTEMS_DEFAULT_OPTIONS,
+    SEMAPHORE_OBTAIN_TIMEOUT
+  );
+
+  return false;
+}
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_status_code     status;
+
+  TEST_BEGIN();
+
+  puts( "Init - Trying to generate semaphore release from ISR while blocking" );
+  puts( "Init - There is no way for the test to know if it hits the case" );
+  puts( "Init - Variation is: " TEST_STRING );
+  status = rtems_semaphore_create(
+    rtems_build_name( 'S', 'M', '1', ' ' ),
+    0,
+    SEMAPHORE_ATTRIBUTES,
+    RTEMS_NO_PRIORITY,
+    &Semaphore
+  );
+  directive_failed( status, "rtems_semaphore_create of SM1" );
+
+  status = rtems_task_create(
+    rtems_build_name( 'B', 'L', 'C', 'K' ),
+    BLOCKER_PRIORITY,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_NO_PREEMPT,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &Secondary_task_id
+  );
+  directive_failed( status, "rtems_task_create" );
+
+  status = rtems_task_start( Secondary_task_id, Secondary_task, 0 );
+  directive_failed( status, "rtems_task_start" );
+
+  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS       2
+#define CONFIGURE_MAXIMUM_TIMERS      1
+#define CONFIGURE_MAXIMUM_SEMAPHORES  1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_INIT_TASK_PRIORITY  INIT_PRIORITY
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
+#define CONFIGURE_MICROSECONDS_PER_TICK  2000
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_DISABLE_SMP_CONFIGURATION
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* global variables */
diff --git a/testsuites/sptests/spintrcritical07/init.c b/testsuites/sptests/spintrcritical07/init.c
new file mode 100644
index 0000000000..0c4f2a7f78
--- /dev/null
+++ b/testsuites/sptests/spintrcritical07/init.c
@@ -0,0 +1,2 @@
+#define PRIORITY_NO_TIMEOUT_REVERSE
+#include "../spintrcritical06/spintrcritical06impl.h"
diff --git a/testsuites/sptests/spintrcritical11/init.c b/testsuites/sptests/spintrcritical11/init.c
index fb0d320dea..126a76d1a9 100644
--- a/testsuites/sptests/spintrcritical11/init.c
+++ b/testsuites/sptests/spintrcritical11/init.c
@@ -1,96 +1,2 @@
-/*
- *  COPYRIGHT (c) 1989-2012.
- *  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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tmacros.h>
-#include <intrcritical.h>
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
-
-rtems_id Main_task;
-
-#if defined(EVENT_ANY)
-  #define TEST_NAME          "11"
-  #define TEST_STRING        "Event Any condition"
-  #define EVENTS_TO_SEND     0x1
-  #define EVENTS_TO_RECEIVE  0x3
-
-#elif defined(EVENT_ALL)
-  #define TEST_NAME          "12"
-  #define TEST_STRING        "Event All condition"
-  #define EVENTS_TO_SEND     0x3
-  #define EVENTS_TO_RECEIVE  0x3
-
-#else
-  #error "Test Mode not defined"
-
-#endif
-
-const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
-
-rtems_timer_service_routine test_release_from_isr(
-  rtems_id  timer,
-  void     *arg
-)
-{
-  (void) rtems_event_send( Main_task, EVENTS_TO_SEND );
-}
-
-static bool test_body( void *arg )
-{
-  rtems_event_set out;
-
-  (void) arg;
-
-  rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out );
-
-  return false;
-}
-
-rtems_task Init(
-  rtems_task_argument ignored
-)
-{
-  TEST_BEGIN();
-
-  puts( "Init - Test may not be able to detect case is hit reliably" );
-  puts( "Init - Trying to generate event send from ISR while blocking" );
-  puts( "Init - Variation is: " TEST_STRING );
-
-  Main_task = rtems_task_self();
-
-  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
-
-  TEST_END();
-  rtems_test_exit(0);
-}
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_TASKS       2
-#define CONFIGURE_MAXIMUM_TIMERS      1
-#define CONFIGURE_MAXIMUM_SEMAPHORES  1
-#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_MICROSECONDS_PER_TICK  1000
-
-#define CONFIGURE_INIT
-#include <rtems/confdefs.h>
-
-/* global variables */
+#define EVENT_ANY
+#include "spintrcritical11impl.h"
diff --git a/testsuites/sptests/spintrcritical11/spintrcritical11impl.h b/testsuites/sptests/spintrcritical11/spintrcritical11impl.h
new file mode 100644
index 0000000000..fb0d320dea
--- /dev/null
+++ b/testsuites/sptests/spintrcritical11/spintrcritical11impl.h
@@ -0,0 +1,96 @@
+/*
+ *  COPYRIGHT (c) 1989-2012.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include <intrcritical.h>
+
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
+
+rtems_id Main_task;
+
+#if defined(EVENT_ANY)
+  #define TEST_NAME          "11"
+  #define TEST_STRING        "Event Any condition"
+  #define EVENTS_TO_SEND     0x1
+  #define EVENTS_TO_RECEIVE  0x3
+
+#elif defined(EVENT_ALL)
+  #define TEST_NAME          "12"
+  #define TEST_STRING        "Event All condition"
+  #define EVENTS_TO_SEND     0x3
+  #define EVENTS_TO_RECEIVE  0x3
+
+#else
+  #error "Test Mode not defined"
+
+#endif
+
+const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
+
+rtems_timer_service_routine test_release_from_isr(
+  rtems_id  timer,
+  void     *arg
+)
+{
+  (void) rtems_event_send( Main_task, EVENTS_TO_SEND );
+}
+
+static bool test_body( void *arg )
+{
+  rtems_event_set out;
+
+  (void) arg;
+
+  rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out );
+
+  return false;
+}
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  TEST_BEGIN();
+
+  puts( "Init - Test may not be able to detect case is hit reliably" );
+  puts( "Init - Trying to generate event send from ISR while blocking" );
+  puts( "Init - Variation is: " TEST_STRING );
+
+  Main_task = rtems_task_self();
+
+  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS       2
+#define CONFIGURE_MAXIMUM_TIMERS      1
+#define CONFIGURE_MAXIMUM_SEMAPHORES  1
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MICROSECONDS_PER_TICK  1000
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* global variables */
diff --git a/testsuites/sptests/spintrcritical12/init.c b/testsuites/sptests/spintrcritical12/init.c
new file mode 100644
index 0000000000..243acfde61
--- /dev/null
+++ b/testsuites/sptests/spintrcritical12/init.c
@@ -0,0 +1,2 @@
+#define EVENT_ALL
+#include "../spintrcritical11/spintrcritical11impl.h"
diff --git a/testsuites/sptests/spintrcritical13/init.c b/testsuites/sptests/spintrcritical13/init.c
index e284d3c33d..86d9cc4cb1 100644
--- a/testsuites/sptests/spintrcritical13/init.c
+++ b/testsuites/sptests/spintrcritical13/init.c
@@ -1,120 +1,2 @@
-/*
- *  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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tmacros.h>
-#include <intrcritical.h>
-
-#if defined(FIRE_AFTER)
-  #define TEST_NAME          "13"
-  #define TEST_STRING        "Timer Fire After"
-  #define TEST_DIRECTIVE     rtems_timer_fire_after
-
-#elif defined(SERVER_FIRE_AFTER)
-  #define TEST_NAME          "14"
-  #define TEST_STRING        "Timer Server Fire After"
-  #define TEST_DIRECTIVE     rtems_timer_server_fire_after
-
-#else
-  #error "Test Mode not defined"
-#endif
-
-const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
-
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
-rtems_timer_service_routine TimerMethod(rtems_id  timer, void *arg);
-
-rtems_id Timer;
-
-rtems_timer_service_routine TimerMethod(
-  rtems_id  timer,
-  void     *arg
-)
-{
-}
-
-rtems_timer_service_routine test_release_from_isr(
-  rtems_id  timer,
-  void     *arg
-)
-{
-  (void) rtems_timer_fire_after( Timer, 10, TimerMethod, NULL );
-}
-
-static bool test_body( void *arg )
-{
-  rtems_status_code sc;
-
-  (void) arg;
-
-  sc = TEST_DIRECTIVE( Timer, 10, TimerMethod, NULL );
-  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
-
-  return false;
-}
-
-rtems_task Init(
-  rtems_task_argument ignored
-)
-{
-  rtems_status_code     sc;
-
-  TEST_BEGIN();
-
-  puts( "Init - Trying to generate timer fire from ISR while firing" );
-  puts( "Init - Variation is: " TEST_STRING );
-
-  puts( "Init - There is no way for the test to know if it hits the case" );
-
-  #if defined(SERVER_FIRE_AFTER)
-   /* initiate timer server */
-    sc = rtems_timer_initiate_server(
-      RTEMS_MINIMUM_PRIORITY,
-      RTEMS_MINIMUM_STACK_SIZE,
-      RTEMS_DEFAULT_ATTRIBUTES
-    );
-    directive_failed( sc, "rtems_timer_initiate_server" );
-  #endif
-
-  puts( "Init - rtems_timer_create - OK" );
-  sc = rtems_timer_create( rtems_build_name( 'P', 'E', 'R', '1' ), &Timer);
-  directive_failed( sc, "rtems_timer_create" );
-
-  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
-
-  TEST_END();
-  rtems_test_exit(0);
-}
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#if defined(SERVER_FIRE_AFTER)
-  #define CONFIGURE_MAXIMUM_TASKS     3
-#else
-  #define CONFIGURE_MAXIMUM_TASKS     2
-#endif
-#define CONFIGURE_MAXIMUM_TIMERS      2
-#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
-#define CONFIGURE_MICROSECONDS_PER_TICK  1000
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-
-#define CONFIGURE_INIT
-#include <rtems/confdefs.h>
-
-/* global variables */
+#define FIRE_AFTER
+#include "spintrcritical13impl.h"
diff --git a/testsuites/sptests/spintrcritical13/spintrcritical13impl.h b/testsuites/sptests/spintrcritical13/spintrcritical13impl.h
new file mode 100644
index 0000000000..e284d3c33d
--- /dev/null
+++ b/testsuites/sptests/spintrcritical13/spintrcritical13impl.h
@@ -0,0 +1,120 @@
+/*
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tmacros.h>
+#include <intrcritical.h>
+
+#if defined(FIRE_AFTER)
+  #define TEST_NAME          "13"
+  #define TEST_STRING        "Timer Fire After"
+  #define TEST_DIRECTIVE     rtems_timer_fire_after
+
+#elif defined(SERVER_FIRE_AFTER)
+  #define TEST_NAME          "14"
+  #define TEST_STRING        "Timer Server Fire After"
+  #define TEST_DIRECTIVE     rtems_timer_server_fire_after
+
+#else
+  #error "Test Mode not defined"
+#endif
+
+const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
+
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
+rtems_timer_service_routine TimerMethod(rtems_id  timer, void *arg);
+
+rtems_id Timer;
+
+rtems_timer_service_routine TimerMethod(
+  rtems_id  timer,
+  void     *arg
+)
+{
+}
+
+rtems_timer_service_routine test_release_from_isr(
+  rtems_id  timer,
+  void     *arg
+)
+{
+  (void) rtems_timer_fire_after( Timer, 10, TimerMethod, NULL );
+}
+
+static bool test_body( void *arg )
+{
+  rtems_status_code sc;
+
+  (void) arg;
+
+  sc = TEST_DIRECTIVE( Timer, 10, TimerMethod, NULL );
+  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+  return false;
+}
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_status_code     sc;
+
+  TEST_BEGIN();
+
+  puts( "Init - Trying to generate timer fire from ISR while firing" );
+  puts( "Init - Variation is: " TEST_STRING );
+
+  puts( "Init - There is no way for the test to know if it hits the case" );
+
+  #if defined(SERVER_FIRE_AFTER)
+   /* initiate timer server */
+    sc = rtems_timer_initiate_server(
+      RTEMS_MINIMUM_PRIORITY,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_ATTRIBUTES
+    );
+    directive_failed( sc, "rtems_timer_initiate_server" );
+  #endif
+
+  puts( "Init - rtems_timer_create - OK" );
+  sc = rtems_timer_create( rtems_build_name( 'P', 'E', 'R', '1' ), &Timer);
+  directive_failed( sc, "rtems_timer_create" );
+
+  interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#if defined(SERVER_FIRE_AFTER)
+  #define CONFIGURE_MAXIMUM_TASKS     3
+#else
+  #define CONFIGURE_MAXIMUM_TASKS     2
+#endif
+#define CONFIGURE_MAXIMUM_TIMERS      2
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_MICROSECONDS_PER_TICK  1000
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* global variables */
diff --git a/testsuites/sptests/spintrcritical14/init.c b/testsuites/sptests/spintrcritical14/init.c
new file mode 100644
index 0000000000..b9c972c371
--- /dev/null
+++ b/testsuites/sptests/spintrcritical14/init.c
@@ -0,0 +1,2 @@
+#define SERVER_FIRE_AFTER
+#include "../spintrcritical13/spintrcritical13impl.h"
-- 
2.16.4



More information about the devel mailing list