This topic helps you troubleshoot problems you might experience with C/C++test.
C/C++test analyzes C/C++ source files directly and header files indirectly. Based on the current selection, C/C++test will analyze all C/C++ source files and report violations for all source and header files from the selection (only for header files included by the source files).
For example:
Choose Parasoft> Preferences, select Console, then select the desired verbosity level (High, Normal, Low).
High Verbosity | Normal Verbosity | Low Verbosity | |
---|---|---|---|
Basic info about the current step’s name and status (done, failed, up-to-date) | Yes | Yes | Yes |
Errors | Yes | Yes | Yes |
Warnings | Yes | No | No |
Command Lines | Yes | Yes | No |
Violations printed out during static analysis and unit testing execution | Yes, full-format | Yes, short-format | No |
To prevent C/C++test from running out of memory, add memory parameters to the script or shortcut you are using to start C/C++test. The two parameters are the initial size of the JVM (Xms) and the maximum size of the JVM (Xmx). Typically, both are set to the same size (for instance, 1024MB). However, if you have occasional problems but don't want to always allocate a large amount of memory, you can set the parameters to different sizes (for example, 1024MB as the initial size and 1400MB for the maximum size). The maximum size you can set depends on your OS and JVM.
Examples:
C/C++test standalone: cpptest.exe -J-Xms1024m -J-Xmx1400m
C/C++test plugin for Eclipse: eclipse.exe -vmargs -Xmx1400m
You canalsocustomize the amount of allocated memory with the CPPTEST_ENGINE_EXTRA_ARGS option by specifying the value of the -Xmx
setting. This may be particularly useful for when you perform static analysis or report results to DTP. See Configuring Advanced Options for details.
If C/C++test runs out of memory when generating the report, see What if C/C++test runs out of memory when generating the report?.
If you suspect that your problems stem from network or connection problems, you may want to try adjusting timeouts by passing these Java system properties to the Eclipse process:
Switch | Description |
---|---|
parasoft.ws.timeout | Sets socket timeout for all services. The value is in seconds. |
parasoft.ws.connection.timeout | Sets connection timeout for all services. The value is in seconds. |
parasoft.tcm.timeout | Sets timeout for the Team Server service. It could set timeout only for this service or override the value set by the general parasoft.ws.timeout. The value is in seconds. |
Example:
C/C++test standalone:
cpptest.exe -J-Dparasoft.ws.timeout=180 cpptest.exe -J-Dparasoft.ws.connection.timeout=15 cpptest.exe -J-Dparasoft.tcm.timeout=30 |
C/C++test plugin for Eclipse:
eclipse.exe -vmargs -Dparasoft.ws.timeout=180 eclipse.exe -vmargs -Dparasoft.ws.connection.timeout=15 eclipse.exe -vmargs -Dparasoft.tcm.timeout=30 |
If only parasoft.ws.timeout is set, it affects both socket and connection timeout.
See Preparing a Support Archive.
To check which version of C++test is currently installed:
Try to launch Eclipse (once) with the -clean
option. This will force a refresh of an internal (Eclipse) registry/cache.
Eclipse may crash when it cannot write to the location in the installation directory where configuration files are kept. This is common when Eclipse is set up to have multiple users share a single install area. To prevent this, store config files in your home directory. See Requirements and Multi-user Installations.
Changes in the network environment may affect the interface that is used to compute your machine ID and result in machine ID instability. You can use the PARASOFT_SUPPORT_NET_INTERFACES environment variable to specify a stable interface and prevent the machine ID from floating.
Set the variable value to a stable Ethernet network interface. Do not use virtual, temporary or loopback interfaces.
- On Windows: Set the value to the MAC address of your network card. You can use the ipconfig -all
command to obtain the address. For example:
SET PARASOFT_SUPPORT_NET_INTERFACES=00-10-D9-27-AC-85 |
- On Linux: Set the value to one of the network interfaces from the "inet" or "inet6" family. You can use the ifconfig
command to obtain the list of available interfaces. For example:
export PARASOFT_SUPPORT_NET_INTERFACES=eth1 |
If the problem persists, you can obtain diagnostic information by setting up the environment variable PARASOFT_DEBUG_NET_INTERFACES and setting its value to true. This will print to the standard output the checking procedure that can be shared with technical support, as well as the interface that is used to compute your machine ID. The interface will be marked with the [SELECTED] prefix.
If your Machine ID is WIN32-0, remove the license file located in <DRIVE>:\Users\<USER_NAME>\.parasoft\C++test\10.x\license.
Suppressions associated with rules whose messages changed between releases may not be available on DTP and the rules must be re-suppressed.
You can restore legacy messages for BD category rules in version 10.4.1 and later by configuring the following advanced option (see Configuring Advanced Options):
CPPTEST_ENGINE_EXTRA_ARGS="-property flowanalysis.legacy.messages.for.<rule_ID>=true"
For example:
CPPTEST_ENGINE_EXTRA_ARGS="-property flowanalysis.legacy.messages.for.BD.PB.ARRAY=true -property flowanalysis.legacy.messages.for.BD.PB.ZERO=true" |
To successfully restore the legacy messages, ensure that you remove the .cpptest folder that contains the local C/C++test cache data from following location: <workspace_location>/.cpptest/.dtpengine/.cpptes
t.
Ensure that you have correctly configured your environment for the given compiler before launching Eclipse (including. $PATH, $LD_LIBRARY_PATH etc.)
QNX GCC compilers may prevent C/C++test from working properly if C/C++test is installed in a directory with a space its name (for example, C:\Program Files
).
If you want to use C/C++test with a QNX compiler, ensure that the name of C/C++test installation directory does not have a space.
Import the project as described in To create a C++test project from a Visual Studio 6.0 project:
For other versions of Microsoft Visual C++, use the "Visual Studio Command Prompt" utility script (provided with the Visual Studio installation) to open a console with the Visual Studio environment. Then, launch Eclipse from that console to ensure that the environment is correctly configured. Note that C++test is also available as a plugin for Visual Studio 2005 and newer versions.
You can create a project using cpptestcli. See Creating a Project Using an Existing Build System.
If you debug code compiled with the Microsoft Visual C++ 14.2 compiler shipped with Visual Studio 2019, launch Visual Studio 2019 IDE prior to debugging and ensure it is running in the background until the C/C++test run has ended.
To ensure the analysis completes, you can do one of the following:
cpptest.analyzer.source.timeout=<TIMEOUT_IN_SECONDS>
.
The setup problem that specifies the file (or files) that was not found when collecting static coverage data indicates that the local path of the file is different from its build-time path.
As a workaround, you can use the CPPTEST_COVERAGE_SRC_ROOT
environment variable to map the original path to the local path:
CPPTEST_COVERAGE_SRC_ROOT=original/path1=local/path1;original/path2=local/path2;...
When generating a report, specify a report configuration file that contains the following entry:
results.report.active_rules=true
Reports generated by Parasoft products require a sans-serif font to be available in your environment. If your report fails to correctly display some characters, such as national characters, ensure that a sans-serif font is installed on your system.
C/C++test uses a separate JVM to generate reports after code is tested. You can increase the amount of memory allocated for generating C/C++test reports by configuring the parasoft.report.separate_vm.xmx
system property, for example:
parasoft.report.separate_vm.xmx=1280m |
You can configure the JVM that generates reports to use Java with a larger maximum memory size by setting the parasoft.report.separate_vm.java_home
system property, for example:
parasoft.report.separate_vm.java_home=C:/Program Files/Java/jdk-12.0.1 |
Set C/C++ or C++test as the current perspective (by choosing Window> Open Perspective> Other, then choosing C/C++ or C++test from the dialog that opens).
Due to a bug in some Eclipse versions, an overlay scrollbar may partially hide the last item in a list or tree, preventing the user from clicking the item. As a workaround on Linux, you can disable overlay scrollbars by setting the following system variable: GTK_OVERLAY_SCROLLING=0
Eclipse may mark correct code elements in test suites with a red underline to indicate potential errors when Eclipse's CDT indexer is unable to recognize C/C++test-specific syntax. To prevent this, you can enable the Parasoft C/C+test Include Paths provider in the project properties:
This workaround is only available for CDT-managed projects.