This topic explains how to collect code dependency data for your projects with Parasoft C/C++test Standard and export the data as files that can later be imported to Lattix Architect.
Requirements
- Parasoft C/C++test Standard
- Lattix Architect
C/C++test requires dedicated license features to be activated to collect and export code dependency data. Contact your Parasoft representative for details.
Exporting Code Dependency Data with C/C++test
To collect and export code dependency data, run C/C++test with the built-in Export Code Dependency Data test configuration. Your command line may resemble the following:
cpptestcli -compiler gcc_9-64 -config "builtin://Export Code Dependency Data" -input cpptestscan.bdf
See Running Static Analysis for details on how create a .bdf file and run analysis in the command line.
The results are saved as XML files in the deps subdirectory of the default report location in your workspace: <WORKSPACE>reports/deps. You can customize the report location with the -report <path>
command line option or the report.location=[path]
setting; see Customizing Reports for details. C/C++test creates one .xml file per compilation unit.
Customizing the Scope to Include Header Files
By default, dependency data is collected for source files in the tested project. You can modify the scope of dependency analysis to include header files:
To analyze project header files, run C/C++test with the
-module .
option. Your command line may resemble the following:cpptestcli -compiler gcc_9-64 -config "builtin://Export Code Dependency Data" -input cpptestscan.bdf -module .
To analyze all header files, including system headers, run C/C++test with the
cpptest.analyzer.dependency.scope
setting disabled in the command line or C/C++test's .properties file. Your command line may resemble the following:cpptestcli -compiler gcc_9-64 -config "builtin://Export Code Dependency Data" -input cpptestscan.bdf -module . -property cpptest.analyzer.dependency.scope=false
See Configuration Overview for details on how to configure C/C++test with command line options and .properties files.
Running Dependency Analysis with Static Analysis
To simultaneously collect code dependency data and perform static code analysis, you need to run C/C++test using a custom test configuration where both the code dependency analyzer and the set of rules you want to enforce are enabled.
You can create the custom test configuration in one of the following ways:
- Duplicate the
builtin://Export Code Dependency Data
test configuration and enable the rules you want to use to check your code. See Creating Custom Test Configurations for details. Open the .properties file that defines your custom static analysis test configuration and add the following entry:
cpptest.analyzer.dependency.enabled=true
Importing Code Dependency Data to Lattix Architect
Log into the Lattix Architect documentation for information about importing XML code dependency data files.