This page lists the command line options for cpptestcli.

Configuring the Test Configuration

-config

This option allows you to specify the test configuration that will be used for analysis. The option must be followed by the name of a built-in, user-defined or DTP-hosted test configuration. Examples:

  • cpptestcli -config "builtin://MISRA C"
  • cpptestcli -config "user://My_Config"
  • cpptestcli -config "dtp://New_Rules"

-list-configs

Prints a list of available test configurations and can be used to obtain a vaild test configuration name you can pass with the -config option.

Configuring the Compiler

-compiler <name|path>

Specifies compiler configuration name to be used for code analysis and instrumentation. Compiler configuration name needs to be one of the supported compilers names. See Supported Compilers or use the -list-compilers option.

-list-compilers

Prints a list of supported compilers and can be used to obtain a vaild compiler ID you can pass with the -compiler option.

-detect-compiler

Detects the compilers based on the compiler command (the executable name) you specify with or without the path). You can provide a list of compiler commands with a semicolon-separated list and use this option to obtain a valid compiler ID to pass with the -compiler option. Example:

  • -detect-compiler gcc

Configuring the Input Scope

 -trace <build command>

Specifies the build command that starts the build process to compile the files to be tested. The information about the build process and the input scope data collected during the build are stored in the cpptest.bdf file. C/C++test-specific options must be specified before -trace, because all values following -trace will be interpreted as a build command. Example:

  • cpptestcli -config "builtin://Recommended Rules" -compiler gcc_3_4 -trace make clean all

-input <build data file|project file>

Specifies the path to an existing build data file (.bdf) or another project definition file to collect the input scope.

Build data file: You can create a build data file with the -trace option or by using the standalone cpptestscan or cpptesttrace utilities.

Project file: Currently, Microsoft Visual Studio projects and solutions (.vcproj, .vcxproj, .sln) are supported. Additionally, when specifying Microsoft Visual Studio project or solution you can provide configuration and platform to collect data for <PROJECT_FILE>@<CONFIGURATION>|<PLATFORM>.

Examples:

  • -input cpptest.bdf
  • -input MyProject.vcproj
  • -input MySolution.sln
  • -input "MySolution.sln@Release|Win32"

-- <compile command

A switch to collect the input scope form a compile command. Ensure the compile command is complete and includes your compiler executable, compiler flags, and source files.

C/C++test-specific options must be specified before -- switch, because all values after -- switch will be interpreted as a compiler command. Example:

  • cpptestcli -config "builtin://Recommended Rules" -compiler gcc_3_4 -- gcc -I include Bank.cxx

-module [<module name>=]<module root directory>

Specifies the module root directory and associates it with a module. If the module name is not specified, C/C++test uses the directory name as the module name.

This option allows you define modular structure for C/C++test files included in the .bdf file:

  • a source file located in the specified module root directory (or its subdirectory) belongs to the associated module
  • a header file located in the specified module root directory (or its subdirecotyr) beliongs to the associated module
  • a header file included in a tested source file is tested only if it belongs to the same module as the source file

You can specify this option more than once to define multiple modules - for example, files included in one .bdf file can be divided into different modules.

This option is not supported for Microsoft Visual Studio projects / solutions (.vcproj, .vcxproj, .sln).

Examples:

  • -module MyProject=/home/project/src
  • -module ../Module1
  • -module .

-resource <path|file name>

Narrows down the input scope to the specified resources. You can specify one of the following:

  • a path to a file – to test a selected file
  • a path to a directory – to test the files included in the selected directory
  • a file name - to only test the files that match the specified name

Examples:

  • -resource /home/cpptest/examples/ATM/ATM.cxx
  • -resource /home/cpptest/examples/ATM
  • -resource ATM.cxx

-include <file|pattern> and -exclude <file|pattern>

Includes/excludes file(s) that match the specified pattern into/from instrumentation scope. The options can be specified multiple times.

Final filtering is determined only after all include/exclude entries have been specified in the order of their specification.

Provide an absolute path to a file (you can use * as a wildcard). Examples:

  • -include /home/project/src/ATM.cxx
  • -include /home/project/CustomIncludes.lst
  • -exclude /home/project/src/*.cxx
  • -exclude /home/project/MyExcludes.lst

Alternatively, you can specify the list of files to be included and/or excluded in a text file with the .lst extension and pass the file with the -resource switch - each line in the file will be treated as a single entry.

Reporting

-report <path>

Specifies the directory where the report will be created.

-publish

A switch to publish the results to the DTP server.

Customizing Configuration

 -settings <path>, -localsettings <path>, and -ls <path>

Specifies the path to a custom .properties file that includes customized settings in the following format: key=value, for example cpptest.license.use_network=true.

You can use the -settings switch multiple times to specify several .properties files. Entries with the same key will be overwritten. Examples:

  • -settings CompanyWideConfig.properties
  • -ls UserLevelConfig.properties

See Configuration Settings for the list of settings you can configure.

-property <key>=<value>

Configures a single setting in the following format: key=value.

You can use the -property switch multiple times to configure several settings. Earlier entries with the same key will be overwritten. Examples:

  • -property cpptest.report.csv.enabled=true -property techsupport.create.on.exit=true

See Configuration Settings for the list of settings you can configure.

-show-settings

Prints the current settings and customizations.

-psrc <path|name>

Specifies an advanced configuration file provided by Parasoft Support. Example:

  • -psrc advanced_options.psrc

Other Options

-machineId

Prints your machine ID.

-encodepass <your password>

Prints an encoded password that can be used in the .properties configuration file.

-workspace <path>

Specifies the workspace directory to be used during code analysis and instrumentation. The workspace location is used to store C/C++test data files (such as cpptest.bdf) and incremental data directory (.cpptest). If not specified, C/C++test uses your working directory for storage. Example:

  • -workspace /home/qa/workspace_for_project1

(info) You can run only one instance of C/C++test per workspace.

-showdetails

Displays detailed progress information by increasing console verbosity.

  -fail

Fails the command by returning a non-zero exit code if any findings are reported.

-version

Prints information about the version of C/C++test.

-help

Displays command line help.

  • No labels