------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2020, Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, Université de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program 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 -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- ------------------------------------------------------------------------------ -- Last update : -- $Rev$ -- $Date$ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with io_tools; use io_tools; with Framework; use Framework; with Call_Framework; use Call_Framework; with Call_Framework_Interface; use Call_Framework_Interface; use Call_Framework_Interface.Framework_Response_Package; use Call_Framework_Interface.Framework_Request_Package; with text_io; use text_io; with Ada.exceptions; use Ada.exceptions; with Ada.directories; use Ada.directories; with unbounded_strings; use unbounded_strings; use unbounded_strings.strings_table_package; use unbounded_strings.unbounded_string_list_package; with Parameters; use Parameters; with Parameters.extended; use Parameters.extended; use Parameters.Framework_Parameters_Table_Package; with multiprocessor_services; use multiprocessor_services; with debug; use debug; package body unit_test_parameters is procedure Call_Unit_Test(service : in Framework_Statement_Type; Sys : in out system; parms : in unbounded_string) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; begin Initialize (Response_List); Initialize (Request_List); Build_Request_List (service, parms, Request_List); Sequential_Framework_Request (Sys, Request_List, Response_List); -- Display result of the called service at output stream -- for J in 0 .. Response_List.nb_entries - 1 loop put_line(to_string(Response_List.entries (j).title)); put_line(to_string(Response_List.entries (J).text)); end loop; -- Display the scheduling computed by the Cheddar service -- if one exists. -- We go throught a regular file to be able to call the pretty printer -- Write_To_Xml_File(sched, sys, to_unbounded_string("unittest.tmp") ); put_line(to_string(read_sequential_file("unittest.tmp"))); delete_file("unittest.tmp"); -- For some Cheddar services, the model will be changed and is -- part of the result ... so print it ! -- We go throught a regular file to be able to call the pretty printer -- if (service = Scheduling_Feasibility_Compute_And_Set_Worst_Case_Blocking_Time ) or (service = Memory_Set_Footprint_Analysis ) or (service = Scheduling_Feasibility_Compute_And_Set_Resource_Ceiling_Priority ) or (service = Scheduling_Feasibility_First_Fit ) or (service = Scheduling_Feasibility_General_Task ) or (service = Scheduling_Feasibility_Next_Fit ) or (service = Scheduling_Feasibility_Best_Fit ) or (service = Scheduling_Feasibility_Small_Task ) or (service = Scheduling_Set_Priorities_According_To_Deadline_Monotonic ) or (service = Scheduling_Set_Priorities_According_To_Rate_Monotonic ) or (service = Scheduling_Set_Priorities_According_To_Audsley_OPA ) or (service = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT ) or (service = Scheduling_Set_Priorities_According_To_OPA_CRPD_PT_Simplified ) or (service = Scheduling_Set_Priorities_According_To_OPA_CRPD_Tree ) or (service = Dependency_Set_End_To_End_Response_Time_One_Step ) or (service = Dependency_Set_End_To_End_Response_Time_All_Steps ) or (service = Dependency_Set_Chetto_Blazewicz_Priority ) or (service = Dependency_Set_Chetto_Blazewicz_Deadline ) or (service = Cache_Analysis_Compute_Cache_Access_Profile ) or (service = Cache_Analysis_Import_CFG ) or (service = Cache_Analysis_Import_CFG_And_Compute_Cache_Access_Profile ) or (service = Network_set_NoC_Transformation_ECTM_SAF ) or (service = Network_set_NoC_Transformation_ECTM_Wormhole ) or (service = Network_set_NoC_Transformation_WCCTM_SAF ) or (service = Network_set_NoC_Transformation_WCCTM_Wormhole ) or (service = Network_set_Spacewire_Transformation_SCM ) then Write_To_Xml_File(sys, to_unbounded_string("unittest.tmp") ); put_line(to_string(read_sequential_file("unittest.tmp"))); delete_file("unittest.tmp"); end if; end call_unit_test; procedure Build_Request_List(service : in Framework_Statement_Type; parms : in unbounded_string; request : in out Framework_Request_Table) is A_Request : Framework_Request; A_Param : Parameter_Ptr; period : integer; ok : boolean; begin case (service) is when Scheduling_Simulation_Basics | Scheduling_Simulation_Priority_Inversion | Scheduling_Simulation_Deadlock | Scheduling_Simulation_Preemption_Number | Scheduling_Simulation_Context_Switch_Number | Random_Response_Time_Density | Buffer_Scheduling_Simulation | Scheduling_Simulation_Run_Event_Handler => Initialize (A_Request); A_Request.statement := Scheduling_Simulation_Time_Line; A_Request.target := empty_string; to_integer (parms, period, Ok); if not ok then Raise_Exception (Parameter_error'Identity, to_string(parms) ); end if; put_debug("Period is " & period'img); A_Param := new Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("period"); A_Param.integer_value := Period; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_offsets"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_precedencies"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_resources"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_crpd"); A_Param.boolean_value := True; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("anomaly_detection"); A_Param.boolean_value := True; add (A_Request.param, A_Param); A_Param := new Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("seed_value"); A_Param.integer_value := 0; Add (A_Request.param, A_Param); Add (Request, A_Request); initialize(A_Request); A_Request.statement := service; A_Request.target := empty_string; Add (Request, A_Request); when Scheduling_Simulation_Time_Line => Initialize (A_Request); A_Request.statement := service; A_Request.target := empty_string; to_integer (parms, period, Ok); if not ok then Raise_Exception (Parameter_error'Identity, to_string(parms) ); end if; put_debug("Period is " & period'img); A_Param := new Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("period"); A_Param.integer_value := Period; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_offsets"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_precedencies"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_resources"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_crpd"); A_Param.boolean_value := True; add (A_Request.param, A_Param); A_Param := new Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("seed_value"); A_Param.integer_value := 0; Add (A_Request.param, A_Param); Add (Request, A_Request); when Scheduling_Simulation_Blocking_Time | Scheduling_Simulation_All_Response_Times | Scheduling_Simulation_Response_Time => Initialize (A_Request); A_Request.statement := Scheduling_Simulation_Time_Line; A_Request.target := empty_string; to_integer (parms, period, Ok); if not ok then Raise_Exception (Parameter_error'Identity, to_string(parms) ); end if; put_debug("Period is " & period'img); A_Param := new Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("period"); A_Param.integer_value := Period; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_offsets"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_precedencies"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_crpd"); A_Param.boolean_value := True; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_resources"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("seed_value"); A_Param.integer_value := 0; Add (A_Request.param, A_Param); Add (Request, A_Request); initialize(A_Request); Initialize (A_Request.param); A_Request.statement := service; A_Request.target := empty_string; A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("worst_case"); A_Param.boolean_value := True; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("best_case"); A_Param.boolean_value := True; add (A_Request.param, A_Param); A_Param := new Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("average_case"); A_Param.boolean_value := True; add (A_Request.param, A_Param); Add (Request, A_Request); when Scheduling_Feasibility_Basics | Scheduling_Feasibility_Periodic_Task_Worst_Case_Response_Time | Scheduling_Feasibility_Demand_Bound_Function | Scheduling_Feasibility_Interval | Scheduling_Feasibility_Compute_Worst_Case_Blocking_Time | Scheduling_Feasibility_Transaction_Worst_Case_Response_Time_Audsley | Scheduling_Feasibility_Transaction_Worst_Case_Response_Time_Tindell | Scheduling_Feasibility_Transaction_Worst_Case_Response_Time_Palencia | Scheduling_Feasibility_Transaction_Worst_Case_Response_Time_WCDOPS_Plus | Scheduling_Feasibility_Transaction_Worst_Case_Response_Time_WCDOPS_Plus_NIM | Scheduling_Feasibility_Cpu_Utilization | Scheduling_Feasibility_Compute_And_Set_Worst_Case_Blocking_Time | Scheduling_Feasibility_Compute_Resource_Ceiling_Priority | Scheduling_Feasibility_First_Fit | Scheduling_Feasibility_General_Task | Scheduling_Feasibility_Next_Fit | Scheduling_Feasibility_Best_Fit | Scheduling_Feasibility_Small_Task | Scheduling_Feasibility_Compute_And_Set_Resource_Ceiling_Priority | Scheduling_Set_Priorities_According_To_Deadline_Monotonic | Scheduling_Set_Priorities_According_To_Rate_Monotonic | Scheduling_Set_Priorities_According_To_Audsley_OPA | Scheduling_Set_Priorities_According_To_OPA_CRPD_PT | Scheduling_Set_Priorities_According_To_OPA_CRPD_PT_Simplified | Scheduling_Set_Priorities_According_To_OPA_CRPD_Tree | Scheduling_Compute_Scheduling_Anomalies | Dependency_Compute_End_To_End_Response_Time_One_Step | Dependency_Compute_Chetto_Blazewicz_Priority | Dependency_Compute_Chetto_Blazewicz_Deadline | Dependency_Compute_End_To_End_Response_Time_All_Steps | Dependency_Set_End_To_End_Response_Time_One_Step | Dependency_Set_End_To_End_Response_Time_All_Steps | Dependency_Set_Chetto_Blazewicz_Priority | Dependency_Set_Chetto_Blazewicz_Deadline | Buffer_Feasibility_Tests | Memory_Analysis_Interferences_Delays | Memory_Set_Footprint_Analysis | Memory_Compute_Footprint_Analysis | Network_NoC_Compute_Communication_Delay | Network_NoC_Compute_Path_Delay | Network_NoC_Compute_Direct_Interference_Delay | Network_NoC_Compute_Indirect_Interference_Delay | Network_compute_NoC_Transformation_ECTM_SAF | Network_set_NoC_Transformation_ECTM_SAF | Network_compute_NoC_Transformation_ECTM_Wormhole | Network_set_NoC_Transformation_ECTM_Wormhole | Network_compute_NoC_Transformation_WCCTM_SAF | Network_set_NoC_Transformation_WCCTM_SAF | Network_compute_NoC_Transformation_WCCTM_Wormhole | Network_set_NoC_Transformation_WCCTM_Wormhole | Network_compute_Spacewire_Transformation_SCM | Network_set_Spacewire_Transformation_SCM | Cache_Analysis_Compute_Cache_Access_Profile | Cache_Analysis_Import_CFG | Cache_Analysis_Import_CFG_And_Compute_Cache_Access_Profile | MILS_compute_security_chinese_wall | MILS_compute_security_Warshall | MILS_compute_security_bell_lapadula | MILS_compute_security_biba => Initialize (A_Request); A_Request.statement := service; A_Request.target := empty_string; Add (Request, A_Request); when Scheduling_Feasibility_Tests_Compositional => null; when Select_Feasibility_Tests_Simple => null; when Select_Feasibility_Test_By_Name => null; end case; end Build_Request_List; end unit_test_parameters;