Ada Source Code Parser - attolstartADA

Purpose

When creating a new Component Testing test campaign for Ada, the Ada Source Code Parser creates an Ada test script template based on the analysis of the source code under test.

When the -metrics option is specified, the Source Code Parser produces static metrics for the specified source files.

Syntax

attolstart ADA <source_under_test > <test_script> [{<-option>}]

attolstart ADA @ <option file >

where:

  1. <source under test> this required parameter is the name of the source file to be tested.

    <test script> is the name of the test script that is generated

    <options> is a list of options as defined below.

    <option file> is the name of a plain-text file containing a list of options.

Description

The Ada Source Code Parser analyzes the source file to be tested in order to extract global variables and testable functions.

Each global variable is automatically declared as external, if this has not already been done at the beginning of the test script. Then, an environment is created to contain all these variables with default tests. This environment has the name of the file (without the extension).

For each function under test, the generator creates a SERVICE which contains the Ada declaration of the variables to use as parameters of the function.

Parameters passed by reference are declared according to the following rule:

  1. char* <param> causes the generation of char <param>[200]

    <type>* <param> causes the generation of <type> <param> passing by reference

It is sometimes necessary to modify this declaration if it is unsuitable for the tested function, where <type>* <param> can entail the following declarations:

  1. <type>* <param> passing-by-value,

    <type> <param> passing-by-reference,

    <type> <param>[10] passing-by-reference.

File names can be related or absolute.

If the generated file name does not have an extension, the Ada Source Code Parser automatically attaches .ptu or the extension specified by the ATTOLPTU environment variable. This name may be specified relatively, in relation to the current directory, or as an absolute path.

If the test script cannot be created, the Ada Source Code Parser issues a fatal error and stops.

If the test script already exists, the previous version is saved under the name <generated test script>_bck and a warning message is generated.

Options

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

Static Metrics

-metrics=<output directory>

Generates static metrics for the specified source files. Resulting .met static metric files are produced in specified <output directory>. When the -metrics option is used, no other action is performed by the Source Code Parser.

Included Files

-insert

With this option the source file under test is included into the test script with an #include directive, ensuring that all the internal functions and variables (declared static) are visible to the test script. The Ada Source Code Parser adds the #include directive before the BEGIN instruction and after any #includes added by the -use option.

Additional Files

-integrate= <additional file>{[, <additional file>]}

This option provides a list of additional source files whose objects are integrated into the test program after linking.

The Ada Source Code Parser analyzes the additional files to extract any global variables that are visible from outside. For each global variable the Parser declares an external variable and creates a default test which is added to an environment named after the corresponding additional file.

By default, any symbols and types that could be exported from the source file under test are declared again in the test script.

Simulated Files

-simulate= <simulated file>{[, <simulated file>]}

This option gives the Ada Source Code Parser a list of source files to simulate upon execution of the test. List elements are separated by commas and may be specified relatively, in relation to the current directory, or as an absolute path.

The Parser analyzes the simulated files to extract the global variables and functions that are visible from outside. For each file, a DEFINE STUB block, which contains the simulation of the file's external global variables and functions, is generated.

By default, no simulation instructions are generated.

Header Files

-use= <file used>{[, <file used>]}

This option gives the Ada Source Code Parser a list of header files to include in the test script before the BEGIN instruction. This avoids declaring variables or functions that have already been declared in an Ada header file of the application under test.

The Ada Source Code Parser adds the #include directive before the BEGIN instruction. Then, for each file, an environment is created, containing all variables with a default test. This environment has the name of the included file.

By default, no files are included in the test script.

Other options

-studio_log

This option is for internal usage only.

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

All messages are sent to the standard error output device.