C Test Script Compiler - attolpreproC

Purpose

The C Test Script Compiler tool pre-processes a .ptu test script and converts it into a native source code test harness.

Syntax

attolpreproC <test_script> <generated_file> [ <target_directory> ] {[ <-options> ]}

attolpreproC @<option_file>

where:

Description

Options can be in any order. They may be upper or lowercase and can be abbreviated to their shortest unambiguous number of characters.

Source File Under Test

-source=<source file>

This option specifies the name of the source file being tested, allowing the Test Script Compiler to:

The name of the tested source file may be specified with a relative or absolute directory in a syntax recognized by the operating system, or, in UNIX, by an environment variable.

By default, the list of include files in the tested source file and the source file name are not displayed in the Results Obtained file.

Condition Definition

-define=<ident>[=<value>] {[,<ident>[=<value>]}

This option specifies conditions to be applied when the Test Script Compiler starts. These conditions allow you to define C symbols that apply conditions to the generation of any IF ... ELSE ... END IF blocks in the test script.

If the option is used with one of the conditions specified in the IF instruction, the IF ... ELSE block (if ELSE is present) or the ELSE ... END IF block (if ELSE is not present) is analyzed and generated. The ELSE ... END IF block is eliminated.

If the option is not used or if none of the conditions specified in the IF instruction are satisfied, the ELSE ... END IF block is analyzed and generated.

All symbols defined by this option are equivalent to the following line in C

-define <ident> [<value>]

 

By default, the ELSE ... END IF blocks are analyzed and generated.

Specifying Tests, Families, and Services

-test=<test>{[,<test>]} | -extest=<test>{[,<test>]}

This option specifies a list of tests to be executed.

Use -test to only generate the source code related to the specified tests, and -extest to specify the tests for which you do not want to generate source code.

Both -test and -extest cannot be used together.

By default, all tests are selected.

-family=<family>{,<family>} | -exfamily=<family>{,<family>}

Use -family to only generate the source code related to the specified families, and -exfamily to specify the families for which you do not want to generate source code.

Both -family and -exfamily cannot be used together.

By default, all families are selected.

-service=<service>{[,<service>]} | -exservice=<service>{[,<service>]}

Use -service to only generate the source code related to the specified services, and -exservice family to specify the services for which you do not want to generate source code.

Both -service and -exservice cannot be used together.

By default, all services are selected.

Test Script Parsing

-fast | -nofast

The -fast option tells the C Test Script Compiler to analyze only those tests that you want to generate. This setting considerably speeds up the Test Script Compiler when you use the -service,-exservice,-family, -exfamily,-test, or -extest options.

The -fast option is selected by default.

If you want a full test script analysis, this option can be de-selected using the -nofast option.

-noanalyse

This option disables the native language parser.

By default, native language lines are analyzed. This option enables you to disable this parsing.

-noedit

This option limits unit test code generation to the initialization of variables, making it possible to generate tighter code for special purposes such as debugging. If you specify the -noedit option, you cannot generate a test report.

By default, code is generated normally.

-nopath

Use this option if you do not want to generate long pathnames on the open and close execution trace file call, and on the Target Deployment Port header file include directive. This can be useful, for example, to preserve memory on embedded targets.

By default, full pathnames are generated.

-nosimulation

This option determines the conditional generation related to simulation in the source file generated by the Test Script Compiler. Blocks delimited by the keywords SIMUL ... ELSE_SIMUL ... END SIMUL can be included in the test scripts.

See SIMUL blocks in the C Test Script Language Reference.

-restriction=ANSI | KR | NOEXCEPTION | NOIMAGE | NOPOS | SEPAR

This option lets you modify the behavior of test script parser.

Several -restriction options can be used on the same command line. The ANSI and KR parameters, however, cannot be used together.

Other options

-STUDIO_LOG

This option is for internal usage only.

Using an Option File

@<parameter file>

This syntax allows the compiler to pass options to the preprocessor through a file. The parameter file name can be written in absolute or relative format.

The format of the file must follow these rules:

By default, no file is taken into account.

If the option file is not found, a fatal error is generated and the preprocessor stops.

Examples

attolprepro C add.ptu Tadd.cpp -service=add -test=1,2,3 -family=nominal

attolprepro CPP @add.opt

 

In this case, the parameter file add.opt would contains:

add.ptu Tadd.cpp

-service=add

-test=1,2,3

-family=nominal

 

Return Codes

After execution, the program exits with the following return codes

 

Code

Description

0

End of execution with no errors

3

End of execution with one or more warning messages

5

End of execution with one or more errors

7

End of execution because of fatal error

9

End of execution because of internal error

 

These codes help you decide on a course of action once the Test Script Compiler has finished test execution. For example, if the return code in the command file shows there have been incorrect tests, you can save certain files in order to analyze them later.

 

All messages are sent to the standard error output device.

Related Topics

C++ Test CompilerSystem Testing Script Compiler