From 621de7fa8acfc18a7a7a736395a496fcc4230d9d Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 14 Aug 2016 14:59:18 -0600 Subject: [PATCH] Add test architecture --- lib.rs | 14 ++++++++++++-- tests/mod.rs | 9 +++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/mod.rs diff --git a/lib.rs b/lib.rs index d9353c7..5927692 100644 --- a/lib.rs +++ b/lib.rs @@ -72,13 +72,23 @@ extern crate bitflags; use arch::interrupt::{set_interrupts, halt}; -/// Architecture specific items +/// Architecture specific items (test) +#[cfg(test)] #[macro_use] -extern crate arch; +extern crate arch_test as arch; + +/// Architecture specific items (x86_64) +#[cfg(all(not(test), target_arch = "x86_64"))] +#[macro_use] +extern crate arch_x86_64 as arch; /// Intrinsics for panic handling pub mod panic; +/// Tests +#[cfg(test)] +pub mod tests; + #[no_mangle] pub extern fn kmain() { println!("TEST"); diff --git a/tests/mod.rs b/tests/mod.rs new file mode 100644 index 0000000..42896c0 --- /dev/null +++ b/tests/mod.rs @@ -0,0 +1,9 @@ +use arch::interrupt::{set_interrupts, halt}; + +#[test] +fn halt_with_interrupts() { + unsafe { + set_interrupts(); + halt(); + } +}