Skip to content

Implement EFI Shell Protocol #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions uefi-test-runner/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn test(image: Handle, st: &mut SystemTable<Boot>) {
target_arch = "aarch64"
))]
shim::test(bt);
shell::test(bt);
tcg::test(bt);
}

Expand Down Expand Up @@ -69,6 +70,7 @@ mod rng;
target_arch = "arm",
target_arch = "aarch64"
))]
mod shell;
mod shim;
mod string;
mod tcg;
28 changes: 28 additions & 0 deletions uefi-test-runner/src/proto/shell.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use uefi::CStr16;
use uefi::prelude::BootServices;
use uefi::proto::shell::Shell;

pub fn test(bt: &BootServices) {
info!("Running shell protocol tests");

let handle = bt.get_handle_for_protocol::<Shell>().expect("No Shell handles");

let mut shell = bt
.open_protocol_exclusive::<Shell>(handle)
.expect("Failed to open Shell protocol");

// create some files
let mut test_buf = [0u16; 12];
let test_str = CStr16::from_str_with_buf("test", &mut test_buf).unwrap();
shell.create_file(test_str, 0);

// get file tree
let mut str_buf = [0u16; 12];
let str_str = CStr16::from_str_with_buf(r"fs0:\*", &mut str_buf).unwrap();
let res = shell.find_files(str_str);
let list = res.unwrap();
let list = list.unwrap();
let first = list.first();

info!("filetree test successful")
}
1 change: 1 addition & 0 deletions uefi/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub mod network;
pub mod pi;
pub mod rng;
pub mod security;
pub mod shell;
pub mod shim;
pub mod string;
pub mod tcg;
Loading