Skip to content

Commit 2aa5bd3

Browse files
test-runner: Add test_timer_freestanding
1 parent cc27f2f commit 2aa5bd3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

uefi-test-runner/src/boot/misc.rs

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn test(st: &SystemTable<Boot>) {
1818
test_timer(bt);
1919
info!("Testing events...");
2020
test_check_event_freestanding();
21+
test_timer_freestanding();
2122
test_event_callback(bt);
2223
test_callback_with_ctx(bt);
2324
info!("Testing watchdog...");
@@ -48,6 +49,14 @@ fn test_check_event_freestanding() {
4849
assert!(!is_signaled);
4950
}
5051

52+
fn test_timer_freestanding() {
53+
let timer_event =
54+
unsafe { boot::create_event(EventType::TIMER, Tpl::CALLBACK, None, None) }.unwrap();
55+
let mut events = unsafe { [timer_event.unsafe_clone()] };
56+
boot::set_timer(&timer_event, TimerTrigger::Relative(5_0 /*00 ns */)).unwrap();
57+
assert_eq!(boot::wait_for_event(&mut events).unwrap(), 0);
58+
}
59+
5160
fn test_timer(bt: &BootServices) {
5261
let timer_event = unsafe { bt.create_event(EventType::TIMER, Tpl::APPLICATION, None, None) }
5362
.expect("Failed to create TIMER event");

0 commit comments

Comments
 (0)