In this section:
Introduction
This topic explains installation and basic setup instructions for the C++test plugin into QNX Momentics.
Integration Overview
The C++test plugin is integrated with the QNX Momentics IDE by means of the Eclipse plugin mechanism. C++test plugs into QNX Momentics IDE by adding a link file to the following location:
<QNX Installation Root>/host/win32/x86/usr/qde/eclipse/links/com.parasoft.xtest.cpptest.link
.
This link file contains the path to the C++test plugin; this informs QNX Momentics IDE that the plugin should be loaded at startup.
After installation C++test will add its views to the C/C++ perspective. Also, a separate C++test perspective will be available in Workbench.
Installation
Prerequisites
- QNX Software Development platform 6.4.0 or 6.5.0
- Windows host (see Embedded Platforms and Cross-Compilers)
Installing
To install the C++test Eclipse plugin into QNX Momentics IDE:
- Run the C++test plugin installation executable.
- Choose the setup language.
- Click Yes when a dialog asks whether you want to install C++test.
- Click Yes after you have read and agreed to the license information.
- Choose the QNX target platform, then click Next.
- Enter your QNX Momentics installation directory (if not detected automatically), then click OK.
- Enter the desired destination directory for the C++test Extension files, then click Next.
- Close the IDE if it is open, then click OK to close the dialog reminding you to close this program. C++test will then start copying files and installing the necessary files into Momentics. A dialog box with a progress indicator will open and indicate installation progress. When the installation is complete, a notification dialog box will open.
- Click the OK button to close the notification dialog box.
During the installation process, C++test will try to create a link file in the QNX Momentics IDE’s embedded Eclipse. The link file will be located in <QNX Installation Root>/host/win32/x86/usr/qde/eclipse/links/com.parasoft.xtest.cpptest.link
, and it will contain the path to the C++test installation directory. This is the only change that the C++test installation makes inside the QNX Software Development platform distribution.
Startup
After the plugin is successfully installed, you can start QNX Momentics IDE (with the C++test plugin installed) by launching it in the usual manner. After installation C++test will add its views to the C/C++ perspective.
Also, a separate C++test perspective will be available in QNX Momentics IDE.
Licensing
For licensing:
- Choose Parasoft> Preferences.
- Expand Parasoft> License in the left pane.
- For machine-locked licenses:
- Contact Parasoft with your Machine id.
- Enter your license expiration code and password in the Local License section of the License preferences page.
- For LicenseServer licenses:
- Select the Use LicenseServer option. The LicenseServer section of the License preferences page will become active.
- If the appropriate LicenseServer is not already set, select it from the Autodetected servers list and click Set. Or, manually enter your organization’s LicenseServer host (either a name or an IP address) in the Host name field, then enter your organization’s LicenseServer port in the Port number field.
- Indicate the license type that you want to use by selecting the appropriate option in the Edition box.
- Click Apply. The licensed options will be highlighted.
Uninstalling
To uninstall the C++test QNX Momentics IDE plugin:
- Use the Control Panel’s Add or Remove Program functionality or run the Windows C++test installation executable and select the Remove option
Do not uninstall the C++test plugin by removing the file <QNX Installation Root>/host/win32/x86/usr/qde/eclipse/links/com.parasoft.xtest.cpptest.link
. If you do this, you will still need to manually remove the C++test installation, and the Windows registry’s Install Shield information will remain.
Working with QNX Projects - Options Scanning
In order to perform static analysis or unit testing, C++test must collect the following information from your QNX project:
- Paths to source files
- Compilation command lines
- Linker command lines
This information is taken from the QNX Momentics IDE project structure description and collected by scanning make files. This process involves the following steps:
- You start the C++test Test Configuration.
- The build process is started—but instead of using the actual compilation/linking command lines, the make file executes the command lines prefixed with the option scanning utility. The command line is generally modified as follows:
- Original compilation command line:
qcc <options> <file>
- C++test prefixed compilation command line:
options_scanner <options> qcc <options> <file>
- Original compilation command line:
- The option scanner analyzes the command line and stores the compiler/linker options for further reuse.
After the build process is completed, C++test will have all the necessary data collected.
Project Configuration
Before you start testing, ensure that the project’s compiler/linker options source is correctly set. In most cases, C++test automatically detects the necessary settings. The compiler/linker flags source settings are specified in the Build Settings. To access the build settings:
- Right-click the project’s Navigator node, then choose Properties from the shortcut menu.
- Expand the Parasoft> C++test category in the left pane.
- Select the Build Settings category in the left pane.
The following configuration options are available:
- Options source: Allows you to specify the strategy to collect compiler/linker switches. For direct testing of QNX projects, choose Use Options from QNX build system. The C++test options extractor is designed to scan QNX make files; it scans the compiler/linker executable name, compiler/linker command lines, and the system environment used to start the compilation/linking process. All these settings are later used during the C++test analysis.
- Build configuration: Allows you to specify the build configuration that will be scanned to collect compiler/linker flags.
Build command line: Enter a command line that will launch your build system. This system can be abstract, but by default, the make-based one is assumed and the appropriate command is preset. This command executes your make on the project's Makefile to scan the project's compilation and linking options. Thus, a special scanner (hidden behind the ${CPPTEST_SCAN} macro) is substituted for C/C++ compilers and the linker; the -i and -B make options are very useful (see Accounting for Make Varieties for more information).
- Build working directory: Specify the directory from which the build command is launched.
- Dependency file(s): Specify all files that should be checked for changes each time a test/build action is performed. If one of these files is found to be modified, the build command will be reexecuted. You should enter all files that are sources of project's options (or influence them). Typically, this is just your Makefile.
- Reset cache button: Lets you clear all scanned options and force rescanning on the next test action (see Accounting for Make Varieties for exceptions).
The Compiler settings area lets you specify the compiler set/tools used for compiling the project's sources and building the test executable. Settings include:
- Family: Select the appropriate family from all the currently registered compiler families (Use QNX® QCC 4.2.x for QNX Development Platform 6.4.0 or QNX® QCC 4.4.x for QNX Development Platform 6.4.0).). Click the Autodetect button to have C++test automatically detect the compiler family based on the compiler executables set and the compiler version regular expression that is stored in the compiler's configuration directory (due to the wide variety of compilers used with embedded solutions, this action may not always produce the expected result).
- C compiler: Specify the C compiler executable.
- C++ compiler: Specify the C++ compiler executable.
- Linker: Specify the linker executable.
Static Analysis
Before you start static analysis, verify that the appropriate compiler settings are used in the Project Properties panel's Parasoft> C++test> Build Settings area. In most cases, it is best to set the Options source as Use Options from QNX build system. After confirming that compiler settings are correct, you can start the analysis.
Runtime Testing
This section covers both Unit Testing and Application Monitoring.
Unit Testing
Building the C++test Runtime Library for Testing QNX Projects
For embedded testing, the C++test runtime library must be cross-compiled for the chosen platform before you can perform unit testing. The built-in "Run QNX Momentics Tests" Test Configuration does this building automatically.
If you need to build C++test runtime library manually, follow the instructions in Working with the C++test Runtime Library — using QNX_4_2.mk
or QNX_4_4
.mk
as the target configuration.
Test Configuration for QNX Unit Testing
C++test provides a Test Configuration template designed specifically for testing QNX Projects. This Test Configuration is in Builtin> Embedded Systems> QNX> Run QNX Momentics Tests. It covers all steps required for full unit testing of QNX Projects:
- Building the C++test runtime library
- Building the test executable
- Executing the test executable on remote QNX system
- Collecting results
This Test Configuration is only a template; it needs to be customized to reflect your remote QNX system configuration as follows:
- Choose Parasoft> Test Configurations.
- Open the Builtin> Embedded Systems> QNX tree node.
- Right-click Run QNX Momentics Tests and choose Duplicate.
- Select the duplicated Test Configuration that now appears under User-defined.
- Open the Execution tab
- Modify the Test Configuration properties to reflect your remote QNX system configuration:
- QNX target: Target host address
- QNX target test directory: Directory on target host where test will be executed
- QNX target user name: User name that will be used to connect to target host
This test configuration is based on rcp (allow remote copy) and rsh (allow remote shell execution) tools available in Windows. The remote QNX system needs to be configured to allow remote calls from rcp and rsh. It is also possible to modify test execution flow and use different tools instead of rcp and rsh.
Debugging Test Cases
Use Eclipse Internal debugging mode. For more details see:
Application Monitoring
Test Configuration for QNX Application Monitoring
C++test provides a Test Configuration template designed especially for running a QNX application with memory monitoring: Builtin> Embedded Systems> QNX> Build and Run Application with Memory Monitoring for QNX Momentics. This Test Configuration provides all steps required for running QNX application monitoring, including:
- Application building
- Executing the application on a remote QNX system
- Collecting results
This Test Configuration is only a template; it needs to be customized to reflect your remote QNX system configuration. To customize it:
- Choose Parasoft> Test Configurations.
- Expand Builtin> Embedded Systems> QNX.
- Right-click Build and Run Application with Memory Monitoring for QNX Momentics and choose Duplicate from the shortcut menu.
- Select the new Test Configuration that is added to the User-defined category.
- Open the Execution tab
- Modify the Test Configuration properties to reflect your remote QNX system configuration:
- QNX target: The target host address.
- QNX target test directory: The directory on the target host where the application will be executed.
- QNX target user name: The user name that will be used to connect to target host
- QNX target PHOTON environment variable value: For GUI applications, you need to specify this value in order to display your application GUI in phindows session.
This Test Configuration is based on rcp (allow remote copy) and rsh (allow remote shell execution) tools available in Windows. The remote QNX system needs to be configured to allow remote calls from rcp and rsh. It is also possible to modify test execution flow and use different tools in place of rcp and rsh.