diff options
Diffstat (limited to 'testsuites/ada/tmtests/tm06')
-rw-r--r-- | testsuites/ada/tmtests/tm06/Makefile.am | 13 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tm06/config.h | 33 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tm06/tm06.adb | 55 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tm06/tmtest.adb | 202 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tm06/tmtest.ads | 104 |
5 files changed, 407 insertions, 0 deletions
diff --git a/testsuites/ada/tmtests/tm06/Makefile.am b/testsuites/ada/tmtests/tm06/Makefile.am new file mode 100644 index 0000000000..a1e5edfc1c --- /dev/null +++ b/testsuites/ada/tmtests/tm06/Makefile.am @@ -0,0 +1,13 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +noinst_PROGRAMS = ada_tm06 +ada_tm06_SOURCES = tm06.adb config.h tmtest.adb tmtest.ads +ada_tm06_SOURCES += ../../support/init.c + +ada_tm06$(EXEEXT): tm06.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/tmtests/tm06/config.h b/testsuites/ada/tmtests/tm06/config.h new file mode 100644 index 0000000000..b03802dcc5 --- /dev/null +++ b/testsuites/ada/tmtests/tm06/config.h @@ -0,0 +1,33 @@ +/* config.h + * + * This include file defines the Configuration Table for this test. + * + * COPYRIGHT (c) 1989-1997. + * 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_TMTEST + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 111 +#define CONFIGURE_MAXIMUM_TIMERS 110 +#define CONFIGURE_MAXIMUM_SEMAPHORES 101 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/tmtests/tm06/tm06.adb b/testsuites/ada/tmtests/tm06/tm06.adb new file mode 100644 index 0000000000..db064adb4d --- /dev/null +++ b/testsuites/ada/tmtests/tm06/tm06.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test TM06 of the Timing 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 TMTEST; +with TEST_SUPPORT; + +procedure TM06 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, + TMTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end TM06; + diff --git a/testsuites/ada/tmtests/tm06/tmtest.adb b/testsuites/ada/tmtests/tm06/tmtest.adb new file mode 100644 index 0000000000..2f0f8b1a26 --- /dev/null +++ b/testsuites/ada/tmtests/tm06/tmtest.adb @@ -0,0 +1,202 @@ +-- +-- TMTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 6 of the RTEMS +-- Timing 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 RTEMS_CALLING_OVERHEAD; +with TEST_SUPPORT; +with TEXT_IO; +with TIMER_DRIVER; + +package body TMTEST is + +-- +-- 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( "*** TIME TEST 6 ***" ); + + TMTEST.TEST_INIT; + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- TEST_INIT +-- + + procedure TEST_INIT + is + ID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; + begin + + TMTEST.TASK_RESTARTED := TIME_TEST_SUPPORT.OPERATION_COUNT; + + RTEMS.TASKS.CREATE( + RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ), + 128, + 1024, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + RTEMS.TASKS.START( ID, TMTEST.TASK_1'ACCESS, 0, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + end TEST_INIT; + +-- +-- TASK_1 +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + OVERHEAD : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + if TMTEST.TASK_RESTARTED = TIME_TEST_SUPPORT.OPERATION_COUNT then + TIMER_DRIVER.INITIALIZE; + end if; + + TMTEST.TASK_RESTARTED := TMTEST.TASK_RESTARTED - 1; + + if TMTEST.TASK_RESTARTED /= 0 then + RTEMS.TASKS.RESTART( RTEMS.SELF, 0, STATUS ); + end if; + + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + + TIMER_DRIVER.INITIALIZE; + for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT + loop + TIMER_DRIVER.EMPTY_FUNCTION; + end loop; + OVERHEAD := TIMER_DRIVER.READ_TIMER; + + TIME_TEST_SUPPORT.PUT_TIME( + "TASK_RESTART self", + TMTEST.END_TIME, + TIME_TEST_SUPPORT.OPERATION_COUNT, + 0, + RTEMS_CALLING_OVERHEAD.TASK_RESTART + ); + + for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT + loop + + RTEMS.TASKS.CREATE( + RTEMS.BUILD_NAME( 'T', 'I', 'M', 'E' ), + 254, + 1024, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + TMTEST.TASK_ID( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE LOOP" ); + + RTEMS.TASKS.START( + TMTEST.TASK_ID( INDEX ), + TMTEST.NULL_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START LOOP" ); + + end loop; + + TIMER_DRIVER.INITIALIZE; + for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT + loop + RTEMS.TASKS.SUSPEND( TMTEST.TASK_ID( INDEX ), STATUS ); + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "TASK_SUSPEND no preempt", + TMTEST.END_TIME, + TIME_TEST_SUPPORT.OPERATION_COUNT, + OVERHEAD, + RTEMS_CALLING_OVERHEAD.TASK_SUSPEND + ); + + TIMER_DRIVER.INITIALIZE; + for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT + loop + RTEMS.TASKS.RESUME( TMTEST.TASK_ID( INDEX ), STATUS ); + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "TASK_RESUME no preempt", + TMTEST.END_TIME, + TIME_TEST_SUPPORT.OPERATION_COUNT, + OVERHEAD, + RTEMS_CALLING_OVERHEAD.TASK_RESUME + ); + + TIMER_DRIVER.INITIALIZE; + for INDEX in 1 .. TIME_TEST_SUPPORT.OPERATION_COUNT + loop + RTEMS.TASKS.DELETE( TMTEST.TASK_ID( INDEX ), STATUS ); + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "TASK_DELETE others", + TMTEST.END_TIME, + TIME_TEST_SUPPORT.OPERATION_COUNT, + OVERHEAD, + RTEMS_CALLING_OVERHEAD.TASK_DELETE + ); + + TEXT_IO.PUT_LINE( "*** END OF TIME TEST 6 ***" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TASK_1; + +-- +-- NULL_TASK +-- + + procedure NULL_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + begin + + NULL; + + end NULL_TASK; + +end TMTEST; diff --git a/testsuites/ada/tmtests/tm06/tmtest.ads b/testsuites/ada/tmtests/tm06/tmtest.ads new file mode 100644 index 0000000000..a6eb2b2df8 --- /dev/null +++ b/testsuites/ada/tmtests/tm06/tmtest.ads @@ -0,0 +1,104 @@ +-- +-- TMTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 6 of the RTEMS +-- Timing 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 TIME_TEST_SUPPORT; +with RTEMS; +with RTEMS.TASKS; + +package TMTEST is + +-- +-- This array contains the IDs of all RTEMS tasks created by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 + range 0 .. TIME_TEST_SUPPORT.OPERATION_COUNT ) of RTEMS.ID; + +-- +-- This variable is used to determine which restart of TASK_1 will start +-- timer and which will stop the timer and report the execution time. +-- + + TASK_RESTARTED : RTEMS.UNSIGNED32; + +-- +-- The following variable is set to the execution time returned +-- by the timer. +-- + + END_TIME : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TEST_INIT +-- +-- DESCRIPTION: +-- +-- This subprogram performs test initialization. +-- + + procedure TEST_INIT; + +-- +-- TASK_1 +-- +-- DESCRIPTION: +-- +-- This RTEMS task is responsible for measuring and reporting the +-- following directive execution times: +-- +-- + TASK_RESTART of SELF +-- + TASK_SUSPEND of another task with no context switch +-- + TASK_RESUME with no preemption +-- + TASK_DELETE of another task +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_1); + +-- +-- NULL_TASK +-- +-- DESCRIPTION: +-- +-- This RTEMS task has no operations. It is used to have +-- tasks to perform directives upon. +-- + + procedure NULL_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, NULL_TASK); + +end TMTEST; |