From c749979c458472c8e7e719b17a6d6906c7ddf3e0 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 23 Feb 2019 21:50:52 +0100 Subject: add some tests --- tests/cfail/used-free-interrupt-2.rs | 21 +++++++++++++++++++++ tests/cpass/binds.rs | 25 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/cfail/used-free-interrupt-2.rs create mode 100644 tests/cpass/binds.rs (limited to 'tests') diff --git a/tests/cfail/used-free-interrupt-2.rs b/tests/cfail/used-free-interrupt-2.rs new file mode 100644 index 0000000..f9aab78 --- /dev/null +++ b/tests/cfail/used-free-interrupt-2.rs @@ -0,0 +1,21 @@ +#![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)] + fn foo() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers + + extern "C" { + fn UART0(); + } +}; diff --git a/tests/cpass/binds.rs b/tests/cpass/binds.rs new file mode 100644 index 0000000..361f08f --- /dev/null +++ b/tests/cpass/binds.rs @@ -0,0 +1,25 @@ +//! 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() {} +}; + +fn foo_trampoline(_: foo::Context) {} + +fn bar_trampoline(_: bar::Context) {} -- cgit v1.2.3 From 72f0cc505addf00d493b764418e4207f53434152 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 23 Feb 2019 21:54:56 +0100 Subject: make cfail test actually fail --- tests/cfail/used-free-interrupt-2.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/cfail/used-free-interrupt-2.rs b/tests/cfail/used-free-interrupt-2.rs index f9aab78..616d308 100644 --- a/tests/cfail/used-free-interrupt-2.rs +++ b/tests/cfail/used-free-interrupt-2.rs @@ -12,8 +12,8 @@ const APP: () = { #[init] fn init() {} - #[interrupt(binds = UART0)] - fn foo() {} //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers + #[interrupt(binds = UART0)] //~ ERROR free interrupts (`extern { .. }`) can't be used as interrupt handlers + fn foo() {} extern "C" { fn UART0(); -- cgit v1.2.3 From a23380828071af69ec0362aae1b30c6e09b511f0 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 23 Feb 2019 21:56:05 +0100 Subject: fix warnings in cpass test --- tests/cpass/binds.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/cpass/binds.rs b/tests/cpass/binds.rs index 361f08f..7cb9174 100644 --- a/tests/cpass/binds.rs +++ b/tests/cpass/binds.rs @@ -20,6 +20,8 @@ const APP: () = { fn bar() {} }; +#[allow(dead_code)] fn foo_trampoline(_: foo::Context) {} +#[allow(dead_code)] fn bar_trampoline(_: bar::Context) {} -- cgit v1.2.3