diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-12 10:00:10 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-12 10:53:16 +0200 |
commit | ee537ea3dd964d4de3565a36b4857af31fb5a3f4 (patch) | |
tree | ad8b328a58469ca0632e3e61cd94f37c9d97cc25 /testsuites/ada/sptests/sp07 | |
parent | ada-tests: Use _SUBDIRS instead of SUBDIRS (diff) | |
download | rtems-ee537ea3dd964d4de3565a36b4857af31fb5a3f4.tar.bz2 |
ada-tests: Move to testsuites/ada
This solves a build dependency issue, e.g. building tests before
librtemsbsp.a exists.
Close #3079.
Diffstat (limited to 'testsuites/ada/sptests/sp07')
-rw-r--r-- | testsuites/ada/sptests/sp07/Makefile.am | 17 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp07/ada_sp07.scn | 23 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp07/config.h | 33 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp07/sp07.adb | 55 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp07/sptest.adb | 513 | ||||
-rw-r--r-- | testsuites/ada/sptests/sp07/sptest.ads | 194 |
6 files changed, 835 insertions, 0 deletions
diff --git a/testsuites/ada/sptests/sp07/Makefile.am b/testsuites/ada/sptests/sp07/Makefile.am new file mode 100644 index 0000000000..076b97d64c --- /dev/null +++ b/testsuites/ada/sptests/sp07/Makefile.am @@ -0,0 +1,17 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +noinst_PROGRAMS = ada_sp07 + +ada_sp07_SOURCES = sp07.adb config.h sptest.adb sptest.ads +ada_sp07_SOURCES += ../../support/init.c + +ada_sp07$(EXEEXT): sp07.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_sp07.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/sptests/sp07/ada_sp07.scn b/testsuites/ada/sptests/sp07/ada_sp07.scn new file mode 100644 index 0000000000..9748dda74c --- /dev/null +++ b/testsuites/ada/sptests/sp07/ada_sp07.scn @@ -0,0 +1,23 @@ +*** TEST 7 *** +TASKS_CREATE - TA1 - created. +TASKS_CREATE - TA2 - created. +TASKS_CREATE - TA3 - created. +TASKS_CREATE - TA4 - created. +TASKS_START - TA1 - started. +TASKS_START - TA2 - started. +TASKS_START - TA3 - started. +TASKS_START - TA4 - started. +TASKS_RESTART - TA3 - restarted. +<pause> +TA1 - task_set_priority - get initial priority of self: 4 +TA1 - task_set_priority - set TA2's priority: 3 +TA2 - task_set_priority - set TA1's priority: 2 +TA1 - task_set_priority - set TA2's priority: 1 +TA2 - task_suspend - suspend TA1 +TA2 - task_set_priority - set priority of TA1 ( blocked ) +TASKS_DELETE - TA2 deleting TA1 +TASKS_DELETE - TA2 deleting TA3 +TASKS_DELETE - TA2 deleting TA2 +TA4 - exitting task +TASK_EXITTED - user extension invoked correctly +*** END OF TEST 7 *** diff --git a/testsuites/ada/sptests/sp07/config.h b/testsuites/ada/sptests/sp07/config.h new file mode 100644 index 0000000000..2aa307a46c --- /dev/null +++ b/testsuites/ada/sptests/sp07/config.h @@ -0,0 +1,33 @@ +/* config.h + * + * This include file defines the Configuration Table for this test. + * + * COPYRIGHT (c) 1989-2007. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#define CONFIGURE_MAXIMUM_TASKS 5 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/sptests/sp07/sp07.adb b/testsuites/ada/sptests/sp07/sp07.adb new file mode 100644 index 0000000000..177de946b8 --- /dev/null +++ b/testsuites/ada/sptests/sp07/sp07.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test SP07 of the Single Processor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with RTEMS; +with RTEMS.TASKS; +with SPTEST; +with TEST_SUPPORT; + +procedure SP07 is + INIT_ID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; +begin + + RTEMS.TASKS.CREATE( + RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ), + 1, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.NO_PREEMPT, + RTEMS.DEFAULT_ATTRIBUTES, + INIT_ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" ); + + + RTEMS.TASKS.START( + INIT_ID, + SPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end SP07; + diff --git a/testsuites/ada/sptests/sp07/sptest.adb b/testsuites/ada/sptests/sp07/sptest.adb new file mode 100644 index 0000000000..d55aa73bf8 --- /dev/null +++ b/testsuites/ada/sptests/sp07/sptest.adb @@ -0,0 +1,513 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 7 of the RTEMS +-- Single Processor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with INTERFACES; use INTERFACES; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; +with RTEMS.EXTENSION; +with RTEMS.FATAL; + +package body SPTEST is + + type Task_Event_Type is ( + Created, + Deleted, + Restarted, + Started + ); + + type Task_Event is record + The_Event : Task_Event_Type; + Task1 : RTEMS.Unsigned32; + Task2 : RTEMS.Unsigned32; + end record; + + Task_Events : array (1 .. 10) of Task_Event; + Task_Events_Index : Natural := Task_Events'First; + + procedure Log_Task_Event ( + The_Event : in Task_Event_Type; + Task1 : in RTEMS.Unsigned32; + Task2 : in RTEMS.Unsigned32 + ) is + begin + if Task_Events_Index = Task_Events'Last then + RTEMS.Fatal.Error_Occurred ( 1 ); -- no other choice + else + Task_Events (Task_Events_Index).The_Event := The_Event; + Task_Events (Task_Events_Index).Task1 := Task1; + Task_Events (Task_Events_Index).Task2 := Task2; + Task_Events_Index := Task_Events_Index + 1; + end if; + end Log_Task_Event; + + procedure Flush_Task_Event_Log is + begin + for I in Task_Events'First .. Task_Events_Index - 1 loop + + case Task_Events (I).The_Event is + + when Created => + TEXT_IO.PUT( "TASKS_CREATE - " ); + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( Task_Events (I).Task1 ), + FALSE + ); + TEXT_IO.PUT_LINE( " - created." ); + + when Deleted => + TEXT_IO.PUT( "TASKS_DELETE - " ); + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( Task_Events (I).Task1 ), + FALSE + ); + + TEXT_IO.PUT( " deleting " ); + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( Task_Events (I).Task2 ), + TRUE + ); + + when Restarted => + TEXT_IO.PUT( "TASKS_RESTART - " ); + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( Task_Events (I).Task1 ), + FALSE + ); + TEXT_IO.PUT_LINE( " - restarted." ); + + when Started => + TEXT_IO.PUT( "TASKS_START - " ); + TEST_SUPPORT.PUT_NAME( + SPTEST.TASK_NAME( Task_Events (I).Task1 ), + FALSE + ); + TEXT_IO.PUT_LINE( " - started." ); + + end case; + end loop; + + -- Reset the events list + Task_Events_Index := Task_Events'First; + + end Flush_Task_Event_Log; + +-- +-- TCB_To_ID +-- + + function TCB_To_ID ( + TCB : RTEMS.TCB_POINTER + ) return RTEMS.ID; + pragma Import (C, TCB_To_ID, "tcb_to_id" ); + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** TEST 7 ***" ); + + SPTEST.EXTENSION_NAME( 1 ) := RTEMS.BUILD_NAME( 'E', 'X', 'T', ' ' ); + + RTEMS.EXTENSION.CREATE( + SPTEST.EXTENSION_NAME( 1 ), + SPTEST.EXTENSIONS'ACCESS, + EXTENSION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EXTENSION_CREATE" ); + + SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + SPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' ); + SPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'T', 'A', '3', ' ' ); + SPTEST.TASK_NAME( 4 ) := RTEMS.BUILD_NAME( 'T', 'A', '4', ' ' ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 1 ), + 4, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 2 ), + 4, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 3 ), + 250, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 3 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 4 ), + 254, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 4 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA4" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 1 ), + SPTEST.TASK_1'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 2 ), + SPTEST.TASK_2'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 3 ), + SPTEST.TASK_3'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 4 ), + SPTEST.TASK_4'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA4" ); + + RTEMS.TASKS.RESTART( SPTEST.TASK_ID( 3 ), 0, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF TA3" ); + + Flush_Task_Event_Log; + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- TASK_1 +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + STATUS : RTEMS.STATUS_CODES; + THE_PRIORITY : RTEMS.TASKS.PRIORITY; + PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY; + begin + + TEST_SUPPORT.PAUSE; + + RTEMS.TASKS.SET_PRIORITY( + RTEMS.SELF, + RTEMS.TASKS.CURRENT_PRIORITY, + THE_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + TEXT_IO.PUT( "TA1 - task_set_priority - "); + TEXT_IO.PUT( "get initial priority of self: "); + UNSIGNED32_IO.PUT( THE_PRIORITY, BASE => 10, WIDTH => 2 ); + TEXT_IO.NEW_LINE; + + loop + + THE_PRIORITY := THE_PRIORITY - 1; + + if THE_PRIORITY = 0 then + TEXT_IO.PUT_LINE( "TA1 - task_suspend - suspend TA2" ); + RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 2 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" ); + + TEXT_IO.PUT( "TA1 - task_set_priority - "); + TEXT_IO.PUT_LINE( "set priority of TA2 ( blocked )"); + RTEMS.TASKS.SET_PRIORITY( + SPTEST.TASK_ID( 2 ), + 5, + PREVIOUS_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + RTEMS.TASKS.DELETE( SPTEST.TASK_ID( 2 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end if; + + TEXT_IO.PUT("TA1 - task_set_priority - set TA2's priority: "); + UNSIGNED32_IO.PUT( THE_PRIORITY, BASE => 10, WIDTH => 2 ); + TEXT_IO.NEW_LINE; + RTEMS.TASKS.SET_PRIORITY( + SPTEST.TASK_ID( 2 ), + THE_PRIORITY, + PREVIOUS_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + end loop; + + end TASK_1; + +-- +-- TASK_2 +-- + + procedure TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + STATUS : RTEMS.STATUS_CODES; + THE_PRIORITY : RTEMS.TASKS.PRIORITY; + PREVIOUS_PRIORITY : RTEMS.TASKS.PRIORITY; + begin + + loop + + THE_PRIORITY := THE_PRIORITY - 1; + + if THE_PRIORITY = 0 then + TEXT_IO.PUT_LINE( "TA2 - task_suspend - suspend TA1" ); + RTEMS.TASKS.SUSPEND( SPTEST.TASK_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" ); + + TEXT_IO.PUT( "TA2 - task_set_priority - "); + TEXT_IO.PUT_LINE( "set priority of TA1 ( blocked )"); + RTEMS.TASKS.SET_PRIORITY( + SPTEST.TASK_ID( 1 ), + 5, + PREVIOUS_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + RTEMS.TASKS.DELETE( + SPTEST.TASK_ID( 1 ), + STATUS + ); -- TA1 is blocked + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA1" ); + + RTEMS.TASKS.DELETE( + SPTEST.TASK_ID( 3 ), + STATUS + ); -- TA3 is ready + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA3" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + else + + TEXT_IO.PUT( "TA2 - task_set_priority - "); + TEXT_IO.PUT( "set TA1's priority: "); + UNSIGNED32_IO.PUT( THE_PRIORITY, BASE => 10, WIDTH => 2); + TEXT_IO.NEW_LINE; + RTEMS.TASKS.SET_PRIORITY( + SPTEST.TASK_ID( 1 ), + THE_PRIORITY, + PREVIOUS_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + end if; + + end loop; + + end TASK_2; + +-- +-- TASK_3 +-- + + procedure TASK_3 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + STATUS : RTEMS.STATUS_CODES; + begin + + loop + + RTEMS.TASKS.WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end loop; + + end TASK_3; + +-- +-- TASK_4 +-- + + procedure TASK_4 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + begin + + Flush_Task_Event_Log; + + TEXT_IO.PUT_LINE( "TA4 - exitting task" ); + + end TASK_4; + +-- +-- TASK_EXIT_EXTENSION +-- + + procedure TASK_EXIT_EXTENSION ( + RUNNING_TASK : in RTEMS.TCB_POINTER + ) is + begin + + if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RUNNING_TASK ) ) > 0 then + TEXT_IO.PUT_LINE( "TASK_EXITTED - user extension invoked correctly" ); + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 7 ***" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TASK_EXIT_EXTENSION; + +-- +-- TASK_CREATE_EXTENSION +-- + + function TASK_CREATE_EXTENSION ( + UNUSED : in RTEMS.TCB_POINTER; + CREATED_TASK : in RTEMS.TCB_POINTER + ) return RTEMS.Boolean is + pragma Unreferenced(UNUSED); + begin + + if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( CREATED_TASK ) ) > 0 then + Log_Task_Event ( + Created, + TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( CREATED_TASK ) ), + 0 + ); + end if; + + return RTEMS.True; + + end TASK_CREATE_EXTENSION; + +-- +-- TASK_DELETE_EXTENSION +-- + + procedure TASK_DELETE_EXTENSION ( + RUNNING_TASK : in RTEMS.TCB_POINTER; + DELETED_TASK : in RTEMS.TCB_POINTER + ) is + begin + + if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RUNNING_TASK ) ) > 0 and + TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( DELETED_TASK ) ) > 0 then + Log_Task_Event ( + Deleted, + TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RUNNING_TASK ) ), + TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( DELETED_TASK ) ) + ); + end if; + + end TASK_DELETE_EXTENSION; + +-- +-- TASK_RESTART_EXTENSION +-- + + procedure TASK_RESTART_EXTENSION ( + UNUSED : in RTEMS.TCB_POINTER; + RESTARTED_TASK : in RTEMS.TCB_POINTER + ) is + pragma Unreferenced(UNUSED); + begin + + if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RESTARTED_TASK ) ) > 0 then + Log_Task_Event ( + Restarted, + TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( RESTARTED_TASK ) ), + 0 + ); + end if; + + end TASK_RESTART_EXTENSION; + +-- +-- TASK_START_EXTENSION +-- + + procedure TASK_START_EXTENSION ( + UNUSED : in RTEMS.TCB_POINTER; + STARTED_TASK : in RTEMS.TCB_POINTER + ) is + pragma Unreferenced(UNUSED); + begin + + if TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( STARTED_TASK ) ) > 0 then + Log_Task_Event ( + Started, + TEST_SUPPORT.TASK_NUMBER( TCB_To_ID( STARTED_TASK ) ), + 0 + ); + end if; + + end TASK_START_EXTENSION; + +end SPTEST; diff --git a/testsuites/ada/sptests/sp07/sptest.ads b/testsuites/ada/sptests/sp07/sptest.ads new file mode 100644 index 0000000000..3984c64ee1 --- /dev/null +++ b/testsuites/ada/sptests/sp07/sptest.ads @@ -0,0 +1,194 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 7 of the RTEMS +-- Single Processor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with RTEMS; +with RTEMS.TASKS; + +package SPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS extensions created +-- by this test. +-- + + EXTENSION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + EXTENSION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TASK_1 +-- +-- DESCRIPTION: +-- +-- This RTEMS task tests some of the capabilities of the Task Manager. +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_1); + +-- +-- TASK_2 +-- +-- DESCRIPTION: +-- +-- This RTEMS task tests some of the capabilities of the Task Manager. +-- + + procedure TASK_2 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_2); + +-- +-- TASK_3 +-- +-- DESCRIPTION: +-- +-- This RTEMS task tests some of the capabilities of the Task Manager. +-- + + procedure TASK_3 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_3); + +-- +-- TASK_4 +-- +-- DESCRIPTION: +-- +-- This RTEMS task tests the Message Queue Manager. +-- + + procedure TASK_4 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_4); + +-- +-- TASK_CREATE_EXTENSION +-- +-- DESCRIPTION: +-- +-- This subprogram is the TASK_CREATE extension for this test. +-- + + function TASK_CREATE_EXTENSION ( + UNUSED : in RTEMS.TCB_POINTER; + CREATED_TASK : in RTEMS.TCB_POINTER + ) return RTEMS.Boolean; + pragma Convention (C, TASK_CREATE_EXTENSION); + +-- +-- TASK_DELETE_EXTENSION +-- +-- DESCRIPTION: +-- +-- This subprogram is the TASK_DELETE extension for this test. +-- + + procedure TASK_DELETE_EXTENSION ( + RUNNING_TASK : in RTEMS.TCB_POINTER; + DELETED_TASK : in RTEMS.TCB_POINTER + ); + pragma Convention (C, TASK_DELETE_EXTENSION); + +-- +-- TASK_RESTART_EXTENSION +-- +-- DESCRIPTION: +-- +-- This subprogram is the TASK_RESTART extension for this test. +-- + + procedure TASK_RESTART_EXTENSION ( + UNUSED : in RTEMS.TCB_POINTER; + RESTARTED_TASK : in RTEMS.TCB_POINTER + ); + pragma Convention (C, TASK_RESTART_EXTENSION); + +-- +-- TASK_START_EXTENSION +-- +-- DESCRIPTION: +-- +-- This subprogram is the TASK_START extension for this test. +-- + + procedure TASK_START_EXTENSION ( + UNUSED : in RTEMS.TCB_POINTER; + STARTED_TASK : in RTEMS.TCB_POINTER + ); + pragma Convention (C, TASK_START_EXTENSION); + +-- +-- TASK_EXIT_EXTENSION +-- +-- DESCRIPTION: +-- +-- This subprogram is the TASK_EXIT extension for this test. +-- It is invoked when a RTEMS task exits from its entry point. +-- + + procedure TASK_EXIT_EXTENSION ( + RUNNING_TASK : in RTEMS.TCB_POINTER + ); + pragma Convention (C, TASK_EXIT_EXTENSION); + +-- +-- This is the User Extension Table for this test. +-- + + EXTENSIONS : aliased RTEMS.EXTENSIONS_TABLE := + ( + SPTEST.TASK_CREATE_EXTENSION'ACCESS, -- Task create + SPTEST.TASK_START_EXTENSION'ACCESS, -- Task start + SPTEST.TASK_RESTART_EXTENSION'ACCESS, -- Task restart + SPTEST.TASK_DELETE_EXTENSION'ACCESS, -- Task delete + NULL, -- Task switch + NULL, -- Task post switch + NULL, -- Task begin + SPTEST.TASK_EXIT_EXTENSION'ACCESS, -- Task exitted + NULL -- Fatal error + ); + +end SPTEST; |