source: rtems/c/src/ada-tests/support/test_support.adb @ 948a069

Last change on this file since 948a069 was f6bcc8f, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 1:25:16 PM

2003-09-04 Joel Sherrill <joel@…>

  • samples/base_sp/base_sp.adb, samples/base_sp/config.h, samples/base_sp/sptest.adb, samples/base_sp/sptest.ads, samples/hello/config.h, samples/hello/hello.adb, samples/hello/sptest.adb, samples/hello/sptest.ads, samples/ticker/config.h, samples/ticker/sptest.adb, samples/ticker/sptest.ads, samples/ticker/ticker.adb, sptests/sp01/config.h, sptests/sp01/sp01.adb, sptests/sp01/sptest.adb, sptests/sp01/sptest.ads, sptests/sp02/config.h, sptests/sp02/sp02.adb, sptests/sp02/sptest.adb, sptests/sp02/sptest.ads, sptests/sp03/config.h, sptests/sp03/sp03.adb, sptests/sp03/sptest.adb, sptests/sp03/sptest.ads, sptests/sp04/config.h, sptests/sp04/sp04.adb, sptests/sp04/sptest.adb, sptests/sp04/sptest.ads, sptests/sp05/config.h, sptests/sp05/sp05.adb, sptests/sp05/sptest.adb, sptests/sp05/sptest.ads, sptests/sp06/config.h, sptests/sp06/sp06.adb, sptests/sp06/sptest.adb, sptests/sp06/sptest.ads, sptests/sp07/config.h, sptests/sp07/sp07.adb, sptests/sp07/sptest.adb, sptests/sp07/sptest.ads, sptests/sp08/config.h, sptests/sp08/sp08.adb, sptests/sp08/sptest.adb, sptests/sp08/sptest.ads, sptests/sp09/config.h, sptests/sp09/sp09.adb, sptests/sp09/sptest.adb, sptests/sp09/sptest.ads, sptests/sp11/config.h, sptests/sp11/sp11.adb, sptests/sp11/sptest.adb, sptests/sp11/sptest.ads, sptests/sp12/config.h, sptests/sp12/sp12.adb, sptests/sp12/sptest.adb, sptests/sp12/sptest.ads, sptests/sp13/config.h, sptests/sp13/sp13.adb, sptests/sp13/sptest.adb, sptests/sp13/sptest.ads, sptests/sp14/config.h, sptests/sp14/sp14.adb, sptests/sp14/sptest.adb, sptests/sp14/sptest.ads, sptests/sp15/config.h, sptests/sp15/sp15.adb, sptests/sp15/sptest.adb, sptests/sp15/sptest.ads, sptests/sp16/config.h, sptests/sp16/sp16.adb, sptests/sp16/sptest.adb, sptests/sp16/sptest.ads, sptests/sp17/config.h, sptests/sp17/sp17.adb, sptests/sp17/sptest.adb, sptests/sp17/sptest.ads, sptests/sp19/config.h, sptests/sp19/sp19.adb, sptests/sp19/sptest.adp, sptests/sp19/sptest.ads, sptests/sp20/config.h, sptests/sp20/sp20.adb, sptests/sp20/sptest.adb, sptests/sp20/sptest.ads, sptests/sp21/config.h, sptests/sp21/sp21.adb, sptests/sp21/sptest.adb, sptests/sp21/sptest.ads, sptests/sp22/config.h, sptests/sp22/sp22.adb, sptests/sp22/sptest.adb, sptests/sp22/sptest.ads, sptests/sp23/config.h, sptests/sp23/sp23.adb, sptests/sp23/sptest.adb, sptests/sp23/sptest.ads, sptests/sp24/config.h, sptests/sp24/sp24.adb, sptests/sp24/sptest.adb, sptests/sp24/sptest.ads, sptests/sp25/config.h, sptests/sp25/sp25.adb, sptests/sp25/sptest.adb, sptests/sp25/sptest.ads, sptests/spsize/spsize.adb, sptests/spsize/sptest.adb, sptests/spsize/sptest.ads, support/address_io.adb, support/address_io.ads, support/float_io.ads, support/fp.inc, support/init.c, support/integer.inc, support/rtems_calling_overhead.ads, support/status_io.ads, support/test_support.adb, support/test_support.ads, support/time_test_support.adb, support/time_test_support.ads, support/timer_driver.adb, support/timer_driver.ads, support/unsigned32_io.ads, tmtests/tm01/config.h, tmtests/tm01/tm01.adb, tmtests/tm01/tmtest.adb, tmtests/tm01/tmtest.ads, tmtests/tm02/config.h, tmtests/tm02/tm02.adb, tmtests/tm02/tmtest.adb, tmtests/tm02/tmtest.ads, tmtests/tm03/config.h, tmtests/tm03/tm03.adb, tmtests/tm03/tmtest.adb, tmtests/tm03/tmtest.ads, tmtests/tm04/config.h, tmtests/tm04/tm04.adb, tmtests/tm04/tmtest.adb, tmtests/tm04/tmtest.ads, tmtests/tm05/config.h, tmtests/tm05/tm05.adb, tmtests/tm05/tmtest.adb, tmtests/tm05/tmtest.ads, tmtests/tm06/config.h, tmtests/tm06/tm06.adb, tmtests/tm06/tmtest.adb, tmtests/tm06/tmtest.ads, tmtests/tm07/config.h, tmtests/tm07/tm07.adb, tmtests/tm07/tmtest.adb, tmtests/tm07/tmtest.ads, tmtests/tm08/config.h, tmtests/tm08/tm08.adb, tmtests/tm08/tmtest.adb, tmtests/tm08/tmtest.ads, tmtests/tm09/config.h, tmtests/tm09/tm09.adb, tmtests/tm09/tmtest.adb, tmtests/tm09/tmtest.ads, tmtests/tm10/config.h, tmtests/tm10/tm10.adb, tmtests/tm10/tmtest.adb, tmtests/tm10/tmtest.ads, tmtests/tm11/config.h, tmtests/tm11/tm11.adb, tmtests/tm11/tmtest.adb, tmtests/tm11/tmtest.ads, tmtests/tm12/config.h, tmtests/tm12/tm12.adb, tmtests/tm12/tmtest.adb, tmtests/tm12/tmtest.ads, tmtests/tm13/config.h, tmtests/tm13/tm13.adb, tmtests/tm13/tmtest.adb, tmtests/tm13/tmtest.ads, tmtests/tm14/config.h, tmtests/tm14/tm14.adb, tmtests/tm14/tmtest.adb, tmtests/tm14/tmtest.ads, tmtests/tm15/config.h, tmtests/tm15/tm15.adb, tmtests/tm15/tmtest.adb, tmtests/tm15/tmtest.ads, tmtests/tm16/config.h, tmtests/tm16/tm16.adb, tmtests/tm16/tmtest.adb, tmtests/tm16/tmtest.ads, tmtests/tm17/config.h, tmtests/tm17/tm17.adb, tmtests/tm17/tmtest.adb, tmtests/tm17/tmtest.ads, tmtests/tm18/config.h, tmtests/tm18/tm18.adb, tmtests/tm18/tmtest.adb, tmtests/tm18/tmtest.ads, tmtests/tm19/config.h, tmtests/tm19/tm19.adb, tmtests/tm19/tmtest.adb, tmtests/tm19/tmtest.ads, tmtests/tm20/config.h, tmtests/tm20/tm20.adb, tmtests/tm20/tmtest.adb, tmtests/tm20/tmtest.ads, tmtests/tm21/config.h, tmtests/tm21/tm21.adb, tmtests/tm21/tmtest.adb, tmtests/tm21/tmtest.ads, tmtests/tm22/config.h, tmtests/tm22/tm22.adb, tmtests/tm22/tmtest.adb, tmtests/tm22/tmtest.ads, tmtests/tm23/config.h, tmtests/tm23/tm23.adb, tmtests/tm23/tmtest.adb, tmtests/tm23/tmtest.ads, tmtests/tm24/config.h, tmtests/tm24/tm24.adb, tmtests/tm24/tmtest.adb, tmtests/tm24/tmtest.ads, tmtests/tm25/config.h, tmtests/tm25/tm25.adb, tmtests/tm25/tmtest.adb, tmtests/tm25/tmtest.ads, tmtests/tm28/config.h, tmtests/tm28/tm28.adb, tmtests/tm28/tmtest.adb, tmtests/tm28/tmtest.ads, tmtests/tm29/config.h, tmtests/tm29/tm29.adb, tmtests/tm29/tmtest.adb, tmtests/tm29/tmtest.ads, tmtests/tmck/config.h, tmtests/tmck/tmck.adb, tmtests/tmck/tmtest.adb, tmtests/tmck/tmtest.ads, tmtests/tmoverhd/config.h, tmtests/tmoverhd/dummy_rtems.adb, tmtests/tmoverhd/dummy_rtems.ads, tmtests/tmoverhd/tmoverhd.adb, tmtests/tmoverhd/tmtest.adb, tmtests/tmoverhd/tmtest.ads: Removed incorrect statement about copyright assignment.
  • Property mode set to 100644
File size: 4.5 KB
Line 
1--
2--  Test_Support / Specification
3--
4--  DESCRIPTION:
5--
6--  This package provides routines which aid the Test Suites
7--  and simplify their design and operation.
8--
9--  DEPENDENCIES:
10--
11-- 
12--
13--  COPYRIGHT (c) 1989-1997.
14--  On-Line Applications Research Corporation (OAR).
15--
16--  The license and distribution terms for this file may in
17--  the file LICENSE in this distribution or at
18--  http://www.OARcorp.com/rtems/license.html.
19--
20--  $Id$
21--
22
23with Interfaces; use Interfaces;
24with RTEMS;
25with Unsigned32_IO;
26with Status_IO;
27with Text_IO;
28
29package body Test_Support is
30
31--PAGE
32--
33--  Fatal_Directive_Status
34--
35
36   procedure Fatal_Directive_Status (
37      Status  : in     RTEMS.Status_Codes;
38      Desired : in     RTEMS.Status_Codes;
39      Message : in     String
40   ) is
41   begin
42
43      if not RTEMS.Are_Statuses_Equal( Status, Desired ) then
44
45         Text_IO.Put( Message );
46         Text_IO.Put( " FAILED -- expected " );
47         Status_IO.Put( Desired );
48         Text_IO.Put( " got " );
49         Status_IO.Put( Status );
50         Text_IO.New_Line;
51
52         RTEMS.Fatal_Error_Occurred( RTEMS.Status_Codes'Pos( Status ) );
53
54      end if;
55
56   end Fatal_Directive_Status;
57
58--PAGE
59--
60--  Directive_Failed
61--
62
63   procedure Directive_Failed (
64      Status  : in     RTEMS.Status_Codes;
65      Message : in     String
66   ) is
67   begin
68
69      Test_Support.Fatal_Directive_Status(
70         Status, 
71         RTEMS.Successful, 
72         Message
73      );
74
75   end Directive_Failed;
76
77--PAGE
78--
79--  Print_Time
80--
81
82   procedure Print_Time (
83      Prefix      : in     String;
84      Time_Buffer : in     RTEMS.Time_Of_Day;
85      Suffix      : in     String
86   ) is
87   begin
88
89      Text_IO.Put( Prefix );
90      Unsigned32_IO.Put( Time_Buffer.Hour, Width=>2 );
91      Text_IO.Put( ":" );
92      Unsigned32_IO.Put( Time_Buffer.Minute, Width=>2 );
93      Text_IO.Put( ":" );
94      Unsigned32_IO.Put( Time_Buffer.Second, Width=>2 );
95      Text_IO.Put( "   " );
96      Unsigned32_IO.Put( Time_Buffer.Month, Width=>2 );
97      Text_IO.Put( "/" );
98      Unsigned32_IO.Put( Time_Buffer.Day, Width=>2 );
99      Text_IO.Put( "/" );
100      Unsigned32_IO.Put( Time_Buffer.Year, Width=>2 );
101      Text_IO.Put( Suffix );
102
103   end Print_Time;
104
105--PAGE
106--
107--  Put_Dot
108--
109 
110   procedure Put_Dot (
111      Buffer : in     String
112   ) is
113   begin
114      Text_IO.Put( Buffer );
115      Text_IO.FLUSH;
116   end Put_Dot;
117
118--PAGE
119--
120--  Pause
121--
122
123   procedure Pause is
124      --  Ignored_String : String( 1 .. 80 );
125      --  Ignored_Last   : Natural;
126     
127   begin
128
129      --
130      --  Really should be a "put" followed by a "flush."
131      --
132      Text_IO.Put_Line( "<pause> " );
133      -- Text_IO.Get_Line( Ignored_String, Ignored_Last );
134
135   -- exception
136
137   --    when Text_IO.End_Error =>
138   --    -- ignore this error.  It happens when redirecting input from /dev/null
139   --    return;
140
141   end Pause;
142
143--PAGE
144--
145--  Pause_And_Screen_Number
146--
147 
148   procedure Pause_And_Screen_Number (
149      SCREEN : in    RTEMS.Unsigned32
150   ) is
151      --  Ignored_String : String( 1 .. 80 );
152      --  Ignored_Last   : Natural;
153   begin
154 
155      --
156      --  Really should be a "put" followed by a "flush."
157      --
158      Text_IO.Put( "<pause - screen  " );
159      Unsigned32_IO.Put( SCREEN, Width=>2 );
160      Text_IO.Put_Line( "> " );
161   --    Text_IO.Get_Line( Ignored_String, Ignored_Last );
162 
163   -- exception
164
165   --    when Text_IO.End_Error =>
166   --    -- ignore this error.  It happens when redirecting input from /dev/null
167   --    return;
168
169   end Pause_And_Screen_Number;
170
171--PAGE
172--
173--  Put_Name
174--
175
176   procedure Put_Name (
177      Name     : in     RTEMS.Name;
178      New_Line : in     Boolean
179   ) is
180      C1 : Character;
181      C2 : Character;
182      C3 : Character;
183      C4 : Character;
184   begin
185
186      RTEMS.Name_To_Characters( Name, C1, C2, C3, C4 );
187
188      Text_IO.Put( C1 );
189      Text_IO.Put( C2 );
190      Text_IO.Put( C3 );
191      Text_IO.Put( C4 );
192
193      if New_Line = True then
194         Text_IO.New_Line;
195      end if;
196
197   end Put_Name;
198 
199--PAGE
200--
201--  Task_Number
202--
203
204   function Task_Number (
205      TID : in     RTEMS.ID
206   ) return RTEMS.Unsigned32 is
207   begin
208
209      return RTEMS.Get_Index( TID ) - 1 -
210        RTEMS.Configuration.RTEMS_API_Configuration.Number_Of_Initialization_Tasks;
211
212   end Task_Number;
213
214--PAGE
215--
216--  Do_Nothing
217--
218
219   procedure Do_Nothing is
220   begin
221      NULL;
222   end Do_Nothing;
223   
224
225--PAGE
226--
227--  Milliseconds_Per_Tick
228--
229
230   function Milliseconds_Per_Tick 
231   return RTEMS.Unsigned32 is
232   begin
233      return RTEMS.Configuration.Microseconds_Per_Tick / 1000;
234   end Milliseconds_Per_Tick;
235end Test_Support;
Note: See TracBrowser for help on using the repository browser.