# `svd2rust` Regression Tester
`svd2rust-regress` is a helper program for regression testing changes against `svd2rust`. It uses `rayon` to parallelize testing of multiple chips simultaneously.
## What it does
`svd2rust-regress` will do the following things for each svd/chip tested:
1. Create a new crate for that chip in `output/<chip>`, populated with the architecture specific dependencies
2. Download the `.svd` file for that chip
3. Run `svd2rust` to generate `output/<chip>/src/lib.rs`
4. Run `cargo check` to ensure the project still builds
## Usage
### Preconditions
By default, `svd2rust-regress` assumes you have already built `svd2rust` in the root of this repository in `--release` mode.
If this is not possible, it is possible to specify the path to an `svd2rust` binary (see **Options** below).
You'll also need to have `rustfmt` version > v0.4.0 to use the `--format` flag, you can install `rustfmt` with `rustup component add rustfmt-preview`.
### Output
For each test case, `svd2rust-regress` will output the result.
Pass results look like this:
```text
Passed: spansion_mb9af12x_k - 23 seconds
```
Fail results look like this:
```text
Failed: si_five_e310x - 0 seconds. Error: Process Failed - cargo check
```
If all test cases passed, the return code will be `0`. If any test cases failed, the return code will be `1`.
### Options
Here are the options for running `svd2rust-regress`:
```text
svd2rust-regress 0.1.0
James Munns <james.munns@gmail.com>:The svd2rust developers
USAGE:
svd2rust-regress [FLAGS] [OPTIONS]
FLAGS:
-b, --bad-tests Include tests expected to fail (will cause a non-zero return code)
-f, --format Enable formatting with `rustfmt`
-h, --help Prints help information
-l, --long-test Run a long test (it's very long)
-V, --version Prints version information
-v, --verbose Use verbose output
OPTIONS:
-a, --architecture <arch>
Filter by architecture, case sensitive, may be combined with other filters Options are: "CortexM", "RiscV", "Msp430", "Mips" and "XtensaLX"
-p, --svd2rust-path <bin_path>
Path to an `svd2rust` binary, relative or absolute. Defaults to `target/release/svd2rust[.exe]` of this
repository (which must be already built)
-c, --chip <chip> Filter by chip name, case sensitive, may be combined with other filters
-m, --manufacturer <mfgr>
Filter by manufacturer, case sensitive, may be combined with other filters
--rustfmt_bin_path <rustfmt_bin_path>
Path to an `rustfmt` binary, relative or absolute. Defaults to `$(rustup which rustfmt)`
```
### Filters
`svd2rust-regress` allows you to filter which tests will be run. These filters can be combined (but not repeated).
For example, to run all `RiscV` tests:
```bash
# in the ci/svd2rust-regress folder
cargo run --release -- -a RiscV
Finished release [optimized] target(s) in 0.0 secs
Running `target/release/svd2rust-regress -a RiscV`
Passed: si_five_e310x - 7 seconds
```
To run against any chip named `MB9AF12xK`:
```bash
cargo run --release -- --long-test -c MB9AF12xK
Finished release [optimized] target(s) in 0.0 secs
Running `target/release/svd2rust-regress --long-test -c MB9AF12xK`
Passed: spansion_mb9af12x_k - 23 seconds
Passed: fujitsu_mb9af12x_k - 25 seconds
```
To run against specifically the `Fujitsu` `MB9AF12xK`:
```bash
cargo run --release -- --long-test -c MB9AF12xK -m Fujitsu
Finished release [optimized] target(s) in 0.0 secs
Running `target/release/svd2rust-regress --long-test -c MB9AF12xK -m Fujitsu`
Passed: fujitsu_mb9af12x_k - 19 seconds
```
Note that you may have to pass `--long-test` to enable some chips as they are known to take a long time to compile.
没有合适的资源?快使用搜索试试~ 我知道了~
从 SVD 文件生成 Rust 寄存器映射(`struct`s)_rust_代码_相关文件_下载
共35个文件
rs:16个
toml:4个
yml:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 156 浏览量
2022-07-07
03:35:09
上传
评论
收藏 81KB ZIP 举报
温馨提示
struct从 SVD 文件生成 Rust 寄存器映射 ( s) 支持的最低 Rust 版本 (MSRV) 生成的代码保证可以在稳定的 Rust 1.60.0 及更高版本上编译。 如果您在任何高于 1.60.0 的稳定版本上遇到编译错误,请打开一个问题。 本地测试 svd2rust-regress是一个辅助程序,用于针对svd2rust. 这个工具可以在本地使用,svd2rust在提交 PR 之前检查本地的修改。 查看svd2rust-regress README以获取有关如何使用此工具的信息。 更多详情、使用方法,请下载后阅读README.md文件
资源详情
资源评论
资源推荐
收起资源包目录
svd2rust-master.zip (35个子文件)
svd2rust-master
LICENSE-MIT 1KB
LICENSE-APACHE 11KB
build.rs 1KB
triagebot.toml 9B
.github
workflows
release.yml 3KB
ci.yml 4KB
changelog.yml 390B
clippy.yml 473B
bors.toml 162B
CODEOWNERS 22B
ci
svd2rust-regress
src
main.rs 9KB
tests.rs 92KB
svd_test.rs 8KB
errors.rs 296B
Cargo.toml 292B
.gitignore 8B
README.md 4KB
before_deploy.sh 284B
script.sh 20KB
src
generate
generic_msp430_atomic.rs 2KB
array_proxy.rs 2KB
peripheral.rs 41KB
mod.rs 73B
register.rs 41KB
device.rs 11KB
interrupt.rs 12KB
generic.rs 16KB
util.rs 14KB
main.rs 8KB
lib.rs 21KB
Cargo.toml 1KB
.gitignore 52B
CHANGELOG.md 24KB
CODE_OF_CONDUCT.md 4KB
README.md 2KB
共 35 条
- 1
快撑死的鱼
- 粉丝: 1w+
- 资源: 9149
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0