129 { |
130 { |
130 TInt r; |
131 TInt r; |
131 TBuf<64> b; |
132 TBuf<64> b; |
132 TChar c; |
133 TChar c; |
133 r=TheFs.DriveToChar(aDrive,c); |
134 r=TheFs.DriveToChar(aDrive,c); |
134 test(r==KErrNone); |
135 test_KErrNone(r); |
135 b.Format(_L("Mount test file system on %c:"),(TUint)c); |
136 b.Format(_L("Mount test file system on %c:"),(TUint)c); |
136 test.Next(b); |
137 test.Next(b); |
137 |
138 |
138 r=TheFs.AddFileSystem(KFsFile); |
139 r=TheFs.AddFileSystem(KFsFile); |
139 test(r==KErrNone || r==KErrAlreadyExists); |
140 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
140 |
141 |
141 r=TheFs.FileSystemName(gOldFsName,aDrive); |
142 r=TheFs.FileSystemName(gOldFsName,aDrive); |
142 test(r==KErrNone || r==KErrNotFound); |
143 test_Value(r, r == KErrNone || r==KErrNotFound); |
143 |
144 |
144 TDriveInfo drv; |
145 TDriveInfo drv; |
145 r = TheFs.Drive(drv, aDrive); |
146 r = TheFs.Drive(drv, aDrive); |
146 test(r == KErrNone); |
147 test_KErrNone(r); |
147 |
148 |
148 gNoMedia = (drv.iType == EMediaUnknown || drv.iType == EMediaNotPresent); |
149 gNoMedia = (drv.iType == EMediaUnknown || drv.iType == EMediaNotPresent); |
149 |
150 |
150 if (gOldFsName.Length() > 0) |
151 if (gOldFsName.Length() > 0) |
151 { |
152 { |
152 TTest::Printf(_L("Dismount %C: %S"), (TUint)c, &gOldFsName); |
153 TTest::Printf(_L("Dismount %C: %S"), (TUint)c, &gOldFsName); |
153 r=TheFs.DismountFileSystem(gOldFsName,aDrive); |
154 r=TheFs.DismountFileSystem(gOldFsName,aDrive); |
154 test(r==KErrNone); |
155 test_KErrNone(r); |
155 } |
156 } |
156 |
157 |
157 r=TheFs.MountFileSystem(KFsName,aDrive); |
158 r=TheFs.MountFileSystem(KFsName,aDrive); |
158 test(r==KErrNone); |
159 test_KErrNone(r); |
159 |
160 |
160 r=TheFs.FileSystemName(gNewFsName,aDrive); |
161 r=TheFs.FileSystemName(gNewFsName,aDrive); |
161 test(r==KErrNone); |
162 test_KErrNone(r); |
162 test(gNewFsName.CompareF(KFsName)==0); |
163 test(gNewFsName.CompareF(KFsName)==0); |
163 return c; |
164 return c; |
164 } |
165 } |
165 |
166 |
166 LOCAL_C void UnmountFileSystem(TInt aDrive) |
167 LOCAL_C void UnmountFileSystem(TInt aDrive) |
167 /// Unmount a test filesystem and mount the old one. |
168 /// Unmount a test filesystem and mount the old one. |
168 { |
169 { |
169 TChar c; |
170 TChar c; |
170 TInt r=TheFs.DriveToChar(aDrive,c); |
171 TInt r=TheFs.DriveToChar(aDrive,c); |
171 test(r==KErrNone); |
172 test_KErrNone(r); |
172 r=TheFs.DismountFileSystem(gNewFsName,aDrive); |
173 r=TheFs.DismountFileSystem(gNewFsName,aDrive); |
173 test(r==KErrNone); |
174 test_KErrNone(r); |
174 // if there's no media present, don't try to mount it |
175 // if there's no media present, don't try to mount it |
175 if (gNoMedia) |
176 if (gNoMedia) |
176 { |
177 { |
177 test.Printf(_L("No media on %C: so don't remount it"), (TUint)c); |
178 test.Printf(_L("No media on %C: so don't remount it"), (TUint)c); |
178 } |
179 } |
179 else if (gOldFsName.Length() > 0) |
180 else if (gOldFsName.Length() > 0) |
180 { |
181 { |
181 test.Printf(_L("Mount %C: %S"), (TUint)c, &gOldFsName); |
182 test.Printf(_L("Mount %C: %S"), (TUint)c, &gOldFsName); |
182 r=TheFs.MountFileSystem(gOldFsName,aDrive); |
183 r=TheFs.MountFileSystem(gOldFsName,aDrive); |
183 test(r==KErrNone); |
184 test_KErrNone(r); |
184 } |
185 } |
185 if (r != KErrNone) |
186 if (r != KErrNone) |
186 test.Printf(_L("Error %d remounting %S on %C\n"), r, &gOldFsName, (TUint)c); |
187 test.Printf(_L("Error %d remounting %S on %C\n"), r, &gOldFsName, (TUint)c); |
187 } |
188 } |
188 |
189 |
193 /// @param aSync Mount synchronous if true, asynchronous if not. |
194 /// @param aSync Mount synchronous if true, asynchronous if not. |
194 { |
195 { |
195 TChar c; |
196 TChar c; |
196 TInt r=TheFs.DriveToChar(aDrive,c); |
197 TInt r=TheFs.DriveToChar(aDrive,c); |
197 r=TheFs.FileSystemName(gFsName, aDrive); |
198 r=TheFs.FileSystemName(gFsName, aDrive); |
198 test(r==KErrNone || r==KErrNotFound); |
199 test_Value(r, r == KErrNone || r==KErrNotFound); |
199 |
200 |
200 if (gFsName.Length() > 0) |
201 if (gFsName.Length() > 0) |
201 { |
202 { |
202 r=TheFs.DismountFileSystem(gFsName, aDrive); |
203 r=TheFs.DismountFileSystem(gFsName, aDrive); |
203 if(r!=KErrNone) |
204 test_KErrNone(r); |
204 { |
|
205 test.Printf(_L("Error = %d"),r); |
|
206 test(EFalse); |
|
207 } |
|
208 } |
205 } |
209 |
206 |
210 TBufC<16> type = _L("asynchronous"); |
207 TBufC<16> type = _L("asynchronous"); |
211 if (aSync) |
208 if (aSync) |
212 type = _L("synchronous"); |
209 type = _L("synchronous"); |
900 UnmountFileSystem(drive0); |
897 UnmountFileSystem(drive0); |
901 User::Panic(_L("USER ABORT"), 0); |
898 User::Panic(_L("USER ABORT"), 0); |
902 } |
899 } |
903 |
900 |
904 r = TheFs.CharToDrive(drvch1, drive1); |
901 r = TheFs.CharToDrive(drvch1, drive1); |
905 test(r == KErrNone); |
902 test_KErrNone(r); |
906 r = TheFs.CharToDrive(drvch2, drive2); |
903 r = TheFs.CharToDrive(drvch2, drive2); |
907 test(r == KErrNone); |
904 test_KErrNone(r); |
908 |
905 |
909 r = TheFs.FileSystemName(gFsName1, drive1); |
906 r = TheFs.FileSystemName(gFsName1, drive1); |
910 test(r == KErrNone || r == KErrNotFound); |
907 test_Value(r, r == KErrNone || r == KErrNotFound); |
911 r = TheFs.FileSystemName(gFsName2, drive2); |
908 r = TheFs.FileSystemName(gFsName2, drive2); |
912 test(r == KErrNone || r == KErrNotFound); |
909 test_Value(r, r == KErrNone || r == KErrNotFound); |
913 |
910 |
914 gDataLock.CreateLocal(); |
911 gDataLock.CreateLocal(); |
915 |
912 |
916 if (drive1 == drive2) |
913 if (drive1 == drive2) |
917 { |
914 { |