blob: 82abbf12cdca9da334ffd2a9d6f0d7656b4ecbf0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#![feature(custom_test_frameworks)]
#![test_runner(x86test::runner::runner)]
// Run with:
// RUSTFLAGS="-C relocation-model=dynamic-no-pic -C code-model=kernel" RUST_BACKTRACE=1 cargo test --verbose --test kvm -- --nocapture
extern crate core;
extern crate klogger;
extern crate x86;
extern crate x86test;
#[cfg(all(test, feature = "vmtest"))]
use self::x86test::*;
#[cfg(all(test, feature = "vmtest"))]
#[x86test(ioport(0x1, 0xfe))]
fn use_the_port() {
unsafe {
kassert!(
x86::io::inw(0x1) == 0xfe,
"`inw` instruction didn't read the correct value"
);
}
}
#[cfg(all(test, feature = "vmtest"))]
#[x86test(ram(0x30000000, 0x31000000))]
fn print_works() {
sprint!("sprint!, ");
sprintln!("sprintln! works");
}
#[cfg(all(test, feature = "vmtest"))]
#[x86test]
#[should_panic]
fn panic_test() {
kpanic!("failed");
}
|