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

xtask: add backward compability test #592

Merged
merged 13 commits into from
Oct 4, 2021
Merged

xtask: add backward compability test #592

merged 13 commits into from
Oct 4, 2021

Conversation

japaric
Copy link
Member

@japaric japaric commented Sep 27, 2021

UPDATE: I have left the defmt-version as it is since we have not made a defmt 0.3.0 release. I have also tweaked the defmt-test to not exit with non-zero exit code and remove some test-specific logic from xtask. See individual commits messages for details.


implements #506 (comment)
closes #506

I tested this against c7b20d5 (I called that defmt-version-3 locally) and found that a bitflags change broke the wire format. Not a big deal but I guess we should bump the version to 4? cc @jonas-schievink

bitflags (dev)
Error: malformed bitflags value string 'Flags::0::FLAG_0'

the other thing that I found out is that some of the snapshot test exit with non-zero code:

defmt-test (dev)
INFO (1/7) running `change_init_struct`...
INFO (2/7) running `test_for_changed_init_struct`...
INFO (3/7) running `assert_true`...
INFO (4/7) running `assert_imported_max`...
INFO (5/7) running `result`...
INFO (6/7) running `should_error`...
INFO (7/7) running `fail`...
ERROR panicked at '`#[should_error]` test failed with outcome: Ok(this should have returned `Err`)'

Timer with period zero, disabling

cargo xtask test-snapshot is not checking the exit code; it only looks at stdout so that non-zero exit code is not a problem for those tests. in the backcompat test we want to look for decoding errors, not at stdout, so I was using the exit code of cargo run but this defmt-test is problematic with that check.

@japaric
Copy link
Member Author

japaric commented Sep 29, 2021

found that a bitflags change broke the wire format.

bisected this down to PR #564

@japaric japaric marked this pull request as ready for review September 29, 2021 12:03
@Urhengulas Urhengulas self-requested a review September 29, 2021 14:18
@Urhengulas Urhengulas self-assigned this Sep 29, 2021
Copy link
Member

@Urhengulas Urhengulas left a comment

Choose a reason for hiding this comment

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

Looks good. I've left two comments. You add a bit of redundant code, but that's not a huge problem.

xtask/src/backcompat.rs Outdated Show resolved Hide resolved
xtask/src/backcompat.rs Show resolved Hide resolved
@Urhengulas
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Oct 1, 2021
592: xtask: add backward compability test r=Urhengulas a=japaric

**UPDATE**: I have left the defmt-version as it is since we have not made a defmt 0.3.0 release. I have also tweaked the defmt-test to not exit with non-zero exit code and remove some test-specific logic from xtask. See individual commits messages for details.

---

implements #506 (comment)
closes #506

I tested this against c7b20d5 (I called that `defmt-version-3` locally) and found that a bitflags change broke the wire format. Not a big deal but I guess we should bump the version to 4? cc `@jonas-schievink` 

``` console
bitflags (dev)
Error: malformed bitflags value string 'Flags::0::FLAG_0'
```

the other thing that I found out is that some of the snapshot test exit with non-zero code:

``` console
defmt-test (dev)
INFO (1/7) running `change_init_struct`...
INFO (2/7) running `test_for_changed_init_struct`...
INFO (3/7) running `assert_true`...
INFO (4/7) running `assert_imported_max`...
INFO (5/7) running `result`...
INFO (6/7) running `should_error`...
INFO (7/7) running `fail`...
ERROR panicked at '`#[should_error]` test failed with outcome: Ok(this should have returned `Err`)'

Timer with period zero, disabling
```

`cargo xtask test-snapshot` is not checking the exit code; it only looks at stdout so that non-zero exit code is not a problem for those tests. in the backcompat test we want to look for decoding errors, not at stdout, so I was using the exit code of `cargo run` but this `defmt-test` is problematic with that check.

Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
@bors
Copy link
Contributor

bors bot commented Oct 1, 2021

Build failed:

@japaric
Copy link
Member Author

japaric commented Oct 4, 2021

had to bump the revision because defmt::println! broke the wire format (expected)
bors r=Urhengulas

@bors
Copy link
Contributor

bors bot commented Oct 4, 2021

Build succeeded:

@bors bors bot merged commit 3e2b601 into main Oct 4, 2021
@bors bors bot deleted the test-backcompat branch October 4, 2021 08:45
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.

Backwards-compatability tests
2 participants