1#[macro_export]
2macro_rules! kassert {
3 ($test:expr) => ({
4 if !$test {
5 sprintln!("kassertion failed: {}, {}:{}:{}", stringify!($test), file!(), line!(), column!());
6 unsafe { x86test::outw(0xf4, 0x01); } }
8 });
9 ($test:expr, $($arg:tt)+) => ({
10 if !$test {
11 sprintln!("kassertion failed: {}, {}:{}:{}", format_args!($($arg)+), file!(), line!(), column!());
12 #[allow(unused_unsafe)]
13 unsafe { x86test::outw(0xf4, 0x01); } }
15 });
16}
17
18#[macro_export]
19macro_rules! kpanic {
20 ($test:expr) => ({
21 sprintln!("kpanic: {}, {}:{}:{}", stringify!($test), file!(), line!(), column!());
22 unsafe { x86test::outw(0xf4, 0x02); } });
24 ($test:expr, $($arg:tt)+) => ({
25 if !$test {
26 sprintln!("kpanic: {}, {}:{}:{}", format_args!($($arg)+), file!(), line!(), column!());
27 #[allow(unused_unsafe)]
28 unsafe { x86test::outw(0xf4, 0x02); } }
30 });
31}
32
33pub struct StaticTestFn(pub fn());
34
35pub struct X86TestFn {
36 pub name: &'static str,
38 pub ignore: bool,
40 pub identity_map: bool,
42 pub physical_memory: (u64, u64),
44 pub ioport_enable: (u16, u32),
47 pub should_panic: bool,
49 pub should_halt: bool,
51 pub testfn: StaticTestFn,
53}