Skip to content

Commit 9e2cf34

Browse files
test-runner: Test boot::get_handle_for_protocol
Modify send_request_to_host to use freestanding boot functions instead of BootServices. There are plenty of other places that still test BootServices::get_handle_for_protocol.
1 parent d66959a commit 9e2cf34

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

uefi-test-runner/src/main.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,9 @@ fn reconnect_serial_to_console(serial_handle: Handle) {
167167
/// Send the `request` string to the host via the `serial` device, then
168168
/// wait up to 10 seconds to receive a reply. Returns an error if the
169169
/// reply is not `"OK\n"`.
170-
fn send_request_to_host(bt: &BootServices, request: HostRequest) {
171-
let serial_handle = bt
172-
.get_handle_for_protocol::<Serial>()
173-
.expect("Failed to get serial handle");
170+
fn send_request_to_host(request: HostRequest) {
171+
let serial_handle =
172+
uefi::boot::get_handle_for_protocol::<Serial>().expect("Failed to get serial handle");
174173

175174
// Open the serial protocol in exclusive mode.
176175
//
@@ -183,8 +182,7 @@ fn send_request_to_host(bt: &BootServices, request: HostRequest) {
183182
// end with `connect_controller`.
184183
//
185184
// [console splitter driver]: https://github.com/tianocore/edk2/blob/HEAD/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
186-
let mut serial = bt
187-
.open_protocol_exclusive::<Serial>(serial_handle)
185+
let mut serial = uefi::boot::open_protocol_exclusive::<Serial>(serial_handle)
188186
.expect("Could not open serial protocol");
189187

190188
// Send the request, but don't check the result yet so that first
@@ -211,7 +209,7 @@ fn shutdown(mut st: SystemTable<Boot>) -> ! {
211209
// Tell the host that tests are done. We are about to exit boot
212210
// services, so we can't easily communicate with the host any later
213211
// than this.
214-
send_request_to_host(st.boot_services(), HostRequest::TestsComplete);
212+
send_request_to_host(HostRequest::TestsComplete);
215213

216214
// Send a special log to the host so that we can verify that logging works
217215
// up until exiting boot services. See `reconnect_serial_to_console` for the

uefi-test-runner/src/proto/console/gop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub unsafe fn test(bt: &BootServices) {
2828

2929
// `draw_fb` is skipped on aarch64, so the screenshot doesn't match.
3030
if cfg!(not(target_arch = "aarch64")) {
31-
send_request_to_host(bt, HostRequest::Screenshot("gop_test"));
31+
send_request_to_host(HostRequest::Screenshot("gop_test"));
3232
}
3333
}
3434

0 commit comments

Comments
 (0)