-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uefi-test-runner: Add test for ShellParams protocol
Signed-off-by: Daniel Schaefer <[email protected]>
- Loading branch information
1 parent
5a443ee
commit 2c9185b
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use uefi::proto::shell_params::ShellParameters; | ||
use uefi::table::boot::BootServices; | ||
|
||
use alloc::string::ToString; | ||
use alloc::vec::Vec; | ||
|
||
pub fn test(bt: &BootServices) { | ||
info!("Running loaded image protocol test"); | ||
|
||
let image = bt | ||
.get_handle_for_protocol::<ShellParameters>() | ||
.expect("No ShellParameters handles"); | ||
let shell_params = bt | ||
.open_protocol_exclusive::<ShellParameters>(image) | ||
.expect("Failed to open ShellParameters protocol"); | ||
|
||
assert_eq!(shell_params.args_len(), 4); | ||
assert_eq!( | ||
shell_params | ||
.args() | ||
.map(|x| x.to_string()) | ||
.collect::<Vec<_>>(), | ||
&["shell.efi", "test_runner.efi", "arg1", "arg2"] | ||
); | ||
} |