summaryrefslogtreecommitdiff
path: root/kernel/tests
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2019-11-11 18:42:59 +0100
committerDennis Kobert <dennis@kobert.dev>2019-11-11 18:42:59 +0100
commitec22f3464c87b3d1b1688898053a569bc4839404 (patch)
tree7332136eb3c3cb08dea32cbd89ee3254b55466bb /kernel/tests
parent26a7561196674b39f9adadcb374f36c503361adb (diff)
Add expect fault handling
Diffstat (limited to 'kernel/tests')
-rw-r--r--kernel/tests/int3.rs16
-rw-r--r--kernel/tests/stack_overflow.rs11
2 files changed, 14 insertions, 13 deletions
diff --git a/kernel/tests/int3.rs b/kernel/tests/int3.rs
index 771c17d..f4e2116 100644
--- a/kernel/tests/int3.rs
+++ b/kernel/tests/int3.rs
@@ -1,28 +1,26 @@
#![no_main]
#![feature(compiler_builtins_lib)]
-#![feature(custom_test_frameworks)]
#![feature(abi_x86_interrupt)]
#![feature(panic_info_message)]
-#![test_runner(kernel::testing::serial_test_runner)]
-#![reexport_test_harness_main = "test_main"]
#![no_std]
use kernel;
+use kernel::interrupts;
+use kernel::interrupts::exceptions;
use kernel::io::qemu;
#[no_mangle]
extern "C" fn _start() -> ! {
kernel::init();
- test_main();
+ unsafe {
+ exceptions::expect_fault(interrupts::Interrupts::BREAKPOINT);
+ }
+ x86_64::instructions::interrupts::int3();
+ panic!("BREAKPOINT not caught");
loop {}
}
-#[test_case]
-fn breakpoint() {
- x86_64::instructions::interrupts::int3();
-}
-
#[cfg(test)]
#[panic_handler]
#[no_mangle]
diff --git a/kernel/tests/stack_overflow.rs b/kernel/tests/stack_overflow.rs
index 677a9e1..dc53537 100644
--- a/kernel/tests/stack_overflow.rs
+++ b/kernel/tests/stack_overflow.rs
@@ -1,25 +1,28 @@
#![no_main]
#![feature(compiler_builtins_lib)]
-#![feature(custom_test_frameworks)]
#![feature(abi_x86_interrupt)]
#![feature(panic_info_message)]
-#![test_runner(kernel::testing::serial_test_runner_panic)]
#![no_std]
use core::fmt::Write;
use kernel;
+use kernel::interrupts;
+use kernel::interrupts::exceptions;
use kernel::io::qemu;
#[no_mangle]
extern "C" fn _start() -> ! {
kernel::init();
+ unsafe {
+ exceptions::expect_fault(interrupts::Interrupts::PAGE_FAULT);
+ }
_loop(0);
-
+ panic!("PAGE_FAULT not caught");
loop {}
}
fn _loop(i: u128) -> u128 {
- if i > 1u128 << 83 {
+ if i > 1u128 << 120 {
return i;
}
let n = i;