aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cfail/cfg-resources.rs64
-rw-r--r--tests/cfail/cfg-static.rs57
-rw-r--r--tests/cfail/duplicate-args-2.rs24
-rw-r--r--tests/cfail/duplicate-args.rs24
-rw-r--r--tests/cfail/early-return-2.rs29
-rw-r--r--tests/cfail/early-return.rs32
-rw-r--r--tests/cfail/exception-divergent.rs20
-rw-r--r--tests/cfail/exception-input.rs19
-rw-r--r--tests/cfail/exception-invalid.rs19
-rw-r--r--tests/cfail/exception-output.rs20
-rw-r--r--tests/cfail/exception-sys-tick.rs19
-rw-r--r--tests/cfail/idle-input.rs19
-rw-r--r--tests/cfail/idle-not-divergent.rs19
-rw-r--r--tests/cfail/init-divergent.rs17
-rw-r--r--tests/cfail/init-input.rs16
-rw-r--r--tests/cfail/init-not-send.rs30
-rw-r--r--tests/cfail/init-output.rs17
-rw-r--r--tests/cfail/insufficient-free-interrupts.rs17
-rw-r--r--tests/cfail/interrupt-divergent.rs20
-rw-r--r--tests/cfail/interrupt-input.rs19
-rw-r--r--tests/cfail/interrupt-output.rs20
-rw-r--r--tests/cfail/late-assigned-to-init.rs16
-rw-r--r--tests/cfail/late-not-send.rs33
-rw-r--r--tests/cfail/late-uninit.rs18
-rw-r--r--tests/cfail/needs-send.rs30
-rw-r--r--tests/cfail/needs-sync.rs36
-rw-r--r--tests/cfail/priority-too-high.rs22
-rw-r--r--tests/cfail/priority-too-low.rs22
-rw-r--r--tests/cfail/resource-not-declared.rs14
-rw-r--r--tests/cfail/resource-pub.rs17
-rw-r--r--tests/cfail/task-divergent.rs24
-rw-r--r--tests/cfail/task-idle.rs23
-rw-r--r--tests/cfail/task-not-declared.rs14
-rw-r--r--tests/cfail/used-free-interrupt-2.rs21
-rw-r--r--tests/cfail/used-free-interrupt.rs21
-rw-r--r--tests/compiletest.rs57
-rw-r--r--tests/cpass/binds.rs27
-rw-r--r--tests/cpass/cfg.rs53
-rw-r--r--tests/cpass/late-not-send.rs34
-rw-r--r--tests/cpass/late-resource.rs20
-rw-r--r--tests/cpass/peripheral.rs18
-rw-r--r--tests/cpass/resource.rs79
-rw-r--r--tests/cpass/schedule.rs58
-rw-r--r--tests/cpass/singleton.rs66
-rw-r--r--tests/cpass/spawn.rs59
-rw-r--r--tests/cpass/unsafe.rs45
-rw-r--r--tests/single.rs7
47 files changed, 7 insertions, 1348 deletions
diff --git a/tests/cfail/cfg-resources.rs b/tests/cfail/cfg-resources.rs
deleted file mode 100644
index dee1485..0000000
--- a/tests/cfail/cfg-resources.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[cfg(never)]
- static mut O1: u32 = 0; // init
- #[cfg(never)]
- static mut O2: u32 = 0; // idle
- #[cfg(never)]
- static mut O3: u32 = 0; // EXTI0
- #[cfg(never)]
- static O4: u32 = 0; // idle
- #[cfg(never)]
- static O5: u32 = 0; // EXTI1
- #[cfg(never)]
- static O6: u32 = 0; // init
-
- #[cfg(never)]
- static mut S1: u32 = 0; // idle & EXTI0
- #[cfg(never)]
- static mut S2: u32 = 0; // EXTI0 & EXTI1
- #[cfg(never)]
- static S3: u32 = 0;
-
- #[init(resources = [O1, O4, O5, O6, S3])]
- fn init() {
- resources.O1; //~ ERROR no field `O1`
- resources.O4; //~ ERROR no field `O4`
- resources.O5; //~ ERROR no field `O5`
- resources.O6; //~ ERROR no field `O6`
- resources.S3; //~ ERROR no field `S3`
- }
-
- #[idle(resources = [O2, O4, S1, S3])]
- fn idle() -> ! {
- resources.O2; //~ ERROR no field `O2`
- resources.O4; //~ ERROR no field `O4`
- resources.S1; //~ ERROR no field `S1`
- resources.S3; //~ ERROR no field `S3`
-
- loop {}
- }
-
- #[interrupt(resources = [O3, S1, S2, S3])]
- fn UART0() {
- resources.O3; //~ ERROR no field `O3`
- resources.S1; //~ ERROR no field `S1`
- resources.S2; //~ ERROR no field `S2`
- resources.S3; //~ ERROR no field `S3`
- }
-
- #[interrupt(resources = [S2, O5])]
- fn UART1() {
- resources.S2; //~ ERROR no field `S2`
- resources.O5; //~ ERROR no field `O5`
- }
-};
diff --git a/tests/cfail/cfg-static.rs b/tests/cfail/cfg-static.rs
deleted file mode 100644
index 0d27e53..0000000
--- a/tests/cfail/cfg-static.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {
- #[cfg(never)]
- static mut FOO: u32 = 0;
-
- FOO; //~ ERROR cannot find value `FOO` in this scope
- }
-
- #[idle]
- fn idle() -> ! {
- #[cfg(never)]
- static mut FOO: u32 = 0;
-
- FOO; //~ ERROR cannot find value `FOO` in this scope
-
- loop {}
- }
-
- #[exception]
- fn SVCall() {
- #[cfg(never)]
- static mut FOO: u32 = 0;
-
- FOO; //~ ERROR cannot find value `FOO` in this scope
- }
-
- #[interrupt]
- fn UART0() {
- #[cfg(never)]
- static mut FOO: u32 = 0;
-
- FOO; //~ ERROR cannot find value `FOO` in this scope
- }
-
- #[task]
- fn foo() {
- #[cfg(never)]
- static mut FOO: u32 = 0;
-
- FOO; //~ ERROR cannot find value `FOO` in this scope
- }
-
- extern "C" {
- fn UART1();
- }
-};
diff --git a/tests/cfail/duplicate-args-2.rs b/tests/cfail/duplicate-args-2.rs
deleted file mode 100644
index 1a196e9..0000000
--- a/tests/cfail/duplicate-args-2.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[task(
- priority = 1,
- priority = 2, //~ ERROR argument appears more than once
- )]
- fn foo() {}
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/cfail/duplicate-args.rs b/tests/cfail/duplicate-args.rs
deleted file mode 100644
index a946bae..0000000
--- a/tests/cfail/duplicate-args.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[task(
- capacity = 1,
- capacity = 2, //~ ERROR argument appears more than once
- )]
- fn foo() {}
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/cfail/early-return-2.rs b/tests/cfail/early-return-2.rs
deleted file mode 100644
index bf867e0..0000000
--- a/tests/cfail/early-return-2.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut UNINITIALIZED: bool = ();
-
- #[init]
- fn init() {
- if false {
- return; //~ ERROR `init` is *not* allowed to early return
- }
-
- UNINITIALIZED = true;
- }
-
- #[interrupt(resources = [UNINITIALIZED])]
- fn UART0() {
- if resources.UNINITIALIZED {
- // UB
- }
- }
-};
diff --git a/tests/cfail/early-return.rs b/tests/cfail/early-return.rs
deleted file mode 100644
index fb695aa..0000000
--- a/tests/cfail/early-return.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut UNINITIALIZED: bool = ();
-
- #[init]
- fn init() {
- let x = || {
- // this is OK
- return 0;
- };
-
- return; //~ ERROR `init` is *not* allowed to early return
-
- UNINITIALIZED = true;
- }
-
- #[interrupt(resources = [UNINITIALIZED])]
- fn UART0() {
- if resources.UNINITIALIZED {
- // UB
- }
- }
-};
diff --git a/tests/cfail/exception-divergent.rs b/tests/cfail/exception-divergent.rs
deleted file mode 100644
index 692a57c..0000000
--- a/tests/cfail/exception-divergent.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[exception]
- fn SVCall() -> ! {
- //~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
- loop {}
- }
-};
diff --git a/tests/cfail/exception-input.rs b/tests/cfail/exception-input.rs
deleted file mode 100644
index cb0711c..0000000
--- a/tests/cfail/exception-input.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[exception]
- fn SVCall(undef: u32) {
- //~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
- }
-};
diff --git a/tests/cfail/exception-invalid.rs b/tests/cfail/exception-invalid.rs
deleted file mode 100644
index 0a7fb52..0000000
--- a/tests/cfail/exception-invalid.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[exception]
- fn NonMaskableInt() {
- //~^ ERROR only exceptions with configurable priority can be used as hardware tasks
- }
-};
diff --git a/tests/cfail/exception-output.rs b/tests/cfail/exception-output.rs
deleted file mode 100644
index 758dbdd..0000000
--- a/tests/cfail/exception-output.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[exception]
- fn SVCall() -> u32 {
- //~^ ERROR `exception` handlers must have type signature `[unsafe] fn()`
- 0
- }
-};
diff --git a/tests/cfail/exception-sys-tick.rs b/tests/cfail/exception-sys-tick.rs
deleted file mode 100644
index 69d73db..0000000
--- a/tests/cfail/exception-sys-tick.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[exception]
- fn SysTick() {
- //~^ ERROR the `SysTick` exception can't be used because it's used by the runtime
- }
-};
diff --git a/tests/cfail/idle-input.rs b/tests/cfail/idle-input.rs
deleted file mode 100644
index 5095977..0000000
--- a/tests/cfail/idle-input.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[idle]
- fn idle(undef: u32) {
- //~^ ERROR `idle` must have type signature `[unsafe] fn() -> !`
- }
-};
diff --git a/tests/cfail/idle-not-divergent.rs b/tests/cfail/idle-not-divergent.rs
deleted file mode 100644
index e90eff0..0000000
--- a/tests/cfail/idle-not-divergent.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[idle]
- fn idle() {
- //~^ ERROR `idle` must have type signature `[unsafe] fn() -> !`
- }
-};
diff --git a/tests/cfail/init-divergent.rs b/tests/cfail/init-divergent.rs
deleted file mode 100644
index 54813d4..0000000
--- a/tests/cfail/init-divergent.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() -> ! {
- //~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]`
- loop {}
- }
-};
diff --git a/tests/cfail/init-input.rs b/tests/cfail/init-input.rs
deleted file mode 100644
index 3bf0cad..0000000
--- a/tests/cfail/init-input.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init(undef: u32) {
- //~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]`
- }
-};
diff --git a/tests/cfail/init-not-send.rs b/tests/cfail/init-not-send.rs
deleted file mode 100644
index 3ac495f..0000000
--- a/tests/cfail/init-not-send.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-//! This is equivalent to the `late-not-send` cfail test
-
-#![feature(extern_crate_item_prelude)] // ???
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use core::marker::PhantomData;
-
-use rtfm::app;
-
-pub struct NotSend {
- _0: PhantomData<*const ()>,
-}
-
-#[app(device = lm3s6965)] //~ ERROR `*const ()` cannot be sent between threads safely
-const APP: () = {
- static mut X: Option<NotSend> = None;
-
- #[init(resources = [X])]
- fn init() {
- *resources.X = Some(NotSend { _0: PhantomData })
- }
-
- #[interrupt(resources = [X])]
- fn UART0() {}
-};
diff --git a/tests/cfail/init-output.rs b/tests/cfail/init-output.rs
deleted file mode 100644
index 414a35a..0000000
--- a/tests/cfail/init-output.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() -> u32 {
- //~^ ERROR `init` must have type signature `[unsafe] fn() [-> init::LateResources]`
- 0
- }
-};
diff --git a/tests/cfail/insufficient-free-interrupts.rs b/tests/cfail/insufficient-free-interrupts.rs
deleted file mode 100644
index baa2582..0000000
--- a/tests/cfail/insufficient-free-interrupts.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)] //~ ERROR 1 free interrupt (`extern { .. }`) is required
-const APP: () = {
- #[init]
- fn init() {}
-
- #[task]
- fn foo() {}
-};
diff --git a/tests/cfail/interrupt-divergent.rs b/tests/cfail/interrupt-divergent.rs
deleted file mode 100644
index 4a01533..0000000
--- a/tests/cfail/interrupt-divergent.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[interrupt]
- fn UART0() -> ! {
- //~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
- loop {}
- }
-};
diff --git a/tests/cfail/interrupt-input.rs b/tests/cfail/interrupt-input.rs
deleted file mode 100644
index d0240f4..0000000
--- a/tests/cfail/interrupt-input.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[interrupt]
- fn UART0(undef: u32) {
- //~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
- }
-};
diff --git a/tests/cfail/interrupt-output.rs b/tests/cfail/interrupt-output.rs
deleted file mode 100644
index 37cd7c2..0000000
--- a/tests/cfail/interrupt-output.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[interrupt]
- fn UART0() -> u32 {
- //~^ ERROR `interrupt` handlers must have type signature `[unsafe] fn()`
- 0
- }
-};
diff --git a/tests/cfail/late-assigned-to-init.rs b/tests/cfail/late-assigned-to-init.rs
deleted file mode 100644
index 70a361c..0000000
--- a/tests/cfail/late-assigned-to-init.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut X: u32 = ();
-
- #[init(resources = [X])] //~ ERROR late resources can NOT be assigned to `init`
- fn init() {}
-};
diff --git a/tests/cfail/late-not-send.rs b/tests/cfail/late-not-send.rs
deleted file mode 100644
index eb3048d..0000000
--- a/tests/cfail/late-not-send.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-//! `init` has a static priority of `0`. Initializing resources from it is equivalent to sending a
-//! message to the task that will own the resource
-
-#![feature(extern_crate_item_prelude)] // ???
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use core::marker::PhantomData;
-
-use rtfm::app;
-
-struct NotSend {
- _0: PhantomData<*const ()>,
-}
-
-#[app(device = lm3s6965)] //~ ERROR `*const ()` cannot be sent between threads safely
-const APP: () = {
- static mut X: NotSend = ();
-
- #[init]
- fn init() -> init::LateResources {
- init::LateResources {
- X: NotSend { _0: PhantomData },
- }
- }
-
- #[interrupt(resources = [X])]
- fn UART0() {}
-};
diff --git a/tests/cfail/late-uninit.rs b/tests/cfail/late-uninit.rs
deleted file mode 100644
index 55122ed..0000000
--- a/tests/cfail/late-uninit.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// TODO remove in v0.5.x
-
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut X: u32 = (); //~ ERROR late resources MUST be initialized at the end of `init`
-
- #[init]
- fn init() {}
-};
diff --git a/tests/cfail/needs-send.rs b/tests/cfail/needs-send.rs
deleted file mode 100644
index 7e3ca30..0000000
--- a/tests/cfail/needs-send.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#![feature(extern_crate_item_prelude)] // ???
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use core::marker::PhantomData;
-
-use rtfm::app;
-
-pub struct NotSend {
- _0: PhantomData<*const ()>,
-}
-
-unsafe impl Sync for NotSend {}
-
-#[app(device = lm3s6965)] //~ ERROR cannot be sent between threads safely
-const APP: () = {
- #[init(spawn = [foo])]
- fn init() {}
-
- #[task]
- fn foo(_x: NotSend) {}
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/cfail/needs-sync.rs b/tests/cfail/needs-sync.rs
deleted file mode 100644
index f25f91a..0000000
--- a/tests/cfail/needs-sync.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-#![feature(extern_crate_item_prelude)] // ???
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use core::marker::PhantomData;
-
-use rtfm::app;
-
-pub struct NotSync {
- _0: PhantomData<*const ()>,
-}
-
-unsafe impl Send for NotSync {}
-
-#[app(device = lm3s6965)] //~ ERROR cannot be shared between threads safely
-const APP: () = {
- static X: NotSync = NotSync { _0: PhantomData };
-
- #[init(spawn = [foo])]
- fn init() {}
-
- #[task(priority = 1, resources = [X])]
- fn foo() {}
-
- #[task(priority = 2, resources = [X])]
- fn bar() {}
-
- extern "C" {
- fn UART0();
- fn UART1();
- }
-};
diff --git a/tests/cfail/priority-too-high.rs b/tests/cfail/priority-too-high.rs
deleted file mode 100644
index ec32401..0000000
--- a/tests/cfail/priority-too-high.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)] //~ error evaluation of constant value failed
-const APP: () = {
- #[init]
- fn init() {}
-
- // OK, this is the maximum priority supported by the device
- #[interrupt(priority = 8)]
- fn UART0() {}
-
- // this value is too high!
- #[interrupt(priority = 9)]
- fn UART1() {}
-};
diff --git a/tests/cfail/priority-too-low.rs b/tests/cfail/priority-too-low.rs
deleted file mode 100644
index 6dcbfd6..0000000
--- a/tests/cfail/priority-too-low.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- // OK, this is the minimum priority that tasks can have
- #[interrupt(priority = 1)]
- fn UART0() {}
-
- // this value is too low!
- #[interrupt(priority = 0)] //~ error this literal must be in the range 1...255
- fn UART1() {}
-};
diff --git a/tests/cfail/resource-not-declared.rs b/tests/cfail/resource-not-declared.rs
deleted file mode 100644
index f6d08a6..0000000
--- a/tests/cfail/resource-not-declared.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init(resources = [X])] //~ ERROR this resource has NOT been declared
- fn init() {}
-};
diff --git a/tests/cfail/resource-pub.rs b/tests/cfail/resource-pub.rs
deleted file mode 100644
index 970fc6c..0000000
--- a/tests/cfail/resource-pub.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- pub static mut X: u32 = 0;
- //~^ ERROR resources must have inherited / private visibility
-
- #[init]
- fn init() {}
-};
diff --git a/tests/cfail/task-divergent.rs b/tests/cfail/task-divergent.rs
deleted file mode 100644
index 3822d75..0000000
--- a/tests/cfail/task-divergent.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[task]
- fn foo() -> ! {
- //~^ ERROR `task` handlers must have type signature `[unsafe] fn(..)`
- loop {}
- }
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/cfail/task-idle.rs b/tests/cfail/task-idle.rs
deleted file mode 100644
index 62d927b..0000000
--- a/tests/cfail/task-idle.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[task]
- fn idle() {
- //~^ ERROR `task` handlers can NOT be named `idle`, `init` or `resources`
- }
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/cfail/task-not-declared.rs b/tests/cfail/task-not-declared.rs
deleted file mode 100644
index 3e6d87c..0000000
--- a/tests/cfail/task-not-declared.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init(spawn = [X])] //~ ERROR this task has NOT been declared
- fn init() {}
-};
diff --git a/tests/cfail/used-free-interrupt-2.rs b/tests/cfail/used-free-interrupt-2.rs
deleted file mode 100644
index 616d308..0000000
--- a/tests/cfail/used-free-interrupt-2.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[interrupt(binds = UART0)] //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
- fn foo() {}
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/cfail/used-free-interrupt.rs b/tests/cfail/used-free-interrupt.rs
deleted file mode 100644
index 78ae540..0000000
--- a/tests/cfail/used-free-interrupt.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[interrupt]
- fn UART0() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers
-
- extern "C" {
- fn UART0();
- }
-};
diff --git a/tests/compiletest.rs b/tests/compiletest.rs
deleted file mode 100644
index 58702ee..0000000
--- a/tests/compiletest.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-use std::{fs, path::PathBuf, process::Command};
-
-use compiletest_rs::{common::Mode, Config};
-use tempdir::TempDir;
-
-#[test]
-fn cfail() {
- let mut config = Config::default();
-
- config.mode = Mode::CompileFail;
- config.src_base = PathBuf::from("tests/cfail");
- config.link_deps();
-
- // remove duplicate and trailing `-L` flags
- let mut s = String::new();
- if let Some(flags) = config.target_rustcflags.as_mut() {
- let mut iter = flags.split_whitespace().peekable();
-
- while let Some(flag) = iter.next() {
- if flag == "-L" && (iter.peek() == Some(&"-L") || iter.peek() == None) {
- iter.next();
- continue;
- }
-
- s += flag;
- s += " ";
- }
-
- // path to proc-macro crate
- s += "-L target/debug/deps ";
-
- // avoid "error: language item required, but not found: `eh_personality`"
- s += "-C panic=abort ";
- }
-
- let td = TempDir::new("rtfm").unwrap();
- for f in fs::read_dir("tests/cpass").unwrap() {
- let f = f.unwrap().path();
- let name = f.file_stem().unwrap().to_str().unwrap();
-
- assert!(Command::new("rustc")
- .args(s.split_whitespace())
- .arg(f.display().to_string())
- .arg("-o")
- .arg(td.path().join(name).display().to_string())
- .arg("-C")
- .arg("linker=true")
- .status()
- .unwrap()
- .success());
- }
-
- config.target_rustcflags = Some(s);
- config.clean_rmeta();
-
- compiletest_rs::run_tests(&config);
-}
diff --git a/tests/cpass/binds.rs b/tests/cpass/binds.rs
deleted file mode 100644
index 7cb9174..0000000
--- a/tests/cpass/binds.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-//! Check that `binds` works as advertised
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {}
-
- #[exception(binds = SVCall)]
- fn foo() {}
-
- #[interrupt(binds = UART0)]
- fn bar() {}
-};
-
-#[allow(dead_code)]
-fn foo_trampoline(_: foo::Context) {}
-
-#[allow(dead_code)]
-fn bar_trampoline(_: bar::Context) {}
diff --git a/tests/cpass/cfg.rs b/tests/cpass/cfg.rs
deleted file mode 100644
index c91ab60..0000000
--- a/tests/cpass/cfg.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-//! Compile-pass test that checks that `#[cfg]` attributes are respected
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_semihosting;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[cfg(never)]
- static mut FOO: u32 = 0;
-
- #[init]
- fn init() {
- #[cfg(never)]
- static mut BAR: u32 = 0;
- }
-
- #[idle]
- fn idle() -> ! {
- #[cfg(never)]
- static mut BAR: u32 = 0;
-
- loop {}
- }
-
- #[task(resources = [FOO], schedule = [quux], spawn = [quux])]
- fn foo() {
- #[cfg(never)]
- static mut BAR: u32 = 0;
- }
-
- #[task(priority = 3, resources = [FOO], schedule = [quux], spawn = [quux])]
- fn bar() {
- #[cfg(never)]
- static mut BAR: u32 = 0;
- }
-
- #[cfg(never)]
- #[task]
- fn quux() {}
-
- extern "C" {
- fn UART0();
- fn UART1();
- }
-};
diff --git a/tests/cpass/late-not-send.rs b/tests/cpass/late-not-send.rs
deleted file mode 100644
index 5b278ab..0000000
--- a/tests/cpass/late-not-send.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use core::marker::PhantomData;
-
-use rtfm::app;
-
-pub struct NotSend {
- _0: PhantomData<*const ()>,
-}
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut X: NotSend = ();
- static mut Y: Option<NotSend> = None;
-
- #[init(resources = [Y])]
- fn init() -> init::LateResources {
- *resources.Y = Some(NotSend { _0: PhantomData });
-
- init::LateResources {
- X: NotSend { _0: PhantomData },
- }
- }
-
- #[idle(resources = [X, Y])]
- fn idle() -> ! {
- loop {}
- }
-};
diff --git a/tests/cpass/late-resource.rs b/tests/cpass/late-resource.rs
deleted file mode 100644
index 0dec4cb..0000000
--- a/tests/cpass/late-resource.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//! Runtime initialized resources
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut X: u32 = ();
- static Y: u32 = ();
-
- #[init]
- fn init() -> init::LateResources {
- init::LateResources { X: 0, Y: 1 }
- }
-};
diff --git a/tests/cpass/peripheral.rs b/tests/cpass/peripheral.rs
deleted file mode 100644
index 509a6be..0000000
--- a/tests/cpass/peripheral.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//! Core and device peripherals
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- fn init() {
- let _: rtfm::Peripherals = core;
- let _: lm3s6965::Peripherals = device;
- }
-};
diff --git a/tests/cpass/resource.rs b/tests/cpass/resource.rs
deleted file mode 100644
index bb83739..0000000
--- a/tests/cpass/resource.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-//! Check code generation of resources
-
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::{app, Exclusive};
-
-#[app(device = lm3s6965)]
-const APP: () = {
- static mut O1: u32 = 0; // init
- static mut O2: u32 = 0; // idle
- static mut O3: u32 = 0; // EXTI0
- static O4: u32 = 0; // idle
- static O5: u32 = 0; // EXTI1
- static O6: u32 = 0; // init
-
- static mut S1: u32 = 0; // idle & EXTI0
- static mut S2: u32 = 0; // EXTI0 & EXTI1
- static S3: u32 = 0;
-
- #[init(resources = [O1, O4, O5, O6, S3])]
- fn init() {
- // owned by `init` == `&'static mut`
- let _: &'static mut u32 = resources.O1;
-
- // owned by `init` == `&'static` if read-only
- let _: &'static u32 = resources.O6;
-
- // `init` has exclusive access to all resources
- let _: &mut u32 = resources.O4;
- let _: &mut u32 = resources.O5;
- let _: &mut u32 = resources.S3;
- }
-
- #[idle(resources = [O2, O4, S1, S3])]
- fn idle() -> ! {
- // owned by `idle` == `&'static mut`
- let _: &'static mut u32 = resources.O2;
-
- // owned by `idle` == `&'static` if read-only
- let _: &'static u32 = resources.O4;
-
- // shared with `idle` == `Mutex`
- resources.S1.lock(|_| {});
-
- // `&` if read-only
- let _: &u32 = resources.S3;
-
- loop {}
- }
-
- #[interrupt(resources = [O3, S1, S2, S3])]
- fn UART0() {
- // owned by interrupt == `&mut`
- let _: &mut u32 = resources.O3;
-
- // no `Mutex` proxy when access from highest priority task
- let _: Exclusive<u32> = resources.S1;
-
- // no `Mutex` proxy when co-owned by cooperative (same priority) tasks
- let _: Exclusive<u32> = resources.S2;
-
- // `&` if read-only
- let _: &u32 = resources.S3;
- }
-
- #[interrupt(resources = [S2, O5])]
- fn UART1() {
- // owned by interrupt == `&` if read-only
- let _: &u32 = resources.O5;
-
- // no `Mutex` proxy when co-owned by cooperative (same priority) tasks
- let _: Exclusive<u32> = resources.S2;
- }
-};
diff --git a/tests/cpass/schedule.rs b/tests/cpass/schedule.rs
deleted file mode 100644
index 0728d8b..0000000
--- a/tests/cpass/schedule.rs
+++ /dev/null
@@ -1,58 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::{app, Instant};
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init(schedule = [foo, bar, baz])]
- fn init() {
- let _: Result<(), ()> = schedule.foo(start + 10.cycles());
- let _: Result<(), u32> = schedule.bar(start + 20.cycles(), 0);
- let _: Result<(), (u32, u32)> = schedule.baz(start + 30.cycles(), 0, 1);
- }
-
- #[idle(schedule = [foo, bar, baz])]
- fn idle() -> ! {
- let _: Result<(), ()> = schedule.foo(Instant::now() + 40.cycles());
- let _: Result<(), u32> = schedule.bar(Instant::now() + 50.cycles(), 0);
- let _: Result<(), (u32, u32)> = schedule.baz(Instant::now() + 60.cycles(), 0, 1);
-
- loop {}
- }
-
- #[exception(schedule = [foo, bar, baz])]
- fn SVCall() {
- let _: Result<(), ()> = schedule.foo(start + 70.cycles());
- let _: Result<(), u32> = schedule.bar(start + 80.cycles(), 0);
- let _: Result<(), (u32, u32)> = schedule.baz(start + 90.cycles(), 0, 1);
- }
-
- #[interrupt(schedule = [foo, bar, baz])]
- fn UART0() {
- let _: Result<(), ()> = schedule.foo(start + 100.cycles());
- let _: Result<(), u32> = schedule.bar(start + 110.cycles(), 0);
- let _: Result<(), (u32, u32)> = schedule.baz(start + 120.cycles(), 0, 1);
- }
-
- #[task(schedule = [foo, bar, baz])]
- fn foo() {
- let _: Result<(), ()> = schedule.foo(scheduled + 130.cycles());
- let _: Result<(), u32> = schedule.bar(scheduled + 140.cycles(), 0);
- let _: Result<(), (u32, u32)> = schedule.baz(scheduled + 150.cycles(), 0, 1);
- }
-
- #[task]
- fn bar(_x: u32) {}
-
- #[task]
- fn baz(_x: u32, _y: u32) {}
-
- extern "C" {
- fn UART1();
- }
-};
diff --git a/tests/cpass/singleton.rs b/tests/cpass/singleton.rs
deleted file mode 100644
index d50f852..0000000
--- a/tests/cpass/singleton.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate owned_singleton;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::{app, Exclusive};
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[Singleton]
- static mut O1: u32 = 0;
- #[Singleton]
- static mut O2: u32 = 0;
- #[Singleton]
- static mut O3: u32 = 0;
- #[Singleton]
- static O4: u32 = 0;
- #[Singleton]
- static O5: u32 = 0;
- #[Singleton]
- static O6: u32 = 0;
-
- #[Singleton]
- static mut S1: u32 = 0;
- #[Singleton]
- static S2: u32 = 0;
-
- #[init(resources = [O1, O2, O3, O4, O5, O6, S1, S2])]
- fn init() {
- let _: O1 = resources.O1;
- let _: &mut O2 = resources.O2;
- let _: &mut O3 = resources.O3;
- let _: O4 = resources.O4;
- let _: &mut O5 = resources.O5;
- let _: &mut O6 = resources.O6;
-
- let _: &mut S1 = resources.S1;
- let _: &mut S2 = resources.S2;
- }
-
- #[idle(resources = [O2, O5])]
- fn idle() -> ! {
- let _: O2 = resources.O2;
- let _: O5 = resources.O5;
-
- loop {}
- }
-
- #[interrupt(resources = [O3, O6, S1, S2])]
- fn UART0() {
- let _: &mut O3 = resources.O3;
- let _: &O6 = resources.O6;
-
- let _: Exclusive<S1> = resources.S1;
- let _: &S2 = resources.S2;
- }
-
- #[interrupt(resources = [S1, S2])]
- fn UART1() {
- let _: Exclusive<S1> = resources.S1;
- let _: &S2 = resources.S2;
- }
-};
diff --git a/tests/cpass/spawn.rs b/tests/cpass/spawn.rs
deleted file mode 100644
index 3df606a..0000000
--- a/tests/cpass/spawn.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-//! Check code generation of `spawn`
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init(spawn = [foo, bar, baz])]
- fn init() {
- let _: Result<(), ()> = spawn.foo();
- let _: Result<(), u32> = spawn.bar(0);
- let _: Result<(), (u32, u32)> = spawn.baz(0, 1);
- }
-
- #[idle(spawn = [foo, bar, baz])]
- fn idle() -> ! {
- let _: Result<(), ()> = spawn.foo();
- let _: Result<(), u32> = spawn.bar(0);
- let _: Result<(), (u32, u32)> = spawn.baz(0, 1);
-
- loop {}
- }
-
- #[exception(spawn = [foo, bar, baz])]
- fn SVCall() {
- let _: Result<(), ()> = spawn.foo();
- let _: Result<(), u32> = spawn.bar(0);
- let _: Result<(), (u32, u32)> = spawn.baz(0, 1);
- }
-
- #[interrupt(spawn = [foo, bar, baz])]
- fn UART0() {
- let _: Result<(), ()> = spawn.foo();
- let _: Result<(), u32> = spawn.bar(0);
- let _: Result<(), (u32, u32)> = spawn.baz(0, 1);
- }
-
- #[task(spawn = [foo, bar, baz])]
- fn foo() {
- let _: Result<(), ()> = spawn.foo();
- let _: Result<(), u32> = spawn.bar(0);
- let _: Result<(), (u32, u32)> = spawn.baz(0, 1);
- }
-
- #[task]
- fn bar(_x: u32) {}
-
- #[task]
- fn baz(_x: u32, _y: u32) {}
-
- extern "C" {
- fn UART1();
- }
-};
diff --git a/tests/cpass/unsafe.rs b/tests/cpass/unsafe.rs
deleted file mode 100644
index b6996ad..0000000
--- a/tests/cpass/unsafe.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-//! Check code generation of `unsafe` `init` / `idle` / `exception` / `interrupt` / `task`
-#![no_main]
-#![no_std]
-
-extern crate lm3s6965;
-extern crate panic_halt;
-extern crate rtfm;
-
-use rtfm::app;
-
-unsafe fn foo() {}
-
-#[app(device = lm3s6965)]
-const APP: () = {
- #[init]
- unsafe fn init() {
- foo();
- }
-
- #[idle]
- unsafe fn idle() -> ! {
- foo();
-
- loop {}
- }
-
- #[exception]
- unsafe fn SVCall() {
- foo();
- }
-
- #[interrupt]
- unsafe fn UART0() {
- foo();
- }
-
- #[task]
- unsafe fn bar() {
- foo();
- }
-
- extern "C" {
- fn UART1();
- }
-};
diff --git a/tests/single.rs b/tests/single.rs
new file mode 100644
index 0000000..b5d480c
--- /dev/null
+++ b/tests/single.rs
@@ -0,0 +1,7 @@
+use trybuild::TestCases;
+
+#[test]
+fn ui() {
+ let t = TestCases::new();
+ t.compile_fail("ui/single/*.rs");
+}