Skip to content

Commit

Permalink
CI problem fixed, CONTRIBUTION.md now includes CI prep.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlindgren committed Oct 27, 2021
1 parent 77d16e2 commit 933d159
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 13 deletions.
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
# Contributing

## New features

New features should go through the [RFC process][rfcs] before a Pull Request is made to this repository.

[rfcs](https://github.com/rtic-rs/rfcs)

## Bugs

Report bugs by creating an issue in this repository.

## Pull Requests

Please make pull requests against the master branch.

Always use rebase instead of merge when bringing in changes from master to your feature branch.

## Writing documentation

Documentation improvements are always welcome. The source for the book is in `book/` and API documentation is generated from the source code.

## CI test preparation

To reduce risk of CI failing for your PR, please make sure that tests passes locally before submitting.

```shell
> cargo xtask --target all
```

Will execute `run` tests on your local `qemu` install. (You may also pass a single target `--target thumbv6m-none-eabi/thumbv7m-none-eabi` during your development). These test are quite time consuming as they compile and run all `examples`.

If you have added further tests, you need to add the expected output in the `ci/expected` folder.

```shell
> cargo run --example <NAME> --target thumbv7m-none-eabi > ci/expected/<NAME>.run
```

Internal fail tests can be locally run:

```shell
> cargo test --tests
```

If you have added fail tests or changed the expected behavior, the expected output needs to be updated (corresponding `.stderr` files). Inspect the error output, when sure that `ACTUAL OUTPUT` is correct you can re-run the test as:

```shell
> TRYBUILD=overwrite cargo test --tests
```

This will update the expected output to match the `ACTUAL OUTPUT`. Please check that the updated files are indeed correct as to avoid regressions.

Once all tests pass you are ready to make a PR.
2 changes: 0 additions & 2 deletions ci/expected/lockall.run
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
foo: a = 1, b = 2
baz
still in foo::lock
bar: a = 3
still in foo
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
foo: a = 1, b = 2
baz
still in foo::lock
bar: a = 3
still in foo
2 changes: 0 additions & 2 deletions examples/cfg-whole-task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ mod app {

#[shared]
struct Shared {
#[cfg(debug_assertions)] // <- `true` when using the `dev` profile
count: u32,
#[cfg(never)]
unused: u32,
Expand All @@ -31,7 +30,6 @@ mod app {

(
Shared {
#[cfg(debug_assertions)]
count: 0,
#[cfg(never)]
unused: 1,
Expand Down
2 changes: 0 additions & 2 deletions examples/lockall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ mod app {
*s.a += 1;
bar::spawn().unwrap();
baz::spawn().unwrap();
hprintln!("still in foo::lock").ok();
});
hprintln!("still in foo").ok();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}

Expand Down
8 changes: 3 additions & 5 deletions examples/lockall_destruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,17 @@ mod app {
**a += 1;
bar::spawn().unwrap();
baz::spawn().unwrap();
hprintln!("still in foo::lock").ok();
});
hprintln!("still in foo").ok();
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
}

#[task(priority = 2, shared = [a])]
fn bar(mut c: bar::Context) {
// the higher priority task does still need a critical section
let a = c.shared.lock(|s| {
*s.a += 1;
let a = c.shared.lock(|bar::Shared { a }| {
**a += 1;
// *s.b += 1; `b` not accessible
*s.a
**a
});

hprintln!("bar: a = {}", a).unwrap();
Expand Down

0 comments on commit 933d159

Please sign in to comment.