Please enable JavaScript to view this site.

Coverage Validator Help

Navigation: Command Line Interface

Example Command Lines

Scroll Prev Top Next More

Typical command line examples

 

The following examples demonstrate a few different scenarios in which you might want to use Coverage Validator via the command line.

 

To run 32 bit coverage validator run C:\Program Files (x86)\Software Verify\Coverage Validator x86\coverageValidator.exe

 

To run 64 bit coverage validator run C:\Program Files (x86)\Software Verify\Coverage Validator x64\coverageValidator_x64.exe

 

 

Example 1 - running a session

 

This example starts the application, showing no progress dialog whilst attaching to the process.

 

On completion, the resulting session is saved, and some tabs are refreshed.

 

The last tab refreshed is displayed, resulting in the Functions tab being the current tab.

 

coverageValidator_x64.exe -program "c:\myProgram.exe" -saveSession "c:\myResults\session1.cvm_x64" -displayUI -refreshResults -refreshCoverage -refreshFunctions -refreshFilesAndLines

 

A brief explanation of each argument:

 

Option

 

Argument

Description

-program

"c:\myProgram.exe"

The target program to launch

-saveSession

"c:\myResults\session1.cvm_x64"

After the application finishes, the session should be saved in this file

-displayUI


Show the user interface during the coverage test

-refreshResults


The current directory for the application to work in

-refreshCoverage


All main data tabs should be refreshed when the test completes, including the Summary Results

-refreshFunctions



-refreshFilesAndLines



 

 

Example 2 - running a session and exiting when the session is complete

 

This example starts the application, showing no progress dialog whilst attaching to the process.

 

On completion, the resulting session is saved, and Coverage Validator exits.

 

coverageValidator_x64.exe -program "c:\myProgram.exe" -saveSession "c:\myResults\session2.cvm_x64" -hideUI

 

A brief explanation of each argument:

 

Option

 

Argument

Description

-program

"c:\myProgram.exe"

The target program to launch

-saveSession

"c:\myResults\session2.cvm_x64"

After the application finishes, the session should be saved in this file

-hideUI


Hide the user interface during the coverage test. Coverage Validator closes when the test application finishes.

 

 

Example 3 - running a session (.Net Core, Self Contained)

 

This example starts a .Net Core application, showing no progress dialog whilst attaching to the process.

 

On completion, the resulting session is saved, and some tabs are refreshed.

 

The last tab refreshed is displayed, resulting in the Functions tab being the current tab.

 

coverageValidator_x64.exe -program "c:\myDotNetCoreApp.exe" -dotNetCoreLaunchType SelfContained -saveSession "c:\myResults\session3.cvm_x64" -displayUI -refreshCoverage -refreshFunctions -refreshResults

 

A brief explanation of each argument:

 

Option

 

Argument

Description

-program

"c:\myDotNetCoreApp.exe"

The target program to launch

-dotNetCoreLaunchType

SelfContained

The .Net Core program is self contained

-saveSession

"c:\myResults\session3.cvm_x64"

After the application finishes, the session should be saved in this file

-displayUI


Show the user interface during the performance test

-refreshCoverage


Main data tabs should be refreshed when the test completes, including the Summary Results

-refreshFunctions



-refreshResults


Coverage Validator will be left open at the Summary Results

 

 

Example 4 - running a session (.Net Core, Framework Dependent)

 

This example starts a .Net Core application, showing no progress dialog whilst attaching to the process.

 

On completion, the resulting session is saved, and some tabs are refreshed.

 

The last tab refreshed is displayed, resulting in the Functions tab being the current tab.

 

coverageValidator_x64.exe -program "c:\dotNetCoreApp.dll" -dotNetCoreLaunchType FrameworkDependent -saveSession "c:\myResults\session4.cvm_x64" -displayUI -refreshCoverage -refreshFunctions -refreshResults

 

A brief explanation of each argument:

 

Option

 

Argument

Description

-program

"c:\dotNetCoreApp.dll"

The target program to launch with the .Net runtime

-dotNetCoreLaunchType

FrameworkDependent

The .Net Core program is framework dependent

-saveSession

"c:\myResults\session4.cvm_x64"

After the application finishes, the session should be saved in this file

-displayUI


Show the user interface during the performance test

-refreshCoverage


Main data tabs should be refreshed when the test completes, including the Summary Results

-refreshFunctions



-refreshResults


Coverage Validator will be left open at the Summary Results

 

 

Example 5 - running and merging a session

 

Add the following to the first example to load a previous session, and after the application has finished and this session saved, merge in the loaded session, and save the combined results:

 

coverageValidator_x64.exe -program "c:\myProgram.exe" -directory "c:\testarea" -loadSession "c:\myResults\session1.cvm_x64" -mergeSessions -saveMergeResult "c:\myResults\session5.cvm_x64"

 

Option

 

Argument

Description

-program

"c:\myProgram.exe"

The target program to launch

-directory

"c:\testarea"

Set the working directory in which the program is executed

-loadSession

"c:\myResults\session1.cvm_x64"

Loads this previously saved session into the session manager

-mergeSessions


The loaded session is to be merged with the newly recorded session recorded after the application has terminated

-saveMergeResult

"c:\myResults\session5.cvm_x64"

The merged session should be saved here

 

 

Example 6 - merging previous results

 

This example loads two previously saved sessions and merges them without any user intervention, saving the merged session as a new session.

 

coverageValidator_x64.exe -hideUI -loadSession "c:\myResults\session1.cvm" -loadSession2 "c:\myResults\session2.cvm_x64" -mergeSessions -saveMergeResult "c:\myResults\session1+2.cvm_x64"

 

 

Option

 

Argument

Description

-hideUI


The user interface should not be shown during the test

-loadSession

"c:\myResults\session1.cvm_x64"

Loads this previously saved session into the session manager

-loadSession2

"c:\myResults\session2.cvm_x64"

Also loads this session

-mergeSessions


The loaded session is to be merged with the newly recorded session recorded after the application has terminated

-saveMergeResult

"c:\myResults\session1+2.cvm_x64"

The merged session should be saved here

 

 

Example 7 - merging multiple previous results

 

This example loads two previously saved sessions and merges them without any user intervention, saving the merged session as a new session.

 

coverageValidator_x64.exe -hideUI -mergeSessions -mergeMultiple e:\cv_merge_multiple.txt -saveMergeResult e:\cv_merge_result.cvm_x64

 

 

Option

 

Argument

Description

-hideUI


The user interface should not be shown during the test

-mergeSessions


Merge all sessions

-mergeMultiple

e:\cv_merge_multiple.txt

Loads all sessions identified by the filenames listed in this file, one filename per line.

-saveMergeResult

e:\cv_merge_result.cvm_x64

Save the merged sessions in this new session

 

 

Example 8 - merging runs into a central session

 

This example profiles two different applications (each of which is a unit test) merging them into a central session.

 

It demonstrates the use of -mergeClearNone, -mergeUsingSymbol and relative file specifications (rather than explicit full path file specifications).

 

Because the two applications are different we must prevent the merge from resetting its data when the application changes and when the application timestamp changes. We do this with the -mergeClearNone option.

 

There is also a very real chance that symbols from each application will use conflicting addresses, thus we must merge using symbol names, not addresses. We do this using the -mergeUsingSymbol option.

 

First unit test:

 

coverageValidator_x64.exe -resetSettings -showErrorsWithMessageBox -mergeUsingSymbol -mergeClearNone -numSessions 2 -hideUI -program .\bin\tstdate.exe -mergeToCentralSession:On -centralFileName .\temp\cvmerge.cvm_x64 -saveSession .\temp\libdate.cvm_x64 -sourceFileFilterHookFile .\cv\libdate.srchook -dllHookFile .\cv\libdate.dllHook

 

Second unit test, with identical arguments in grey:

 

coverageValidator_x64.exe -resetSettings -showErrorsWithMessageBox -mergeUsingSymbol -mergeClearNone -numSessions 2 -hideUI -program .\bin\tsttime.exe -mergeToCentralSession:On -centralFileName .\temp\cvmerge.cvm -saveSession .\temp\libtime.cvm_x64 -sourceFileFilterHookFile .\cv\libdate.srchook -dllHookFile .\cv\libdate.dllHook

 

Each command line is essentially the same, but runs a different application and saves a different session.

 

You can add more unit tests by running more command lines.

 

Because of the repeatable nature of the command line this is easily scriptable.

 

A brief explanation of the arguments not already covered above:

 

Option

 

Argument

Description

-resetSettings


Resets the settings to the default state, providing a known starting point to modify the settings from. An alternative would be to use -loadSettings to load a known set of settings

-showErrorsWithMessageBox


A message box is displayed if any errors are encountered when processing options such as -dllHookFile and -sourceFileFilterHookFile

-mergeUsingSymbol


Merges sessions by symbol, rather than by address

-mergeClearNone


Prevents merged data in the central session from being reset, e.g. because the application has changed or because the timestamp has changed

-numSessions


Allows the session manager to load 2 sessions, ensuring there is enough workspace to hold the sessions in use

-mergeToCentralSession

:On

Indicates that code coverage sessions should be merged into a central session

-centralFileName

.\temp\cvmerge.cvm_x64

The central session location in the temp sub directory of the current directory

-sourceFileFilterHookFile

.\cv\libdate.srchook

A file listing source files that should be processed for code coverage

-dllHookFile

.\cv\libdate.dllHook

A file listing the DLLs that should be processed for code coverage

 

 

Example 9 - using command files

 

Functionally this example does the same as the previous example, but uses command files to achieve the same result

 

The following code would be placed in a .bat or .cmd file:

 

@echo off
del /Q .\temp\*.*
"C:\Program Files (x86)\Software Verify\Coverage Validator\coverageValidator.exe" -commandFile .\cv\libtime.cf
"C:\Program Files (x86)\Software Verify\Coverage Validator\coverageValidator.exe" -commandFile .\cv\libdate.cf
"C:\Program Files (x86)\Software Verify\Coverage Validator\coverageValidator.exe" -commandFile .\cv\export.cf

 

The code empties the local results 'temp' directory and then runs two tests as above, before finally running CoverageValidator once more to create some HTML reports.

 

The batch file assumes it will be run from the directory that has the bin, cv, and temp sub-directories with the appropriate data in them.

 

The contents of the .cf files in this example would be as follows:

 

libdate.cf

 
-resetSettings
-showErrorsWithMessageBox
-mergeUsingSymbol
-mergeClearNone
-numSessions 2
-hideUI
-program .\bin\tstdate.exe
-dllHookFile .\cv\libdate.dllhook
-sourceFileFilterHookFile .\cv\libdate.srchook
-mergeToCentralSession:On
-centralFileName .\temp\cvmerge.cvm_x64
-saveSession .\temp\libdate.cvm_x64

 

libtime.cf

 

-resetSettings
-showErrorsWithMessageBox
-mergeUsingSymbol
-mergeClearNone
-numSessions 2
-hideUI
-program .\bin\tsttime.exe
-dllHookFile .\cv\libtime.dllhook
-sourceFileFilterHookFile .\cv\libtime.srchook
-mergeToCentralSession:On
-centralFileName .\temp\cvmerge.cvm_x64
-saveSession .\temp\libtime.cvm_x64

 

export.cf

 

-resetSettings
-loadSession .\temp\cvmerge.cvm_x64
-hideUI
-exportAsHTML .\temp\cvreport.html
-exportDescription "Time and date tests"
-exportDetailedReport:On
-exportDoColourCode:On
-exportSourceCode:On
-exportType SummaryAndCoverage
-exportUnhooked:On
-exportUnvisitedFunctions:On
-exportUnvisitedLines:On
-exportVisitedFunctions:On
-exportVisitedLines:On
-showMergeWithReport none

 

 

Example 10 - monitoring a process that restarts itself

 

This example shows you how to collect code coverage data for a process that restarts itself. Because it restarts itself it will create multiple coverage sessions - to deal with this we use the central session to collect all the different coverage data into one session.

 

coverageValidator_x64.exe -waitName "E:\test\myProgram.exe" -hideUI -monitorAllRestarts -maxNumRestarts 3  -mergeUsingSymbol -mergeClearNone -mergeToCentralSession:On -centralFileName e:\cvmerge.cvm_x64

 

 

Option

 

Argument

Description

-waitName

"E:\test\myProgram.exe"

Wait for this program to start

-hideUI


The user interface should not be shown during the test

-monitorAllRestarts


Monitor this program when it restarts as well as the first time it starts.

-maxNumRestarts

3

When the program has been restarted 3 times and then shutdown, close Coverage Validator.

-mergeUsingSymbol


Merges sessions by symbol, rather than by address

-mergeClearNone


Prevents merged data in the central session from being reset, e.g. because the application has changed or because the timestamp has changed

-mergeToCentralSession

:On

Indicates that code coverage sessions should be merged into a central session

-centralFileName

e:\cvmerge.cvm_x64

The central session location in the root directory of e: drive.