Running code coverage in headless mode

Running code coverage in headless mode allows you to run code coverage without having a UI open. This is ideal for environments in which a UI workbench is not installed and/or running code coverage from the command line or as part of a script may be necessary.

About this task

You can run code coverage for any compiled language application that you can debug from the command line or as part of a script. There are two modes in which you can run headless code coverage:

  1. As a daemon listening for a connection (use with a remote debug engine using the port specified - see Running code coverage in headless mode: Daemon) for more information.
  2. Operating directly on a program compiled with debug information, specified as an argument (One Shot mode).
    Note: One Shot mode is only available for AIX/Linux, not on z Series.
    $ codecov testProg
Note: The results will be stored by date in the root of the user's home directory under the CC folder.
The syntax diagram for the codecov command is shown below:
>>-codecov--+----------------------------------------------------------------------------------------------------------------+--><
            |                                                                                                                |
            + -stopdaemon=<PORT_NUMBER> -------------------------------------------------------------------------------------+
            |                                                                                                                |
            + <PROGRAM_NAME>  <PROGRAM_PARAMETERS>  -optionsfile=<PATH> --+                                                  |
            |                                                             |                                                  |
            |                                     .------------------.    |                                                  |
            |                                     v                  |    v                                                  |
            + -startdaemon  -optionsfile=<PATH> --+--------------------------+--------------------------------------------+--+
            |                                     |                  |       |                                            |  |
            |                                     + -singleconnect --+       + -output=<PATH> ----------------------------+  |
            |                                     |           	     |       |                                            |  |
            |                                     + -localonly ------+       + -cclevel=<"LINE" | "FUNCTION" | "LEVEL"> --+  |
            |                                                                |                                            |  |
            |                                                                + -prevresultpath=<"NONE" | "PREV" | PATH> --+  |
            |                                                                |                                            |  |
            |                                                                + -reportformat=<"HTML" | "NONE"> -----------+  |
            |                                                                |                                            |  |
            |                                                                + -savesource -------------------------------+  |
            |                                                                |                                            |  |
            |                                                                + -startupcommandlist=<PATH> ----------------+  |
            |                                                                |                                            |  |
            |                                                                + -zipresult --------------------------------+  |
            |                                                                |                                            |  |
            |                                                                + -moduleexcludelist=<PATH> -----------------+  |
            |                                                                |                                            |  |
            |                                                                + -port=<PORT_LIST> -------------------------+  |
            |                                                                                                                |  
            + -help ---------------------------------------------------------------------------------------------------------+  
                                           
Options List
Format: codecov [options] [program_name] [program_parameters]
program_name
The full path of the executable to run code coverage on.
Note: One Shot mode is only available on AIX/Linux, not on z Series.
program_parameters
The parameters for the program.
Note: One Shot mode is only available on AIX/Linux, not on z Series.
-startdaemon
Start in daemon mode and wait for connections.
-stopdaemon=<port>
Stop the daemon that is listening on the port.
-cclevel=<"LINE" | "FUNCTION" | "MODULE">
The code coverage level (either "LINE", "FUNCTION" or "LINE")
-modulelist=<path>
Optionally specify a file that contains a list modules used by MODULE level code coverage.
-prevresultpath=<"NONE" | "PREV" | path>
Specify the path of the previous result file.
-reportformat=<"HTML" | "NONE">
Generate an HTML report if the report format is HTML.
-singleconnect
Exit after a single daemon connection (must use with -startDaemon).
-localonly
The daemon will only accept connections from the localhost.
startupcommandlist=<path>
Specifies a file that contains commands that will be sent to the debug engine at startup.
-savesource
Saves the source with the results.
-optionsfile=<path>
Read command arguments from the specified options file.
-tag="text"
Specify a tag that will be associated with the CC results. e.g. testcase ID.
-zipresult
The results directory is compressed into a zip file with the same name as the results directory.
-moduleexcludelist=path
Specifies a file that contains a list of modules to exclude from code coverage. Modules should be listed one per line within the file, and may include regular expressions.
-port=<port_list>
The port number, port list(port,port) or port range(port-port) used by the debug daemon.
-help
Print out the help screen.

Feedback