Skip to content

Commit 933d159

Browse files
committed
CI problem fixed, CONTRIBUTION.md now includes CI prep.
1 parent 77d16e2 commit 933d159

File tree

6 files changed

+40
-13
lines changed

6 files changed

+40
-13
lines changed

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,53 @@
11
# Contributing
2+
23
## New features
4+
35
New features should go through the [RFC process][rfcs] before a Pull Request is made to this repository.
46

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

79
## Bugs
10+
811
Report bugs by creating an issue in this repository.
912

1013
## Pull Requests
14+
1115
Please make pull requests against the master branch.
1216

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

1519
## Writing documentation
20+
1621
Documentation improvements are always welcome. The source for the book is in `book/` and API documentation is generated from the source code.
22+
23+
## CI test preparation
24+
25+
To reduce risk of CI failing for your PR, please make sure that tests passes locally before submitting.
26+
27+
```shell
28+
> cargo xtask --target all
29+
```
30+
31+
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`.
32+
33+
If you have added further tests, you need to add the expected output in the `ci/expected` folder.
34+
35+
```shell
36+
> cargo run --example <NAME> --target thumbv7m-none-eabi > ci/expected/<NAME>.run
37+
```
38+
39+
Internal fail tests can be locally run:
40+
41+
```shell
42+
> cargo test --tests
43+
```
44+
45+
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:
46+
47+
```shell
48+
> TRYBUILD=overwrite cargo test --tests
49+
```
50+
51+
This will update the expected output to match the `ACTUAL OUTPUT`. Please check that the updated files are indeed correct as to avoid regressions.
52+
53+
Once all tests pass you are ready to make a PR.

ci/expected/lockall.run

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
foo: a = 1, b = 2
22
baz
3-
still in foo::lock
43
bar: a = 3
5-
still in foo
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
foo: a = 1, b = 2
22
baz
3-
still in foo::lock
43
bar: a = 3
5-
still in foo

examples/cfg-whole-task.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ mod app {
1515

1616
#[shared]
1717
struct Shared {
18-
#[cfg(debug_assertions)] // <- `true` when using the `dev` profile
1918
count: u32,
2019
#[cfg(never)]
2120
unused: u32,
@@ -31,7 +30,6 @@ mod app {
3130

3231
(
3332
Shared {
34-
#[cfg(debug_assertions)]
3533
count: 0,
3634
#[cfg(never)]
3735
unused: 1,

examples/lockall.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ mod app {
3535
*s.a += 1;
3636
bar::spawn().unwrap();
3737
baz::spawn().unwrap();
38-
hprintln!("still in foo::lock").ok();
3938
});
40-
hprintln!("still in foo").ok();
4139
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
4240
}
4341

examples/lockall_destruct.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,17 @@ mod app {
3535
**a += 1;
3636
bar::spawn().unwrap();
3737
baz::spawn().unwrap();
38-
hprintln!("still in foo::lock").ok();
3938
});
40-
hprintln!("still in foo").ok();
4139
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
4240
}
4341

4442
#[task(priority = 2, shared = [a])]
4543
fn bar(mut c: bar::Context) {
4644
// the higher priority task does still need a critical section
47-
let a = c.shared.lock(|s| {
48-
*s.a += 1;
45+
let a = c.shared.lock(|bar::Shared { a }| {
46+
**a += 1;
4947
// *s.b += 1; `b` not accessible
50-
*s.a
48+
**a
5149
});
5250

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

0 commit comments

Comments
 (0)