...
You can make your program displays a coverage analysis report when it exits by adding the summarize coverage
value to your Advanced Options on Windows or by add the insure++.summarize coverage
option to your .psrc file on Unix.
The insure++.coverage_switches
option lets you set flags to control the output just as though you were passing those switches to the tca
command (see Options Used by Insure++).
Step 1: Compile Time
At compile time, Insure++ creates a database of each file processed, describing how many blocks and statements are in each file and function. This The database is called a referred to as the map file , because it provides TCA with a map of how your program is laid out. By default, the name of this file is tca.map
, but you can change the name of this file by adding a an insure++.coverage_map_file
value to your Advanced Options (Windows) or .psrc file (Unix).
Ideally, all the files in your application should store their information in the same map file. If your source code is spread across several directories, you will probably want to set the map filename using a full path. For example:
coverage_map_file c:\usr\project.map
(Windows)
insure++.coverage_map_file ~/project.map
(Unix)
If you compile several files simultaneously and they are all trying to modify the same map file, you may end up with a corrupt map file. In this case, you will need to delete the original map file and recompile the application you are interested in.
If you are only interested in coverage information and not debugging, you can add the -Zcov
option to the insure
command lines that build your program. You must If you use the -Zcov
option at both compilation and linkingduring compilation, it must also be used during linking and vice versa.
Step 2: Runtime
At runtime, your program compiled with Insure++ writes a log file that records the blocks that were actually executed during a specific run. By default, this file is called tca.log
, but you can change the name of this file by adding a an insure++.coverage_log_file
value to your Advanced Options (Windows) or your .psrc file (Unix). Normally, each time you run your program the new log information will be combined with the existing log file unless the data is incompatible. Data may not be compatible because you changed your code and recompiled, for example.
Another useful option is to generate a new log file each time your application runs. You can do this by taking advantage of the %n filename
option, for example:coverage_log_file tca.log.%n
(Windows)
insure++.coverage_log_file tca.log.%n
(Unix)
In this example, each run would make a new file, such as tca.log.0
, tca.log.1
, and so forth. If your program forks, you will need to use this option so that each child creates its own log file.
...
After you have created one or more log files, you can use the tca
command command to get the information in which you are interested. TCA normally sends its reports to console
(Windows) or stdout
(Unix)to stdout
. If you would like to use the graphical version to generate coverage reports, see The TCA Display for more information.
...