summaryrefslogtreecommitdiffstats
path: root/c/src/ada-tests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-06-02 20:52:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-06-02 20:52:48 +0000
commitf3f06f79c34b82beb05532972f04e1bc1fcb7d2d (patch)
tree169f048f42ee4b378b817fe37d5ed2dd8c89a66c /c/src/ada-tests
parentmodified copyright notice to be the same as RTEMS 4.0.0. (diff)
downloadrtems-f3f06f79c34b82beb05532972f04e1bc1fcb7d2d.tar.bz2
added new files from test area.
This code has successfully been used to run sp01.
Diffstat (limited to 'c/src/ada-tests')
-rw-r--r--c/src/ada-tests/support/init.c55
-rw-r--r--c/src/ada-tests/support/status_io.ads28
-rw-r--r--c/src/ada-tests/support/test_support.adb236
-rw-r--r--c/src/ada-tests/support/test_support.ads173
-rw-r--r--c/src/ada-tests/support/unsigned32_io.ads28
5 files changed, 520 insertions, 0 deletions
diff --git a/c/src/ada-tests/support/init.c b/c/src/ada-tests/support/init.c
new file mode 100644
index 0000000000..f13e61cc76
--- /dev/null
+++ b/c/src/ada-tests/support/init.c
@@ -0,0 +1,55 @@
+/*
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#ifdef PROVIDES_GETPID
+#include <unistd.h>
+pid_t getpid()
+{
+#ifndef PID
+ return 1;
+#else
+ return PID;
+#endif
+}
+#endif
+
+void *POSIX_Init(
+ void *argument
+)
+{
+ extern int gnat_main ( int argc, char **argv, char **envp );
+
+ (void) gnat_main ( 0, 0, 0 );
+
+ exit( 0 );
+}
+
+/* configuration information */
+
+#define CONFIGURE_SPTEST
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 20
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 20
+#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 30
+#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 20
+
+#define CONFIGURE_INIT
+
+#include <confdefs.h>
+
diff --git a/c/src/ada-tests/support/status_io.ads b/c/src/ada-tests/support/status_io.ads
new file mode 100644
index 0000000000..ada20ce31d
--- /dev/null
+++ b/c/src/ada-tests/support/status_io.ads
@@ -0,0 +1,28 @@
+--
+-- 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, 1990, 1991, 1992, 1993, 1994.
+-- On-Line Applications Research Corporation (OAR).
+-- All rights assigned to U.S. Government, 1994.
+--
+-- This material may be reproduced by or for the U.S. Government pursuant
+-- to the copyright license under the clause at DFARS 252.227-7013. This
+-- notice must appear in all copies of this file and its derivatives.
+--
+-- status_io.ads,v 1.2 1995/05/31 16:28:20 joel Exp
+--
+
+with RTEMS;
+with Text_IO;
+
+package Status_IO is new Text_IO.Enumeration_IO( RTEMS.Status_Codes );
+
diff --git a/c/src/ada-tests/support/test_support.adb b/c/src/ada-tests/support/test_support.adb
new file mode 100644
index 0000000000..6f4380c185
--- /dev/null
+++ b/c/src/ada-tests/support/test_support.adb
@@ -0,0 +1,236 @@
+--
+-- Test_Support / Specification
+--
+-- DESCRIPTION:
+--
+-- This package provides routines which aid the Test Suites
+-- and simplify their design and operation.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+-- On-Line Applications Research Corporation (OAR).
+-- All rights assigned to U.S. Government, 1994.
+--
+-- This material may be reproduced by or for the U.S. Government pursuant
+-- to the copyright license under the clause at DFARS 252.227-7013. This
+-- notice must appear in all copies of this file and its derivatives.
+--
+-- test_support.adb,v 1.2 1995/07/21 15:08:54 joel Exp
+--
+
+with Interfaces; use Interfaces;
+with RTEMS;
+with Unsigned32_IO;
+with Status_IO;
+with Text_IO;
+
+package body Test_Support is
+
+--PAGE
+--
+-- 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;
+
+--PAGE
+--
+-- 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;
+
+--PAGE
+--
+-- 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;
+
+--PAGE
+--
+-- Put_Dot
+--
+
+ procedure Put_Dot (
+ Buffer : in String
+ ) is
+ begin
+ Text_IO.Put( Buffer );
+ Text_IO.FLUSH;
+ end Put_Dot;
+
+--PAGE
+--
+-- 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 );
+
+ exception
+
+ when Text_IO.End_Error =>
+ -- ignore this error. It happens when redirecting input from /dev/null
+ return;
+
+ end Pause;
+
+--PAGE
+--
+-- 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 );
+
+ exception
+
+ when Text_IO.End_Error =>
+ -- ignore this error. It happens when redirecting input from /dev/null
+ return;
+
+ end Pause_And_Screen_Number;
+
+--PAGE
+--
+-- 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 = True then
+ Text_IO.New_Line;
+ end if;
+
+ end Put_Name;
+
+--PAGE
+--
+-- Task_Number
+--
+
+ function Task_Number (
+ TID : in RTEMS.ID
+ ) return RTEMS.Unsigned32 is
+ begin
+
+ return RTEMS.Get_Index( TID ) -
+ RTEMS.Configuration.RTEMS_API_Configuration.Number_Of_Initialization_Tasks;
+
+ end Task_Number;
+
+--PAGE
+--
+-- Do_Nothing
+--
+
+ procedure Do_Nothing is
+ begin
+ NULL;
+ end Do_Nothing;
+
+
+--PAGE
+--
+-- Milliseconds_Per_Tick
+--
+
+ function Milliseconds_Per_Tick
+ return RTEMS.Unsigned32 is
+ begin
+ return RTEMS.Configuration.Microseconds_Per_Tick / 1000;
+ end Milliseconds_Per_Tick;
+end Test_Support;
diff --git a/c/src/ada-tests/support/test_support.ads b/c/src/ada-tests/support/test_support.ads
new file mode 100644
index 0000000000..af429de643
--- /dev/null
+++ b/c/src/ada-tests/support/test_support.ads
@@ -0,0 +1,173 @@
+--
+-- Test_Support / SPECIFICATION
+--
+-- DESCRIPTION:
+--
+-- This package provides routines which aid the Test Suites
+-- and simplify their design and operation.
+--
+-- DEPENDENCIES:
+--
+--
+--
+-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+-- On-Line Applications Research Corporation (OAR).
+-- All rights assigned to U.S. Government, 1994.
+--
+-- This material may be reproduced by or for the U.S. Government pursuant
+-- to the copyright license under the clause at DFARS 252.227-7013. This
+-- notice must appear in all copies of this file and its derivatives.
+--
+-- test_support.ads,v 1.1 1995/07/12 19:38:15 joel Exp
+--
+
+with Interfaces; use Interfaces;
+with RTEMS;
+with Text_IO;
+
+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.
+--
+
+ Ticks_Per_Second : RTEMS.Interval;
+ pragma Import (C, Ticks_Per_Second, "_TOD_Ticks_per_second");
+
+--
+-- Milliseconds_Per_Tick is the number of milliseconds which
+-- occur between each RTEMS clock tick.
+--
+
+ function Milliseconds_Per_Tick
+ return RTEMS.Unsigned32;
+
+private
+
+end Test_Support;
diff --git a/c/src/ada-tests/support/unsigned32_io.ads b/c/src/ada-tests/support/unsigned32_io.ads
new file mode 100644
index 0000000000..dac1c055b3
--- /dev/null
+++ b/c/src/ada-tests/support/unsigned32_io.ads
@@ -0,0 +1,28 @@
+--
+-- 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, 1990, 1991, 1992, 1993, 1994.
+-- On-Line Applications Research Corporation (OAR).
+-- All rights assigned to U.S. Government, 1994.
+--
+-- This material may be reproduced by or for the U.S. Government pursuant
+-- to the copyright license under the clause at DFARS 252.227-7013. This
+-- notice must appear in all copies of this file and its derivatives.
+--
+-- unsigned32_io.ads,v 1.1 1995/07/12 19:37:33 joel Exp
+--
+
+with RTEMS;
+with Text_IO;
+
+package Unsigned32_IO is new Text_IO.Modular_IO( RTEMS.Unsigned32 );
+