-- CXD1007.A -- -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687 and -- F08630-91-C-0015, 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 technical data and -- 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. --* -- -- OBJECTIVE: -- Check that a priority pragma has no effect if it occurs in the -- declarative_part of a subprogram_body other than the main -- subprogram. -- Check that the priority specified for the main subprogram sets -- the priority of the environment task. -- Check that dynamic values can be specified in the interrupt_priority -- and priority pragmas. -- -- TEST DESCRIPTION: -- This test declares two subprograms, both of which contain pragma -- priority declarations. A check is made that only the real main -- procedure's priority is used for the environment task. -- Note that the check is performed in the non-main subprogram -- so the priority expected is not the priority specified in the -- pragma priority declaration in that subprogram. -- Tasks are declared where the priorities for the tasks are dynamic -- values. Each task's priority is checked. -- The package Ada.Dynamic_Priorities is used to query the priority -- of the tasks (including the environment task). -- -- APPLICABILITY CRITERIA: -- This test applies only to implementations supporting the -- Real-Time Systems Annex. -- -- -- CHANGE HISTORY: -- 18 SEP 95 SAIC Initial version -- --! -- not the main procedure with System; with Report; with Ada.Dynamic_Priorities; procedure CXD1007_1 is Verbose : constant Boolean := False; This_Procedure_Priority : constant System.Priority := System.Default_Priority - 2; Real_Main_Priority : constant System.Priority := System.Default_Priority + 3; pragma Priority (This_Procedure_Priority); P : System.Any_Priority; begin P := Ada.Dynamic_Priorities.Get_Priority; if P = This_Procedure_Priority then Report.Failed ("pragma priority for non-main procedure" & " was not ignored"); elsif P /= Real_Main_Priority then Report.Failed ("expected main priority to be" & System.Any_Priority'Image (Real_Main_Priority) & " but the priority was" & System.Any_Priority'Image (P) ); else if Verbose then Report.Comment ("main priority is" & System.Any_Priority'Image (P)); end if; end if; end CXD1007_1; with System; with Report; with Ada.Dynamic_Priorities; with CXD1007_1; procedure CXD1007 is Verbose : constant Boolean := False; This_Procedure_Priority : constant System.Priority := System.Default_Priority - 2; Real_Main_Priority : constant System.Priority := System.Default_Priority + 3; pragma Priority (Real_Main_Priority); Check_2_Priority : System.Any_Priority; begin Report.Test ("CXD1007", "Check the priority of the environment task" & " and priorities set with dynamic expressions"); -- check the priority of the main procedure. CXD1007_1; declare task Check_1 is pragma Priority (Report.Ident_Int (System.Default_Priority + 5)); end Check_1; task body Check_1 is P : System.Any_Priority; begin P := Ada.Dynamic_Priorities.Get_Priority; if P /= System.Default_Priority + 5 then Report.Failed ("expected task priority to be" & System.Any_Priority'Image (System.Default_Priority + 5) & " but the priority was" & System.Any_Priority'Image (P) ); else if Verbose then Report.Comment ("Check_1 priority is" & System.Any_Priority'Image (P) & " which is System.Default_Priority + 5" ); end if; end if; end Check_1; task Check_2 is pragma Interrupt_Priority ( Report.Ident_Int (System.Interrupt_Priority'First)); end Check_2; task body Check_2 is begin Check_2_Priority := Ada.Dynamic_Priorities.Get_Priority; end Check_2; begin null; end; if Check_2_Priority /= System.Interrupt_Priority'First then Report.Failed ("expected task priority to be" & System.Any_Priority'Image (System.Interrupt_Priority'First) & " but the priority was" & System.Any_Priority'Image (Check_2_Priority) ); else if Verbose then Report.Comment ("Check_2 priority is" & System.Any_Priority'Image (Check_2_Priority) & " which is System.Interrupt_Priority'First" ); end if; end if; Report.Result; end CXD1007;