------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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, -- Hai Nam Tran, Stephane Rubini -- -- 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 Text_IO; use Text_IO; with Processor_Set; use Processor_Set; use Processor_Set.Generic_Processor_Set; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; 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 Task_Set; use Task_Set; use Task_Set.Generic_Task_Set; with Systems; use Systems; with framework; use framework; with call_framework; use call_framework; with call_framework_interface; use call_framework_interface; with Multiprocessor_Services; use Multiprocessor_Services; with Multiprocessor_Services_Interface; use Multiprocessor_Services_Interface; use Multiprocessor_Services_Interface.Scheduling_Result_Per_Processor_Package; with GNAT.Command_Line; with GNAT.OS_Lib; use GNAT.OS_Lib; with Version; use Version; with Ada.Exceptions; use Ada.Exceptions; with unit_test_parameters; use unit_test_parameters; with debug; use debug; with framework_config; use framework_config; procedure unittest is -- A set of variables required to call the framework -- Service : Framework_Statement_Type; Sys : System; -- Is the command should run in verbose mode ? -- Verbose : Boolean := False; -- The XML file to read -- Input_File_switch : Boolean := False; service_switch : Boolean := False; Input_File_Name : Unbounded_String; -- To fetch arguments of the program -- Ok : Boolean; S : unbounded_string; parameters : unbounded_string; procedure Usage is begin Put_Line( "unittest is a program which calls each cheddar service independly and produces the results on the standard output. The main rational for this program is to run non regression tests." ); New_Line; Put_Line( "Check Cheddar home page for details : http://beru.univ-brest.fr/~singhoff/cheddar " ); New_Line; New_Line; Put_Line ("Usage : unittest [switch] list of parameter for the called service "); Put_Line (" switch can be :"); Put_Line (" -u get this help"); Put_Line (" -v verbose mode "); Put_Line (" -i name, name of the Cheddar XML file to load"); Put_Line (" -s service-name, name of the Cheddar service to call. Can be of the following values:"); for i in Framework_Statement_Type'range loop put_line(" " & i'img ); end loop; New_Line; end Usage; begin if Cheddar_Debug /= no_debug then Copyright ("unittest"); end if; -- Get arguments -- loop case GNAT.Command_Line.Getopt ("u v i: s:") is when ASCII.NUL => exit; when 's' => Service_switch := True; To_Framework_Statement_Type(GNAT.Command_Line.Parameter, service, Ok); if not Ok then Put_Line ("Unknown service : " & GNAT.Command_Line.Parameter); OS_Exit(0); end if; when 'i' => Input_File_switch := True; Input_File_Name := To_Unbounded_String (GNAT.Command_Line.Parameter); when 'v' => Verbose := True; when 'u' => Usage; OS_Exit (0); when others => Usage; OS_Exit (0); end case; end loop; loop s:=to_unbounded_string(GNAT.Command_Line.Get_Argument (Do_Expansion => True)); exit when s=empty_string; parameters := parameters & " " & s; end loop; -- Is an input file and service file given ??? -- if (not Input_File_switch) or (not service_switch) then Usage; OS_Exit (0); end if; Put_debug("Service :" & service'img); Put_debug("XML file :" & to_string(input_file_name)); Put_debug("Framework parameter:" & to_string(parameters)); -- Initialize the Cheddar framework -- Call_Framework.initialize (False); -- Read the XML project file -- Systems.Read_From_Xml_File (Sys, to_string(Input_File_Name)); -- Call the framework -- Call_Unit_Test(service, Sys, parameters); end unittest;