55 TBuf<32> shortName=nameshort; |
54 TBuf<32> shortName=nameshort; |
56 shortName.AppendNum(fileNum); |
55 shortName.AppendNum(fileNum); |
57 TBuf<32> longName=namelong; |
56 TBuf<32> longName=namelong; |
58 longName.AppendNum(fileNum); |
57 longName.AppendNum(fileNum); |
59 TInt r=TheFs.Rename(shortName,longName); |
58 TInt r=TheFs.Rename(shortName,longName); |
60 test_KErrNone(r); |
59 test(r==KErrNone); |
61 } |
60 } |
62 |
61 |
63 TInt r=TheFs.CheckDisk(gSessionPath); |
62 TInt r=TheFs.CheckDisk(gSessionPath); |
64 test_Value(r, r == KErrNone || r==KErrNotSupported); |
63 test(r==KErrNone || r==KErrNotSupported); |
65 |
64 |
66 CDir* dirList; |
65 CDir* dirList; |
67 r=TheFs.GetDir(_L("*.*"),KEntryAttMaskSupported,ESortBySize,dirList); |
66 r=TheFs.GetDir(_L("*.*"),KEntryAttMaskSupported,ESortBySize,dirList); |
68 test_KErrNone(r); |
67 test(r==KErrNone); |
69 test(dirList->Count()==totalFiles); |
68 test(dirList->Count()==totalFiles); |
70 for (i=0;i<totalFiles;i++) |
69 for (i=0;i<totalFiles;i++) |
71 { |
70 { |
72 TBuf<32> longName=namelong; |
71 TBuf<32> longName=namelong; |
73 longName.AppendNum(i); |
72 longName.AppendNum(i); |
128 TInt r; |
127 TInt r; |
129 fileName=gFileName[fileNum]; |
128 fileName=gFileName[fileNum]; |
130 if (fileName==_L("")) |
129 if (fileName==_L("")) |
131 goto End; |
130 goto End; |
132 r=TheFs.Delete(fileName); |
131 r=TheFs.Delete(fileName); |
133 test_KErrNone(r); |
132 test(r==KErrNone); |
134 gFileName[fileNum]=_L(""); |
133 gFileName[fileNum]=_L(""); |
135 goto End; |
134 goto End; |
136 default: |
135 default: |
137 User::Panic(_L("IllegalVal"),KErrGeneral); |
136 User::Panic(_L("IllegalVal"),KErrGeneral); |
138 }; |
137 }; |
141 { |
140 { |
142 /* Delete any existing file with the same name */ |
141 /* Delete any existing file with the same name */ |
143 TInt r; |
142 TInt r; |
144 RFile thing; |
143 RFile thing; |
145 r=thing.Open(TheFs, fileName, EFileShareAny); |
144 r=thing.Open(TheFs, fileName, EFileShareAny); |
146 test_Value(r, r == KErrNone || r==KErrNotFound); |
145 test (r==KErrNone || r==KErrNotFound); |
147 if (r==KErrNone) |
146 if (r==KErrNone) |
148 { |
147 { |
149 TInt s; |
148 TInt s; |
150 test (thing.Size(s) == KErrNone); |
149 test (thing.Size(s) == KErrNone); |
151 thing.Close(); |
150 thing.Close(); |
152 r=TheFs.Delete(fileName); |
151 r=TheFs.Delete(fileName); |
153 test_KErrNone(r); |
152 test (r==KErrNone); |
154 gFileName[s]=_L(""); |
153 gFileName[s]=_L(""); |
155 } |
154 } |
156 else |
155 else |
157 thing.Close(); |
156 thing.Close(); |
158 |
157 |
167 else |
166 else |
168 { |
167 { |
169 TInt r=TheFs.Rename(gFileName[fileNum],fileName); |
168 TInt r=TheFs.Rename(gFileName[fileNum],fileName); |
170 if (r != KErrNone && r != KErrAlreadyExists) |
169 if (r != KErrNone && r != KErrAlreadyExists) |
171 test.Printf(_L("Rename returned %d at line %d"), r, __LINE__); |
170 test.Printf(_L("Rename returned %d at line %d"), r, __LINE__); |
172 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
171 test(r==KErrNone || r==KErrAlreadyExists); |
173 if (r==KErrNone) |
172 if (r==KErrNone) |
174 gFileName[fileNum]=fileName; |
173 gFileName[fileNum]=fileName; |
175 } |
174 } |
176 End: |
175 End: |
177 if ((maxIterations%checkFrequency)==0) |
176 if ((maxIterations%checkFrequency)==0) |
178 { |
177 { |
179 test.Printf(_L("Iteration %d \r"),gMaxIterations-maxIterations); |
178 test.Printf(_L("Iteration %d \r"),gMaxIterations-maxIterations); |
180 TInt r=TheFs.CheckDisk(gSessionPath); |
179 TInt r=TheFs.CheckDisk(gSessionPath); |
181 test_Value(r, r == KErrNone || r==KErrNotSupported); |
180 test(r==KErrNone || r==KErrNotSupported); |
182 TInt count=0; |
181 TInt count=0; |
183 CDir* dirList; |
182 CDir* dirList; |
184 r=TheFs.GetDir(_L("*.*"),KEntryAttMaskSupported,ESortBySize,dirList); |
183 r=TheFs.GetDir(_L("*.*"),KEntryAttMaskSupported,ESortBySize,dirList); |
185 test_KErrNone(r); |
184 test(r==KErrNone); |
186 for(i=0;i<gMaxFiles;i++) |
185 for(i=0;i<gMaxFiles;i++) |
187 { |
186 { |
188 if (gFileName[i]==_L("")) |
187 if (gFileName[i]==_L("")) |
189 continue; |
188 continue; |
190 TEntry entry; |
189 TEntry entry; |
230 { |
229 { |
231 TInt nRes; |
230 TInt nRes; |
232 TEntry entry; |
231 TEntry entry; |
233 |
232 |
234 nRes = TheFs.Entry(KName1, entry); |
233 nRes = TheFs.Entry(KName1, entry); |
235 test_KErrNone(nRes); |
234 test(nRes == KErrNone); |
236 test(entry.iName.CompareF(KExpectedName) == 0); |
235 test(entry.iName.CompareF(KExpectedName) == 0); |
237 |
236 |
238 nRes = TheFs.Entry(KName2, entry); |
237 nRes = TheFs.Entry(KName2, entry); |
239 test_KErrNone(nRes); |
238 test(nRes == KErrNone); |
240 test(entry.iName.CompareF(KExpectedName) == 0); |
239 test(entry.iName.CompareF(KExpectedName) == 0); |
241 |
240 |
242 nRes = TheFs.Entry(KName3, entry); |
241 nRes = TheFs.Entry(KName3, entry); |
243 test_KErrNone(nRes); |
242 test(nRes == KErrNone); |
244 test(entry.iName.CompareF(KExpectedName) == 0); |
243 test(entry.iName.CompareF(KExpectedName) == 0); |
245 |
244 |
246 nRes = TheFs.Entry(KName3, entry); |
245 nRes = TheFs.Entry(KName3, entry); |
247 test_KErrNone(nRes); |
246 test(nRes == KErrNone); |
248 test(entry.iName.CompareF(KExpectedName) == 0); |
247 test(entry.iName.CompareF(KExpectedName) == 0); |
249 } |
248 } |
250 |
249 |
251 /** |
250 /** |
252 Test that ALL trailing dots are removed from the file names by filsystem implementation |
251 Test that ALL trailing dots are removed from the file names by filsystem implementation |
272 TInt nRes; |
271 TInt nRes; |
273 RFile file; |
272 RFile file; |
274 |
273 |
275 //----- create and check "\\file1" |
274 //----- create and check "\\file1" |
276 nRes = file.Replace(TheFs, KName1, EFileWrite); |
275 nRes = file.Replace(TheFs, KName1, EFileWrite); |
277 test_KErrNone(nRes); |
276 test(nRes == KErrNone); |
278 file.Close(); |
277 file.Close(); |
279 |
278 |
280 DoCheckTD_FN(); |
279 DoCheckTD_FN(); |
281 |
280 |
282 nRes = TheFs.Delete(KName1); |
281 nRes = TheFs.Delete(KName1); |
283 test_KErrNone(nRes); |
282 test(nRes == KErrNone); |
284 |
283 |
285 |
284 |
286 //----- create and check "\\file1." |
285 //----- create and check "\\file1." |
287 nRes = file.Replace(TheFs, KName2, EFileWrite); |
286 nRes = file.Replace(TheFs, KName2, EFileWrite); |
288 test_KErrNone(nRes); |
287 test(nRes == KErrNone); |
289 file.Close(); |
288 file.Close(); |
290 |
289 |
291 DoCheckTD_FN(); |
290 DoCheckTD_FN(); |
292 |
291 |
293 nRes = TheFs.Delete(KName2); |
292 nRes = TheFs.Delete(KName2); |
294 test_KErrNone(nRes); |
293 test(nRes == KErrNone); |
295 |
294 |
296 |
295 |
297 //----- create and check "\\file1.." |
296 //----- create and check "\\file1.." |
298 nRes = file.Replace(TheFs, KName3, EFileWrite); |
297 nRes = file.Replace(TheFs, KName3, EFileWrite); |
299 test_KErrNone(nRes); |
298 test(nRes == KErrNone); |
300 file.Close(); |
299 file.Close(); |
301 |
300 |
302 DoCheckTD_FN(); |
301 DoCheckTD_FN(); |
303 |
302 |
304 nRes = TheFs.Delete(KName3); |
303 nRes = TheFs.Delete(KName3); |
305 test_KErrNone(nRes); |
304 test(nRes == KErrNone); |
306 |
305 |
307 |
306 |
308 //----- create and check "\\file1..." |
307 //----- create and check "\\file1..." |
309 nRes = file.Replace(TheFs, KName4, EFileWrite); |
308 nRes = file.Replace(TheFs, KName4, EFileWrite); |
310 test_KErrNone(nRes); |
309 test(nRes == KErrNone); |
311 file.Close(); |
310 file.Close(); |
312 |
311 |
313 DoCheckTD_FN(); |
312 DoCheckTD_FN(); |
314 |
313 |
315 nRes = TheFs.Delete(KName4); |
314 nRes = TheFs.Delete(KName4); |
316 test_KErrNone(nRes); |
315 test(nRes == KErrNone); |
317 |
316 |
318 |
317 |
319 } |
318 } |
320 |
319 |
321 void CallTestsL() |
320 void CallTestsL() |