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

[testing] Embedded ci #623

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 171 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ jobs:
args: --examples --target=${{ matrix.target }}

# Verify the example output with run-pass tests
testexamples:
name: testexamples
testexamplesqemu:
name: testexamplesqemu
runs-on: ubuntu-20.04
strategy:
matrix:
Expand All @@ -157,13 +157,6 @@ jobs:
override: true
components: llvm-tools-preview

# Use precompiled binutils
- name: cargo install cargo-binutils
uses: actions-rs/[email protected]
with:
crate: cargo-binutils
version: latest

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1

Expand All @@ -176,8 +169,165 @@ jobs:
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs

- name: Run-pass tests
run:
cargo xtask --target ${{ matrix.target }}
run: |
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner qemu

testexamplesembeddedcim0:
name: testexamplesembeddedcim0
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- thumbv6m-none-eabi
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
components: llvm-tools-preview

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1

- name: Install embedded-ci-client
run: |
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client

- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs

- name: Run-pass tests
env:
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
run: |
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m0

testexamplesembeddedcim3:
name: testexamplesembeddedcim3
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
components: llvm-tools-preview

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1

- name: Install embedded-ci-client
run: |
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client

- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs

- name: Run-pass tests
env:
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
run: |
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m3

testexamplesembeddedcim4:
name: testexamplesembeddedcim4
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
components: llvm-tools-preview

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1

- name: Install embedded-ci-client
run: |
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client

- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs

- name: Run-pass tests
env:
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
run: |
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m4

testexamplesembeddedcim7:
name: testexamplesembeddedcim7
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
components: llvm-tools-preview

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1

- name: Install embedded-ci-client
run: |
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client

- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs

- name: Run-pass tests
env:
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
run: |
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m7

# Check the correctness of macros/ crate
checkmacros:
Expand Down Expand Up @@ -373,7 +523,11 @@ jobs:
- check
- clippy
- checkexamples
- testexamples
- testexamplesqemu
- testexamplesembeddedcim0
- testexamplesembeddedcim3
- testexamplesembeddedcim4
- testexamplesembeddedcim7
- checkmacros
- testmacros
- tests
Expand Down Expand Up @@ -555,7 +709,11 @@ jobs:
- check
- clippy
- checkexamples
- testexamples
- testexamplesqemu
- testexamplesembeddedcim0
- testexamplesembeddedcim3
- testexamplesembeddedcim4
- testexamplesembeddedcim7
- checkmacros
- testmacros
- tests
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!

### Added

- HIL tests (embedded-ci)
- Improve how CHANGELOG.md merges are handled
- If current $stable and master version matches, dev-book redirects to $stable book
- During deploy stage, merge master branch into current stable IFF cargo package version matches
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ lto = true
[workspace]
members = [
"macros",
"xtask",
]
exclude = [
"examples-runner",
]

# do not optimize proc-macro deps or build scripts
Expand Down
2 changes: 1 addition & 1 deletion book/en/src/by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ $ cargo run --target thumbv7m-none-eabi --example locals
Yields this output:

``` console
{{#include ../../../ci/expected/locals.run}}
{{#include ../../../examples-runner/ci/expected/locals.run}}
```
2 changes: 1 addition & 1 deletion book/en/src/by-example/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ To give a flavour of RTIC, the following example contains commonly used features
In the following sections we will go through each feature in detail.

``` rust
{{#include ../../../../examples/common.rs}}
{{#include ../../../../examples-runner/src/bin/common.rs}}
```
8 changes: 4 additions & 4 deletions book/en/src/by-example/app_idle.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ are safe to access.
The example below shows that `idle` runs after `init`.

``` rust
{{#include ../../../../examples/idle.rs}}
{{#include ../../../../examples-runner/src/bin/idle.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example idle
{{#include ../../../../ci/expected/idle.run}}
{{#include ../../../../examples-runner/ci/expected/idle.run}}
```

By default, the RTIC `idle` task does not try to optimize for any specific targets.
Expand All @@ -43,10 +43,10 @@ default [`nop()`][NOP] with [`wfi()`][WFI].
[NOP]: https://developer.arm.com/documentation/dui0662/b/The-Cortex-M0--Instruction-Set/Miscellaneous-instructions/NOP

``` rust
{{#include ../../../../examples/idle-wfi.rs}}
{{#include ../../../../examples-runner/src/bin/idle-wfi.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example idle-wfi
{{#include ../../../../ci/expected/idle-wfi.run}}
{{#include ../../../../examples-runner/ci/expected/idle-wfi.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/app_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ The `device` field is available when the `peripherals` argument is set to the de
In the rare case you want to implement an ultra-slim application you can explicitly set `peripherals` to `false`.

``` rust
{{#include ../../../../examples/init.rs}}
{{#include ../../../../examples-runner/src/bin/init.rs}}
```

Running the example will print `init` to the console and then exit the QEMU process.

``` console
$ cargo run --target thumbv7m-none-eabi --example init
{{#include ../../../../ci/expected/init.run}}
{{#include ../../../../examples-runner/ci/expected/init.run}}
```

> **NOTE**: You can choose target device by passing a target
Expand Down
2 changes: 1 addition & 1 deletion book/en/src/by-example/app_minimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
This is the smallest possible RTIC application:

``` rust
{{#include ../../../../examples/smallest.rs}}
{{#include ../../../../examples-runner/src/bin/smallest.rs}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/app_priorities.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Task Priority
The following example showcases the priority based scheduling of tasks:

``` rust
{{#include ../../../../examples/preempt.rs}}
{{#include ../../../../examples-runner/src/bin/preempt.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example preempt
{{#include ../../../../ci/expected/preempt.run}}
{{#include ../../../../examples-runner/ci/expected/preempt.run}}
```

Note that the task `bar` does *not* preempt task `baz` because its priority
Expand Down
4 changes: 2 additions & 2 deletions book/en/src/by-example/hardware_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ The example below demonstrates the use of the `#[task(binds = InterruptName)]` a
hardware task bound to an interrupt handler.

``` rust
{{#include ../../../../examples/hardware.rs}}
{{#include ../../../../examples-runner/src/bin/hardware.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example hardware
{{#include ../../../../ci/expected/hardware.run}}
{{#include ../../../../examples-runner/ci/expected/hardware.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/message_passing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ pending spawns of `foo`. Exceeding this capacity is an `Error`.
The number of arguments to a task is not limited:

``` rust
{{#include ../../../../examples/message_passing.rs}}
{{#include ../../../../examples-runner/src/bin/message_passing.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example message_passing
{{#include ../../../../ci/expected/message_passing.run}}
{{#include ../../../../examples-runner/ci/expected/message_passing.run}}
```
8 changes: 4 additions & 4 deletions book/en/src/by-example/monotonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ This activates the monotonics making it possible to use them.
See the following example:

``` rust
{{#include ../../../../examples/schedule.rs}}
{{#include ../../../../examples-runner/src/bin/schedule.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example schedule
{{#include ../../../../ci/expected/schedule.run}}
{{#include ../../../../examples-runner/ci/expected/schedule.run}}
```

## Canceling or rescheduling a scheduled task
Expand All @@ -51,10 +51,10 @@ If `cancel` or `reschedule_at`/`reschedule_after` returns an `Err` it means that
too late and that the task is already sent for execution. The following example shows this in action:

``` rust
{{#include ../../../../examples/cancel-reschedule.rs}}
{{#include ../../../../examples-runner/src/bin/cancel-reschedule.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example cancel-reschedule
{{#include ../../../../ci/expected/cancel-reschedule.run}}
{{#include ../../../../examples-runner/ci/expected/cancel-reschedule.run}}
```
Loading