Skip to content

Commit

Permalink
test-runner: Test find_handles
Browse files Browse the repository at this point in the history
This implicitly tests `locate_handle` as well.
  • Loading branch information
nicholasbishop committed Aug 12, 2024
1 parent 23a8525 commit 15b7418
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions uefi-test-runner/src/boot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pub fn test(st: &SystemTable<Boot>) {
info!("Testing boot services");
memory::test(bt);
misc::test(st);
test_locate_handle_buffer(bt);
test_locate_handles(bt);
test_load_image(bt);
}

fn test_locate_handle_buffer(bt: &BootServices) {
info!("Testing the `locate_handle_buffer` function");
fn test_locate_handles(bt: &BootServices) {
info!("Testing the `locate_handle_buffer`/`find_handles` functions");

{
// search all handles
Expand Down Expand Up @@ -51,6 +51,11 @@ fn test_locate_handle_buffer(bt: &BootServices) {
*handles,
*boot::locate_handle_buffer(SearchType::ByProtocol(&Output::GUID)).unwrap()
);

// Compare with `boot::find_handles`. This implicitly tests
// `boot::locate_handle` as well.
let handles_vec = boot::find_handles::<Output>().unwrap();
assert_eq!(*handles, handles_vec);
}
}

Expand Down

0 comments on commit 15b7418

Please sign in to comment.