OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c9/] [c951001.a] - Diff between revs 154 and 816

Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
-- C951001.A
-- C951001.A
--
--
--                             Grant of Unlimited Rights
--                             Grant of Unlimited Rights
--
--
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
--     unlimited rights in the software and documentation contained herein.
--     unlimited rights in the software and documentation contained herein.
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
--     this public release, the Government intends to confer upon all
--     this public release, the Government intends to confer upon all
--     recipients unlimited rights  equal to those held by the Government.
--     recipients unlimited rights  equal to those held by the Government.
--     These rights include rights to use, duplicate, release or disclose the
--     These rights include rights to use, duplicate, release or disclose the
--     released technical data and computer software in whole or in part, in
--     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
--     any manner and for any purpose whatsoever, and to have or permit others
--     to do so.
--     to do so.
--
--
--                                    DISCLAIMER
--                                    DISCLAIMER
--
--
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--     PARTICULAR PURPOSE OF SAID MATERIAL.
--     PARTICULAR PURPOSE OF SAID MATERIAL.
--*
--*
--
--
-- OBJECTIVE:
-- OBJECTIVE:
--      Check that two procedures in a protected object will not be
--      Check that two procedures in a protected object will not be
--      executed concurrently.
--      executed concurrently.
--
--
-- TEST DESCRIPTION:
-- TEST DESCRIPTION:
--      A very simple example of two tasks calling two procedures in the same
--      A very simple example of two tasks calling two procedures in the same
--      protected object is used.  Test control code has been added to the
--      protected object is used.  Test control code has been added to the
--      procedures such that, whichever gets called first executes a lengthy
--      procedures such that, whichever gets called first executes a lengthy
--      calculation giving sufficient time (on a multiprocessor or a
--      calculation giving sufficient time (on a multiprocessor or a
--      time-slicing machine) for the other task to get control and call the
--      time-slicing machine) for the other task to get control and call the
--      other procedure.  The control code verifies that entry to the second
--      other procedure.  The control code verifies that entry to the second
--      routine is postponed until the first is complete.
--      routine is postponed until the first is complete.
--
--
--
--
-- CHANGE HISTORY:
-- CHANGE HISTORY:
--      06 Dec 94   SAIC    ACVC 2.0
--      06 Dec 94   SAIC    ACVC 2.0
--
--
--!
--!
with Report;
with Report;
with ImpDef;
with ImpDef;
procedure C951001 is
procedure C951001 is
   protected Ramp_31 is
   protected Ramp_31 is
      procedure Add_Meter_Queue;
      procedure Add_Meter_Queue;
      procedure Subtract_Meter_Queue;
      procedure Subtract_Meter_Queue;
      function  TC_Failed return Boolean;
      function  TC_Failed return Boolean;
   private
   private
      Ramp_Count : integer range 0..20 := 4;  -- Start test with some
      Ramp_Count : integer range 0..20 := 4;  -- Start test with some
                                              -- vehicles on the ramp
                                              -- vehicles on the ramp
      TC_Add_Started       : Boolean := false;
      TC_Add_Started       : Boolean := false;
      TC_Subtract_Started  : Boolean := false;
      TC_Subtract_Started  : Boolean := false;
      TC_Add_Finished      : Boolean := false;
      TC_Add_Finished      : Boolean := false;
      TC_Subtract_Finished : Boolean := false;
      TC_Subtract_Finished : Boolean := false;
      TC_Concurrent_Running: Boolean := false;
      TC_Concurrent_Running: Boolean := false;
   end Ramp_31;
   end Ramp_31;
   protected body Ramp_31 is
   protected body Ramp_31 is
      function TC_Failed return Boolean is
      function TC_Failed return Boolean is
      begin
      begin
         -- this indicator will have been set true if any instance
         -- this indicator will have been set true if any instance
         -- of concurrent running has been proved
         -- of concurrent running has been proved
         return TC_Concurrent_Running;
         return TC_Concurrent_Running;
      end TC_Failed;
      end TC_Failed;
      procedure Add_Meter_Queue is
      procedure Add_Meter_Queue is
      begin
      begin
         --==================================================
         --==================================================
         -- This section is all Test_Control code
         -- This section is all Test_Control code
         TC_Add_Started := true;
         TC_Add_Started := true;
         if TC_Subtract_Started then
         if TC_Subtract_Started then
            if not TC_Subtract_Finished then
            if not TC_Subtract_Finished then
               TC_Concurrent_Running := true;
               TC_Concurrent_Running := true;
            end if;
            end if;
         else
         else
            -- Subtract has not started.
            -- Subtract has not started.
            -- Execute a lengthy routine to give it a chance to do so
            -- Execute a lengthy routine to give it a chance to do so
            ImpDef.Exceed_Time_Slice;
            ImpDef.Exceed_Time_Slice;
            if TC_Subtract_Started then
            if TC_Subtract_Started then
               -- Subtract was able to start so we have concurrent
               -- Subtract was able to start so we have concurrent
               -- running and the test has failed
               -- running and the test has failed
               TC_Concurrent_Running := true;
               TC_Concurrent_Running := true;
            end if;
            end if;
         end if;
         end if;
         TC_Add_Finished := true;
         TC_Add_Finished := true;
         --==================================================
         --==================================================
         Ramp_Count := Ramp_Count + 1;
         Ramp_Count := Ramp_Count + 1;
      end Add_Meter_Queue;
      end Add_Meter_Queue;
      procedure Subtract_Meter_Queue is
      procedure Subtract_Meter_Queue is
      begin
      begin
         --==================================================
         --==================================================
         -- This section is all Test_Control code
         -- This section is all Test_Control code
         TC_Subtract_Started := true;
         TC_Subtract_Started := true;
         if TC_Add_Started then
         if TC_Add_Started then
            if not TC_Add_Finished then
            if not TC_Add_Finished then
               -- We already have concurrent running
               -- We already have concurrent running
               TC_Concurrent_Running := true;
               TC_Concurrent_Running := true;
            end if;
            end if;
         else
         else
            -- Add has not started.
            -- Add has not started.
            -- Execute a lengthy routine to give it a chance to do so
            -- Execute a lengthy routine to give it a chance to do so
            ImpDef.Exceed_Time_Slice;
            ImpDef.Exceed_Time_Slice;
            if TC_Add_Started then
            if TC_Add_Started then
               -- Add was able to start so we have concurrent
               -- Add was able to start so we have concurrent
               -- running and the test has failed
               -- running and the test has failed
               TC_Concurrent_Running := true;
               TC_Concurrent_Running := true;
            end if;
            end if;
         end if;
         end if;
         TC_Subtract_Finished := true;
         TC_Subtract_Finished := true;
         --==================================================
         --==================================================
         Ramp_Count := Ramp_Count - 1;
         Ramp_Count := Ramp_Count - 1;
      end Subtract_Meter_Queue;
      end Subtract_Meter_Queue;
   end Ramp_31;
   end Ramp_31;
begin
begin
   Report.Test ("C951001", "Check that two procedures in a protected" &
   Report.Test ("C951001", "Check that two procedures in a protected" &
                           " object will not be executed concurrently");
                           " object will not be executed concurrently");
   declare -- encapsulate the test
   declare -- encapsulate the test
      task Vehicle_1;
      task Vehicle_1;
      task Vehicle_2;
      task Vehicle_2;
      -- Vehicle_1 and Vehicle_2 are simulations of Instances of the task
      -- Vehicle_1 and Vehicle_2 are simulations of Instances of the task
      -- of type Vehicle in different stages of execution
      -- of type Vehicle in different stages of execution
      task body Vehicle_1 is
      task body Vehicle_1 is
      begin
      begin
         null;  -- ::::: stub.  preparation code
         null;  -- ::::: stub.  preparation code
         -- Add to the count of vehicles on the queue
         -- Add to the count of vehicles on the queue
         Ramp_31.Add_Meter_Queue;
         Ramp_31.Add_Meter_Queue;
         null;  -- ::::: stub:  wait at the meter then pass to first sensor
         null;  -- ::::: stub:  wait at the meter then pass to first sensor
         -- Reduce the count of vehicles on the queue
         -- Reduce the count of vehicles on the queue
         null;  -- ::::: stub: Ramp_31.Subtract_Meter_Queue
         null;  -- ::::: stub: Ramp_31.Subtract_Meter_Queue
      exception
      exception
         when others =>
         when others =>
               Report.Failed ("Unexpected Exception in Vehicle_1 task");
               Report.Failed ("Unexpected Exception in Vehicle_1 task");
      end Vehicle_1;
      end Vehicle_1;
      task body Vehicle_2 is
      task body Vehicle_2 is
      begin
      begin
         null;  -- ::::: stub.  preparation code
         null;  -- ::::: stub.  preparation code
         -- Add to the count of vehicles on the queue
         -- Add to the count of vehicles on the queue
         null;  -- ::::: stub Ramp_31.Add_Meter_Queue;
         null;  -- ::::: stub Ramp_31.Add_Meter_Queue;
         null;  -- ::::: stub:  wait at the meter then pass to first sensor
         null;  -- ::::: stub:  wait at the meter then pass to first sensor
         -- Reduce the count of vehicles on the queue
         -- Reduce the count of vehicles on the queue
         Ramp_31.Subtract_Meter_Queue;
         Ramp_31.Subtract_Meter_Queue;
      exception
      exception
         when others =>
         when others =>
               Report.Failed ("Unexpected Exception in Vehicle_2 task");
               Report.Failed ("Unexpected Exception in Vehicle_2 task");
      end Vehicle_2;
      end Vehicle_2;
   begin
   begin
      null;
      null;
   end;   -- encapsulation
   end;   -- encapsulation
   if Ramp_31.TC_Failed then
   if Ramp_31.TC_Failed then
      Report.Failed ("Concurrent Running detected");
      Report.Failed ("Concurrent Running detected");
   end if;
   end if;
   Report.Result;
   Report.Result;
end C951001;
end C951001;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.