@@ -5,25 +5,25 @@ use uefi::proto::shell::Shell;
5
5
use uefi:: { boot, cstr16} ;
6
6
use uefi_raw:: Status ;
7
7
8
- /// Test `get_env ()`, `get_envs ()`, and `set_env ()`
8
+ /// Test `var ()`, `vars ()`, and `set_var ()`
9
9
pub fn test_env ( shell : & ScopedProtocol < Shell > ) {
10
10
/* Test retrieving list of environment variable names */
11
- let mut cur_env_vec = shell. get_envs ( ) ;
11
+ let mut cur_env_vec = shell. vars ( ) ;
12
12
assert_eq ! ( cur_env_vec. next( ) . unwrap( ) , cstr16!( "path" ) , ) ;
13
13
// check pre-defined shell variables; see UEFI Shell spec
14
14
assert_eq ! ( cur_env_vec. next( ) . unwrap( ) , cstr16!( "nonesting" ) , ) ;
15
- let cur_env_vec = shell. get_envs ( ) ;
15
+ let cur_env_vec = shell. vars ( ) ;
16
16
let default_len = cur_env_vec. count ( ) ;
17
17
18
18
/* Test setting and getting a specific environment variable */
19
- let cur_env_vec = shell. get_envs ( ) ;
19
+ let cur_env_vec = shell. vars ( ) ;
20
20
let test_var = cstr16 ! ( "test_var" ) ;
21
21
let test_val = cstr16 ! ( "test_val" ) ;
22
- assert ! ( shell. get_env ( test_var) . is_none( ) ) ;
23
- let status = shell. set_env ( test_var, test_val, false ) ;
22
+ assert ! ( shell. var ( test_var) . is_none( ) ) ;
23
+ let status = shell. set_var ( test_var, test_val, false ) ;
24
24
assert_eq ! ( status, Status :: SUCCESS ) ;
25
25
let cur_env_str = shell
26
- . get_env ( test_var)
26
+ . var ( test_var)
27
27
. expect ( "Could not get environment variable" ) ;
28
28
assert_eq ! ( cur_env_str, test_val) ;
29
29
@@ -34,7 +34,7 @@ pub fn test_env(shell: &ScopedProtocol<Shell>) {
34
34
}
35
35
}
36
36
assert ! ( !found_var) ;
37
- let cur_env_vec = shell. get_envs ( ) ;
37
+ let cur_env_vec = shell. vars ( ) ;
38
38
let mut found_var = false ;
39
39
for env_var in cur_env_vec {
40
40
if env_var == test_var {
@@ -43,49 +43,49 @@ pub fn test_env(shell: &ScopedProtocol<Shell>) {
43
43
}
44
44
assert ! ( found_var) ;
45
45
46
- let cur_env_vec = shell. get_envs ( ) ;
46
+ let cur_env_vec = shell. vars ( ) ;
47
47
assert_eq ! ( cur_env_vec. count( ) , default_len + 1 ) ;
48
48
49
49
/* Test deleting environment variable */
50
50
let test_val = cstr16 ! ( "" ) ;
51
- let status = shell. set_env ( test_var, test_val, false ) ;
51
+ let status = shell. set_var ( test_var, test_val, false ) ;
52
52
assert_eq ! ( status, Status :: SUCCESS ) ;
53
- assert ! ( shell. get_env ( test_var) . is_none( ) ) ;
53
+ assert ! ( shell. var ( test_var) . is_none( ) ) ;
54
54
55
- let cur_env_vec = shell. get_envs ( ) ;
55
+ let cur_env_vec = shell. vars ( ) ;
56
56
let mut found_var = false ;
57
57
for env_var in cur_env_vec {
58
58
if env_var == test_var {
59
59
found_var = true ;
60
60
}
61
61
}
62
62
assert ! ( !found_var) ;
63
- let cur_env_vec = shell. get_envs ( ) ;
63
+ let cur_env_vec = shell. vars ( ) ;
64
64
assert_eq ! ( cur_env_vec. count( ) , default_len) ;
65
65
}
66
66
67
- /// Test `get_cur_dir ()` and `set_cur_dir ()`
67
+ /// Test `current_dir ()` and `set_current_dir ()`
68
68
pub fn test_cur_dir ( shell : & ScopedProtocol < Shell > ) {
69
69
/* Test setting and getting current file system and current directory */
70
70
let fs_var = cstr16 ! ( "fs0:" ) ;
71
71
let dir_var = cstr16 ! ( "/" ) ;
72
- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
72
+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
73
73
assert_eq ! ( status, Status :: SUCCESS ) ;
74
74
75
75
let cur_fs_str = shell
76
- . get_cur_dir ( Some ( fs_var) )
76
+ . current_dir ( Some ( fs_var) )
77
77
. expect ( "Could not get the current file system mapping" ) ;
78
78
let expected_fs_str = cstr16 ! ( "FS0:\\ " ) ;
79
79
assert_eq ! ( cur_fs_str, expected_fs_str) ;
80
80
81
81
// Changing current file system
82
82
let fs_var = cstr16 ! ( "fs1:" ) ;
83
83
let dir_var = cstr16 ! ( "/" ) ;
84
- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
84
+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
85
85
assert_eq ! ( status, Status :: SUCCESS ) ;
86
86
87
87
let cur_fs_str = shell
88
- . get_cur_dir ( Some ( fs_var) )
88
+ . current_dir ( Some ( fs_var) )
89
89
. expect ( "Could not get the current file system mapping" ) ;
90
90
assert_ne ! ( cur_fs_str, expected_fs_str) ;
91
91
let expected_fs_str = cstr16 ! ( "FS1:\\ " ) ;
@@ -94,11 +94,11 @@ pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
94
94
// Changing current file system and current directory
95
95
let fs_var = cstr16 ! ( "fs0:" ) ;
96
96
let dir_var = cstr16 ! ( "efi/" ) ;
97
- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
97
+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
98
98
assert_eq ! ( status, Status :: SUCCESS ) ;
99
99
100
100
let cur_fs_str = shell
101
- . get_cur_dir ( Some ( fs_var) )
101
+ . current_dir ( Some ( fs_var) )
102
102
. expect ( "Could not get the current file system mapping" ) ;
103
103
assert_ne ! ( cur_fs_str, expected_fs_str) ;
104
104
let expected_fs_str = cstr16 ! ( "FS0:\\ efi" ) ;
@@ -108,50 +108,50 @@ pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
108
108
109
109
// At this point, the current working file system has not been set
110
110
// So we expect a NULL output
111
- assert ! ( shell. get_cur_dir ( None ) . is_none( ) ) ;
111
+ assert ! ( shell. current_dir ( None ) . is_none( ) ) ;
112
112
113
113
// Setting the current working file system and current working directory
114
114
let dir_var = cstr16 ! ( "fs0:/" ) ;
115
- let status = shell. set_cur_dir ( None , Some ( dir_var) ) ;
115
+ let status = shell. set_current_dir ( None , Some ( dir_var) ) ;
116
116
assert_eq ! ( status, Status :: SUCCESS ) ;
117
117
let cur_fs_str = shell
118
- . get_cur_dir ( Some ( fs_var) )
118
+ . current_dir ( Some ( fs_var) )
119
119
. expect ( "Could not get the current file system mapping" ) ;
120
120
let expected_fs_str = cstr16 ! ( "FS0:" ) ;
121
121
assert_eq ! ( cur_fs_str, expected_fs_str) ;
122
122
123
123
let cur_fs_str = shell
124
- . get_cur_dir ( None )
124
+ . current_dir ( None )
125
125
. expect ( "Could not get the current file system mapping" ) ;
126
126
assert_eq ! ( cur_fs_str, expected_fs_str) ;
127
127
128
128
// Changing current working directory
129
129
let dir_var = cstr16 ! ( "/efi" ) ;
130
- let status = shell. set_cur_dir ( None , Some ( dir_var) ) ;
130
+ let status = shell. set_current_dir ( None , Some ( dir_var) ) ;
131
131
assert_eq ! ( status, Status :: SUCCESS ) ;
132
132
let cur_fs_str = shell
133
- . get_cur_dir ( Some ( fs_var) )
133
+ . current_dir ( Some ( fs_var) )
134
134
. expect ( "Could not get the current file system mapping" ) ;
135
135
let expected_fs_str = cstr16 ! ( "FS0:\\ efi" ) ;
136
136
assert_eq ! ( cur_fs_str, expected_fs_str) ;
137
137
let cur_fs_str = shell
138
- . get_cur_dir ( None )
138
+ . current_dir ( None )
139
139
. expect ( "Could not get the current file system mapping" ) ;
140
140
assert_eq ! ( cur_fs_str, expected_fs_str) ;
141
141
142
142
// Changing current directory in a non-current working file system
143
143
let fs_var = cstr16 ! ( "fs0:" ) ;
144
144
let dir_var = cstr16 ! ( "efi/tools" ) ;
145
- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
145
+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
146
146
assert_eq ! ( status, Status :: SUCCESS ) ;
147
147
let cur_fs_str = shell
148
- . get_cur_dir ( None )
148
+ . current_dir ( None )
149
149
. expect ( "Could not get the current file system mapping" ) ;
150
150
assert_ne ! ( cur_fs_str, expected_fs_str) ;
151
151
152
152
let expected_fs_str = cstr16 ! ( "FS0:\\ efi\\ tools" ) ;
153
153
let cur_fs_str = shell
154
- . get_cur_dir ( Some ( fs_var) )
154
+ . current_dir ( Some ( fs_var) )
155
155
. expect ( "Could not get the current file system mapping" ) ;
156
156
assert_eq ! ( cur_fs_str, expected_fs_str) ;
157
157
}
0 commit comments