IBM
Contents Index Previous Next



Getting Started


Unfortunately a test sequence description expressed in TTCN can not easily be executed as it is. This is because the test notation is not executable and only few test environments interpret pure TTCN. A different approach to create an executable test suite (ETS), is to translate the formal test description into a language which can be compiled into an executable format.

The TTCN to C compiler translates TTCN into ANSI-C which can be compiled by an ANSI-C compiler. Figure 210 depicts the first step in the process of creating an ETS using the TTCN to C compiler.

The generated code, called the TTCN runtime behavior, is only one of the two major modules of an ETS.

The second module which is needed includes test support functions which are dependent on the protocol used, the host machine, test equipment, etc. For this reason, it is up to the user to write this second module and in such way adapt the TTCN runtime behavior to the system he/she wants to test.

Figure 210 : Translating TTCN to ANSI-C

The adaption process is described in chapter 36, Adaptation of Generated Code. Figure 211 displays the anatomy of the final result.

Figure 211 : The anatomy of an ETS

Running the TTCN to C Compiler

The TTCN to C compiler can be activated either from the TTCN Browser, both as a quick button and a menu command, or from the Organizer when a TTCN test suite is selected.

Note:

Observe that the TTCN to C compiler is unable to function correctly if the test suite is not fully verified correct. This verification is accomplished by running the Analyzer tool on all the parts of the test suite.

Note:

If you generate code for large test suites containing many types that form long reference chains (T references T1, T1 references T2 and so on), code generation process may fail. This may happen if reference depth exceeds the default limit = 200. You can solve this by setting the environment variable ITEX_REFERENCE_DEPTH to a higher value, for example 300.

Note:

(Windows only) On Windows, code generation may fail to do anything for big test suites containing large number of type declarations. And no crash information will pop up. This may happen because of stack overflow during code generation.

Code generator is invoked from 2 different executables - ttcn2c.exe starts code generation from command line, iedit2.exe invokes code generation from GUI. The problem with stack overflow can be solved by increasing the stack size for one of these executables or for both if you use both of them. This can be done with Microsoft Visual Studio utility "editbin.exe". The default stack size set during compilation is 10000000, so if this is not enough, try setting stack size to a higher value, for example:

editbin /STACK:20000000 <installation>\bin\wini386\iedit2.exe

editbin /STACK:20000000 <installation>\bin\wini386\ttcn2c.exe

Tools > Make

When you select Make, the TTCN Suite Make dialog is opened. The dialog contains two important toggle buttons, Analyze & Generate and Compile & Link.

Figure 212 : Dialog for starting the TTCN to C compiler

Analyze & Generate

If Analyze & Generate is set, the Analyzer will first be called to analyze the test suite before any code is generated. If errors are found, these will be reported and no code will be written to file. The generation phase performed after the analysis phase will only generate code for the parts that need to be re-generated.

Directory for generated files

If code is generated, that code will reside in the directory specified in this field.

Makefile

If Compile & Link is set, the TTCN Suite will also take care of the making and linking of the generated code. At this point you have the possibility to specify how you want the code to be built. Either you can specify that the default generated makefile is to be used, or your own special makefile. This is done by setting the radio buttons in the field below the Makefile toggle button.

Verbose Log

The Verbose Log switches the logging between the default mode, which prints the result of the Make process as it goes along, and the Verbose mode, where all possible information is presented. The Verbose log is primarily intended for debugging.

The Verbose log contains the following information in addition to the default log:

Show Executable Path

When Show Executable Path is selected, the lines in the ETS log will be prefixed by the path for the executing Test Case and Test Steps, like the following example:

Test Case:[line number]  Step_no:[line number] ... Test Step_n 
Compilation flag /DSHOWSIGNALPARAMETERS

The flag SHOWSIGNALPARAMETERS is generated in the Makefile even when the log is not Verbose. With this compilation flag the default log will also contain the complete contents of all signals, just like when log is set to Verbose. When this is not desired, this flag can easily be removed from the Makefile.

Additional Compiler Options and Additional Linker Options

Here it is possible to specify any compiler and linker options that will be added into the generated Makefile.

Compile & Link

The compiler needs to know what files to link into the executable. Three different possibilities are at hand:

The TTCN to C compiler assumes the first case to be the default one. In this case the Generate empty adaptor files radio button is set. If you do not have adaptor files (adaptor.c and adaptor.h) in the target directory, these will be created, as empty templates, for you. If you already have generated and edited adaptor files these will of course not be overwritten.

If you already have your own compiled adaptor files elsewhere in the file system, these files, as object files, should be listed in the text field below the Use the object files dialog button. Observe that you should use absolute path names for the adaptor files to avoid problems for the makefile to find these files! An absolute path name is a path name that identifies a file uniquely from the root of the files system, for example /home/myhome/myadaptor.o.

Finally, if you want to generate code for simulation, the Use standard kernel radio button should be set with the option Simulation. This is the only available kernel at the moment so no other choice is valid here.

Make

If the Make button is pressed, the compiler will only generate code for the parts that really need to be re-generated.

Full Make

If the Full Make button is pressed, everything will be regenerated again.

When the generation phase is started, a new log window will be displayed where information about the compiler actions will be displayed.

TTCN to C Compiler Options

By pressing the TTCN to C Compiler Options button in the Make dialog, the dialog depicted in Figure 213 will be displayed.

Figure 213 : Setting extra TTCN to C compiler options

MSC Trace

For more information, see "TTCN Test Logs in MSC Format" on page 1333.

Encoders
Encoders
Files

You can also choose the names of the files you want to use. This is done in the fields in the lower part of the TTCN to C compiler options dialog.

Running the TTCN to C Compiler from the Command Line

Please see "Running the TTCN to C Compiler from the Command Line" on page 1328 in chapter 32, The TTCN to C Compiler (in Windows).


http://www.ibm.com/rational
Contents Index Previous Next