aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-23 20:51:58 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-07-23 20:51:58 -0500
commit6ea9cda6635e7536523f3c6d3d217f7d474ae4a2 (patch)
treec5617f6b60531891231ba2b5b029f957562a085f
parent05feb7b018817f88123900c9196e830d51608a5f (diff)
downloadrtic-6ea9cda6635e7536523f3c6d3d217f7d474ae4a2.tar.gz
rtic-6ea9cda6635e7536523f3c6d3d217f7d474ae4a2.tar.zst
rtic-6ea9cda6635e7536523f3c6d3d217f7d474ae4a2.zip
update cfail tests
-rw-r--r--tests/cfail.rs5
-rw-r--r--tests/cfail/duplicated-handler.rs1
-rw-r--r--tests/cfail/duplicated-task.rs1
-rw-r--r--tests/cfail/exception.rs1
-rw-r--r--tests/cfail/idle.rs1
-rw-r--r--tests/cfail/init.rs1
-rw-r--r--tests/cfail/interrupt.rs1
-rw-r--r--tests/cfail/local-token.rs7
-rw-r--r--tests/cfail/lock.rs15
-rw-r--r--tests/cfail/peripheral-alias.rs1
-rw-r--r--tests/cfail/priority-too-high.rs1
-rw-r--r--tests/cfail/priority-too-low.rs1
-rw-r--r--tests/cfail/resource-alias.rs1
-rw-r--r--tests/cfail/token-outlive.rs5
-rw-r--r--tests/cfail/token-transfer.rs5
-rw-r--r--tests/cfail/wrong-threshold.rs7
16 files changed, 37 insertions, 17 deletions
diff --git a/tests/cfail.rs b/tests/cfail.rs
index 44c982ce..a475894d 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 dc902041..d7741b5a 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 ab80519c..a167576a 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 08bd8db4..1428bccb 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 e5171705..a362ec79 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 19bc13c1..73643b11 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 3659495f..2969d1f9 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 4c98956b..90a9560c 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<Threshold> = None;
+ static TOKEN: Option<Threshold> = 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 736027e2..77310ddc 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 840f0dc0..042666af 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 c76b7a6b..01ddc032 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 1e0c8e92..d127c406 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 159b5263..788af6f6 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 93d1c604..777729a5 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 91e74bdf..7bf42339 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<Threshold> = None;
+ static TOKEN: Option<Threshold> = None;
},
tasks: {
diff --git a/tests/cfail/wrong-threshold.rs b/tests/cfail/wrong-threshold.rs
index 39d3a57b..05ebb2f7 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: {