source: rtems/c/src/ada-tests/sptests/spname01/sptest.adb @ 3ca942a

4.104.114.95
Last change on this file since 3ca942a was 3ca942a, checked in by Joel Sherrill <joel.sherrill@…>, on 02/04/08 at 17:18:01

2008-02-04 Joel Sherrill <joel.sherrill@…>

  • configure.ac, sptests/Makefile.am: Exercise passing as object Id of SELF.
  • sptests/spname01/.cvsignore, sptests/spname01/Makefile.am, sptests/spname01/ada_spname01.scn, sptests/spname01/spname01.adb, sptests/spname01/sptest.adb, sptests/spname01/sptest.ads: New files.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1--
2--  SPTEST / BODY
3--
4--  DESCRIPTION:
5--
6--  This package is the implementation of the Ada Task Name test of the RTEMS
7--  Ada Single Processor Test Suite.
8--
9--  DEPENDENCIES:
10--
11-- 
12--
13--  COPYRIGHT (c) 1989-2008.
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.rtems.com/license/LICENSE.
19--
20--  $Id$
21--
22
23with INTERFACES; use INTERFACES;
24with RTEMS;
25with TEST_SUPPORT;
26with TEXT_IO;
27with Ada.Strings.Unbounded;
28with System; use System;  -- for Null Pointer comparison
29
30package body SPTEST is
31
32   task body AdaTask is
33      Status     : RTEMS.Status_Codes;
34      Pointer    : RTEMS.Address;
35      StringName : String(1 .. 120) := (1 .. 120 => '*' );
36      NewName    : constant String  := "Josiah";
37   begin
38
39      TEXT_IO.NEW_LINE( 2 );
40      TEXT_IO.PUT_LINE( "*** Ada Task Name TEST ***" );
41
42      RTEMS.Object_Get_Name( RTEMS.Self, StringName, Pointer );
43      if Pointer = RTEMS.Null_Address then
44         TEXT_IO.PUT_LINE( "Object_Get_Name_Failed" );
45      else
46         TEXT_IO.PUT_LINE( "My name is (" & StringName & ")" );
47      end if;
48
49      TEXT_IO.PUT_LINE( "Setting name to (Josiah)" );
50      RTEMS.Object_Set_Name( RTEMS.Self, NewName, Status );
51      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "Object_Set_Name" );
52
53      RTEMS.Object_Get_Name( RTEMS.Self, StringName, Pointer );
54      if Pointer = RTEMS.Null_Address then
55         TEXT_IO.PUT_LINE( "Object_Get_Name_Failed" );
56      else
57         TEXT_IO.PUT_LINE( "My name is (" & StringName & ")" );
58      end if;
59
60      TEXT_IO.PUT_LINE( "*** END OF Ada Task Name TEST ***" );
61
62      RTEMS.SHUTDOWN_EXECUTIVE( 0 );
63
64   end AdaTask;
65
66end SPTEST;
Note: See TracBrowser for help on using the repository browser.