Skip to content

Commit 572382e

Browse files
committed
Separating cur_dir tests into its own function
1 parent 11f5d8f commit 572382e

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
// SPDX-License-Identifier: MIT OR Apache-2.0
22

3+
use uefi::boot::ScopedProtocol;
34
use uefi::proto::shell::Shell;
45
use uefi::{CStr16, boot};
56
use uefi_raw::Status;
67

7-
pub fn test() {
8-
info!("Running shell protocol tests");
9-
10-
let handle = boot::get_handle_for_protocol::<Shell>().expect("No Shell handles");
11-
12-
let shell =
13-
boot::open_protocol_exclusive::<Shell>(handle).expect("Failed to open Shell protocol");
14-
15-
// create some files
16-
// let mut test_buf = [0u16; 12];
17-
// let test_str = CStr16::from_str_with_buf("test", &mut test_buf).unwrap();
18-
8+
/// Test ``get_cur_dir()`` and ``set_cur_dir()``
9+
pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
1910
let mut test_buf = [0u16; 128];
2011

2112
/* Test retrieving list of environment variable names (null input) */
@@ -151,6 +142,21 @@ pub fn test() {
151142
.get_cur_dir(Some(fs_var))
152143
.expect("Could not get the current file system mapping");
153144
assert_eq!(cur_fs_str, expected_fs_str);
145+
}
146+
147+
pub fn test() {
148+
info!("Running shell protocol tests");
149+
150+
let handle = boot::get_handle_for_protocol::<Shell>().expect("No Shell handles");
151+
152+
let shell =
153+
boot::open_protocol_exclusive::<Shell>(handle).expect("Failed to open Shell protocol");
154+
155+
test_cur_dir(&shell);
156+
157+
// create some files
158+
// let mut test_buf = [0u16; 12];
159+
// let test_str = CStr16::from_str_with_buf("test", &mut test_buf).unwrap();
154160

155161
// Create a file
156162
// let status = shell.create_file(test_str, 0).expect("Could not create file");

0 commit comments

Comments
 (0)