Ada_Task directory
Test RealTime - User Guide
This instruction block is placed just before the END ELEMENT statement of the Test
Script.
Example
The source files and complete .ptu script for following example are provided in the
examples/Ada_Task directory.
In this example, the task calls a stubbed procedure. Therefore the task must be
terminated from within the Test Script. Two different techniques of starting and
stopping the task are shown here in Test 1 and Test 2.
HEADER Prg_Under_Tst, 0.3, 0.0
#with Pck_Stub;
BEGIN Prg_Under_Tst
DEFINE STUB Pck_Stub
#with Text_IO;
#procedure Proc_Stubbed is
#begin
# Text_IO.Put_Line("Stub called.");
#end;
END DEFINE
SERVICE S1
SERVICE_TYPE extern
#Param_1 : duration;
#task1 : Prioritaire;
TEST 1
FAMILY nominal
ELEMENT
VAR Param_1, init = duration(0), ev = init
STUB Pck_Stub.Proc_Stubbed 1..1 => ()
#Task1.Unit_Testing_Exit_Loop;
#delay duration(5);
#Task1.Unit_Testing_Wait_Termination;
END ELEMENT
END TEST -- TEST 1
TEST 2
FAMILY nominal
ELEMENT
VAR Param_1, init = duration(2), ev = init
STUB Pck_Stub.Proc_Stubbed 1..1 => ()
#declare
# Task2 : T_Prio := new Prioritaire;
#begin
# Task2.Do_Something_Useful(Param_1);
# Task2.Unit_Testing_Exit_Loop;
# Task2.Unit_Testing_Wait_Termination;
#end;
END ELEMENT
END TEST -- TEST 2
END SERVICE --S1
In the BEGIN line of the script, it is not necessary to add the name of the separate
procedure Attol_Test, as this is the default name;
120