From eea803008390cbae307e873ce6d39e01d6367759 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 21 Apr 2017 21:24:28 -0500 Subject: reword the comments in compile-fail tests --- tests/cfail/race-2.rs | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'tests/cfail/race-2.rs') diff --git a/tests/cfail/race-2.rs b/tests/cfail/race-2.rs index 55dedb6..6bd957e 100644 --- a/tests/cfail/race-2.rs +++ b/tests/cfail/race-2.rs @@ -8,21 +8,40 @@ static R2: Resource = Resource::new(0); fn j1(prio: P1) { let ceil = prio.as_ceiling(); - ceil.raise(&R1, |ceil| { - let r1 = R1.borrow(&prio, ceil); + ceil.raise( + &R1, |ceil| { + let r1 = R1.borrow(&prio, ceil); - // Would preempt this critical section - // rtfm::request(j2); - }); + // `j2` preempts this critical section + rtfm::request(j2); + } + ); } -fn j2(prio: P3) { +fn j2(_task: Task, prio: P3) { let ceil = prio.as_ceiling(); - ceil.raise(&R2, |ceil| { - // OK C2 (R1's ceiling) <= C4 (system ceiling) - // BAD C2 (R1's ceiling) < P3 (j2's priority) - let r1 = R1.borrow(&prio, ceil); - //~^ error - }); + ceil.raise( + &R2, |ceil| { + // OK C2 (R1's ceiling) <= C4 (system ceiling) + // BAD C2 (R1's ceiling) < P3 (j2's priority) + let r1 = R1.borrow(&prio, ceil); + //~^ error + } + ); +} + +// glue +extern crate cortex_m; + +use cortex_m::ctxt::Context; +use cortex_m::interrupt::Nr; + +struct Task; + +unsafe impl Context for Task {} +unsafe impl Nr for Task { + fn nr(&self) -> u8 { + 0 + } } -- cgit v1.2.3