------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, 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 README.md -- -- 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); Initialize (a_request.param); 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_jitters"); a_param.boolean_value := False; 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 := False; 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;