Skip to content

Commit cfb3b20

Browse files
test-runner: Test boot::protocols_per_handle
1 parent 769ca4b commit cfb3b20

File tree

1 file changed

+9
-1
lines changed
  • uefi-test-runner/src/proto

1 file changed

+9
-1
lines changed

uefi-test-runner/src/proto/mod.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use uefi::prelude::*;
22
use uefi::proto::loaded_image::LoadedImage;
3-
use uefi::{proto, Identify};
3+
use uefi::{boot, proto, Identify};
44

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

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

59+
fn test_protocols_per_handle_freestanding() {
60+
let pph = boot::protocols_per_handle(boot::image_handle()).unwrap();
61+
info!("Image handle has {} protocols", pph.len());
62+
// Check that one of the image's protocols is `LoadedImage`.
63+
assert!(pph.iter().any(|guid| **guid == LoadedImage::GUID));
64+
}
65+
5866
mod console;
5967
mod debug;
6068
mod device_path;

0 commit comments

Comments
 (0)