-- BXC30TV.A -- -- Grant of Unlimited Rights -- -- The Ada Conformity Assessment Authority (ACAA) holds unlimited -- rights in the software and documentation contained herein. Unlimited -- rights are the same as those granted by the U.S. Government for older -- parts of the Ada Conformity Assessment Test Suite, and are defined -- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA -- intends to confer upon all recipients unlimited rights equal to those -- held by the ACAA. 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 ACAA 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. -- -- Notice -- -- The ACAA has created and maintains the Ada Conformity Assessment Test -- Suite for the purpose of conformity assessments conducted in accordance -- with the International Standard ISO/IEC 18009 - Ada: Conformity -- assessment of a language processor. This test suite should not be used -- to make claims of conformance unless used in accordance with -- ISO/IEC 18009 and any applicable ACAA procedures. -- -- OBJECTIVE: -- Check that if either the Attach_Handler or Interrupt_Handler aspect is -- specified for a protected procedure, the corresponding protected declaration -- must be at library-level. (C.3.1(7/3)). -- -- TEST DESCRIPTION: -- Declare a protected object that uses an Attach_Handler aspect and a main procedure -- that attempts to detach the interrupt that was attached by the aspect specification -- -- CHANGE HISTORY: -- 21 Jan 12 TV Initial version. -- --! with Ada.Interrupts; with System; with ImpDef.Annex_C; with Report; with CXC300TV_0; use CXC300TV_0; -- reusing declaration from C-Test procedure BXC30TV is Device_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'Last; An_Interrupt_Id : constant Ada.Interrupts.Interrupt_Id := Impdef.Annex_C.Interrupt_To_Generate; A_Handler : Device_Interface_T (Prio => Device_Priority, Int_Id => An_Interrupt_Id); -- legal -- begin Report.Test ("BXC30TV", "Legality test: the protected procedure for which " & "the Attach_Handler aspect is specified must be at library-level"); if Ada.Interrupts.Is_Attached (An_Interrupt_Id) then -- Handler is attached we can continue declare Dev_Priority : constant System.Interrupt_Priority := System.Interrupt_Priority'First; Another_Interrupt_Id : constant Ada.Interrupts.Interrupt_Id := Impdef.Annex_C.Interrupt_To_Generate; Another_Handler : Device_Interface_T -- illegal C.3.1(7/3) (Prio => Dev_Priority, Int_Id => Another_Interrupt_Id); begin if Ada.Interrupts.Is_Attached (Another_Interrupt_Id) then Report.Failure ("Implementation allowed attaching illegal handler"); else Report.Failure ("Implementation allowed using Attach_Handler aspect on " & "protected procedure below library level"); end if; end; else Report.Failed ("Implementation did not attach legal handler"); end if; -- end BXC30TV; -- Editor's note: In response to a request for comments on the above, I wrote: -- --Five things: -- --(1) B-Tests don't usually call Report (since they're not supposed to be executed). If you --leave the calls of Report in here, you missed the call to Report.Result (which reports the --Passed or Failed result). But I'd just delete them (and the with of Report). -- --(2) If you want to reuse the declarations between multiple tests, those declarations have --to be put into a "foundation" package (which starts with F, and whose fifth character is a --sequence letter, usually A). Then each of the tests can use that foundation, and their names --need to include that sequence letter in the fifth position. They both have to have the same --section reference in characters 2-4, which is the case here. -- --(3) The non-errors and errors ought to be marked with "-- OK" and "-- ERROR:". -- --(4) The line marked "-- legal" in your test isn't legal, because the declaration of the object --is inside of a procedure -- so it isn't at library-level. -- --(5) The objective says that if either Attach_Handler or Interrupt_Handler is specified... I don't --see any test case for aspect Interrupt_Handler, just for Attach_Handler. That needs to be added --to the foundation. -- --Other than those, it looks great! :-) -- --These things need to be fixed before this is issued.