From 724b65069522beb252beaaef3283adaa2db91ff7 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 7 Nov 2024 15:15:14 +0100 Subject: [PATCH 1/5] feat: add Ariel OS support --- Cargo.toml | 3 ++ macros/Cargo.toml | 1 + macros/src/lib.rs | 72 ++++++++++++++++++++++++++++++++++++----------- src/export.rs | 8 ++++-- 4 files changed, 66 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 886534d..8c23ea4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,5 +46,8 @@ embassy = [ # you will use your own executor by setting it via the `tasks` macro, e.g. `#[embedded_test::tests(executor = esp_hal::embassy::executor::thread::Executor::new())]` external-executor = ["embedded-test-macros/external-executor"] +# Enables Ariel OS integration +ariel-os = ["embedded-test-macros/ariel-os", "embassy"] + # enables the xtensa-specific semihosting implementation xtensa-semihosting = ["semihosting/openocd-semihosting"] diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 50e535b..1a23c9d 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -21,6 +21,7 @@ darling = "0.20.8" [features] embassy = [] external-executor = [] +ariel-os = [] [dev-dependencies] trybuild = "1" diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 4958a15..4412541 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -93,6 +93,14 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result parse::Result !, so it will never return. // The closure will signal the test result via semihosting exit/abort instead @@ -347,29 +361,37 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result parse::Result parse::Result ! { // The linker file will redirect this call to the function below. // This trick ensures that we get a compile error, if the linker file was not added to the rustflags. diff --git a/src/export.rs b/src/export.rs index 4796e7f..11eb8b9 100644 --- a/src/export.rs +++ b/src/export.rs @@ -15,9 +15,13 @@ pub fn ensure_linker_file_was_added_to_rustflags() -> ! { } // Reexport the embassy stuff -#[cfg(feature = "embassy")] +#[cfg(all(feature = "embassy", not(feature = "ariel-os")))] pub use embassy_executor::task; -#[cfg(all(feature = "embassy", not(feature = "external-executor")))] +#[cfg(all( + feature = "embassy", + not(feature = "external-executor"), + not(feature = "ariel-os") +))] pub use embassy_executor::Executor; // Please activate the `executor-thread` or `executor-interrupt` feature on the embassy-executor crate (v0.7.x)! const VERSION: u32 = 1; //Format version of our protocol between probe-rs and target running embedded-test From 15a7b18c4b14754895f3d0dd2a88723ef093254d Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Fri, 17 Jan 2025 11:25:22 +0100 Subject: [PATCH 2/5] feat: don't provide panic handler for ariel os --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 2d9b7f4..0a4afc3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ mod fmt; pub use embedded_test_macros::tests; -#[cfg(feature = "panic-handler")] +#[cfg(all(feature = "panic-handler", not(feature = "ariel-os")))] #[panic_handler] fn panic(info: &core::panic::PanicInfo) -> ! { error!("====================== PANIC ======================"); From 91a267826edc29685bf56ca6771fc70d44478f58 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 13 Feb 2025 13:44:38 +0100 Subject: [PATCH 3/5] cleanup leftover --- macros/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 4412541..6777f29 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -446,7 +446,6 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result Date: Thu, 13 Feb 2025 13:45:05 +0100 Subject: [PATCH 4/5] move `ariel-os` <-> `external-executor` dependency to build.rs --- build.rs | 1 + macros/src/lib.rs | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/build.rs b/build.rs index ed057ca..7ecbd44 100644 --- a/build.rs +++ b/build.rs @@ -21,6 +21,7 @@ macro_rules! assert_unique_features { fn main() -> Result<(), Box> { assert_unique_features!("log", "defmt"); + assert_unique_features!("ariel-os", "external-executor"); let out = &PathBuf::from(env::var("OUT_DIR")?); let linker_script = fs::read_to_string("embedded-test.x")?; diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 6777f29..0517d37 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -93,14 +93,6 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result Date: Thu, 13 Feb 2025 13:50:16 +0100 Subject: [PATCH 5/5] update README.md and CHANGELOG.md with Ariel OS support --- CHANGELOG.md | 6 ++++++ README.md | 1 + 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 736c1c2..a225961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Support [Ariel OS](https://ariel-os.org). + ## [0.6.0] ### Added diff --git a/README.md b/README.md index 7e3b19d..ed6f771 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ mod tests { | `embassy` | No | Enables async test and init functions. Note: You need to enable at least one executor feature on the embassy-executor crate unless you are using the `external-executor` feature. | | `external-executor` | No | Allows you to bring your own embassy executor which you need to pass to the `#[tests]` macro (e.g. `#[embedded_test::tests(executor = esp_hal::embassy::executor::thread::Executor::new())]`) | | `xtensa-semihosting` | No | Enables semihosting for xtensa targets. | +| `ariel-os` | No | Enables [Ariel OS](https://ariel-os.github.io/ariel-os/dev/docs/book/testing.html) integration. | Please also note the doc for the [Attribute Macro embedded_test::tests](https://docs.rs/embedded-test/latest/embedded-test/attr.tests.html).