Project

General

Profile

Titan TTCN3 Notes » History » Version 29

pespin, 09/21/2023 03:04 PM

1 1 laforge
h1. Titan TTCN3 Notes
2
3
Some notes about developing in Titan TTCN3, specifically regarding test cases in the Osmocom universe.
4
5 12 pespin
h1. Building / Using test cases
6 8 laforge
7
h2. Dependencies
8
9 25 laforge
* You'll need recent enough eclipse-titan installed: 8.0.0 or later recommended.
10 1 laforge
** if you're using Debian packages, you might run into a compile error "The version of GCC does not match the expected version". If you do, it is suggested to use MAKEDEPEND_RUN define to workaround the issue. Alternatively you can edit @/usr/include/titan/cversion.h@ and comment out the related @#error@ line.
11 23 laforge
** there's a build for Debian 9.0 available from our @osmocom:latest@ feed, see https://obs.osmocom.org/package/show/osmocom:latest/eclipse-titan
12
* You'll need a checkout/clone of @https://gerrit.osmocom.org/osmo-ttcn3-hacks/@
13 8 laforge
14 1 laforge
h3. Titan Modules required
15 8 laforge
16 18 laforge
The @osmo-ttcn3-hacks@ depend on a variety of other TTCN-3 modules that will be automatically cloned by the make files included, see the @deps/@ sub-directory.
17 8 laforge
18
19
h2. Test run
20
21
For example, to run sysinfo tests do the following:
22
* adjust BASEDIR in sysinfo/gen_links.sh to match your environment
23
* adjust test configuration in sysinfo/Test.cfg if necessary
24
<pre>
25
cd sysinfo
26
./gen_links.sh
27
./regen_makefile.sh
28
make -j1 compile && make -j8
29
cd ..
30
./start-testsuite.sh sysinfo/Test sysinfo/Test.cfg
31
</pre>
32
33 24 laforge
See also https://gitea.osmocom.org/osmocom/docker-playground/src/branch/master/ttcn3-nitb-sysinfo
34 8 laforge
35
h3. Log files
36
37
you will receive log files in the current working directory.  You can use the @ttcn3_logmerge@ tool to merge multiple log files based on their timestamps, and you can use the @ttcn3_logformat@ tool to do some human-friendly formatting of the log files.  Harald often runs his test suite like:
38
<pre>
39 11 pespin
rm -f *.log && make -j1 compile && make -j8 && ../start-testsuite.sh MGCP_Test MGCP_Test.cfg && ttcn3_logformat *.log
40 8 laforge
</pre>
41
42
h1. Development related bits
43
44 19 Hoernchen
h2. ttcn3 import statements
45
46
Calling the shell scripts to create symlinks is necessary because the titan compiler has to see all related files at once.
47
Be careful when you're adding new import statements to files residing in the library/ subdirectory - those might not get symlinked to all test subdirs yet, and might cause compile errors for some tests!
48
49
h2. Learning TTCN3
50 14 pespin
51 17 pespin
A good set of slides about TTCN3 can be found in:
52 16 pespin
* http://download.eclipse.org/titan/TTCN3_Course_PartI_EclipseLicensed.pdf
53 1 laforge
* http://download.eclipse.org/titan/TTCN3_Course_PartII_EclipseLicensed.pdf
54 20 fixeria
* http://www.ttcn-3.org/files/Titan_TTCN3_course.pdf
55 29 pespin
* https://download.eclipse.org/titan/UserGuide.pdf
56
* https://download.eclipse.org/titan/ReferenceGuide.pdf
57 14 pespin
58 21 fixeria
See also http://www.ttcn-3.org/index.php/learn/tutorials.
59
60 13 pespin
h2. Speedup local builds with ccache:
61
62
There's a patch in gerrit to use ccache if it is found in the build system, which provides a speedup factor of around x10.
63
64
Patch can be found in: https://gerrit.osmocom.org/#/c/7601/
65
66
Upstream should be contacted to request for inclusion of a flag to remove the "generated date" as a comment in the generated code, which prevents ccache to work fine out of the box (the provided gerrit patch workarounds this issue).
67
68 1 laforge
h2. RAW coder
69 3 msuraev
70
A lot of the messages (GSMTAP, LAPDm, L1CTL, ...) are described using the Titan extensions to the TTCN-3 type language and the associated RAW coder.
71
72 22 fixeria
Section 4.23 of the _Programmer's Technical Reference Guide for the TITAN TTCN-3 Toolset_ contains the description of this RAW coder.
73
See https://github.com/eclipse/titan.core/blob/master/usrguide/referenceguide/4-ttcn3_language_extensions.adoc#raw-encoder-and-decoder.
74 5 msuraev
75 3 msuraev
h3. FIELDORDER
76
77
This determines the order of fields within a record or set type.
78
79
In (not only) GSM specs, typically the messages are described from first field at top to the last field at the bottom, so the logical choice here is to set "FIELDORDER(msb)" as we do in the GMS_Types.ttcn and other files.  However, there's one CAVEAT: In GSM 04.08 (and derived specs), Information Elements with 1/2 (4bit) length are ordered un-intitively.
80
81 1 laforge
Example: TS 44.018 SYSTEM INFORMATION TYPE 4:
82 4 laforge
83
 * L1 Pseudl Length (1)
84 6 msuraev
 * protocol descriptor (1/2)
85
 * skip indicator (1/2)
86
 * Message Type (1)
87
88
which then translates to:
89
90
<pre>
91
        type record RrHeader {
92
                L2PseudoLength  l2_plen,
93
                uint4_t         skip_indicator,
94
                uint4_t         rr_protocol_discriminator,
95
                RrMessageType   message_type
96
        } with { variant "FIELDORDER(msb)" };
97
</pre>
98 7 msuraev
99
Note the skip_indicator and rr_protocol_discriminator fields are swapped in their order compared to the spec!
100 26 neels
101
h3. fftranscode
102
103 1 laforge
Our RANAP ttcn3 tests require libfftranscode, which can be found at: https://downloads.osmocom.org/binaries/libfftranscode/
104 27 neels
105
When it is missing, the error message looks like this:
106
107
<pre>
108
RANAP_EncDec.cc:7:10: fatal error: fftranscode/transcode.h: No such file or directory
109
    7 | #include <fftranscode/transcode.h>
110
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
111
compilation terminated.
112
make: *** [Makefile:180: RANAP_EncDec.o] Error 1
113
</pre>
114 28 neels
115
See also [[Titan_TTCN3_Testsuites]]
Add picture from clipboard (Maximum size: 48.8 MB)