33use uefi:: boot:: ScopedProtocol ;
44use uefi:: proto:: shell:: Shell ;
55use uefi:: { boot, cstr16} ;
6- use uefi_raw:: Status ;
76
8- /// Test `get_cur_dir ()` and `set_cur_dir ()`
9- pub fn test_cur_dir ( shell : & ScopedProtocol < Shell > ) {
7+ /// Test `current_dir ()` and `set_current_dir ()`
8+ pub fn test_current_dir ( shell : & ScopedProtocol < Shell > ) {
109 /* Test setting and getting current file system and current directory */
1110 let fs_var = cstr16 ! ( "fs0:" ) ;
1211 let dir_var = cstr16 ! ( "/" ) ;
13- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
14- assert_eq ! ( status, Status :: SUCCESS ) ;
12+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
13+ assert ! ( status. is_ok ( ) ) ;
1514
1615 let cur_fs_str = shell
17- . get_cur_dir ( Some ( fs_var) )
16+ . current_dir ( Some ( fs_var) )
1817 . expect ( "Could not get the current file system mapping" ) ;
1918 let expected_fs_str = cstr16 ! ( "FS0:\\ " ) ;
2019 assert_eq ! ( cur_fs_str, expected_fs_str) ;
2120
2221 // Changing current file system
2322 let fs_var = cstr16 ! ( "fs1:" ) ;
2423 let dir_var = cstr16 ! ( "/" ) ;
25- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
26- assert_eq ! ( status, Status :: SUCCESS ) ;
24+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
25+ assert ! ( status. is_ok ( ) ) ;
2726
2827 let cur_fs_str = shell
29- . get_cur_dir ( Some ( fs_var) )
28+ . current_dir ( Some ( fs_var) )
3029 . expect ( "Could not get the current file system mapping" ) ;
3130 assert_ne ! ( cur_fs_str, expected_fs_str) ;
3231 let expected_fs_str = cstr16 ! ( "FS1:\\ " ) ;
@@ -35,11 +34,11 @@ pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
3534 // Changing current file system and current directory
3635 let fs_var = cstr16 ! ( "fs0:" ) ;
3736 let dir_var = cstr16 ! ( "efi/" ) ;
38- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
39- assert_eq ! ( status, Status :: SUCCESS ) ;
37+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
38+ assert ! ( status. is_ok ( ) ) ;
4039
4140 let cur_fs_str = shell
42- . get_cur_dir ( Some ( fs_var) )
41+ . current_dir ( Some ( fs_var) )
4342 . expect ( "Could not get the current file system mapping" ) ;
4443 assert_ne ! ( cur_fs_str, expected_fs_str) ;
4544 let expected_fs_str = cstr16 ! ( "FS0:\\ efi" ) ;
@@ -49,50 +48,50 @@ pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
4948
5049 // At this point, the current working file system has not been set
5150 // So we expect a NULL output
52- assert ! ( shell. get_cur_dir ( None ) . is_none( ) ) ;
51+ assert ! ( shell. current_dir ( None ) . is_none( ) ) ;
5352
5453 // Setting the current working file system and current working directory
5554 let dir_var = cstr16 ! ( "fs0:/" ) ;
56- let status = shell. set_cur_dir ( None , Some ( dir_var) ) ;
57- assert_eq ! ( status, Status :: SUCCESS ) ;
55+ let status = shell. set_current_dir ( None , Some ( dir_var) ) ;
56+ assert ! ( status. is_ok ( ) ) ;
5857 let cur_fs_str = shell
59- . get_cur_dir ( Some ( fs_var) )
58+ . current_dir ( Some ( fs_var) )
6059 . expect ( "Could not get the current file system mapping" ) ;
6160 let expected_fs_str = cstr16 ! ( "FS0:" ) ;
6261 assert_eq ! ( cur_fs_str, expected_fs_str) ;
6362
6463 let cur_fs_str = shell
65- . get_cur_dir ( None )
64+ . current_dir ( None )
6665 . expect ( "Could not get the current file system mapping" ) ;
6766 assert_eq ! ( cur_fs_str, expected_fs_str) ;
6867
6968 // Changing current working directory
7069 let dir_var = cstr16 ! ( "/efi" ) ;
71- let status = shell. set_cur_dir ( None , Some ( dir_var) ) ;
72- assert_eq ! ( status, Status :: SUCCESS ) ;
70+ let status = shell. set_current_dir ( None , Some ( dir_var) ) ;
71+ assert ! ( status. is_ok ( ) ) ;
7372 let cur_fs_str = shell
74- . get_cur_dir ( Some ( fs_var) )
73+ . current_dir ( Some ( fs_var) )
7574 . expect ( "Could not get the current file system mapping" ) ;
7675 let expected_fs_str = cstr16 ! ( "FS0:\\ efi" ) ;
7776 assert_eq ! ( cur_fs_str, expected_fs_str) ;
7877 let cur_fs_str = shell
79- . get_cur_dir ( None )
78+ . current_dir ( None )
8079 . expect ( "Could not get the current file system mapping" ) ;
8180 assert_eq ! ( cur_fs_str, expected_fs_str) ;
8281
8382 // Changing current directory in a non-current working file system
8483 let fs_var = cstr16 ! ( "fs0:" ) ;
8584 let dir_var = cstr16 ! ( "efi/tools" ) ;
86- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
87- assert_eq ! ( status, Status :: SUCCESS ) ;
85+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
86+ assert ! ( status. is_ok ( ) ) ;
8887 let cur_fs_str = shell
89- . get_cur_dir ( None )
88+ . current_dir ( None )
9089 . expect ( "Could not get the current file system mapping" ) ;
9190 assert_ne ! ( cur_fs_str, expected_fs_str) ;
9291
9392 let expected_fs_str = cstr16 ! ( "FS0:\\ efi\\ tools" ) ;
9493 let cur_fs_str = shell
95- . get_cur_dir ( Some ( fs_var) )
94+ . current_dir ( Some ( fs_var) )
9695 . expect ( "Could not get the current file system mapping" ) ;
9796 assert_eq ! ( cur_fs_str, expected_fs_str) ;
9897}
@@ -105,5 +104,5 @@ pub fn test() {
105104 let shell =
106105 boot:: open_protocol_exclusive :: < Shell > ( handle) . expect ( "Failed to open Shell protocol" ) ;
107106
108- test_cur_dir ( & shell) ;
107+ test_current_dir ( & shell) ;
109108}
0 commit comments