Index: testsuites/sptests/ChangeLog
===================================================================
--- testsuites/sptests/ChangeLog	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/ChangeLog	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -1,2 +1,14 @@
+2008-12-14	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* sp07/init.c, sp12/init.c, sp12/pridrv.c, sp12/pritask.c,
+	sp12/system.h, sp16/system.h, sp25/system.h, sp26/task1.c,
+	sp28/init.c, sp29/init.c, sp35/priinv.c, sp42/init.c: Run all tests
+	successfully with maxixum number of priorities as 16 instead of 256.
+	This was done by temporarily modifying the score priority.h maximum.
+	This allowed testing of all API code to ensure that it worked
+	properly with a reduced number of priorities. Most modifications were
+	to switch from hard-coded maximum to using the API provided methods
+	to determine maximum number of priority levels.
+
 2008-12-04	Joel Sherrill <joel.sherrill@oarcorp.com>
 
Index: testsuites/sptests/sp07/init.c
===================================================================
--- testsuites/sptests/sp07/init.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp07/init.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -12,5 +12,5 @@
  *  Output parameters:  NONE
  *
- *  COPYRIGHT (c) 1989-2007.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -133,7 +133,8 @@
   directive_failed( status, "rtems_task_create of TA2" );
 
+#define TA3_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 4)
   status = rtems_task_create(
     Task_name[ 3 ],
-    250,
+    TA3_PRIORITY,
     RTEMS_MINIMUM_STACK_SIZE * 2,
     RTEMS_DEFAULT_MODES,
@@ -143,7 +144,8 @@
   directive_failed( status, "rtems_task_create of TA3" );
 
+#define TA4_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1)
   status = rtems_task_create(
     Task_name[ 4 ],
-    254,
+    TA4_PRIORITY,
     RTEMS_MINIMUM_STACK_SIZE * 2,
     RTEMS_DEFAULT_MODES,
Index: testsuites/sptests/sp12/init.c
===================================================================
--- testsuites/sptests/sp12/init.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp12/init.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -12,5 +12,5 @@
  *  Output parameters:  NONE
  *
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -80,5 +80,5 @@
 
   puts( "INIT - Backward priority queue test" );
-  Priority_test_driver( 32 );
+  Priority_test_driver( (RTEMS_MAXIMUM_PRIORITY / 2) + 1 );
 
 rtems_test_pause();
@@ -87,5 +87,5 @@
 
   status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
-  directive_failed( status, "rtems_semaphore_delete of SM2" );
+  directive_failed( status, "rtems_semaphore_delete of SM2 #1" );
 
   puts( "INIT - rtems_semaphore_create - allocated binary semaphore" );
@@ -105,5 +105,5 @@
   puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" );
   status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
-  directive_failed( status, "rtems_semaphore_delete of SM2" );
+  directive_failed( status, "rtems_semaphore_delete of SM2 #2" );
 
   status = rtems_semaphore_create(
@@ -116,10 +116,10 @@
   directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
 
-  Priority_test_driver( 64 );
+  Priority_test_driver( PRIORITY_INHERIT_BASE_PRIORITY );
 
 rtems_test_pause();
 
   status = rtems_semaphore_delete( Semaphore_id[ 2 ] );
-  directive_failed( status, "rtems_semaphore_delete of SM2" );
+  directive_failed( status, "rtems_semaphore_delete of SM2 #3" );
 
   status = rtems_semaphore_create(
Index: testsuites/sptests/sp12/pridrv.c
===================================================================
--- testsuites/sptests/sp12/pridrv.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp12/pridrv.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -12,5 +12,5 @@
  *  Output parameters:  NONE
  *
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -29,5 +29,5 @@
 {
   rtems_task_priority previous_priority;
-  uint32_t      index;
+  uint32_t            index;
   rtems_status_code   status;
 
@@ -77,5 +77,5 @@
       directive_failed( status, "rtems_task_wake_after loop" );
 
-      if ( priority_base == 64 ) {
+      if ( priority_base == PRIORITY_INHERIT_BASE_PRIORITY ) {
         if ( index == 4 ) {
           status = rtems_task_set_priority(
@@ -111,5 +111,5 @@
   }
 
-  if ( priority_base == 64 ) {
+  if ( priority_base == PRIORITY_INHERIT_BASE_PRIORITY ) {
     puts( "PDRV - rtems_task_resume - PRI5" );
     status = rtems_task_resume( Priority_task_id[ 5 ] );
Index: testsuites/sptests/sp12/pritask.c
===================================================================
--- testsuites/sptests/sp12/pritask.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp12/pritask.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -8,5 +8,5 @@
  *  Output parameters:  NONE
  *
- *  COPYRIGHT (c) 1989-2007.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -47,5 +47,5 @@
   directive_failed( status, "rtems_semaphore_obtain of SM2" );
 
-  if ( its_priority < 64 ) {
+  if ( its_priority < PRIORITY_INHERIT_BASE_PRIORITY ) {
     printf( "PRI%d - WHY AM I HERE? (pri=%d)", its_index, its_priority );
     rtems_test_exit( 0 );
Index: testsuites/sptests/sp12/system.h
===================================================================
--- testsuites/sptests/sp12/system.h	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp12/system.h	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -4,5 +4,5 @@
  *  function in the test set.
  *
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -15,4 +15,6 @@
 
 #include <tmacros.h>
+
+#define PRIORITY_INHERIT_BASE_PRIORITY 5
 
 /* functions */
Index: testsuites/sptests/sp16/system.h
===================================================================
--- testsuites/sptests/sp16/system.h	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp16/system.h	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -4,5 +4,5 @@
  *  function in the test set.
  *
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -69,5 +69,5 @@
 TEST_EXTERN uint8_t   Area_4[8192] CPU_STRUCTURE_ALIGNMENT;
 
-#define BASE_PRIORITY 140
+#define BASE_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2) + 1)
 
 #define Put_address_from_area_1( _to_be_printed ) \
Index: testsuites/sptests/sp25/system.h
===================================================================
--- testsuites/sptests/sp25/system.h	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp25/system.h	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -4,5 +4,5 @@
  *  function in the test set.
  *
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -53,5 +53,5 @@
 #endif
 
-#define BASE_PRIORITY 140
+#define BASE_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2) + 1)
 
 #define Put_address_from_area_1( _to_be_printed ) \
Index: testsuites/sptests/sp26/task1.c
===================================================================
--- testsuites/sptests/sp26/task1.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp26/task1.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -1,4 +1,4 @@
 /*
- *  COPYRIGHT (c) 1989-1999.
+ *  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -86,5 +86,5 @@
 
   sc = rtems_task_create (rtems_build_name('S','u','b',c),
-    100,
+    RTEMS_MAXIMUM_PRIORITY - 1,
     RTEMS_MINIMUM_STACK_SIZE * 4,
     RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
Index: testsuites/sptests/sp28/init.c
===================================================================
--- testsuites/sptests/sp28/init.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp28/init.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -97,5 +97,5 @@
 
   sc = rtems_task_create(rtems_build_name ('S', 'R', 'V', arg + 'A'),
-    100,
+    RTEMS_MAXIMUM_PRIORITY - 1,
     RTEMS_MINIMUM_STACK_SIZE,
     RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
@@ -281,5 +281,5 @@
 
   sc = rtems_task_create(rtems_build_name ('O', 'T', 'H', 'R'),
-    100,
+    RTEMS_MAXIMUM_PRIORITY - 1,
     RTEMS_MINIMUM_STACK_SIZE,
     RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
@@ -328,5 +328,5 @@
 
   sc = rtems_task_create(rtems_build_name ('O', 'T', 'H', 'R'),
-    100,
+    RTEMS_MAXIMUM_PRIORITY - 1,
     RTEMS_MINIMUM_STACK_SIZE,
     RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
Index: testsuites/sptests/sp29/init.c
===================================================================
--- testsuites/sptests/sp29/init.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp29/init.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -50,5 +50,5 @@
 
 	sc = rtems_task_create (rtems_build_name ('S', 'R', 'V', 'A'),
-		100,
+		RTEMS_MAXIMUM_PRIORITY - 1,
 		RTEMS_MINIMUM_STACK_SIZE * 2,
 		RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
Index: testsuites/sptests/sp35/priinv.c
===================================================================
--- testsuites/sptests/sp35/priinv.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp35/priinv.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -411,7 +411,8 @@
   /* -- Medium-prio Test Tasks --- */
   for (i = 0; i < NofMediumTask_C; i++) {
+#define MEDIUM_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2) + 1)
     status = rtems_task_create(
       rtems_build_name('M','E','D','0'+i),               /* Name */
-      100,                                               /* Priority */
+      MEDIUM_PRIORITY,                                   /* Priority */
       RTEMS_MINIMUM_STACK_SIZE*2,                        /* Stack size (8KB) */
       RTEMS_DEFAULT_MODES | RTEMS_NO_ASR,                /* Mode */
@@ -426,7 +427,8 @@
 
   /* -- High-prio Test Task --- */
+#define HIGH_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2))
   status = rtems_task_create(
     rtems_build_name('H','I','G','H'),                 /* Name */
-    10,                                                /* Priority */
+    HIGH_PRIORITY,                                     /* Priority */
     RTEMS_MINIMUM_STACK_SIZE*2,                        /* Stack size (8KB) */
     RTEMS_DEFAULT_MODES | RTEMS_NO_ASR,                /* Mode */
@@ -440,7 +442,8 @@
 
   /* -- Low-prio Test Task --- */
+#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1)
   status = rtems_task_create(
     rtems_build_name('L','O','W',' '),                 /* Name */
-    200,                                               /* Priority */
+    LOW_PRIORITY,                                      /* Priority */
     RTEMS_MINIMUM_STACK_SIZE*2,                        /* Stack size (8KB) */
     RTEMS_DEFAULT_MODES | RTEMS_NO_ASR,                /* Mode */
@@ -454,7 +457,8 @@
 
   /* -- HW Simulator Task --- */
+#define HWTASK_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 2)
   status = rtems_task_create(
     rtems_build_name('H','W','S','M'),                 /* Name */
-    240,                                               /* Priority */
+    HWTASK_PRIORITY,                                   /* Priority */
     RTEMS_MINIMUM_STACK_SIZE*2,                        /* Stack size (8KB) */
     RTEMS_DEFAULT_MODES | RTEMS_NO_ASR,                /* Mode */
Index: testsuites/sptests/sp42/init.c
===================================================================
--- testsuites/sptests/sp42/init.c	(revision a6608123c0952979821bbfe4bf58713403c2f9cb)
+++ testsuites/sptests/sp42/init.c	(revision a986c0757ad4c5f843502bcea0a5e7211368444e)
@@ -26,4 +26,5 @@
  * behavior won't be the same when released.
  */
+#if (RTEMS_MAXIMUM_PRIORITY >= 64)
 rtems_task_priority Priorities[MAX_TASKS] = {
   37, 37, 37, 37,       /* backward - more 2-n */
@@ -34,4 +35,14 @@
   34, 34, 34, 34,       /* backward - multple on 2-n chain */
 };
+#else
+rtems_task_priority Priorities[MAX_TASKS] = {
+  13, 13, 13, 13,       /* backward - more 2-n */
+  2, 2, 2, 2,           /* forward - multiple are on 2-n chain */
+  4, 3,                 /* forward - search forward arbitrary */
+  3, 3, 3, 3,           /* forward - more 2-n */
+  14, 13,               /* backward - search backward arbitrary */
+  12, 12, 12, 12,       /* backward - multple on 2-n chain */
+};
+#endif
 
 
