mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Disable the test harness for the should_panic test
This commit is contained in:
@@ -4,6 +4,10 @@ version = "0.1.0"
|
|||||||
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "should_panic"
|
||||||
|
harness = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bootloader = "0.6.4"
|
bootloader = "0.6.4"
|
||||||
volatile = "0.2.3"
|
volatile = "0.2.3"
|
||||||
|
|||||||
@@ -1,27 +1,20 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![feature(custom_test_frameworks)]
|
|
||||||
#![test_runner(test_runner)]
|
|
||||||
#![reexport_test_harness_main = "test_main"]
|
|
||||||
|
|
||||||
use blog_os::{exit_qemu, serial_print, serial_println, QemuExitCode};
|
use blog_os::{exit_qemu, serial_print, serial_println, QemuExitCode};
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn _start() -> ! {
|
pub extern "C" fn _start() -> ! {
|
||||||
test_main();
|
should_fail();
|
||||||
|
serial_println!("[test did not panic]");
|
||||||
|
exit_qemu(QemuExitCode::Failed);
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test_runner(tests: &[&dyn Fn()]) {
|
fn should_fail() {
|
||||||
serial_println!("Running {} tests", tests.len());
|
serial_print!("should_fail... ");
|
||||||
if let Some(test) = tests.first() {
|
assert_eq!(0, 1);
|
||||||
test();
|
|
||||||
serial_println!("[test did not panic]");
|
|
||||||
exit_qemu(QemuExitCode::Failed);
|
|
||||||
}
|
|
||||||
exit_qemu(QemuExitCode::Success);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
@@ -30,9 +23,3 @@ fn panic(_info: &PanicInfo) -> ! {
|
|||||||
exit_qemu(QemuExitCode::Success);
|
exit_qemu(QemuExitCode::Success);
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test_case]
|
|
||||||
fn should_fail() {
|
|
||||||
serial_print!("should_fail... ");
|
|
||||||
assert_eq!(0, 1);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user