Skip to content

Commit 2758846

Browse files
test-runner: Test boot::register_protocol_notify
1 parent 4f2a994 commit 2758846

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

+15
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub fn test(st: &SystemTable<Boot>) {
2525
test_watchdog(bt);
2626
info!("Testing protocol handler services...");
2727
test_register_protocol_notify(bt);
28+
test_register_protocol_notify_freestanding();
2829
test_protocol_interface_management();
2930
test_install_protocol_interface(bt);
3031
test_reinstall_protocol_interface(bt);
@@ -156,6 +157,20 @@ fn test_register_protocol_notify(bt: &BootServices) {
156157
.expect("Failed to register protocol notify fn");
157158
}
158159

160+
fn test_register_protocol_notify_freestanding() {
161+
unsafe extern "efiapi" fn callback(_event: Event, _context: Option<NonNull<c_void>>) {
162+
info!("in callback for test_register_protocol_notify_freestanding")
163+
}
164+
165+
let protocol = &TestProtocol::GUID;
166+
let event = unsafe {
167+
boot::create_event(EventType::NOTIFY_SIGNAL, Tpl::NOTIFY, Some(callback), None).unwrap()
168+
};
169+
170+
boot::register_protocol_notify(protocol, &event)
171+
.expect("Failed to register protocol notify fn");
172+
}
173+
159174
fn test_protocol_interface_management() {
160175
let mut interface = TestProtocol { data: 123 };
161176
let interface_ptr: *mut _ = &mut interface;

0 commit comments

Comments
 (0)