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
- Create a project directory for unit testing using the C++test Sensor example code.
- For example,
- For example,
sensor.cto the new project directory. These files are found in
[C++test install directory\examples\Sensor].
- 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
- Set your workspace to create a new workspace in the Sensor parent directory (for example,
- From the C++test Perspective, choose File> New> Project.
- Expand C, select C Project, and click Next.
Sensorin the Project name field.
- Clear Use default location.
- Browse to the location of the Sensor Makefile (for example,
- Under Project Types, select Makefile project.
- Under Toolchain, select Cygwin GCC.
- Click Finish.
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.
- 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.