Skip to content

Commit

Permalink
test-runner: Test boot::protocols_per_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasbishop committed Aug 9, 2024
1 parent 769ca4b commit cfb3b20
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion uefi-test-runner/src/proto/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use uefi::prelude::*;
use uefi::proto::loaded_image::LoadedImage;
use uefi::{proto, Identify};
use uefi::{boot, proto, Identify};

pub fn test(st: &mut SystemTable<Boot>) {
info!("Testing various protocols");
Expand All @@ -10,6 +10,7 @@ pub fn test(st: &mut SystemTable<Boot>) {
let bt = st.boot_services();
find_protocol(bt);
test_protocols_per_handle(bt);
test_protocols_per_handle_freestanding();

debug::test(bt);
device_path::test(bt);
Expand Down Expand Up @@ -55,6 +56,13 @@ fn test_protocols_per_handle(bt: &BootServices) {
assert!(pph.iter().any(|guid| **guid == LoadedImage::GUID));
}

fn test_protocols_per_handle_freestanding() {
let pph = boot::protocols_per_handle(boot::image_handle()).unwrap();
info!("Image handle has {} protocols", pph.len());
// Check that one of the image's protocols is `LoadedImage`.
assert!(pph.iter().any(|guid| **guid == LoadedImage::GUID));
}

mod console;
mod debug;
mod device_path;
Expand Down

0 comments on commit cfb3b20

Please sign in to comment.