Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unproven #131

Merged
merged 1 commit into from
Dec 26, 2020
Merged

Remove unproven #131

merged 1 commit into from
Dec 26, 2020

Conversation

brainstorm
Copy link
Contributor

@brainstorm brainstorm commented Dec 26, 2020

Fixes #116

@MarcoIeni @burrbull Let's do what you suggest on #116, shall we? See the integration test mostly borrowed from @MarcoIeni's svd_parser

Getting the following error for now, seems like getting the same capitalization (and perhaps ordering?) might be challenging for integration testing purposes... nope, it's just <fields /> being empty, I guess the SVD parser should tolerate that?:

    <peripheral>
           <name>RNG</name>
           <description>RNG register</description>
           <baseAddress>0x3FF20E44</baseAddress>
           <addressBlock>
                       <offset>0</offset>
                       <size>32</size>
                       <usage>RNG register</usage>
           </addressBlock>
           <registers>
                  <register>
                       <name>rng</name>
                       <fields />
                       <description>RNG register</description>
                       <addressOffset>0</addressOffset>
                       <size>32</size>
                       <access>read-only</access>
                      <resetValue>0</resetValue>
                   </register>
        </registers>
     </peripheral>
---- read_and_write stdout ----
thread 'read_and_write' panicked at 'Failed to parse the SVD file into Rust structs: In device `esp8266`

Caused by:
    0: In peripheral `RNG`
    1: In register `rng`
    2: Register have `fields` tag, but it is empty', tests/integration.rs:14:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@brainstorm brainstorm marked this pull request as ready for review December 26, 2020 02:30
@brainstorm brainstorm requested a review from a team as a code owner December 26, 2020 02:30
@brainstorm
Copy link
Contributor Author

brainstorm commented Dec 26, 2020

A couple of bits I've realized while thinking about this PR:

  1. Ideally this integration testing should be run against https://github.com/posborne/cmsis-svd, to expose this parser to many ICs, even those not even supported by @rust-embedded, since they don't have HALs/PACs (yet)... if so, would it make sense to pull the repo via git submodules or other mechanisms are preferred? Perhaps this is already done somewhere else (in svdtools)? EDIT: CI seems to be thoroughly discussed on Testing svdtools#6... only for STM32 though.

  2. I mentioned the introduction of a lax (or strict) feature flag in e17cbae ... I've seen the pros/cons mentioned in passing somewhere else, but it would be good to reference those discussions here and reach consensus to get it done for good?

assert_eq!(device_svd, device_svd_deserialized)
}

// fn diff_svds(orig: Path, dest: Path) -> Result<Diff> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcoIeni, Are you exploring https://github.com/MarcoIeni/delta for SVD diffing currently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I did some work on delta just for fun, not svd related reasons :P

@burrbull
Copy link
Member

burrbull commented Dec 26, 2020

1. Ideally this integration testing should be run against https://github.com/posborne/cmsis-svd, to expose this parser to many ICs, even those not even supported by @rust-embedded, since they don't have HALs/PACs (yet)... if so, would it make sense to pull the repo via git submodules or other mechanisms are preferred? Perhaps this is already done somewhere else (in [svdtools](https://github.com/stm32-rs/svdtools/issues/9))? **EDIT:** CI seems to be thoroughly discussed on [stm32-rs/svdtools#6](https://github.com/stm32-rs/svdtools/issues/6)...  only for STM32 though.

cmsis-svd is already connected via submodules. Or I don't understand question.

2. I mentioned the introduction of a `lax` (or `strict`) feature flag in [e17cbae](https://github.com/rust-embedded/svd/commit/e17cbae99667dcd9d681ecbb80313a64b02f477e) ... I've seen the pros/cons mentioned in passing somewhere else, but it would be good to reference those discussions here and reach consensus to get it done for good?

Yes, we need to add strict feature for several new checks.
CMSIS SVD specification says that some tags can absent, but can't be empty. So we should have such checks, but can hide them under feature.
https://www.keil.com/pack/doc/CMSIS/SVD/html/elem_registers.html#elem_fields

@brainstorm
Copy link
Contributor Author

brainstorm commented Dec 26, 2020

cmsis-svd is already connected via submodules. Or I don't understand question.

Ouch, my fault for not doing a git clone --recursive, just realised now 🤦🏻 Thanks.

2. I mentioned the introduction of a `lax` (or `strict`) feature flag in [e17cbae](https://github.com/rust-embedded/svd/commit/e17cbae99667dcd9d681ecbb80313a64b02f477e) ... I've seen the pros/cons mentioned in passing somewhere else, but it would be good to reference those discussions here and reach consensus to get it done for good?

Yes, we need to add strict feature for several new checks.
CMSIS SVD specification says that some tags can absent, but can't be empty. So we should have such checks, but can hide them under feature.
https://www.keil.com/pack/doc/CMSIS/SVD/html/elem_registers.html#elem_fields

Good, is that being worked on under some branch?

@burrbull
Copy link
Member

Good, is that being worked on under some branch?

No, as I know.

You can see this also:
rust-embedded/svd2rust#447

@brainstorm
Copy link
Contributor Author

brainstorm commented Dec 26, 2020

Ah, good to see the integration tests there, I suspected this might not be the right place to put those, thanks for the pointer!

Shall I remove the integration test from here and you merge this PR with just the unproven flag removed or just close this PR and let you carry on? ;)

@burrbull
Copy link
Member

Ah, good to see the integration tests there, I suspected this might not be the right place to put those, thanks for the pointer!

Shall I remove the integration test from here and you merge this PR with just the unproven flag removed or just close this PR and let you carry on? ;)

1 think 3 PRs should be here:

  1. remove unproven
  2. hide some checks under strict
  3. add more tests

@brainstorm brainstorm changed the title Remove unproven, draft integration tests Remove unproven Dec 26, 2020
@brainstorm
Copy link
Contributor Author

Alright, backtracked on this PR so that it just fits point 1: remove unproven.

Cheers!

@@ -4,7 +4,7 @@ use svd_parser as svd;
fn arm_sample_faulty() {
let xml = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/ARM_Sample_faulty.svd"
"/tests/data/ARM_Sample_faulty.svd"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you missed this I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean reverting it as it was? I think that this structure is more intuitive (keep tests and data separate)... it's a minimal change and tests keep passing as they were anyway?:

$ cargo test
(...)
running 1 test
test arm_sample_faulty ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I haven't seen you moved the file!

@@ -2,4 +2,3 @@
[._]*.sw[a-p]
Cargo.lock
target
tests/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why tests directory was ignored?

Copy link
Contributor Author

@brainstorm brainstorm Dec 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻‍♂️ ... I guess that @burrbull was generating some files automatically and did not want to version them in the past? Can't see any reason to keep ignoring them now TBH, that's why I removed the dir from .gitignore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not my repo initially :)

@burrbull
Copy link
Member

LGTM. Squash commits and modify changelog please.

@MarcoIeni
Copy link
Contributor

Squash commits and modify changelog please.

Just out of curiosity. Why should he squash commits? You can select the option "Squash and merge" from github.

@burrbull
Copy link
Member

We use bors for tests and merging as I remember.

@MarcoIeni
Copy link
Contributor

you are right, thanks!

@burrbull
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Dec 26, 2020
131: Remove unproven r=burrbull a=brainstorm

Fixes #116

@MarcoIeni @burrbull Let's do what you suggest on #116, shall we? See the integration [test mostly borrowed from @MarcoIeni's `svd_parser`](https://github.com/rust-embedded/svd/pull/131/files#diff-eb771f54a1fdc1c330a82981d7d27d1202a5cbe3a59581ff67af5e3361f5f90e)

Getting the following error for now, ~seems like getting the same capitalization (and perhaps ordering?) might be challenging for integration testing purposes~... nope, it's just `<fields />` being empty,  I guess the SVD parser should tolerate that?:

```xml
    <peripheral>
           <name>RNG</name>
           <description>RNG register</description>
           <baseAddress>0x3FF20E44</baseAddress>
           <addressBlock>
                       <offset>0</offset>
                       <size>32</size>
                       <usage>RNG register</usage>
           </addressBlock>
           <registers>
                  <register>
                       <name>rng</name>
                       <fields />
                       <description>RNG register</description>
                       <addressOffset>0</addressOffset>
                       <size>32</size>
                       <access>read-only</access>
                      <resetValue>0</resetValue>
                   </register>
        </registers>
     </peripheral>
```

```rust
---- read_and_write stdout ----
thread 'read_and_write' panicked at 'Failed to parse the SVD file into Rust structs: In device `esp8266`

Caused by:
    0: In peripheral `RNG`
    1: In register `rng`
    2: Register have `fields` tag, but it is empty', tests/integration.rs:14:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Co-authored-by: Roman Valls Guimera <[email protected]>
@bors
Copy link
Contributor

bors bot commented Dec 26, 2020

Build failed:

@burrbull
Copy link
Member

Looks like ci is broken. We need to move it on Github Actions and update cross

@MarcoIeni
Copy link
Contributor

Looks like ci is broken. We need to move it on Github Actions and update cross

See #132
I can do it!

@burrbull
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 26, 2020

Build succeeded:

@bors bors bot merged commit 8a8b7a7 into rust-embedded:master Dec 26, 2020
@ForsakenHarmony
Copy link

We use bors for tests and merging as I remember.

You can configure bors to squash merge

@MarcoIeni
Copy link
Contributor

You can configure bors to squash merge

Yes, but I don't remember where, therealprof told me that sometimes they prefer to keep commit history, so they don't want to squash and merge everytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove unproven flag
4 participants