diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/lib.rs | 21 | ||||
-rw-r--r-- | xtask/src/main.rs | 8 |
2 files changed, 26 insertions, 3 deletions
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index a7b85e7..c3d8356 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -208,3 +208,24 @@ pub fn check_blobs() { println!("Blobs identical."); } + +// Check that serde and PartialOrd works with VectActive +pub fn check_host_side() { + use cortex_m::peripheral::scb::VectActive; + + // check serde + { + let v = VectActive::from(22).unwrap(); + let json = serde_json::to_string(&v).expect("Failed to serialize VectActive"); + let deser_v: VectActive = + serde_json::from_str(&json).expect("Failed to deserialize VectActive"); + assert_eq!(deser_v, v); + } + + // check PartialOrd + { + let a = VectActive::from(19).unwrap(); + let b = VectActive::from(20).unwrap(); + assert_eq!(a < b, true); + } +} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ec55bf8..3e4b394 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,17 +1,19 @@ use std::{env, process}; -use xtask::{assemble_blobs, check_blobs}; +use xtask::{assemble_blobs, check_blobs, check_host_side}; fn main() { let subcommand = env::args().skip(1).next(); match subcommand.as_ref().map(|s| &**s) { Some("assemble") => assemble_blobs(), Some("check-blobs") => check_blobs(), + Some("check-host-side") => check_host_side(), _ => { eprintln!("usage: cargo xtask <subcommand>"); eprintln!(); eprintln!("subcommands:"); - eprintln!(" assemble Reassemble the pre-built artifacts"); - eprintln!(" check-blobs Check that the pre-built artifacts are up-to-date and reproducible"); + eprintln!(" assemble Reassemble the pre-built artifacts"); + eprintln!(" check-blobs Check that the pre-built artifacts are up-to-date and reproducible"); + eprintln!(" check-host-side Build the crate in a non-Cortex-M host application and check host side usage of certain types"); process::exit(1); } } |