From 6ea9cda6635e7536523f3c6d3d217f7d474ae4a2 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 23 Jul 2017 20:51:58 -0500 Subject: [PATCH] update cfail tests --- tests/cfail.rs | 5 +++-- tests/cfail/duplicated-handler.rs | 1 + tests/cfail/duplicated-task.rs | 1 + tests/cfail/exception.rs | 1 + tests/cfail/idle.rs | 1 + tests/cfail/init.rs | 1 + tests/cfail/interrupt.rs | 1 + tests/cfail/local-token.rs | 7 ++++--- tests/cfail/lock.rs | 15 ++++++++++----- tests/cfail/peripheral-alias.rs | 1 + tests/cfail/priority-too-high.rs | 1 + tests/cfail/priority-too-low.rs | 1 + tests/cfail/resource-alias.rs | 1 + tests/cfail/token-outlive.rs | 5 +++-- tests/cfail/token-transfer.rs | 5 +++-- tests/cfail/wrong-threshold.rs | 7 ++++--- 16 files changed, 37 insertions(+), 17 deletions(-) diff --git a/tests/cfail.rs b/tests/cfail.rs index 44c982ce5a..a475894d82 100644 --- a/tests/cfail.rs +++ b/tests/cfail.rs @@ -9,8 +9,9 @@ fn cfail() { let mut config = compiletest::default_config(); config.mode = Mode::CompileFail; config.src_base = PathBuf::from(format!("tests/cfail")); - config.target_rustcflags = - Some("-L target/debug -L target/debug/deps ".to_string()); + config.target_rustcflags = Some( + "-C panic=abort -L target/debug -L target/debug/deps ".to_string(), + ); compiletest::run_tests(&config); } diff --git a/tests/cfail/duplicated-handler.rs b/tests/cfail/duplicated-handler.rs index dc90204115..d7741b5aff 100644 --- a/tests/cfail/duplicated-handler.rs +++ b/tests/cfail/duplicated-handler.rs @@ -2,6 +2,7 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; diff --git a/tests/cfail/duplicated-task.rs b/tests/cfail/duplicated-task.rs index ab80519c0c..a167576a10 100644 --- a/tests/cfail/duplicated-task.rs +++ b/tests/cfail/duplicated-task.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/exception.rs b/tests/cfail/exception.rs index 08bd8db439..1428bccb29 100644 --- a/tests/cfail/exception.rs +++ b/tests/cfail/exception.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/idle.rs b/tests/cfail/idle.rs index e517170517..a362ec7915 100644 --- a/tests/cfail/idle.rs +++ b/tests/cfail/idle.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/init.rs b/tests/cfail/init.rs index 19bc13c1e2..73643b111d 100644 --- a/tests/cfail/init.rs +++ b/tests/cfail/init.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/interrupt.rs b/tests/cfail/interrupt.rs index 3659495f1a..2969d1f946 100644 --- a/tests/cfail/interrupt.rs +++ b/tests/cfail/interrupt.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/local-token.rs b/tests/cfail/local-token.rs index 4c98956bf0..90a9560c2b 100644 --- a/tests/cfail/local-token.rs +++ b/tests/cfail/local-token.rs @@ -1,6 +1,7 @@ #![deny(warnings)] #![feature(const_fn)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; @@ -26,11 +27,11 @@ fn idle() -> ! { } task!(EXTI0, exti0, Old { - token: Option = None; + static TOKEN: Option = None; }); fn exti0(nt: &mut Threshold, old: &mut Old, _r: EXTI0::Resources) { - if let Some(ot) = old.token.take() { + if let Some(ot) = old.TOKEN.take() { let _: (Threshold, Threshold) = (*nt, ot); //~^ error cannot move out of borrowed content @@ -39,6 +40,6 @@ fn exti0(nt: &mut Threshold, old: &mut Old, _r: EXTI0::Resources) { // ERROR can't store a threshold token in a local variable, otherwise you // would end up with two threshold tokens in a task (see `if let` above) - old.token = Some(*nt); + *old.TOKEN = Some(*nt); //~^ error cannot move out of borrowed content } diff --git a/tests/cfail/lock.rs b/tests/cfail/lock.rs index 736027e221..77310ddc0e 100644 --- a/tests/cfail/lock.rs +++ b/tests/cfail/lock.rs @@ -1,19 +1,20 @@ #![deny(warnings)] #![feature(const_fn)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; -use rtfm::{app, Threshold}; +use rtfm::{app, Resource, Threshold}; app! { device: stm32f103xx, resources: { - STATE: bool = false; - MAX: u8 = 0; + static STATE: bool = false; + static MAX: u8 = 0; }, tasks: { @@ -45,7 +46,7 @@ fn idle() -> ! { task!(EXTI0, exti0); -fn exti0(mut t: &mut Threshold, r: EXTI0::Resources) { +fn exti0(mut t: &mut Threshold, mut r: EXTI0::Resources) { // OK need to lock to access the resource if r.STATE.claim(&mut t, |state, _| **state) {} @@ -57,7 +58,7 @@ task!(EXTI1, exti1); fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) { // ERROR no need to lock. Has direct access because priority == ceiling - if r.STATE.claim(&mut t, |state, _| **state) { + if (**r.STATE).claim(&mut t, |state, _| **state) { //~^ error no method named `claim` found for type } @@ -65,3 +66,7 @@ fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) { // OK } } + +task!(EXTI2, exti2); + +fn exti2(_t: &mut Threshold, _r: EXTI2::Resources) {} diff --git a/tests/cfail/peripheral-alias.rs b/tests/cfail/peripheral-alias.rs index 840f0dc04d..042666afaf 100644 --- a/tests/cfail/peripheral-alias.rs +++ b/tests/cfail/peripheral-alias.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/priority-too-high.rs b/tests/cfail/priority-too-high.rs index c76b7a6b68..01ddc032d5 100644 --- a/tests/cfail/priority-too-high.rs +++ b/tests/cfail/priority-too-high.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; diff --git a/tests/cfail/priority-too-low.rs b/tests/cfail/priority-too-low.rs index 1e0c8e92be..d127c406ab 100644 --- a/tests/cfail/priority-too-low.rs +++ b/tests/cfail/priority-too-low.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; diff --git a/tests/cfail/resource-alias.rs b/tests/cfail/resource-alias.rs index 159b526304..788af6f634 100644 --- a/tests/cfail/resource-alias.rs +++ b/tests/cfail/resource-alias.rs @@ -1,5 +1,6 @@ #![deny(warnings)] #![feature(proc_macro)] +#![no_std] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; diff --git a/tests/cfail/token-outlive.rs b/tests/cfail/token-outlive.rs index 93d1c604f9..777729a5b6 100644 --- a/tests/cfail/token-outlive.rs +++ b/tests/cfail/token-outlive.rs @@ -1,18 +1,19 @@ #![deny(warnings)] #![feature(const_fn)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; -use rtfm::{app, Threshold}; +use rtfm::{app, Resource, Threshold}; app! { device: stm32f103xx, resources: { - STATE: bool = false; + static STATE: bool = false; }, tasks: { diff --git a/tests/cfail/token-transfer.rs b/tests/cfail/token-transfer.rs index 91e74bdf38..7bf42339bb 100644 --- a/tests/cfail/token-transfer.rs +++ b/tests/cfail/token-transfer.rs @@ -1,6 +1,7 @@ #![deny(warnings)] #![feature(const_fn)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; @@ -8,11 +9,11 @@ extern crate stm32f103xx; use rtfm::{app, Threshold}; -app! { //~ error bound `rtfm::Threshold: std::marker::Send` is not satisfied +app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied device: stm32f103xx, resources: { - TOKEN: Option = None; + static TOKEN: Option = None; }, tasks: { diff --git a/tests/cfail/wrong-threshold.rs b/tests/cfail/wrong-threshold.rs index 39d3a57b52..05ebb2f7ed 100644 --- a/tests/cfail/wrong-threshold.rs +++ b/tests/cfail/wrong-threshold.rs @@ -1,19 +1,20 @@ #![deny(warnings)] #![feature(const_fn)] #![feature(proc_macro)] +#![no_std] #[macro_use(task)] extern crate cortex_m_rtfm as rtfm; extern crate stm32f103xx; -use rtfm::{app, Threshold}; +use rtfm::{app, Resource, Threshold}; app! { device: stm32f103xx, resources: { - A: u8 = 0; - B: u8 = 0; + static A: u8 = 0; + static B: u8 = 0; }, tasks: {