Skip to content
Snippets Groups Projects
Commit 6ea9cda6 authored by Jorge Aparicio's avatar Jorge Aparicio
Browse files

update cfail tests

parent 05feb7b0
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,9 @@ fn cfail() { ...@@ -9,8 +9,9 @@ fn cfail() {
let mut config = compiletest::default_config(); let mut config = compiletest::default_config();
config.mode = Mode::CompileFail; config.mode = Mode::CompileFail;
config.src_base = PathBuf::from(format!("tests/cfail")); config.src_base = PathBuf::from(format!("tests/cfail"));
config.target_rustcflags = config.target_rustcflags = Some(
Some("-L target/debug -L target/debug/deps ".to_string()); "-C panic=abort -L target/debug -L target/debug/deps ".to_string(),
);
compiletest::run_tests(&config); compiletest::run_tests(&config);
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
...@@ -26,11 +27,11 @@ fn idle() -> ! { ...@@ -26,11 +27,11 @@ fn idle() -> ! {
} }
task!(EXTI0, exti0, Old { task!(EXTI0, exti0, Old {
token: Option<Threshold> = None; static TOKEN: Option<Threshold> = None;
}); });
fn exti0(nt: &mut Threshold, old: &mut Old, _r: EXTI0::Resources) { 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); let _: (Threshold, Threshold) = (*nt, ot);
//~^ error cannot move out of borrowed content //~^ error cannot move out of borrowed content
...@@ -39,6 +40,6 @@ fn exti0(nt: &mut Threshold, old: &mut Old, _r: EXTI0::Resources) { ...@@ -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 // 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) // 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 //~^ error cannot move out of borrowed content
} }
#![deny(warnings)] #![deny(warnings)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
use rtfm::{app, Threshold}; use rtfm::{app, Resource, Threshold};
app! { app! {
device: stm32f103xx, device: stm32f103xx,
resources: { resources: {
STATE: bool = false; static STATE: bool = false;
MAX: u8 = 0; static MAX: u8 = 0;
}, },
tasks: { tasks: {
...@@ -45,7 +46,7 @@ fn idle() -> ! { ...@@ -45,7 +46,7 @@ fn idle() -> ! {
task!(EXTI0, exti0); 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 // OK need to lock to access the resource
if r.STATE.claim(&mut t, |state, _| **state) {} if r.STATE.claim(&mut t, |state, _| **state) {}
...@@ -57,7 +58,7 @@ task!(EXTI1, exti1); ...@@ -57,7 +58,7 @@ task!(EXTI1, exti1);
fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) { fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
// ERROR no need to lock. Has direct access because priority == ceiling // 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 //~^ error no method named `claim` found for type
} }
...@@ -65,3 +66,7 @@ fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) { ...@@ -65,3 +66,7 @@ fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
// OK // OK
} }
} }
task!(EXTI2, exti2);
fn exti2(_t: &mut Threshold, _r: EXTI2::Resources) {}
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
......
#![deny(warnings)] #![deny(warnings)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
use rtfm::{app, Threshold}; use rtfm::{app, Resource, Threshold};
app! { app! {
device: stm32f103xx, device: stm32f103xx,
resources: { resources: {
STATE: bool = false; static STATE: bool = false;
}, },
tasks: { tasks: {
......
#![deny(warnings)] #![deny(warnings)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
...@@ -8,11 +9,11 @@ extern crate stm32f103xx; ...@@ -8,11 +9,11 @@ extern crate stm32f103xx;
use rtfm::{app, Threshold}; 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, device: stm32f103xx,
resources: { resources: {
TOKEN: Option<Threshold> = None; static TOKEN: Option<Threshold> = None;
}, },
tasks: { tasks: {
......
#![deny(warnings)] #![deny(warnings)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(proc_macro)] #![feature(proc_macro)]
#![no_std]
#[macro_use(task)] #[macro_use(task)]
extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx; extern crate stm32f103xx;
use rtfm::{app, Threshold}; use rtfm::{app, Resource, Threshold};
app! { app! {
device: stm32f103xx, device: stm32f103xx,
resources: { resources: {
A: u8 = 0; static A: u8 = 0;
B: u8 = 0; static B: u8 = 0;
}, },
tasks: { tasks: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment