florist_blady_6.1.0_05ac0091/tests/p120200.adb

 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
------------------------------------------------------------------------------
--                                                                          --
--                      POSIX.5b VALIDATION TEST SUITE                      --
--                                                                          --
--                             P 1 2 0 2 0 0                                --
--                                                                          --
--                                B o d y                                   --
--                                                                          --
--                                                                          --
--  Copyright (c) 1995-1999 Florida  State  University  (FSU).  All Rights  --
--  Reserved.                                                               --
--                                                                          --
--  This is free software;  you can redistribute it and/or modify it under  --
--  terms of the  GNU  General  Public  License  as published by the  Free  --
--  Software Foundation;  either version 2, or (at your option) any  later  --
--  version.  This  software  is distributed  in the hope that it  will be  --
--  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  --
--  MERCHANTABILITY   or  FITNESS FOR A PARTICULAR PURPOSE.   See the  GNU  --
--  General Public License for more details.  You  should have  received a  --
--  copy of the GNU General Public License  distributed  with  GNARL;  see  --
--  file  COPYING.  If not,  write to  the  Free  Software  Foundation, 59  --
--  Temple Place - Suite 330, Boston, MA 02111-1307, USA.                   --
--                                                                          --
--  Under contract  GS-35F-4506G, the U. S. Government obtained  unlimited  --
--  rights in the software and documentation contained herein.   Unlimited  --
--  rights are defined in DFAR 252,227-7013(a)(19).  By making this public  --
--  release,   the  Government  intends  to  confer  upon  all  recipients  --
--  unlimited  rights equal to those held by the Government.  These rights  --
--  include rights to use,  duplicate,  release  or  disclose the released  --
--  data an computer software  in whole or in part,  in any manner and for  --
--  any purpose whatsoever, and to have or permit others to do so.          --
--                                                                          --
--  DISCLAIMER   --   ALL MATERIALS OR INFORMATION HEREIN RELEASED,   MADE  --
--  AVAILABLE OR DISCLOSED ARE AS IS.   THE GOVERNMENT MAKES NO EXPRESS OR  --
--  IMPLIED WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS  --
--  OF THE SOFTWARE,  DOCUMENTATION  OR  OTHER INFORMATION RELEASED,  MADE  --
--  AVAILABLE OR DISCLOSED,  OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS  --
--  FOR A PARTICULAR PURPOSE OF SAID MATERIAL.                              --
--                                                                          --
------------------------------------------------------------------------------

--  [$Revision: 1.12 $]

--  This test does not check that the operation has any effect;
--  just that it can be called.

with POSIX,
     POSIX_Memory_Range_Locking,
     POSIX_Page_Alignment,
     POSIX_Report,
     System.Storage_Elements;
procedure p120200 is
   use POSIX,
       POSIX_Memory_Range_Locking,
       POSIX_Report,
       System.Storage_Elements;

   X : Integer := 10;
   Addr : System.Address := POSIX_Page_Alignment.Truncate_To_Page (X'Address);
   Len  : System.Storage_Elements.Storage_Offset := 100;

begin

   Header ("p120200", Root_OK => True);

   -----------------------------------------------------------------------

   begin
      Test ("Lock_Range (Options) [12.2.1]");
      Lock_Range (Addr, Len);
      --  should not have resource problem
   exception
   when E1 : POSIX.POSIX_Error =>
      Privileged (Memory_Locking_Privilege,
        Memory_Range_Locking_Option, Operation_Not_Implemented, E1, "A001");
   when E2 : others => Unexpected_Exception (E2, "A002");
   end;

   -----------------------------------------------------------------------

   begin
      Test ("Unlock_Range [12.2.1]");
      Unlock_Range (Addr, Len);
   exception
   when E1 : POSIX.POSIX_Error =>
      Privileged (Memory_Locking_Privilege,
        Memory_Range_Locking_Option, Operation_Not_Implemented, E1, "A003");
   when E2 : others => Unexpected_Exception (E2, "A004");
   end;

   -----------------------------------------------------------------------

   Done;
exception when E : others => Fatal_Exception (E, "A005");
end p120200;