polyspace-test -run
Syntax
Description
The system command polyspace-test -run runs tests in a Polyspace® Platform project.
polyspace-test -run runs all tests in a Polyspace Platform project file -project <projectFile> [options] projectFile. If the test executable(s) cannot be found, the command builds the executable and then runs it.
polyspace-test -run runs a list of tests specified by -project <projectFile> -test <testList> [options] <testList>.
polyspace-test -run runs tests using the options specified in -options-file <optionsFile><optionsFile>.
Examples
Automate the building and running of the tests in a project file projectName.psprjx by using the polyspace-test command.
For an example of creating a project and adding sources and tests, see Write C/C++ Unit Tests in Polyspace Platform User Interface.
Build a test executable to run all the tests included in a project file
projectName.psprjx.polyspace-test -build -project projectName.psprjxThe command generates the test executable and other artifacts and stores them in folder
polyspace_artifacts.Run the tests and generate a results file.
polyspace-test -run -project projectName.psprjx -results-dir resultsFolderThe command runs all the tests and generates a
.pstestrresults file which is stored in the folderresultsFolder. When you use the-runcommand, if a test executable does not already exist, the software builds the tests and then runs them.Generate an XML report to capture a snapshot of the testing status.
The generated report is stored in a subfolder of thepolyspace-test -report -report-dir reportFolder -xml resultsFolderreportFolderfolder.
Input Arguments
Path to the Polyspace Platform project file (.psprjx file) that contains the tests that you want to build. polyspace-test uses the build and test configurations specified in the project unless you override the configurations. You can specify the file path as an absolute path or as a path relative to your working directory.
Example: -project "../project/myTestProject.psprjx"
Example: -project "C:\Users\jsmith\project\myTestProject.psprjx"
List of Polyspace Test™ tests specified using the following rules:
To specify a test suite
<suiteName>, use the option-test <suiteName>.To specify a test
<testName>:In the default test suite (
pst_default_suite), use the option-test <testName>.In the suite
<suiteName>, use the option-test <suiteName>/<testName>.
To specify an iteration of a parameterized test
<testName>in a suite<suiteName>, use the option-test <suiteName>/<testName>(<paramList>)where<paramList>is a list of parameter indices. For instance, if a parameterized test has two parameters and you want to execute the iteration where both parameters take their first values, use the option-test <suiteName>/<testName>(1,1).
You can also run tests authored using an external test framework. If you import tests into your project from an external framework such as GoogleTest, specify -test external: to run all the external tests, or -test external:suiteName.testName to run only the test testName from the test suite suiteName. For more on the GoogleTest syntax, see Running a Subset of Tests.
To execute all Polyspace
Test tests in addition to an external test MyExternalSuite.MyExternalTest, use this option:
-test pstunit: -test external:MyExternalSuite.MyExternalTest
Path to text file containing options to use with the polyspace-test -run command. The file must contain one option per line.
Build Options
| Option | Description |
|---|---|
-build-dir <buildFolderPath> | Specify a path By default, Polyspace stores the build artifacts in the project artifacts folder, specified using the configuration option |
-profiling-mode <codeProfilingMode> | Specify the code profiling mode as one of these values:
|
-cov-metric-level <coverageLevel> | Specify the code coverage level
|
-enable-debugger | Build your project in debug mode. In this mode, breakpoints are associated with specific places in the test code before the test code is built. Later, when you run tests in the project, instead of normal execution, the tests open in a debugger at those breakpoints. For more information on supported debuggers, see Debug Test Failures from Polyspace Platform User Interface. Note that you cannot debug tests in a project with profiling enabled. |
-enable-portable-word-sizes | Use this option to compile your code on a host computer while retaining the word sizes of the target processor on which the code is intended to run. For example, if your code runs on a 16-bit processor, the size of an integer is 16 bits. You can emulate this processor on a 64-bit host machine (where the size of an integer is 64 bits) by enabling this option. |
-refresh-sources | Use this option to update the content of a folder that is already added to the project before project build (in case source or test files were added to or removed from that folder). |
-force-rebuild | Use this option to force full build of all sources in the project.
|
Execution Options
| Option | Description |
|---|---|
-results-dir <resultsFolderpath> | Specify the path to the folder where test results are stored. You can specify an absolute path or a path relative to your working directory. If you omit this option, the command stores test results in a folder |
Project Override Options
| Option | Description |
|---|---|
-build-config <configName> | Specify the name of a build configuration variant to use instead of the current active build configuration of the project. For more information on configuration variants, see Create Configuration Variants. |
-test-config <configName> | Specify the name of a test configuration variant to use instead of the current active test configuration of the project. For more information on configuration variants, see Create Configuration Variants. |
-var <var=value> | Assign a value to variable var instead of the value specified in the project. |
-board <targetName> | Specify the board to use instead of the board used in the active build configuration of the project. |
-toolchain <toolchainName> | Specify the toolchain to use instead of the toolchain specified in the active build configuration of the project. |
Version History
Introduced in R2023b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)