Page tree

Skip to end of metadata
Go to start of metadata

This lesson contains a set of exercises that cover application monitoring and runtime error detection. For details on performing application monitoring and runtime error detection in C++test, refer to the Runtime Error Detection.

In this section:


  • C++test Server 9.0 or higher must be installed and licensed for Runtime Error Detection.
  • The Sensor project from C++test Examples must be available in your workspace. See Tutorial - Creating a C++test Project for details on how to create a project in C++test.

Introduction to C++test Runtime Error Detection

C++test can perform runtime error detection at the application level or during unit test execution. C++test’s runtime error detection performs a dynamic code review by analyzing the executing application, applying a set of dynamic rules, and reporting rule violations. It detects memory errors such as memory access errors, memory leaks, memory corruptions, and more. The instrumentation used to perform runtime error detection is lightweight and suitable for running on the target board for embedded testing.

Introduction to C++test Application Monitoring

C++test can prepare an instrumented version of the application executable and then run it. Depending on the configuration selected, C++test will report coverage statistics and/or memory errors found during the application execution.

Setup for Exercises

To prepare for the following exercises, you need to have a project setup with a fresh copy of the Sensor example code available in [C++test install directory\Examples\Sensor]  (use the procedure described in Tutorial - Creating a C++test Project). For details on setup for GNU/host based testing, see below.

GNU Host-Based Testing Procedure

  1. Create a project directory for unit testing using the C++test Sensor example code.
    • For example, C:\C++test\Tutorial\SensorEclipseGnu\Sensor.
  2. Copy Makefile and sensor.c to the new project directory. These files are found in [C++test install directory\Examples\Sensor].
  3. Do one of the following:
    • If your default Windows environment includes paths to gcc, g++, make, etc., start C++test using your desktop icon or using the Start> All Programs menu.
    • Otherwise, open a Command Prompt window, setup your compiler and C++test paths, and start C++test by entering cpptest.
  4. Set your workspace to create a new workspace in the Sensor parent directory (for example, C:\C++test\Tutorial\SensorEclipseGnu\workspace).
  5. From the C++test Perspective, choose File> New> Project.
  6. Expand C, select C Project, and click Next.
  7. Enter Sensor in the Project name field.
  8. Clear Use default location.
  9. Browse to the location of the Sensor Makefile (for example, C:\C++test\Tutorial\SensorE-clipseGnu\Sensor).
  10. Under Project Types, select Makefile project.
  11. Under Toolchain, select Cygwin GCC.
  12. Click Finish.
  13. When you see a dialog asking whether you want to open the associated perspective, respond according to your preferences. You can choose to work in the C/C++ perspective or the C++test perspective.

  14. Run static analysis on sensor.c as a sanity check for project setup. See Tutorial - Analyzing Code Against Coding Standards for more information or running static analysis.

  • No labels