主要内容

Polyspace 平台用户界面中执行测试

配置工程、编译测试、检查测试是否存在运行时错误、运行测试

Polyspace 平台工程中设置适当的选项后,您可以在该工程中编译和运行测试。

  • 若在编译过程中遇到错误,可以使用编译日志中的错误消息来解决这些错误。还可以在编译工程之前先运行快速测试验证。

  • 若在测试执行过程中遇到错误,可以对测试运行静态分析,以确保测试数据不会导致运行时错误。

Polyspace 选项

全部展开

源代码语言 (-lang)指定源文件的语言
C 标准版本 (-c-version)Specify C language standard followed in source code
C++ 标准版本 (-cpp-version)Specify C++ language standard followed in source code
编译工具链(测试)Specify the compiler that you use to build your source code and tests for dynamic testing
预处理器定义 (-D)替换预处理代码中的宏
已禁用的预处理器定义 (-U)取消定义预处理代码中的宏
隐式 C(C++) 编译器定义View implicit compiler defines extracted from your build command (自 R2024b 起)
额外的 C 标志Specify C compilation flags required for building project (自 R2023b 起)
额外的 C++ 标志Specify C++ compilation flags required for building project (自 R2023b 起)
包含路径 (-I)指定包含文件所在文件夹的路径
其他包含路径 (-I)Specify build-specific include paths in addition to project-wide include paths (自 R2024a 起)
隐式 C(C++) 编译器包含路径View implicit compiler include paths extracted from your build command (自 R2024b 起)
强制包含文件 (-include)指定每个源文件必须通过 #include 包含的文件。 (自 R2023b 起)
库路径Specify folders containing precompiled libraries for building tests (自 R2023b 起)
Specify precompiled libraries for building tests (自 R2023b 起)
用于链接的额外标志Specify linker flags required for building project (自 R2023b 起)
处理器Select the processor for the current build configuration
启用可移植字长Allow compilation of code on host computer while retaining word sizes of target processor on which code is intended to run (自 R2023b 起)
包对齐值 (-pack-alignment-value)为在 Visual C++ 中开发的代码指定默认结构体打包对齐值
检查未定义的符号Specify whether to check for undefined symbols (自 R2023b 起)
外部符号Specify symbol names that are not defined in code (自 R2023b 起)
工件目录Specify folder for storing project artifacts such as generated test code and build information (自 R2025a 起)

工具

Polyspace 平台设置Settings for Polyspace Platform user interface (自 R2023b 起)
工具链Create, validate, and register a custom toolchain for building C/C++ sources and tests

主题

配置工程

验证、编译和运行测试

打开测试结果

疑难解答

Fix Project Build Errors in Polyspace Platform User Interface

Troubleshoot project build errors because of issues in source files or tests.

Fix Test Execution Failures in Polyspace Platform User Interface

Troubleshoot test execution failures.

Fix Multiple main Error in Polyspace Platform User Interface

Troubleshoot errors related to main function when building Polyspace Platform projects.

Fix Undefined Symbol Errors in Polyspace Platform User Interface

Troubleshoot errors related to undefined symbols when building Polyspace Platform projects.

Fix Build Errors from Non-C/C++ Files in Polyspace Platform User Interface

Troubleshoot errors related to non-C/C++ files when building Polyspace Platform projects.