Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Type compatiblity issues in Titan(Function test runtime vs. load test runtime)
Type compatiblity issues in Titan [message #1744360] Mon, 26 September 2016 10:18
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 807
Registered: January 2015
Senior Member
Compatibility of structured and non-structured types is decribed in detail in ch 6.3 "Type compatibility" of the core language standard.
However, due to performance considerations type compatibility for structured types is enabled only in the function test run-time (run-time 2)
(except record of/set of types for certain element types, see section ‎4.32.2 of the referenceguide).
Titan generates different code in function test run-time mode and performance(load) test run-time mode:
the first type of code generated aims functional completeness, the second aims maximum performance( build-time performance, execution speed performance).

Let's take the below code as an example:

module test 

type union Type0
  charstring    m1,
  octetstring   m2

type record  ParamValueType
  integer  			f1,
  octetstring   	f2,
  Type0   			f3 

type record Type1
  record of ParamValueType parameter_list

type record Type3
  Type1   tct 

type record Type2
  record of ParamValueType parameter_list         

function getParameterValueById(Type1.parameter_list p_tot, integer p_id) return integer
  return p_id

control {
  var  Type1.parameter_list 	v_list0:=  	{{f1:=1,f2:='ABDC'O,f3:={m1:="AAAAA"}} }
  var  Type2.parameter_list 	v_list1:= 	{{f1:=1,f2:='ABDC'O,f3:={m1:="AAAAA"}} }
  var  Type3.tct.parameter_list v_list2:= 	{{f1:=1,f2:='ABDC'O,f3:={m1:="AAAAA"}} }

  var integer  v_int
  v_int:=getParameterValueById(v_list0, 2)

  v_int:=getParameterValueById(v_list1, 3)
  v_int:=getParameterValueById(v_list2, 4)



The function getParameterValueById has one parameter of type Type1.parameter_list;
when the function is called with parameters of compatible types,
in run-time #1(load test runtime) , which is selected by default, this will result in all kinds of errors;

however if code generation for function test run-time is chose by using the compiler flag -R
(see compiler -h for different flags )

# Flags for the TTCN-3 and ASN.1 compiler:

then the compilation and execution is successful:

/proj/TTCN/Releases/TTCNv3_daily_LMWP3.1/bin/compiler -L -R  \
        test.ttcn  - test.ttcn
Notify: Parsing TTCN-3 module `test.ttcn'...
Notify: Checking modules...
Notify: Generating code...
Notify: File `test.hh' was generated.
Notify: File `' was generated.
Notify: 2 files were updated.
touch compile
g++  -c -DLINUX -I/proj/TTCN/Releases/TTCNv3_daily_LMWP3.1/include -DTITAN_RUNTIME_2 -Wall   -o test.o
if g++   -o test test.o  \
        -L/proj/TTCN/Releases/TTCNv3_daily_LMWP3.1/lib -lttcn3-rt2-parallel \
        -L/proj/TTCN/Releases/TTCNv3_daily_LMWP3.1/lib -lcrypto \
        -L/proj/TTCN/Releases/TTCNv3_daily_LMWP3.1/lib -lxml2 -lpthread -lrt; \
        then : ; else /proj/TTCN/Releases/TTCNv3_daily_LMWP3.1/bin/titanver test.o ; exit 1; fi

The reason for the load test run-time being default goes back as usual to a careful design decision of which details no one remembers anymore.
For the tl;dr crowd: if you run into type compatibility problems with Titan, try function test run-time by using the -R flag for the compiler.

Best regards
Previous Topic:ETSI ITS wireshark capture
Next Topic:Advanced TTCN-3 usage: the secret life of assignments
Goto Forum:

Current Time: Sat Sep 22 06:50:41 GMT 2018

Powered by FUDForum. Page generated in 0.01533 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top