summaryrefslogtreecommitdiffstats
path: root/c/src/ada-tests/sptests/spname01/sptest.adb
blob: 5dd78d8e4a8430ba0b5ec49f455a3b12f628d62d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--
--  SPTEST / BODY
--
--  DESCRIPTION:
--
--  This package is the implementation of the Ada Task Name test of the RTEMS
--  Ada Single Processor Test Suite.
--
--  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;
with TEST_SUPPORT;
with TEXT_IO;
with System; use System;  -- for Null Pointer comparison

package body SPTEST is

   task body AdaTask is
      Status     : RTEMS.Status_Codes;
      Pointer    : RTEMS.Address;
      StringName : String(1 .. 120) := (1 .. 120 => '*' );
      NewName    : constant String  := "Josiah";
   begin

      TEXT_IO.NEW_LINE( 2 );
      TEXT_IO.PUT_LINE( "*** Ada Task Name TEST ***" );

      RTEMS.Object_Get_Name( RTEMS.Self, StringName, Pointer );
      if Pointer = RTEMS.Null_Address then
         TEXT_IO.PUT_LINE( "Object_Get_Name_Failed" );
      else
         TEXT_IO.PUT_LINE( "My name is (" & StringName & ")" );
      end if;

      TEXT_IO.PUT_LINE( "Setting name to (Josiah)" );
      RTEMS.Object_Set_Name( RTEMS.Self, NewName, Status );
      TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "Object_Set_Name" );

      RTEMS.Object_Get_Name( RTEMS.Self, StringName, Pointer );
      if Pointer = RTEMS.Null_Address then
         TEXT_IO.PUT_LINE( "Object_Get_Name_Failed" );
      else
         TEXT_IO.PUT_LINE( "My name is (" & StringName & ")" );
      end if;

      TEXT_IO.PUT_LINE( "*** END OF Ada Task Name TEST ***" );

      RTEMS.SHUTDOWN_EXECUTIVE( 0 );

   end AdaTask;

end SPTEST;