This topic explains how to review and customize project-level and file-level options, including build settings, custom compiler and linker options, and other settings.
Sections include:
The appropriate build settings must be configured in order for C/C++test to properly test your code. Additionally, Advanced Settings (instrumentation options) can be configured as needed.
To review and modify settings:
Right-click the Solution Explorer tree (a.k.a. "the project tree") node for the project or file whose settings you want to review and modify, then choose Parasoft>Properties from the shortcut menu. The Properties dialog will open.
Options source: Determines how options are set.
Use options from a build data file is recommended if you used cpptestscan
to create a build data file, as described in, and if you prefer to manually manage regeneration and update the build data file.
Use options from the project is recommended for projects that were originally developed in Visual Studio.
Use options from the project is recommended for projects that were originally developed in Visual Studio.
The available controls depend on the Options source selected.
Build system complexity and time required to perform a full project rebuild determine which options source is appropriate. If Use options from a build system is enabled:
If Use options from a build data file is enabled:
|
If you decide to manually manage a build data file, integrating the mechanism for creating build data files into your build process is highly recommended. This is so that members of the development team can access and use your build data file, as well as helps you seamlessly generate or update it during regular build activities. |
In C++test 7.1 and above, Use options from Makefile-based project was replaced by Use options from a build system. To achieve the same functionality as that provided by Use options from Makefile-based project, use the following settings
|
Multiple C/C++test Project Configurations can be used to manage tests for a range of different configurations. For example, you can configure a project for testing a host-compiler, cross-compiler, testing in Debug mode, testing in Release mode, etc.
You can also export current active properties to a file or import previously saved properties from a file:
Exporting a properties creates a file that's can also be used as an argument in the cpptestcli -settings
parameter. This allows you to easily switch between different project configurations when testing from the command line.
To configure the appropriate settings:
When Visual C++ project file options change, C/C++test will automatically rescan the options and modify the project accordingly.
To configure the appropriate settings:
${resource_loc}
resolves to the path to the specific project resource. For instance, ${resource_loc:/MyProject/linked_src_dir/source.cpp}
will be resolved into C:\src\source.cpp
.When the options in the specified build data file change, C/C++test will automatically rescan the options and modify the project accordingly. If you want to force C/C++test to update options immediately (for example, if an external configuration file has changed), click the Reset cache button.
To configure the appropriate settings:
${CPPTEST_SCAN}
variable.Here is a sample GNU build command line:make -i -B objects CXX=${CPPTEST_SCAN} CC=${CPPTEST_SCAN}
This command line will build the objects
make target with the flags -B
(make all targets unconditionally) and -i
(ignore errors). The CXX
and CC
make variables will be substituted with ${CPPTEST_SCAN}
. This command line will allow C/C++test to extract options for all source files that are normally compiled to build the objects
target.
CXX=\${CPPTEST_SCAN}
The build command line is preset to include the -B switch option (unconditionally make all targets). Only GNU Make 3.80+ supports this option. If you are using an earlier make, clean the build before creating a project. Keep the -k switch. If you are using a make that does not support -B, further modification of the command line is required. The default build command line used in the project properties does not have any targets. We recommend that you modify this command line with the target(s) used to build the code you want analyzed For example:
Also, add a clean step prior to the normal build target. For example:
This would first make the clean target, then |
3. In the Build working directory field, specify the directory in which the build process should execute.
${project_loc}
resolves to the absolute path to the Visual Studioproject location
${resource_loc}
resolves to the path to the specific project resource. For instance, ${resource_loc:/MyProject/linked_src_dir/source.cpp}
will be resolved into C:\src\source.cpp
.
4. In the Dependency file(s) field, specify the Makefile(s) to be checked for changes. Options will be automatically updated if the specified file(s) changes.
Using an absolute path could result in a non-portable project. We recommend that you use the following C/C++test variables to specify the path:
${project_loc}
resolves to the path to the Visual Studioproject location
${resource_loc}
resolves to the path to the specific project resource. For instance, ${resource_loc:/MyProject/linked_src_dir/source.cpp}
will be resolved into C:\src\source.cpp.
5. In the Compiler settings area, specify the compiler executable (for C and C++ sources), linker, and family. If your compiler is not listed, add a custom compiler definition for it (as described in Configuring Testing with the Cross Compiler).
6. In the Options area, specify any test-specific C/C++test-specific options compiler or linker options that you want to use, and that are not already specified in the Makefile. See Specifying Custom Compiler Settings and Linker Options for details.
When the options in the specified dependency file(s) change, C/C++test will automatically rescan the options and modify the project accordingly.
Determines whether the selected source file is instrumented during test case execution.
In order to apply this setting to multiple files, select files in the project tree, then right-click the selection and choose Parasoft> C/C++test> Execution Settings. Note that the current setting will be applied uniformly to all selected files.
The C/C++test temporary files field controls where C/C++test keeps temporary data/files, such as instrumented sources, compiled objects, linked test executables, and automatically-generated header files. This setting controls {cpptest:testware_loc}
.
Since C/C++test can automatically re-generate these files as needed, they do not need to be shared across team members. Thus, these files should not be saved within the project or added to source control.
The temporary data can be deleted by clicking the Clear button. We recommend that you do not delete the temporary data between test runs; keeping this data can significantly improve performance.
For optimal performance, use a location on the local hard drive.
This table allows you to specify various low-level and debug options; for a list of available options, see Advanced Instrumentation Configuration Options.
Determines if multibyte encoding should be used when processing source files. By default, C/C++test automatically activates support for multibyte characters based on the current system encoding (Auto mode). In order to manually control multibyte support, set the option value to On or Off.
Note that performance may be impacted by analyzing code with support for multibyte characters enabled.
Allows you to specify project files that you do not want tested. See Testing a User-Defined Set of Resources for details.