This topic helps you troubleshoot problems you might experience with C/C++test.
General
What files are analyzed? How do I analyze header files?
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:
- if the project root is selected, then all source files (and header files indirectly) will be analyzed.
- if a single source file is selected, then only that file will be analyzed (no header files will be analyzed).
- if single source file and a single header file is selected, then the source file (and header file if it's included by the source) will be analyzed.
- if only a header file is selected, then C/C++test will skip the analysis (header files are not analyzed directly).
How can I modify the verbosity level of the C/C++test console?
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 |
What do I do if C/C++test runs out of memory?
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?.
How can I adjust connection timeouts?
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. |
Example:
C/C++test standalone:
cpptest.exe -J-Dparasoft.ws.timeout=180 cpptest.exe -J-Dparasoft.ws.connection.timeout=15
C/C++test plugin for Eclipse:
eclipse.exe -vmargs -Dparasoft.ws.timeout=180 eclipse.exe -vmargs -Dparasoft.ws.connection.timeout=15
If only parasoft.ws.timeout is set, it affects both socket and connection timeout.
How can I work with C/C++test via proxy?
C/C++test automatically detects and uses the proxy settings specified in Eclipse. No additional configuration is required.
If I’m having problems, what information should I send to the C/C++test support team?
See Preparing a Support Archive.
Installation
How can I tell what version of C/C++test is installed?
To check which version of C++test is currently installed:
- Choose Help> About Eclipse (for the plugin) or Help> About Parasoft C/C++test (for the standalone version).
- Click the Parasoft button. The About Features dialog will open.
- Check the C/C++test version in the features table (the Version column).
What if C/C++test was not (re-) installed correctly?
Try to launch Eclipse (once) with the -clean
option. This will force a refresh of an internal (Eclipse) registry/cache.
Why does Eclipse crash upon startup now that I installed the C/C++test plugin?
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.
How can I prevent my machine ID from floating?
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 up the PARASOFT_SUPPORT_NET_INTERFACES environment variable.
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 theipconfig -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.
What if my Machine ID is WIN32-0?
If your Machine ID is WIN32-0, remove the license file located in <DRIVE>:\Users\<USER_NAME>\.parasoft\C++test\10.x\license.
Why are suppressions of some rules no longer available on DTP after C/C++test was upgraded to a newer version?
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 newer 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.
Testing and Analysis
What if the compiler family is not auto-detected?
Ensure that you have correctly configured your environment for the given compiler before launching Eclipse (including. $PATH, $LD_LIBRARY_PATH etc.)
What if C/C++test is unable to preprocess source files with a QNX compiler configuration?
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.
What if C/C++test is unable to execute test cases with the Debug Unit Tests test configuration?
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.
What can I do if C/C++test reports a timeout during static analysis?
To ensure the analysis completes, you can do one of the following:
- Increase the timeout limit by configuring the following advanced option:
cpptest.analyzer.source.timeout=<TIMEOUT_IN_SECONDS>
See Configuring Advanced Options.
- Disable the most time-consuming rules or metrics in your test configuration. The information about the times is included in the timeout message displayed on the console and in the report.
- Contact Parasoft Support.
What if one or more files were not found when collecting static coverage data?
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;...
You can use '*' as an accepted wildcard in the original path. For example:
CPPTEST_COVERAGE_SRC_ROOT=/*/path=/local/path
You can also specify a list of path mappings in a list file (*.lst) and set its location as the value. For example:
CPPTEST_COVERAGE_SRC_ROOT=/path/mapping.lst
Each item in the *.lst file is treated as a separate entry.
What if memory is not allocated when using C/C++test with a Bazel build?
In some cases, the linking process may run out of mappable pages. This will manifest as an inability to allocate memory despite the machine having enough free RAM. To fix the issue, increase the maximum number of mapping pages per process. The default is 65530. Increasing this value ten times should resolve the problem. To do this, use the following command:
sysctl -w vm.max_map_count=655300
If the problem persists, you may need to increase this value further.
How can I disable C/C++test code instrumentation for functions containing OpenMP instructions?
Add the following entry to Project Settings> Parasoft> C/C++test> Other Settings> Advanced options:
xharness.ignoreFunctionsWithOpenMP true
When using the cpptestcc
utility for collecting code coverage, add the following option to the cpptestcc
command line:
-xharness-option="—-ignore-functions-with-openmp=true"
Reports
How can I create a report with a list of active coding standard rules?
When generating a report, specify a report configuration file that contains the following entry:
results.report.active_rules=true
What if some characters fail to be properly displayed in C/C++test reports?
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.
What if C/C++test runs out of memory when generating the report?
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
Working in the IDE
What if the Parasoft menu is not available?
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).
What if an overlay scrollbar in Eclipse hides some C/C++test's GUI elements on Linux?
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
What if the Parasoft Welcome Page cannot be displayed on Ubuntu Linux?
When using latest Ubuntu Linux (21.10 or newer), consider installing additional 'webkit2gtk-driver' system package with the following command:
> sudo apt install webkit2gtk-driver
What if the HTML content (C/C++test's rule documentation, reports etc.) cannot be displayed on Ubuntu Linux because the HTML browser is not started?
When using Ubuntu Linux with a Snap-based browser as the default system browser (which is the default setup in Ubuntu 21.10 and newer), the Eclipse IDE may be unable to start this browser (see https://github.com/eclipse-platform/eclipse.platform.swt/issues/221).
As a workaround, configure Eclipse to use a specific external web browser in Preferences> General> Web Browser> External web browsers.
- If the intended browser is already listed, select it and review its settings.
- If the intended browser is not listed, click the New... button to add it. For example, to use Firefox in a typical environment, use the following settings:
Name: Firefox (env)
Location: /usr/bin/env
Parameters: firefox %URL%
In case of Linux C/C++test standalone distribution, for new workspaces this Firefox browser is preconfigured and selected automatically. If required, update its configuration to match your environment.
As an alternative workaround, install a non-Snap version of the intended browser and set it as the default system browser.
What if C/C++test's report cannot be displayed on Ubuntu Linux because the started HTML browser reports that file was not found or that access to the file was denied?
Snap-based browsers, e.g. Snap-based Firefox (default in Ubuntu 21.10 and newer), may be unable to open HTML files located outside of the /home
directory (see https://snapcraft.io/docs/snap-confinement).
If C/C++test's report was generated in a location outside of /home
(e.g. somewhere in /tmp), then a Snap-based browser may be unable to open it. To work around this limitation, when generating reports, use a report location somewhere inside /home
(e.g. /home/<username>/parasoft/reports
).
What if Eclipse reports syntax errors on code that is correct in test suites generated with C/C++test?
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:
- Go to C/C+ General> Preprocessor Include Paths, Macros etc.
- Open the Providers tab.
- Enable the Parasoft C/C+test Include Paths provider.
This workaround is only available for CDT-managed projects.
What if debugging in Eclipse does not work with Cygwin GDB on Windows?
Debugging in Eclipse may not work if you are using Cygwin GDB v. 10 or newer. This is a known Eclipse issue. As a workaround, use GDB v. 9 or older.
What if I encounter issues while editing tables in the Test Case Editor when using Eclipse IDE on Linux?
If you are experiencing issues while editing tables in the Test Case Editor or Test Case Wizard (e.g., cell editing is difficult, cursor navigation does not work, changing the column width is not possible, new values cannot be saved), then check if your Linux distribution uses a Wayland display server. If you use a Wayland display server, we recommend changing it to X11.
You can verify what display server your Linux distribution is using by:
- executing the following command in the Linux terminal: "echo $XDG_SESSION_TYPE" (working in most distributions)
- checking the desktop environment settings (not available in all distributions)
- checking the current setting on the login screen, usually by clicking the wheel/cog/menu icon on the login screen (not available in all distributions; the Automatic Login feature needs to be turned off)
- checking the Windowing System field on the Settings/About page
You can change your display server to X11 by:
- editing the display manager (GDM, SDDM, etc.) configuration file, e.g.
/etc/gdm3/custom.conf
for Ubuntu with GDM (a reboot is required) - clicking the wheel/cog/menu icon on the login screen and choosing X11 (not available in all distributions; the Automatic Login feature needs to be turned off)
What if I encounter issues with displaying the RuleWizard UI on Linux?
If you are experiencing issues with displaying the RuleWizard UI, then check if your Linux distribution uses a Wayland display server. If you use a Wayland display server, we recommend changing it to X11.
You can verify what display server your Linux distribution is using by:
- executing the following command in the Linux terminal: "echo $XDG_SESSION_TYPE" (working in most distributions)
- checking the desktop environment settings (not available in all distributions)
- checking the current setting on the login screen, usually by clicking the wheel/cog/menu icon on the login screen (not available in all distributions; the Automatic Login feature needs to be turned off)
- checking the Windowing System field on the Settings/About page
You can change your display server to X11 by:
- editing the display manager (GDM, SDDM, etc.) configuration file, e.g.
/etc/gdm3/custom.conf
for Ubuntu with GDM (a reboot is required) - clicking the wheel/cog/menu icon on the login screen and choosing X11 (not available in all distributions; the Automatic Login feature needs to be turned off)