Project

General

Profile

Titan TTCN3 Notes » History » Version 18

laforge, 04/12/2018 01:18 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 18 laforge
* You'll need recent enough eclipse-titan installed: 6.3.1 is known working fine, 5.5.1 or 6.1.0 is too old.
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 18 laforge
** there's a build for Debian 9.0 available from our @network:osmocom:latest@ feed, see https://build.opensuse.org/package/show/network:osmocom:latest/eclipse-titan
12 8 laforge
* You'll need a checkout/clone of @http://git.osmocom.org/osmo-ttcn3-hacks/@
13
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 9 dexter
See also https://git.osmocom.org/docker-playground/tree/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 14 pespin
h3. Learning TTCN3
45
46 17 pespin
A good set of slides about TTCN3 can be found in:
47 16 pespin
* http://download.eclipse.org/titan/TTCN3_Course_PartI_EclipseLicensed.pdf
48
* http://download.eclipse.org/titan/TTCN3_Course_PartII_EclipseLicensed.pdf
49
* http://www.ttcn-3.org/files/TTCN3_P.pdf
50 14 pespin
51 13 pespin
h2. Speedup local builds with ccache:
52
53
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.
54
55
Patch can be found in: https://gerrit.osmocom.org/#/c/7601/
56
57
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).
58
59 1 laforge
h2. RAW coder
60 3 msuraev
61
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.
62
63 5 msuraev
Section 4.23 of the _Programmer's Technical Reference Guide for the TITAN TTCN-3 Toolset_ contains the description of this RAW coder
64
65 3 msuraev
h3. FIELDORDER
66
67
This determines the order of fields within a record or set type.
68
69
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.
70
71 1 laforge
Example: TS 44.018 SYSTEM INFORMATION TYPE 4:
72 4 laforge
73
 * L1 Pseudl Length (1)
74 6 msuraev
 * protocol descriptor (1/2)
75
 * skip indicator (1/2)
76
 * Message Type (1)
77
78
which then translates to:
79
80
<pre>
81
        type record RrHeader {
82
                L2PseudoLength  l2_plen,
83
                uint4_t         skip_indicator,
84
                uint4_t         rr_protocol_discriminator,
85
                RrMessageType   message_type
86
        } with { variant "FIELDORDER(msb)" };
87
</pre>
88 7 msuraev
89
Note the skip_indicator and rr_protocol_discriminator fields are swapped in their order compared to the spec!
Add picture from clipboard (Maximum size: 48.8 MB)