跳转到内容

Fuzzing 和验证

Vela 使用分层验证。parser tests、compiler tests、VM tests、examples、 benchmarks、fuzz targets 和 CI checks 覆盖不同失败模式。

默认完整验证目标是:

Terminal window
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

文档站语法高亮还提供:

Terminal window
cd site && npm run test:syntax

仓库在 fuzz/ 下包含 parser fuzz target。本地安装 cargo-fuzz 后可以运 行:

Terminal window
cargo fuzz run parser

fuzzing 主要用于发现 parser crash、恢复问题和意外 panic。它不能替代语义 测试或 VM conformance tests。

examples/src/bin 下的可运行示例覆盖热更新、反射、宿主权限、stale host refs、schema rejection、I/O capabilities 和 domain-neutral standard helpers。

不要删除测试来让失败通过。新的 runtime 行为应先在拥有该 contract 的层写 聚焦测试;当行为跨越子系统时,再补充更宽的 example 或 conformance fixture。