LF Fortran 95

Coverage Tool

One approach to program testing is to verify the operation range and coverage of the program execution. The Coverage Tool provides the following information for programs coded in the Fortran or C language:

Starting and Terminating the Coverage Tool

Starting the Coverage Tool

When the Coverage is started, the last used sample data file name and the executable file name is restored.

There are two ways to start the Coverage Tool:

  1. From the Windows desktop icon
  2. From the Windows command prompt

Starting from the desktop icon

Start by double-clicking the Coverage Tool icon on your Windows desktop if you chose to have an icon at installation time; otherwise start it from the Start|Programs menu.

Starting from the Command prompt

Type

COV

followed by the <Enter> key.

Terminating the Coverage Tool

In the coverage window, terminate the coverage tool by selecting the Exit Coverage command from the File menu.

Coverage Menus

The coverage menus are outlined below.

File Menu

The table below lists the File menu commands.

Commands in the File Menu

Command

Function

Select Files

Open dialog for selecting executable (.exe) file and specifying coverage data output (.cov) file

Print

Print the coverage information being displayed.

Print Preview

Display image as it would be printed

Print Setup

Specify printer configuration.

File Search Path

Specify the path for searching for the file.

Exit Coverage

Terminate the coverage tool.

When the "OK" button in the "Select Files" dialogbox is clicked, the "Executable File and Sample Data File" window appears.

The Print, and Print Preview commands are active only if coverage information is being displayed.

Coverage Menu

The table below lists the Coverage menu commands.

Commands in the Coverage Menu

Command

Function

Execute

Run the program to collect coverage information.

Executing Options

Submit command line argument(s) and runtime options to the program and execute the program to collect coverage information

Execution

Coverage Rate

Display the coverage information for all program units

Source File Directory

Specify the source file directory

View Menu

The table below lists the View menu commands.

Commands in the View Menu

Command

Function

File Information

Displays a dialog showing information about the executable file and the coverage data file.

Status Bar

Specifies whether to display the status bar.

Toolbar

Specifies whether to display the toolbar.

Window Menu

The table below lists the Window menu commands.

Commands in the Window Menu

Command

Function

Cascade

Displays all open windows so that they overlap, revealing the Title Bar for each window.

Tile Horizontally

Displays the listed coverage information from left to right.

Tile Vertically

Displays the listed coverage information from top to bottom.

Arrange Icons

Arranges all the icons along the bottom of the window.

Close All

Close all open windows

Note: the Window menu is displayed only if coverage information is being displayed.

Help Menu

The table below lists the Help menu commands.

Commands in the Help Menu

Command

Function

Help

Displays the Coverage Tool help topics

About Coverage

Displays version information for the coverage tool.

Using the Coverage Tool

To compile a source program for the collection of coverage information, you must specify -cover as an option at compilation. If the source program is compiled without the -cover option specified, coverage information is not collected.

The coverage functions are listed below.

Collecting Coverage Information

To collect coverage information, run the program once.

Do the following to collect the information:

  1. In the Coverage tool, select the "Select Files..." command from the File menu. The Select Files dialog box appears.
  2. Specify the Coverage Data File, either by typing it in or browsing. The file must have an extension of .cov. Note that selection through browsing will set the default directory.
  3. Specify the Executable File, either by typing it in or browsing. The file must have an extension of .exe.
  4. Select one of the following methods for executing the program:

Storing & Merging Coverage Information

Collected coverage information can be stored. You can update and display the stored information by assigning another argument to the executable program (merging the information). If the program being tested requires input data, you can put sample data into a file and then use that data for testing the program.

Storing Coverage Information

Coverage information is stored in the file specified by the "Select Coverage Data File" command in the File menu.

Merging Coverage Information

Follow these steps to merge coverage information with the existing coverage data file:

  1. Use the "Select Coverage Data File" command in the File menu to specify the data file containing the collected coverage information.
  2. Use the "Select Executable File" command in the File menu to specify the same executable file generated by (1) above as the Executable File.
  3. Select the "Execute" or "Executing Options" command from the Coverage menu to execute the program and collect its coverage information.

The new coverage information is now stored in the specified data file.

Displaying Coverage Information

The following items are displayed in the coverage information:

Follow these steps to display the information:

  1. Select the "Select Coverage Data File" command from the File menu. The Coverage Data File dialog box appears.
  2. In the Coverage Data File dialog box, specify the coverage data file.
  3. Select the "Select Executable File" command from the File menu. The Executable File dialog box appears.
  4. In the Executable File dialog box, specify the executable file.
  5. Select the "Function" command from the Display menu to display the execution coverage rate for each subroutine and function. (See the first figure below.) Then double-click the subroutine or function to display the executed and non executed sections of the corresponding source code. (See the second figure below.)


Remarks:

The coverage tool shows the executed and non executed parts of each block. A block is a set of statements that do not change the control of execution. The following instances may separate a block:

  1. Fortran: IF, CASE, DO and GOTO
  2. C language: if, case, for and label

The following marks are placed at the beginning of the block:

  1. Blue foot mark: the block which is executed for the first time
  2. White foot mark: the block which is executed for the second or subsequent times.
  3. Stick mark: the block that is never executed.