Skip to content

Commit d2b7eac

Browse files
test-runner: Remove BootServices from test_load_image
1 parent b593c0c commit d2b7eac

File tree

1 file changed

+14
-15
lines changed
  • uefi-test-runner/src/boot

1 file changed

+14
-15
lines changed

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn test(st: &SystemTable<Boot>) {
1717
memory::test(bt);
1818
misc::test(st);
1919
test_locate_handles(bt);
20-
test_load_image(bt);
20+
test_load_image();
2121
}
2222

2323
fn test_locate_handles(bt: &BootServices) {
@@ -65,15 +65,15 @@ fn test_locate_handles(bt: &BootServices) {
6565
///
6666
/// It transitively tests the protocol [`LoadedImageDevicePath`] which is
6767
/// required as helper.
68-
fn test_load_image(bt: &BootServices) {
68+
fn test_load_image() {
6969
/// The path of the loaded image executing this integration test.
7070
const LOADED_IMAGE_PATH: &str = r"\EFI\BOOT\TEST_RUNNER.EFI";
7171

7272
info!("Testing the `load_image` function");
7373

74-
let image_device_path_protocol = bt
75-
.open_protocol_exclusive::<LoadedImageDevicePath>(bt.image_handle())
76-
.expect("should open LoadedImage protocol");
74+
let image_device_path_protocol =
75+
boot::open_protocol_exclusive::<LoadedImageDevicePath>(boot::image_handle())
76+
.expect("should open LoadedImage protocol");
7777

7878
// Note: This is the full device path. The LoadedImage protocol would only
7979
// provide us with the file-path portion of the device path.
@@ -95,7 +95,8 @@ fn test_load_image(bt: &BootServices) {
9595

9696
// Variant A: FromBuffer
9797
{
98-
let fs = boot::get_image_file_system(bt.image_handle()).expect("should open file system");
98+
let fs =
99+
boot::get_image_file_system(boot::image_handle()).expect("should open file system");
99100
let path = CString16::try_from(image_device_path_file_path.as_str()).unwrap();
100101
let image_data = FileSystem::new(fs)
101102
.read(&*path)
@@ -104,17 +105,17 @@ fn test_load_image(bt: &BootServices) {
104105
buffer: image_data.as_slice(),
105106
file_path: None,
106107
};
107-
let loaded_image = bt
108-
.load_image(bt.image_handle(), load_source)
109-
.expect("should load image");
108+
let loaded_image =
109+
boot::load_image(boot::image_handle(), load_source).expect("should load image");
110110

111111
log::debug!("load_image with FromBuffer strategy works");
112112

113113
// Check that the `LoadedImageDevicePath` protocol can be opened and
114114
// that the interface data is `None`.
115-
let loaded_image_device_path = bt
116-
.open_protocol_exclusive::<LoadedImageDevicePath>(loaded_image)
117-
.expect("should open LoadedImageDevicePath protocol");
115+
let loaded_image_device_path =
116+
boot::open_protocol_exclusive::<LoadedImageDevicePath>(loaded_image)
117+
.expect("should open LoadedImageDevicePath protocol");
118+
log::info!("bish 1");
118119
assert!(loaded_image_device_path.get().is_none());
119120
}
120121
// Variant B: FromDevicePath
@@ -123,9 +124,7 @@ fn test_load_image(bt: &BootServices) {
123124
device_path: image_device_path,
124125
boot_policy: BootPolicy::ExactMatch,
125126
};
126-
let _ = bt
127-
.load_image(bt.image_handle(), load_source)
128-
.expect("should load image");
127+
let _ = boot::load_image(boot::image_handle(), load_source).expect("should load image");
129128

130129
log::debug!("load_image with FromFilePath strategy works");
131130
}

0 commit comments

Comments
 (0)