Skip to content

Commit

Permalink
Merge pull request #762 from ithinuel/move-on-target-tests
Browse files Browse the repository at this point in the history
Move on-target-tests back to the work space
  • Loading branch information
jannic authored Feb 8, 2024
2 parents 6715d71 + b53f51d commit 31ccfa3
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 83 deletions.
36 changes: 6 additions & 30 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,8 @@ jobs:
version: "=0.5.28"
- name: Build rp2040-hal's workspace (without the examples)
run: cargo hack build --optional-deps --each-feature
examples-builds:
name: Build rp2040-hal's examples
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
- name: Install cargo-hack
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-hack
version: "=0.5.28"
- name: Build workspace
- run: cargo clean
- name: Build rp2040-hal's workspace (with the examples)
run: cargo hack build --examples --optional-deps --each-feature
tests:
name: Execute host-runable tests
Expand All @@ -45,13 +33,13 @@ jobs:
crate: cargo-hack
version: "=0.5.28"
- name: Test
run: cargo hack test -p rp2040-hal --tests --target x86_64-unknown-linux-gnu --optional-deps --each-feature --features critical-section-impl
run: cargo hack test -p rp2040-hal --target x86_64-unknown-linux-gnu --optional-deps --each-feature --tests --features critical-section-impl
- name: Test docs
run: cargo hack test -p rp2040-hal --doc --target x86_64-unknown-linux-gnu --optional-deps --each-feature --features critical-section-impl
run: cargo hack test -p rp2040-hal --target x86_64-unknown-linux-gnu --optional-deps --each-feature --doc --features critical-section-impl
- name: Test macros
run: cargo hack test -p rp2040-hal-macros --tests --target x86_64-unknown-linux-gnu --optional-deps --each-feature
run: cargo hack test -p rp2040-hal-macros --target x86_64-unknown-linux-gnu --optional-deps --tests --each-feature
- name: Test macro docs
run: cargo hack test -p rp2040-hal-macros --doc --target x86_64-unknown-linux-gnu --optional-deps --each-feature
run: cargo hack test -p rp2040-hal-macros --target x86_64-unknown-linux-gnu --optional-deps --doc --each-feature
- name: Clean
run: cargo clean
udeps:
Expand Down Expand Up @@ -93,15 +81,3 @@ jobs:
run: cargo update -p regex --precise 1.9.3
- name: Verifiy MSRV
run: cargo hack build --examples --optional-deps --each-feature
on-target-build:
name: Build on-target-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
- name: Build on-target-tests
run: |
cd on-target-tests
cargo test --no-run
7 changes: 2 additions & 5 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ jobs:
with:
target: thumbv6m-none-eabi
components: clippy
- run: cargo clippy --workspace --examples -- -Dwarnings
- run: cargo clippy --workspace --examples --all-features -- -Dwarnings
- run: |
cd on-target-tests
cargo clippy -- -Dwarnings
- run: cargo clippy --workspace --examples
- run: cargo clippy --workspace --examples --all-features
3 changes: 0 additions & 3 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ jobs:
target: thumbv6m-none-eabi
components: rustfmt
- run: cargo fmt -- --check
- run: |
cd on-target-tests
cargo fmt -- --check
22 changes: 15 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
[workspace]
resolver = "2"
members = [
"rp2040-hal",
"rp2040-hal-macros",
]
exclude = [
"on-target-tests"
]
members = ["rp2040-hal", "rp2040-hal-macros", "on-target-tests"]
exclude = []

[patch.'https://github.com/rp-rs/rp-hal.git']
rp2040-hal = { path = "./rp2040-hal" }

[patch.crates-io]
rp2040-hal = { path = "./rp2040-hal" }

# Those profiles are only used for `on-target-tests` compilation
[profile.dev]
codegen-units = 1
incremental = false
lto = 'fat'
opt-level = 's'

[profile.test]
codegen-units = 1
incremental = false
lto = 'fat'
opt-level = 's'
14 changes: 0 additions & 14 deletions on-target-tests/.cargo/config.toml

This file was deleted.

22 changes: 1 addition & 21 deletions on-target-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
edition = "2021"
name = "rp2040-hal-on-target-tests"
name = "on-target-tests"
version = "0.1.0"
publish = false

Expand Down Expand Up @@ -47,23 +47,3 @@ fugit = "0.3.6"

rp2040-boot2 = "0.3.0"
critical-section = "1.0.0"

[features]
default = ['defmt-trace']
defmt-trace = []
defmt-debug = []
defmt-info = []
defmt-warn = []
defmt-error = []

[profile.dev]
codegen-units = 1
incremental = false
lto = 'fat'
opt-level = 's'

[profile.test]
codegen-units = 1
incremental = false
lto = 'fat'
opt-level = 's'
2 changes: 1 addition & 1 deletion on-target-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ run_tests.bat
To run a specific test (to make developing tests faster)

```system
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test --test my_new_test -- --chip rp2040
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test -p on-target-tests --test my_new_test -- --chip rp2040
```

## Prerequisites
Expand Down
3 changes: 3 additions & 0 deletions on-target-tests/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("cargo:rustc-link-arg-tests=-Tdefmt.x");
}
2 changes: 1 addition & 1 deletion on-target-tests/run_tests.bat → run_tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

@SET "CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-rs run"

cargo test --no-fail-fast -- --chip rp2040
cargo test -p on-target-tests --no-fail-fast -- --chip rp2040
2 changes: 1 addition & 1 deletion on-target-tests/run_tests.sh → run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Keep running tests even if one of them fails
# We need to specify probe-rs as our runner via environment variables here
# to control build since we aren't able to override them in config.toml
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test --no-fail-fast -- --chip rp2040
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test -p on-target-tests --no-fail-fast -- --chip rp2040

0 comments on commit 31ccfa3

Please sign in to comment.