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/support | |
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/support')
-rw-r--r-- | testsuites/ada/support/Makefile.am | 18 | ||||
-rw-r--r-- | testsuites/ada/support/address_io.adb | 43 | ||||
-rw-r--r-- | testsuites/ada/support/address_io.ads | 32 | ||||
-rw-r--r-- | testsuites/ada/support/float_io.ads | 24 | ||||
-rw-r--r-- | testsuites/ada/support/fp.inc | 151 | ||||
-rw-r--r-- | testsuites/ada/support/init.c | 82 | ||||
-rw-r--r-- | testsuites/ada/support/integer.inc | 142 | ||||
-rw-r--r-- | testsuites/ada/support/rtems_calling_overhead.ads | 102 | ||||
-rw-r--r-- | testsuites/ada/support/status_io.ads | 25 | ||||
-rw-r--r-- | testsuites/ada/support/test_support.adb | 266 | ||||
-rw-r--r-- | testsuites/ada/support/test_support.ads | 195 | ||||
-rw-r--r-- | testsuites/ada/support/time_test_support.adb | 73 | ||||
-rw-r--r-- | testsuites/ada/support/time_test_support.ads | 51 | ||||
-rw-r--r-- | testsuites/ada/support/timer_driver.adb | 59 | ||||
-rw-r--r-- | testsuites/ada/support/timer_driver.ads | 77 | ||||
-rw-r--r-- | testsuites/ada/support/unsigned32_io.ads | 25 |
16 files changed, 1365 insertions, 0 deletions
diff --git a/testsuites/ada/support/Makefile.am b/testsuites/ada/support/Makefile.am new file mode 100644 index 0000000000..2bd719349f --- /dev/null +++ b/testsuites/ada/support/Makefile.am @@ -0,0 +1,18 @@ +EXTRA_DIST = +EXTRA_DIST += address_io.adb +EXTRA_DIST += address_io.ads +EXTRA_DIST += float_io.ads +EXTRA_DIST += fp.inc +EXTRA_DIST += init.c +EXTRA_DIST += integer.inc +EXTRA_DIST += rtems_calling_overhead.ads +EXTRA_DIST += status_io.ads +EXTRA_DIST += test_support.adb +EXTRA_DIST += test_support.ads +EXTRA_DIST += time_test_support.adb +EXTRA_DIST += time_test_support.ads +EXTRA_DIST += timer_driver.adb +EXTRA_DIST += timer_driver.ads +EXTRA_DIST += unsigned32_io.ads + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/support/address_io.adb b/testsuites/ada/support/address_io.adb new file mode 100644 index 0000000000..f549f57ffe --- /dev/null +++ b/testsuites/ada/support/address_io.adb @@ -0,0 +1,43 @@ +-- +-- Address_IO / Specification +-- +-- DESCRIPTION: +-- +-- This package instantiates the IO routines necessary to +-- perform IO on data of the type System.Address. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2009. +-- 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 System.Storage_Elements; +with Text_IO; + +package body Address_IO is + + procedure Put ( + Item : in System.Address; + Width : in Natural := 8; + Base : in Natural := 16 + ) is + package Integer_IO is new TEXT_IO.Integer_IO( Integer ); + begin + + Integer_IO.Put( + Integer( System.Storage_Elements.To_Integer( Item ) ), + Width, + Base + ); + + end Put; + +end Address_IO; + diff --git a/testsuites/ada/support/address_io.ads b/testsuites/ada/support/address_io.ads new file mode 100644 index 0000000000..8a4fce98d3 --- /dev/null +++ b/testsuites/ada/support/address_io.ads @@ -0,0 +1,32 @@ +-- +-- ADDRESS_IO / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package instantiates the IO routines necessary to +-- perform IO on data of the type System.Address. +-- +-- DEPENDENCIES: +-- +-- +-- +-- 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. +-- + +with System; + +package Address_IO is + + procedure Put ( + Item : in System.Address; + Width : in Natural := 8; + Base : in Natural := 16 + ); + +end Address_IO; + diff --git a/testsuites/ada/support/float_io.ads b/testsuites/ada/support/float_io.ads new file mode 100644 index 0000000000..5e1a90bf92 --- /dev/null +++ b/testsuites/ada/support/float_io.ads @@ -0,0 +1,24 @@ +-- +-- Float_IO / Specification +-- +-- Description: +-- +-- This package instantiates the IO routines necessary to +-- perform IO on data of the type Float. +-- +-- Dependencies: +-- +-- +-- +-- 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. +-- + +with Text_IO; + +package Float_IO is new Text_IO.Float_IO( Float ); + diff --git a/testsuites/ada/support/fp.inc b/testsuites/ada/support/fp.inc new file mode 100644 index 0000000000..eb6f5528a9 --- /dev/null +++ b/testsuites/ada/support/fp.inc @@ -0,0 +1,151 @@ +-- +-- fp.inc +-- +-- Macros to produce a large number of LOCAL floating point variables. This +-- preprocessing is necessary to insure that the variables are +-- scoped properly and to avoid duplicating hundreds of lines +-- of code. +-- +-- +-- DEFICIENCIES: +-- +-- 1. This currently does not address whether or not the CPU +-- actually has hardware floating point. It just does the work. +-- +-- 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. + +-- +-- private definitions for macro use +-- + +-- macro usage EPSILON() +define(`EPSILON',`0.0005') + +-- macro usage FP_CHECK_ONE( value, base, factor ) +define(`FP_CHECK_ONE',` + if ( $1 - ( $2 + $3 ) ) > EPSILON or else ( $1 - ( $2 + $3 ) ) < - EPSILON then + UNSIGNED32_IO.PUT( TASK_INDEX ); + TEXT_IO.PUT( ": $1 wrong -- (" ); + FLOAT_IO.PUT( $1 ); + TEXT_IO.PUT( " not " ); + FLOAT_IO.PUT( $2 + $3 ); + TEXT_IO.PUT_LINE( ")" ); + end if +' +) + +-- macro usage FP_DECLARE +define(`FP_DECLARE', ` + FP01 : FLOAT := 1.0; + FP02 : FLOAT := 2.0; + FP03 : FLOAT := 3.0; + FP04 : FLOAT := 4.0; + FP05 : FLOAT := 5.0; + FP06 : FLOAT := 6.0; + FP07 : FLOAT := 7.0; + FP08 : FLOAT := 8.0; + FP09 : FLOAT := 9.0; + FP10 : FLOAT := 10.0; + FP11 : FLOAT := 11.0; + FP12 : FLOAT := 12.0; + FP13 : FLOAT := 13.0; + FP14 : FLOAT := 14.0; + FP15 : FLOAT := 15.0; + FP16 : FLOAT := 16.0; + FP17 : FLOAT := 17.0; + FP18 : FLOAT := 18.0; + FP19 : FLOAT := 19.0; + FP20 : FLOAT := 20.0; + FP21 : FLOAT := 21.0; + FP22 : FLOAT := 22.0; + FP23 : FLOAT := 23.0; + FP24 : FLOAT := 24.0; + FP25 : FLOAT := 25.0; + FP26 : FLOAT := 26.0; + FP27 : FLOAT := 27.0; + FP28 : FLOAT := 28.0; + FP29 : FLOAT := 29.0; + FP30 : FLOAT := 30.0; + FP31 : FLOAT := 31.0; + FP32 : FLOAT := 32.0 +' +) + + +-- macro usage FP_LOAD( factor ) +define(`FP_LOAD',` + FP01 := FP01 + $1; + FP02 := FP02 + $1; + FP03 := FP03 + $1; + FP04 := FP04 + $1; + FP05 := FP05 + $1; + FP06 := FP06 + $1; + FP07 := FP07 + $1; + FP08 := FP08 + $1; + FP09 := FP09 + $1; + FP10 := FP10 + $1; + FP11 := FP11 + $1; + FP12 := FP12 + $1; + FP13 := FP13 + $1; + FP14 := FP14 + $1; + FP15 := FP15 + $1; + FP16 := FP16 + $1; + FP17 := FP17 + $1; + FP18 := FP18 + $1; + FP19 := FP19 + $1; + FP20 := FP20 + $1; + FP21 := FP21 + $1; + FP22 := FP22 + $1; + FP23 := FP23 + $1; + FP24 := FP24 + $1; + FP25 := FP25 + $1; + FP26 := FP26 + $1; + FP27 := FP27 + $1; + FP28 := FP28 + $1; + FP29 := FP29 + $1; + FP30 := FP30 + $1; + FP31 := FP31 + $1; + FP32 := FP32 + $1 +') + +-- macro usage FP_CHECK( factor ) +define(`FP_CHECK',` + FP_CHECK_ONE( FP01, 1.0, $1 ); + FP_CHECK_ONE( FP02, 2.0, $1 ); + FP_CHECK_ONE( FP03, 3.0, $1 ); + FP_CHECK_ONE( FP04, 4.0, $1 ); + FP_CHECK_ONE( FP05, 5.0, $1 ); + FP_CHECK_ONE( FP06, 6.0, $1 ); + FP_CHECK_ONE( FP07, 7.0, $1 ); + FP_CHECK_ONE( FP08, 8.0, $1 ); + FP_CHECK_ONE( FP09, 9.0, $1 ); + FP_CHECK_ONE( FP10, 10.0, $1 ); + FP_CHECK_ONE( FP11, 11.0, $1 ); + FP_CHECK_ONE( FP12, 12.0, $1 ); + FP_CHECK_ONE( FP13, 13.0, $1 ); + FP_CHECK_ONE( FP14, 14.0, $1 ); + FP_CHECK_ONE( FP15, 15.0, $1 ); + FP_CHECK_ONE( FP16, 16.0, $1 ); + FP_CHECK_ONE( FP17, 17.0, $1 ); + FP_CHECK_ONE( FP18, 18.0, $1 ); + FP_CHECK_ONE( FP19, 19.0, $1 ); + FP_CHECK_ONE( FP20, 20.0, $1 ); + FP_CHECK_ONE( FP21, 21.0, $1 ); + FP_CHECK_ONE( FP22, 22.0, $1 ); + FP_CHECK_ONE( FP23, 23.0, $1 ); + FP_CHECK_ONE( FP24, 24.0, $1 ); + FP_CHECK_ONE( FP25, 25.0, $1 ); + FP_CHECK_ONE( FP26, 26.0, $1 ); + FP_CHECK_ONE( FP27, 27.0, $1 ); + FP_CHECK_ONE( FP28, 28.0, $1 ); + FP_CHECK_ONE( FP29, 29.0, $1 ); + FP_CHECK_ONE( FP30, 30.0, $1 ); + FP_CHECK_ONE( FP31, 31.0, $1 ); + FP_CHECK_ONE( FP32, 32.0, $1 ) +' +) diff --git a/testsuites/ada/support/init.c b/testsuites/ada/support/init.c new file mode 100644 index 0000000000..968b17b3a4 --- /dev/null +++ b/testsuites/ada/support/init.c @@ -0,0 +1,82 @@ +/* + * COPYRIGHT (c) 1989-2015 + * On-Line Applications Research Corporation (OAR). + */ + +#include <bsp.h> +#include <stdlib.h> + +#include <rtems/score/threadimpl.h> + +/* + * This is the entry point automatically generated by GNAT. + */ +extern int gnat_main ( int argc, char **argv, char **envp ); + +static void *POSIX_Init( + void *argument +) +{ + (void) gnat_main ( 0, 0, 0 ); + + exit( 0 ); +} + +/* + * Prototypes for various test support routines. Since these are bound to + * from Ada, there are no external .h files even though they must be public. + */ +uint32_t milliseconds_per_tick(void); +uint32_t ticks_per_second(void); +uint32_t work_space_size(void); +uint32_t is_configured_multiprocessing(void); +uint32_t get_node(void); +rtems_id tcb_to_id(Thread_Control *tcb); + +/* + * By putting this in brackets rather than quotes, we get the search + * path and can get this file from ".." in the mptests. + */ +#define CONFIGURE_INIT +#define CONFIGURE_GNAT_RTEMS +#define CONFIGURE_MEMORY_OVERHEAD (256) + +#include <config.h> + +rtems_id tcb_to_id( + Thread_Control *tcb +) +{ + return tcb->Object.id; /* Only for sp04 */ +} + +uint32_t milliseconds_per_tick(void) +{ + return CONFIGURE_MICROSECONDS_PER_TICK / 1000; +} + +uint32_t ticks_per_second(void) +{ + return rtems_clock_get_ticks_per_second(); +} + +uint32_t work_space_size(void) +{ + return CONFIGURE_EXECUTIVE_RAM_SIZE; +} + +uint32_t is_configured_multiprocessing(void) +{ +#if defined(RTEMS_MULTIPROCESSING) + return 1; +#else + return 0; +#endif +} + +uint32_t get_node(void) +{ + /* XXX HACK -- use public API */ + return _Objects_Local_node; +} + diff --git a/testsuites/ada/support/integer.inc b/testsuites/ada/support/integer.inc new file mode 100644 index 0000000000..c47f68efd4 --- /dev/null +++ b/testsuites/ada/support/integer.inc @@ -0,0 +1,142 @@ +-- +-- integer.inc +-- +-- Macros to produce a large number of LOCAL integer variables. This +-- preprocessing is necessary to insure that the variables are +-- scoped properly and to avoid duplicating hundreds of lines +-- of code. +-- +-- 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. + +-- +-- private definitions for macro use +-- + +-- macro usage INTEGER_CHECK_ONE( value, base, factor ) +define(`INTEGER_CHECK_ONE',` + if $1 /= ($2 + $3) then + UNSIGNED32_IO.PUT( TASK_INDEX ); + TEXT_IO.PUT( ": $1 wrong -- (" ); + UNSIGNED32_IO.PUT( $1, BASE => 16); + TEXT_IO.PUT( " not " ); + UNSIGNED32_IO.PUT( $2, BASE => 16 ); + TEXT_IO.PUT_LINE( ")" ); + end if +' +) + +-- macro usage INTEGER_DECLARE +define(`INTEGER_DECLARE', ` + INT01 : RTEMS.UNSIGNED32 := 1; + INT02 : RTEMS.UNSIGNED32 := 2; + INT03 : RTEMS.UNSIGNED32 := 3; + INT04 : RTEMS.UNSIGNED32 := 4; + INT05 : RTEMS.UNSIGNED32 := 5; + INT06 : RTEMS.UNSIGNED32 := 6; + INT07 : RTEMS.UNSIGNED32 := 7; + INT08 : RTEMS.UNSIGNED32 := 8; + INT09 : RTEMS.UNSIGNED32 := 9; + INT10 : RTEMS.UNSIGNED32 := 10; + INT11 : RTEMS.UNSIGNED32 := 11; + INT12 : RTEMS.UNSIGNED32 := 12; + INT13 : RTEMS.UNSIGNED32 := 13; + INT14 : RTEMS.UNSIGNED32 := 14; + INT15 : RTEMS.UNSIGNED32 := 15; + INT16 : RTEMS.UNSIGNED32 := 16; + INT17 : RTEMS.UNSIGNED32 := 17; + INT18 : RTEMS.UNSIGNED32 := 18; + INT19 : RTEMS.UNSIGNED32 := 19; + INT20 : RTEMS.UNSIGNED32 := 20; + INT21 : RTEMS.UNSIGNED32 := 21; + INT22 : RTEMS.UNSIGNED32 := 22; + INT23 : RTEMS.UNSIGNED32 := 23; + INT24 : RTEMS.UNSIGNED32 := 24; + INT25 : RTEMS.UNSIGNED32 := 25; + INT26 : RTEMS.UNSIGNED32 := 26; + INT27 : RTEMS.UNSIGNED32 := 27; + INT28 : RTEMS.UNSIGNED32 := 28; + INT29 : RTEMS.UNSIGNED32 := 29; + INT30 : RTEMS.UNSIGNED32 := 30; + INT31 : RTEMS.UNSIGNED32 := 31; + INT32 : RTEMS.UNSIGNED32 := 32 +' +) + + +-- macro usage INTEGER_LOAD( factor ) +define(`INTEGER_LOAD',` + INT01 := INT01 + $1; + INT02 := INT02 + $1; + INT03 := INT03 + $1; + INT04 := INT04 + $1; + INT05 := INT05 + $1; + INT06 := INT06 + $1; + INT07 := INT07 + $1; + INT08 := INT08 + $1; + INT09 := INT09 + $1; + INT10 := INT10 + $1; + INT11 := INT11 + $1; + INT12 := INT12 + $1; + INT13 := INT13 + $1; + INT14 := INT14 + $1; + INT15 := INT15 + $1; + INT16 := INT16 + $1; + INT17 := INT17 + $1; + INT18 := INT18 + $1; + INT19 := INT19 + $1; + INT20 := INT20 + $1; + INT21 := INT21 + $1; + INT22 := INT22 + $1; + INT23 := INT23 + $1; + INT24 := INT24 + $1; + INT25 := INT25 + $1; + INT26 := INT26 + $1; + INT27 := INT27 + $1; + INT28 := INT28 + $1; + INT29 := INT29 + $1; + INT30 := INT30 + $1; + INT31 := INT31 + $1; + INT32 := INT32 + $1 +') + +-- macro usage INTEGER_CHECK( factor ) +define(`INTEGER_CHECK',` + INTEGER_CHECK_ONE( INT01, 1, $1 ); + INTEGER_CHECK_ONE( INT02, 2, $1 ); + INTEGER_CHECK_ONE( INT03, 3, $1 ); + INTEGER_CHECK_ONE( INT04, 4, $1 ); + INTEGER_CHECK_ONE( INT05, 5, $1 ); + INTEGER_CHECK_ONE( INT06, 6, $1 ); + INTEGER_CHECK_ONE( INT07, 7, $1 ); + INTEGER_CHECK_ONE( INT08, 8, $1 ); + INTEGER_CHECK_ONE( INT09, 9, $1 ); + INTEGER_CHECK_ONE( INT10, 10, $1 ); + INTEGER_CHECK_ONE( INT11, 11, $1 ); + INTEGER_CHECK_ONE( INT12, 12, $1 ); + INTEGER_CHECK_ONE( INT13, 13, $1 ); + INTEGER_CHECK_ONE( INT14, 14, $1 ); + INTEGER_CHECK_ONE( INT15, 15, $1 ); + INTEGER_CHECK_ONE( INT16, 16, $1 ); + INTEGER_CHECK_ONE( INT17, 17, $1 ); + INTEGER_CHECK_ONE( INT18, 18, $1 ); + INTEGER_CHECK_ONE( INT19, 19, $1 ); + INTEGER_CHECK_ONE( INT20, 20, $1 ); + INTEGER_CHECK_ONE( INT21, 21, $1 ); + INTEGER_CHECK_ONE( INT22, 22, $1 ); + INTEGER_CHECK_ONE( INT23, 23, $1 ); + INTEGER_CHECK_ONE( INT24, 24, $1 ); + INTEGER_CHECK_ONE( INT25, 25, $1 ); + INTEGER_CHECK_ONE( INT26, 26, $1 ); + INTEGER_CHECK_ONE( INT27, 27, $1 ); + INTEGER_CHECK_ONE( INT28, 28, $1 ); + INTEGER_CHECK_ONE( INT29, 29, $1 ); + INTEGER_CHECK_ONE( INT30, 30, $1 ); + INTEGER_CHECK_ONE( INT31, 31, $1 ); + INTEGER_CHECK_ONE( INT32, 32, $1 ) +' +) diff --git a/testsuites/ada/support/rtems_calling_overhead.ads b/testsuites/ada/support/rtems_calling_overhead.ads new file mode 100644 index 0000000000..5f94e0505a --- /dev/null +++ b/testsuites/ada/support/rtems_calling_overhead.ads @@ -0,0 +1,102 @@ +-- +-- RTEMS_CALLING_OVERHEAD / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package contains the invocation overhead for each +-- of the RTEMS directives on the MC68020 Timing Platform. +-- This time is then subtracted from the execution time +-- of each directive as measured by the Timing Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- 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. +-- + +with RTEMS; + +package RTEMS_CALLING_OVERHEAD is + + INITIALIZE_EXECUTIVE : constant RTEMS.UNSIGNED32 := 0; + SHUTDOWN_EXECUTIVE : constant RTEMS.UNSIGNED32 := 0; + TASK_CREATE : constant RTEMS.UNSIGNED32 := 0; + TASK_IDENT : constant RTEMS.UNSIGNED32 := 0; + TASK_START : constant RTEMS.UNSIGNED32 := 0; + TASK_RESTART : constant RTEMS.UNSIGNED32 := 0; + TASK_DELETE : constant RTEMS.UNSIGNED32 := 0; + TASK_SUSPEND : constant RTEMS.UNSIGNED32 := 0; + TASK_RESUME : constant RTEMS.UNSIGNED32 := 0; + TASK_SET_PRIORITY : constant RTEMS.UNSIGNED32 := 0; + TASK_MODE : constant RTEMS.UNSIGNED32 := 0; + TASK_GET_NOTE : constant RTEMS.UNSIGNED32 := 0; + TASK_SET_NOTE : constant RTEMS.UNSIGNED32 := 0; + TASK_WAKE_WHEN : constant RTEMS.UNSIGNED32 := 0; + TASK_WAKE_AFTER : constant RTEMS.UNSIGNED32 := 0; + INTERRUPT_CATCH : constant RTEMS.UNSIGNED32 := 0; + CLOCK_GET : constant RTEMS.UNSIGNED32 := 0; + CLOCK_SET : constant RTEMS.UNSIGNED32 := 0; + CLOCK_TICK : constant RTEMS.UNSIGNED32 := 0; + + TIMER_CREATE : constant RTEMS.UNSIGNED32 := 0; + TIMER_DELETE : constant RTEMS.UNSIGNED32 := 0; + TIMER_IDENT : constant RTEMS.UNSIGNED32 := 0; + TIMER_FIRE_AFTER : constant RTEMS.UNSIGNED32 := 0; + TIMER_FIRE_WHEN : constant RTEMS.UNSIGNED32 := 0; + TIMER_RESET : constant RTEMS.UNSIGNED32 := 0; + TIMER_CANCEL : constant RTEMS.UNSIGNED32 := 0; + SEMAPHORE_CREATE : constant RTEMS.UNSIGNED32 := 0; + SEMAPHORE_DELETE : constant RTEMS.UNSIGNED32 := 0; + SEMAPHORE_IDENT : constant RTEMS.UNSIGNED32 := 0; + SEMAPHORE_OBTAIN : constant RTEMS.UNSIGNED32 := 0; + SEMAPHORE_RELEASE : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_CREATE : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_IDENT : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_DELETE : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_SEND : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_URGENT : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_BROADCAST : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_RECEIVE : constant RTEMS.UNSIGNED32 := 0; + MESSAGE_QUEUE_FLUSH : constant RTEMS.UNSIGNED32 := 0; + + EVENT_SEND : constant RTEMS.UNSIGNED32 := 0; + EVENT_RECEIVE : constant RTEMS.UNSIGNED32 := 0; + SIGNAL_CATCH : constant RTEMS.UNSIGNED32 := 0; + SIGNAL_SEND : constant RTEMS.UNSIGNED32 := 0; + PARTITION_CREATE : constant RTEMS.UNSIGNED32 := 0; + PARTITION_IDENT : constant RTEMS.UNSIGNED32 := 0; + PARTITION_DELETE : constant RTEMS.UNSIGNED32 := 0; + PARTITION_GET_BUFFER : constant RTEMS.UNSIGNED32 := 0; + PARTITION_RETURN_BUFFER : constant RTEMS.UNSIGNED32 := 0; + REGION_CREATE : constant RTEMS.UNSIGNED32 := 0; + REGION_IDENT : constant RTEMS.UNSIGNED32 := 0; + REGION_DELETE : constant RTEMS.UNSIGNED32 := 0; + REGION_GET_SEGMENT : constant RTEMS.UNSIGNED32 := 0; + REGION_RETURN_SEGMENT : constant RTEMS.UNSIGNED32 := 0; + PORT_CREATE : constant RTEMS.UNSIGNED32 := 0; + PORT_IDENT : constant RTEMS.UNSIGNED32 := 0; + PORT_DELETE : constant RTEMS.UNSIGNED32 := 0; + PORT_EXTERNAL_TO_INTERNAL : constant RTEMS.UNSIGNED32 := 0; + PORT_INTERNAL_TO_EXTERNAL : constant RTEMS.UNSIGNED32 := 0; + + IO_INITIALIZE : constant RTEMS.UNSIGNED32 := 0; + IO_OPEN : constant RTEMS.UNSIGNED32 := 0; + IO_CLOSE : constant RTEMS.UNSIGNED32 := 0; + IO_READ : constant RTEMS.UNSIGNED32 := 0; + IO_WRITE : constant RTEMS.UNSIGNED32 := 0; + IO_CONTROL : constant RTEMS.UNSIGNED32 := 0; + FATAL_ERROR_OCCURRED : constant RTEMS.UNSIGNED32 := 0; + RATE_MONOTONIC_CREATE : constant RTEMS.UNSIGNED32 := 0; + RATE_MONOTONIC_IDENT : constant RTEMS.UNSIGNED32 := 0; + RATE_MONOTONIC_DELETE : constant RTEMS.UNSIGNED32 := 0; + RATE_MONOTONIC_CANCEL : constant RTEMS.UNSIGNED32 := 0; + RATE_MONOTONIC_PERIOD : constant RTEMS.UNSIGNED32 := 0; + MULTIPROCESSING_ANNOUNCE : constant RTEMS.UNSIGNED32 := 0; + +end RTEMS_CALLING_OVERHEAD; diff --git a/testsuites/ada/support/status_io.ads b/testsuites/ada/support/status_io.ads new file mode 100644 index 0000000000..301e7a2ba1 --- /dev/null +++ b/testsuites/ada/support/status_io.ads @@ -0,0 +1,25 @@ +-- +-- Status_IO / Specification +-- +-- DESCRIPTION: +-- +-- This package instantiates the IO routines necessary to +-- perform IO on data of the type Status.CODES. +-- +-- DEPENDENCIES: +-- +-- +-- +-- 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. +-- + +with RTEMS; +with Text_IO; + +package Status_IO is new Text_IO.Enumeration_IO( RTEMS.Status_Codes ); + diff --git a/testsuites/ada/support/test_support.adb b/testsuites/ada/support/test_support.adb new file mode 100644 index 0000000000..bc636cee11 --- /dev/null +++ b/testsuites/ada/support/test_support.adb @@ -0,0 +1,266 @@ +-- +-- Test_Support / Specification +-- +-- DESCRIPTION: +-- +-- This package provides routines which aid the Test Suites +-- and simplify their design and operation. +-- +-- 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 Unsigned32_IO; +with Status_IO; +with Text_IO; +with RTEMS.Fatal; + +package body Test_Support is + +-- +-- Fatal_Directive_Status +-- + + procedure Fatal_Directive_Status ( + Status : in RTEMS.Status_Codes; + Desired : in RTEMS.Status_Codes; + Message : in String + ) is + begin + + if not RTEMS.Are_Statuses_Equal( Status, Desired ) then + + Text_IO.Put( Message ); + Text_IO.Put( " FAILED -- expected " ); + Status_IO.Put( Desired ); + Text_IO.Put( " got " ); + Status_IO.Put( Status ); + Text_IO.New_Line; + + RTEMS.Fatal.Error_Occurred( RTEMS.Status_Codes'Pos( Status ) ); + + end if; + + end Fatal_Directive_Status; + +-- +-- Directive_Failed +-- + + procedure Directive_Failed ( + Status : in RTEMS.Status_Codes; + Message : in String + ) is + begin + + Test_Support.Fatal_Directive_Status( + Status, + RTEMS.Successful, + Message + ); + + end Directive_Failed; + +-- +-- Print_Time +-- + + procedure Print_Time ( + Prefix : in String; + Time_Buffer : in RTEMS.Time_Of_Day; + Suffix : in String + ) is + begin + + Text_IO.Put( Prefix ); + Unsigned32_IO.Put( Time_Buffer.Hour, Width=>2 ); + Text_IO.Put( ":" ); + Unsigned32_IO.Put( Time_Buffer.Minute, Width=>2 ); + Text_IO.Put( ":" ); + Unsigned32_IO.Put( Time_Buffer.Second, Width=>2 ); + Text_IO.Put( " " ); + Unsigned32_IO.Put( Time_Buffer.Month, Width=>2 ); + Text_IO.Put( "/" ); + Unsigned32_IO.Put( Time_Buffer.Day, Width=>2 ); + Text_IO.Put( "/" ); + Unsigned32_IO.Put( Time_Buffer.Year, Width=>2 ); + Text_IO.Put( Suffix ); + + end Print_Time; + +-- +-- Put_Dot +-- + + procedure Put_Dot ( + Buffer : in String + ) is + begin + Text_IO.Put( Buffer ); + Text_IO.FLUSH; + end Put_Dot; + +-- +-- Pause +-- + + procedure Pause is + -- Ignored_String : String( 1 .. 80 ); + -- Ignored_Last : Natural; + + begin + + -- + -- Really should be a "put" followed by a "flush." + -- + Text_IO.Put_Line( "<pause> " ); + -- Text_IO.Get_Line( Ignored_String, Ignored_Last ); + + end Pause; + +-- +-- Pause_And_Screen_Number +-- + + procedure Pause_And_Screen_Number ( + SCREEN : in RTEMS.Unsigned32 + ) is + -- Ignored_String : String( 1 .. 80 ); + -- Ignored_Last : Natural; + begin + + -- + -- Really should be a "put" followed by a "flush." + -- + Text_IO.Put( "<pause - screen " ); + Unsigned32_IO.Put( SCREEN, Width=>2 ); + Text_IO.Put_Line( "> " ); + -- Text_IO.Get_Line( Ignored_String, Ignored_Last ); + + end Pause_And_Screen_Number; + +-- +-- Put_Name +-- + + procedure Put_Name ( + Name : in RTEMS.Name; + New_Line : in Boolean + ) is + C1 : Character; + C2 : Character; + C3 : Character; + C4 : Character; + begin + + RTEMS.Name_To_Characters( Name, C1, C2, C3, C4 ); + + Text_IO.Put( C1 ); + Text_IO.Put( C2 ); + Text_IO.Put( C3 ); + Text_IO.Put( C4 ); + + if New_Line then + Text_IO.New_Line; + end if; + + end Put_Name; + +-- +-- Task_Number +-- + + function Task_Number ( + TID : in RTEMS.ID + ) return RTEMS.Unsigned32 is + begin + + -- probably OK + return RTEMS.Get_Index( TID ) - 1; + + end Task_Number; + +-- +-- Do_Nothing +-- + + procedure Do_Nothing is + begin + NULL; + end Do_Nothing; + + +-- +-- Milliseconds_Per_Tick +-- + + function Milliseconds_Per_Tick + return RTEMS.Unsigned32 is + function Milliseconds_Per_Tick_Base return RTEMS.Unsigned32; + pragma Import (C, Milliseconds_Per_Tick_Base, "milliseconds_per_tick"); + begin + return Milliseconds_Per_Tick_Base; + end Milliseconds_Per_Tick; + +-- +-- Milliseconds_Per_Tick +-- + function Ticks_Per_Second + return RTEMS.Interval is + function Ticks_Per_Second_Base return RTEMS.Unsigned32; + pragma Import (C, Ticks_Per_Second_Base, "ticks_per_second"); + begin + return Ticks_Per_Second_Base; + end Ticks_Per_Second; + +-- +-- Return the size of the RTEMS Workspace +-- + + function Work_Space_Size + return RTEMS.Unsigned32 is + function Work_Space_Size_Base return RTEMS.Unsigned32; + pragma Import (C, Work_Space_Size_Base, "work_space_size"); + begin + return Work_Space_Size_Base; + end Work_Space_Size; + +-- +-- Return an indication of whether multiprocessing is configured +-- + + function Is_Configured_Multiprocessing + return Boolean is + function Is_Configured_Multiprocessing_Base return RTEMS.Unsigned32; + pragma Import ( + C, Is_Configured_Multiprocessing_Base, "is_configured_multiprocessing" + ); + begin + if Is_Configured_Multiprocessing_Base = 1 then + return True; + else + return False; + end if; + end Is_Configured_Multiprocessing; + +-- +-- Node is the node number in a multiprocessor configuration +-- + + function Node + return RTEMS.Unsigned32 is + function Get_Node_Base return RTEMS.Unsigned32; + pragma Import (C, Get_Node_Base, "get_node"); + begin + return Get_Node_Base; + end Node; +end Test_Support; diff --git a/testsuites/ada/support/test_support.ads b/testsuites/ada/support/test_support.ads new file mode 100644 index 0000000000..e41bf834ed --- /dev/null +++ b/testsuites/ada/support/test_support.ads @@ -0,0 +1,195 @@ +-- +-- Test_Support / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package provides routines which aid the Test Suites +-- and simplify their design and operation. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2009. +-- 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; + +package Test_Support is + +-- +-- Fatal_Directive_Status +-- +-- DESCRIPTION: +-- +-- This subprogram checks if Status is equal to Desired. If so, it +-- returns immediately. Otherwise, it prints the Message along with +-- the Status and Desired status and invokes the Fatal_Error_Occurred +-- directive. +-- + + procedure Fatal_Directive_Status ( + Status : in RTEMS.Status_Codes; + Desired : in RTEMS.Status_Codes; + Message : in STRING + ); + pragma Inline ( Fatal_Directive_Status ); + +-- Directive_Failed +-- +-- DESCRIPTION: +-- +-- This subprogram checks if Status is equal to Successful. If so, it +-- returns immediately. Otherwise, it prints the Message along with +-- the Status and Desired status and invokes the Fatal_Error_Occurred +-- + + procedure Directive_Failed ( + Status : in RTEMS.Status_Codes; + Message : in STRING + ); + pragma Inline ( Directive_Failed ); + +-- +-- Print_Time +-- +-- DESCRIPTION: +-- +-- This subprogram prints the Prefix string, following by the +-- time of day in Time_Buffer, followed by the Suffix. +-- + + procedure Print_Time ( + Prefix : in STRING; + Time_Buffer : in RTEMS.Time_Of_Day; + Suffix : in STRING + ); + pragma Inline ( Print_Time ); + +-- +-- Put_Dot +-- +-- DESCRIPTION: +-- +-- This subprogram prints a single character without a carriage return. +-- + + procedure Put_Dot ( + Buffer : in STRING + ); + pragma Inline ( Put_Dot ); + +-- +-- Pause +-- +-- DESCRIPTION: +-- +-- This subprogram is used to pause screen output in the Test Suites +-- until the user presses carriage return. +-- + + procedure Pause; + +-- +-- Pause_And_Screen_Number +-- +-- DESCRIPTION: +-- +-- This subprogram is used to pause screen output and print the current +-- number in the Test Suites until the user presses carriage return. +-- + + procedure Pause_And_Screen_Number ( + SCREEN : in RTEMS.Unsigned32 + ); + +-- +-- Put_Name +-- +-- DESCRIPTION: +-- +-- This subprogram prints the RTEMS object Name. If New_Line is TRUE, +-- then a carriage return is printed after the Name. +-- + + procedure Put_Name ( + Name : in RTEMS.Name; + New_Line : in Boolean + ); + +-- +-- Task_Number +-- +-- DESCRIPTION: +-- +-- This function returns the task index which the test should use +-- for TID. +-- + + function Task_Number ( + TID : in RTEMS.ID + ) return RTEMS.Unsigned32; + pragma Inline ( Task_Number ); + +-- +-- Do_Nothing +-- +-- DESCRIPTION: +-- +-- This procedure is called when a test wishes to use a delay +-- loop and insure that the compiler does not optimize it away. +-- + + procedure Do_Nothing; + +-- +-- Ticks_Per_Second is the number of RTEMS clock ticks which +-- occur each second. +-- + + function Ticks_Per_Second + return RTEMS.Interval; + +-- +-- Milliseconds_Per_Tick is the number of milliseconds which +-- occur between each RTEMS clock tick. +-- + + function Milliseconds_Per_Tick + return RTEMS.Unsigned32; + +-- +-- Return the size of the RTEMS Workspace +-- + + function Work_Space_Size + return RTEMS.Unsigned32; + +-- +-- Return an indication of whether multiprocessing is configured +-- + + function Is_Configured_Multiprocessing + return Boolean; + +-- +-- Node is the node number in a multiprocessor configuration +-- + + function Node + return RTEMS.Unsigned32; + +-- +-- Longest time in seconds to run a test +-- + + MAXIMUM_LONG_TEST_DURATION : RTEMS.UNSIGNED32; + +private + +end Test_Support; diff --git a/testsuites/ada/support/time_test_support.adb b/testsuites/ada/support/time_test_support.adb new file mode 100644 index 0000000000..aab0c75dfe --- /dev/null +++ b/testsuites/ada/support/time_test_support.adb @@ -0,0 +1,73 @@ +-- +-- TIME_TEST_SUPPORT / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package provides routines which aid the individual tests in +-- the Timing Test Suite and simplify their design and operation. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2009. +-- 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 TEXT_IO; +with UNSIGNED32_IO; + +package body TIME_TEST_SUPPORT is + +--PAGE +-- +-- PUT_TIME +-- + + procedure PUT_TIME ( + MESSAGE : in STRING; + TOTAL_TIME : in RTEMS.UNSIGNED32; + ITERATIONS : in RTEMS.UNSIGNED32; + LOOP_OVERHEAD : in RTEMS.UNSIGNED32; + CALLING_OVERHEAD : in RTEMS.UNSIGNED32 + ) is + PER_ITERATION : RTEMS.UNSIGNED32; + begin + + PER_ITERATION := (TOTAL_TIME - LOOP_OVERHEAD) / ITERATIONS; + PER_ITERATION := PER_ITERATION - CALLING_OVERHEAD; + + if PER_ITERATION = 0 then + + TEXT_IO.PUT( "TOTAL_TIME " ); + UNSIGNED32_IO.PUT( TOTAL_TIME ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT( "ITERATIONS " ); + UNSIGNED32_IO.PUT( ITERATIONS ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT( "LOOP_OVERHEAD " ); + UNSIGNED32_IO.PUT( LOOP_OVERHEAD ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT( "CALLING_OVERHEAD " ); + UNSIGNED32_IO.PUT( CALLING_OVERHEAD ); + TEXT_IO.NEW_LINE; + + end if; + + TEXT_IO.PUT( MESSAGE ); + TEXT_IO.PUT( " " ); + UNSIGNED32_IO.PUT( PER_ITERATION ); + TEXT_IO.NEW_LINE; + TEXT_IO.FLUSH; + + end PUT_TIME; + +end TIME_TEST_SUPPORT; diff --git a/testsuites/ada/support/time_test_support.ads b/testsuites/ada/support/time_test_support.ads new file mode 100644 index 0000000000..aeed677ba2 --- /dev/null +++ b/testsuites/ada/support/time_test_support.ads @@ -0,0 +1,51 @@ +-- +-- TIME_TEST_SUPPORT / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package provides routines which aid the individual tests in +-- the Timing Test Suite and simplify their design and operation. +-- +-- DEPENDENCIES: +-- +-- +-- +-- 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. +-- + +with RTEMS; + +package TIME_TEST_SUPPORT is + +-- +-- The following constants define the number of times a directive +-- will be performed in the Timing Suite. +-- + + OPERATION_COUNT : constant RTEMS.UNSIGNED32 := 100; + ITERATION_COUNT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- PUT_TIME +-- +-- DESCRIPTION: +-- +-- This subprogram prints the MESSAGE followed by the length of +-- time which each individual operation took. All times are +-- in microseconds. +-- + + procedure PUT_TIME ( + MESSAGE : in STRING; + TOTAL_TIME : in RTEMS.UNSIGNED32; + ITERATIONS : in RTEMS.UNSIGNED32; + LOOP_OVERHEAD : in RTEMS.UNSIGNED32; + CALLING_OVERHEAD : in RTEMS.UNSIGNED32 + ); + +end TIME_TEST_SUPPORT; diff --git a/testsuites/ada/support/timer_driver.adb b/testsuites/ada/support/timer_driver.adb new file mode 100644 index 0000000000..389499ccc8 --- /dev/null +++ b/testsuites/ada/support/timer_driver.adb @@ -0,0 +1,59 @@ +-- +-- Timer_Driver / Body +-- +-- Description: +-- +-- This package is the body for the Timer Driver. +-- +-- Dependencies: +-- +-- +-- +-- COPYRIGHT (c) 1989-2009. +-- 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; + +package body Timer_Driver is + +--PAGE +-- +-- Empty_function +-- +-- + procedure Empty_Function + is + begin + Null; + end Empty_Function; + +--PAGE +-- +-- Set_Find_Average_Overhead +-- +-- + + procedure Set_Find_Average_Overhead ( + Find_Flag : in Standard.Boolean + ) is + procedure Set_Find_Average_Overhead_base ( + Find_Flag : in Interfaces.Unsigned_8 + ); + pragma Import (C, Set_Find_Average_Overhead_base, + "benchmark_timer_disable_subtracting_average_overhead"); + c: Interfaces.Unsigned_8; + begin + if Find_Flag then + c := 1; + else + c := 0; + end if; + Set_Find_Average_Overhead_base (c); + end Set_Find_Average_Overhead; + +end Timer_Driver; diff --git a/testsuites/ada/support/timer_driver.ads b/testsuites/ada/support/timer_driver.ads new file mode 100644 index 0000000000..00642dfe90 --- /dev/null +++ b/testsuites/ada/support/timer_driver.ads @@ -0,0 +1,77 @@ +-- +-- Timer_Driver / Specification +-- +-- Description: +-- +-- This package is the specification for the Timer Driver. +-- +-- Dependencies: +-- +-- +-- +-- 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. +-- + +with RTEMS; + +package Timer_Driver is + +-- +-- Initialize +-- +-- Description: +-- +-- This subprogram initializes the hardware timer to start it. +-- + + procedure Initialize; + pragma Import (C, Initialize, "benchmark_timer_initialize"); + +-- +-- Read_Timer +-- +-- Description: +-- +-- This subprogram stops the timer, calculates the length of time +-- in microseconds since the timer was started, and returns that +-- value. +-- + + function Read_Timer + return RTEMS.Unsigned32; + pragma Import (C, Read_Timer, "benchmark_timer_read"); + +-- +-- Empty_Function +-- +-- Description: +-- +-- This subprogram is an empty subprogram. It is used to +-- insure that a loop will be included in the final executable +-- so that loop overhead can be subtracted from the directive +-- times reported. +-- + + procedure Empty_Function; + +-- +-- Set_Find_Average_Overhead +-- +-- Description: +-- +-- This subprogram sets the Find_Average_Overhead flag to the +-- the value passed. +-- + + procedure Set_Find_Average_Overhead ( + Find_Flag : in Standard.Boolean + ); + +private + +end Timer_Driver; diff --git a/testsuites/ada/support/unsigned32_io.ads b/testsuites/ada/support/unsigned32_io.ads new file mode 100644 index 0000000000..4d1a7e6e87 --- /dev/null +++ b/testsuites/ada/support/unsigned32_io.ads @@ -0,0 +1,25 @@ +-- +-- Unsigned32_IO / Specification +-- +-- DESCRIPTION: +-- +-- This package instantiates the IO routines necessary to +-- perform IO on data of the type RTEMS.Unsigned32. +-- +-- DEPENDENCIES: +-- +-- +-- +-- 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. +-- + +with RTEMS; +with Text_IO; + +package Unsigned32_IO is new Text_IO.Modular_IO( RTEMS.Unsigned32 ); + |