Main Content

Stub source files

Add stub source files to Polyspace Platform project

Since R2026a

Description

Add C/C++ stub source files to a Polyspace Platform project or see stub source files explicitly added to the project.

Set Option

In your Polyspace Platform project configuration, enter file paths for this option on the Project tab.

Why Use This Option

For dynamic testing with Polyspace® Test™, you can work around undefined functions and variables by creating stubs. One way to stub undefined functions and variables is by creating an external C/C++ stub file. You can use this option to add C/C++ stub source files to your project.

In a regular workflow, you might be adding C/C++ stub source files using one of these methods:

  • Option Add Stub Source File on the Polyspace Platform toolstrip.

  • Right-click option Add Stub Source File on the Test Artifacts node of a Polyspace Platform project.

You see each stub source file as a new row listed under the Stub source files option. The stub source file path is added relative to the project path. For more information, see Create Project and Add Source Files in Polyspace Platform User Interface .

You can also use this option to add stub source files by absolute path, or to add stub source files using a project or system environment variable. These features are not available when adding files using the other methods.

Settings

Specify stub source files by absolute or relative path.

  • Add the absolute path to a stub source file by clicking the Add file button .

  • Add the relative path to a stub source file by clicking the Add file as relative path button .

  • Add multiple stub source files by clicking the Add/edit multiple rows button . Then, type or paste one path per line in the Add/edit multiple rows dialog box. Leading and trailing spaces are trimmed, and empty lines are ignored.

You can also edit existing paths. Editing existing paths is useful when you use a project variable or a system environment variable as a shorthand in your paths. After entering an absolute path using the Add file button , replace part of the path with a project variable or system environment variable. Alternatively, use the Add/edit multiple rows button to edit multiple rows at once. For more information, see Project variables.

To remove a stub source file, select the corresponding row and click the Remove selected button . Alternatively, right-click the stub source file under the Test Artifacts node in the Projects pane and select Remove From Project.

Version History

Introduced in R2026a