This topic explains how to collect code dependency data for your projects with Parasoft C/C++test Professional and export the data as files that can later be imported to Lattix Architect.

Requirements

  • Parasoft C/C++test Professional
  • 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:

  1. Create a dependency.properties file and add the following entry to configure the output location for exported files:

    cpptest.analyzer.dependency.report.location=<path>
  2. Add the path to the dependency.properties file to C/C++test's advanced settings.

    If you run C/C++test in the IDE, go to Parasoft> Preferences...> C/C++test advanced settings> Settings file and and specify the path to the the dependency.properties file.

    If you run C/C++test in the command line, add the following entry to the configuration file with localsettings (see Configuring Localsettings for details):

    cpptest.advanced.settings.file=<path/to/dependency.properties>
  3. Run C/C++test with the built-in Export Code Dependency Data test configuration.

    If you run C/C++test in the IDE, choose Parasoft> Test Using> Builtin> Integrations> Lattix Architect> Export Code Dependency Data.

    If you run C/C++test in the command line, specify the test configuration with the -config option.  Additionally, you can use the -appconsole stdout option to enable displaying output of the C/C++test analysis engine. Your command line may resemble the following:

    cpptestcli -data /path/to/workspace -localsettings /path/to/localsettings.properties -config "builtin://Export Code Dependency Data" -appconsole stdout
  4. Review the results saved as XML files (one file per compilation unit). The results are saved in the location you specified in the dependency.properties file.

The results are saved as XML files in the location you specified in the dependency.properties file. C/C++test creates one .xml file per compilation unit.

Customizing the Scope

By default, dependency data is collected for source and header files in the tested project. To analyze all header files, including system headers, add the following option to the dependency.properties file:

cpptest.analyzer.dependency.scope=false

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 a Custom Test Configuration 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

See the Lattix Architect documentation for information about importing XML code dependency data files.



  • No labels