|
1 | 1 | // SPDX-License-Identifier: MIT OR Apache-2.0
|
2 | 2 |
|
| 3 | +use uefi::boot::ScopedProtocol; |
3 | 4 | use uefi::proto::shell::Shell;
|
4 | 5 | use uefi::{CStr16, boot};
|
5 | 6 | use uefi_raw::Status;
|
6 | 7 |
|
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>) { |
19 | 10 | let mut test_buf = [0u16; 128];
|
20 | 11 |
|
21 | 12 | /* Test retrieving list of environment variable names (null input) */
|
@@ -151,6 +142,21 @@ pub fn test() {
|
151 | 142 | .get_cur_dir(Some(fs_var))
|
152 | 143 | .expect("Could not get the current file system mapping");
|
153 | 144 | 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(); |
154 | 160 |
|
155 | 161 | // Create a file
|
156 | 162 | // let status = shell.create_file(test_str, 0).expect("Could not create file");
|
|
0 commit comments