Overview
What the Plugin Does: White-box testing of C code in models.
Reactis for C Plugin integrates seamlessly with Reactis to offer white-box testing and validation of the C-code portions of models (S-Functions and calls to C from Stateflow). Together Reactis and Reactis for C Plugin automate the generation of test data from, and validation of models constructed with Simulink, Stateflow, and C code.
If you currently build Simulink models that include C code, Reactis for C Plugin will help you cut both the costs and time associated with development tasks such as the following:
- Finding runtime errors in the C code (S-Functions or Stateflow custom code)
- Testing the C code
- Debugging the C code
By automating testing and validation of C code within the same environment that tests your Simulink and Stateflow, the Reactis for C Plugin enables you to do a more thorough analysis of your C code much more quickly.
Using Reactis for C
Reactis for C Plugin integrates seamlessly with Reactis.
Core Reactis treats S-Functions and Stateflow custom C code as black boxes. Purchasing a Reactis for C Plugin license opens up these black boxes and gives users the capability to analyze the C code they contain.
Reactis Tester generates test data automatically from models. The tool selects test data using structural-coverage criteria, such as decision coverage, condition coverage, and Modified Condition/Decision Coverage (MC/DC). With the C Plugin, Reactis aims for structural coverage of the C code in addition to coverage of the Simulink and Stateflow portions of a model.
Reactis Validator allows users to instrument models with checks for assessing model behavior and targets for guiding the generation of test data. With the Reactis for C Plugin, the C portions of models may be subjected to this validation.
Reactis Simulator enables users to visualize model execution. Simulator’s user interface is similar to those of traditional debuggers from programming languages: it allows users to step through the execution of models by hand as well as set break points. Simulator also supports reverse execution, the replay of tests generated by Reactis Tester, the graphical display of different coverage metrics, and the capability to fine-tune Tester-generated test suites.
With Reactis for C Plugin these advanced debug capabilities extend beyond Simulink and Stateflow and into C code. Step seamlessly from Simulink into an S-Function or from Stateflow into custom C code and set break points and track coverage in the C code.
Generating Tests
Test all parts of the model: Simulink, Stateflow, and C code.
Tester, the test-generation component of Reactis, relies on model coverage criteria to construct tests. The tool tracks several coverage criteria as it computes test data, and uses uncovered elements of these criteria to influence subsequent tests that it creates.
With Reactis for C Plugin, Tester measures coverage in the C code as well as in the Simulink and Stateflow portions of a model. The new coverage targets include C statements, as well as decisions, conditions, and MC/DC targets in the C code. The net effect is more comprehensive tests than only tracking coverage targets in the Simulink and Stateflow portions of the model.
Tester employs a patented technique called guided simulation to build tests. Tests in Reactis correspond to simulation runs, with the inputs at each step in a run constituting the input data used for the test. At each step in a simulation run, Tester uses information about uncovered parts of the model and C code to select input data that will advance the coverage of the model.
Finding Runtime Errors
Find and debug runtime errors
The Reactis for C Plugin performs a variety of checks that flag runtime errors to help you to find, diagnose, and fix runtime errors in your S-Functions. Memory errors are particularly easy to make in C and can be very hard to debug. The Reactis for C Plugin automatically detects memory errors. A memory error occurs whenever a program reads-from or writes-to an invalid address. Some common memory errors include out-of-bounds array indexes, buffer overruns, dangling heap pointers (accessing a region of heap-allocated memory after the memory has been freed), dangling stack pointers (accessing a pointer to a local variable of a function after the function has returned) and the use of pointers cast from incorrect numeric values. If Reactis Tester detects a runtime error in an S-Function it returns a test that can be run in Reactis Simulator to show the exact sequence that leads to the error.
Try the Reactis for C Plugin to see how the tool can help test and debug your S-Functions and Stateflow custom C code.
If you would like to learn more, an 8-minute video shows how the Reactis for C Plugin can be used to test and debug S-Functions.
