0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// f32test\server\t_dirs.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <f32file.h>
|
|
19 |
#include <e32test.h>
|
|
20 |
#include "t_server.h"
|
|
21 |
|
|
22 |
#include "f32_test_utils.h"
|
|
23 |
|
|
24 |
using namespace F32_Test_Utils;
|
|
25 |
|
|
26 |
|
|
27 |
RTest test(_L("T_DIRS"));
|
|
28 |
|
|
29 |
TTime gTimeNow;
|
|
30 |
TBool gTestedZ = EFalse;
|
|
31 |
TInt gDriveNum = -1;
|
|
32 |
|
|
33 |
static void Test1()
|
|
34 |
//
|
|
35 |
// Make a directory with lots of entries
|
|
36 |
//
|
|
37 |
{
|
|
38 |
|
|
39 |
RFile f;
|
|
40 |
TInt maxEntry=56;
|
|
41 |
test.Next(_L("Create a directory with 55 entries"));
|
|
42 |
TFileName sessionPath;
|
|
43 |
TInt r=TheFs.SessionPath(sessionPath);
|
257
|
44 |
test(r==KErrNone);
|
0
|
45 |
r=TheFs.MkDir(_L("\\F32-TST\\"));
|
257
|
46 |
test((r==KErrNone)||(r==KErrAlreadyExists));
|
0
|
47 |
r=TheFs.MkDir(_L("\\F32-TST\\TDIRS\\"));
|
257
|
48 |
test((r==KErrNone)||(r==KErrAlreadyExists));
|
0
|
49 |
|
|
50 |
for (TInt i=0;i<maxEntry;i++)
|
|
51 |
{
|
|
52 |
TFileName baseName=_L("\\F32-TST\\TDIRS\\FILE");
|
|
53 |
baseName.AppendNum(i);
|
|
54 |
r=f.Replace(TheFs,baseName,EFileRead);
|
257
|
55 |
test(r==KErrNone);
|
0
|
56 |
r=f.Write(_L8("Hello World"));
|
257
|
57 |
test(r==KErrNone);
|
0
|
58 |
f.Close();
|
|
59 |
}
|
|
60 |
test.Next(_L("Test all entries have been created successfully."));
|
|
61 |
for (TInt j=0;j<=maxEntry;j++)
|
|
62 |
{
|
|
63 |
TFileName baseName=_L("\\F32-TST\\TDIRS\\FILE");
|
|
64 |
baseName.AppendNum(j);
|
|
65 |
TInt r=f.Open(TheFs,baseName,EFileRead);
|
|
66 |
if (r!=KErrNone)
|
|
67 |
{
|
257
|
68 |
test(r==KErrNotFound && j==maxEntry);
|
0
|
69 |
return;
|
|
70 |
}
|
|
71 |
TBuf8<16> data;
|
|
72 |
r=f.Read(data);
|
257
|
73 |
test(r==KErrNone);
|
0
|
74 |
test(data==_L8("Hello World"));
|
|
75 |
f.Close();
|
|
76 |
}
|
|
77 |
}
|
|
78 |
|
|
79 |
static void Test2()
|
|
80 |
//
|
|
81 |
// List all directory entries
|
|
82 |
//
|
|
83 |
{
|
|
84 |
|
|
85 |
test.Printf(_L("List all entries in directory %S\n"),&gSessionPath);
|
|
86 |
RDir d;
|
|
87 |
|
|
88 |
TInt r=d.Open(TheFs,gSessionPath,KEntryAttMaskSupported);
|
|
89 |
if (r==KErrNone)
|
|
90 |
{
|
|
91 |
TEntry e;
|
|
92 |
while ((r=d.Read(e))==KErrNone)
|
|
93 |
{
|
|
94 |
if (e.IsDir())
|
|
95 |
test.Printf(_L("%- 20S <DIR>\n"),&e.iName);
|
|
96 |
else
|
|
97 |
test.Printf(_L("%- 20S %+ 8d\n"),&e.iName,e.iSize);
|
|
98 |
}
|
|
99 |
d.Close();
|
|
100 |
if (r!=KErrEof)
|
|
101 |
test.Printf(_L("Error %d\n"),r);
|
|
102 |
}
|
|
103 |
else
|
|
104 |
test.Printf(_L("Error %d\n"),r);
|
|
105 |
}
|
|
106 |
|
|
107 |
static void TestZ()
|
|
108 |
//
|
|
109 |
// Check you cannot open a directory on a file
|
|
110 |
//
|
|
111 |
{
|
|
112 |
|
|
113 |
test.Next(_L("Open files and directories on Z:"));
|
|
114 |
TEntry entry;
|
|
115 |
RDir d;
|
|
116 |
|
|
117 |
TInt r=d.Open(TheFs,PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("\\Sys\\Bin\\ESHELL.EXE\\*"):_L("\\System\\Bin\\ESHELL.EXE\\*"),KEntryAttMaskSupported);
|
257
|
118 |
test(r==KErrPathNotFound);
|
0
|
119 |
|
|
120 |
r=d.Open(TheFs,PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("\\Sys\\Bin\\ESHELL.EXE"):_L("\\System\\Bin\\ESHELL.EXE"),KEntryAttMaskSupported);
|
257
|
121 |
test(r==KErrNone);
|
0
|
122 |
|
|
123 |
r=d.Read(entry);
|
|
124 |
if (r==KErrEof)
|
|
125 |
{
|
|
126 |
test.Printf(_L("Error: EShell.EXE not found\n"));
|
|
127 |
//test.Getch();
|
|
128 |
}
|
|
129 |
else
|
|
130 |
{
|
257
|
131 |
test(r==KErrNone);
|
0
|
132 |
test(entry.iName.FindF(_L("ESHELL.EXE"))>=0);
|
|
133 |
r=d.Read(entry);
|
257
|
134 |
test(r==KErrEof);
|
0
|
135 |
}
|
|
136 |
d.Close();
|
|
137 |
|
|
138 |
r=d.Open(TheFs,_L("\\*.XQP"),KEntryAttMaskSupported);
|
257
|
139 |
test(r==KErrNone);
|
0
|
140 |
r=d.Read(entry);
|
257
|
141 |
test(r==KErrEof);
|
0
|
142 |
d.Close();
|
|
143 |
|
|
144 |
r=d.Open(TheFs,PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("\\Sys\\Bin\\"):_L("\\System\\Bin\\"),KEntryAttMaskSupported);
|
257
|
145 |
test(r==KErrNone);
|
0
|
146 |
r=d.Read(entry);
|
|
147 |
|
|
148 |
if (r==KErrEof)
|
|
149 |
{
|
|
150 |
test.Printf(_L("No files found\n"));
|
|
151 |
d.Close();
|
|
152 |
}
|
|
153 |
else
|
|
154 |
{
|
257
|
155 |
test(r==KErrNone);
|
0
|
156 |
test.Printf(_L("First Entry = %S\n"),&entry.iName);
|
|
157 |
r=d.Read(entry);
|
257
|
158 |
test(r==KErrNone);
|
0
|
159 |
test.Printf(_L("Second Entry = %S\n"),&entry.iName);
|
|
160 |
d.Close();
|
|
161 |
}
|
|
162 |
|
|
163 |
r=d.Open(TheFs,_L("\\*"),KEntryAttMaskSupported);
|
257
|
164 |
test(r==KErrNone);
|
0
|
165 |
d.Close();
|
|
166 |
r=d.Open(TheFs,PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("\\Sys\\Bin\\*"):_L("\\System\\Bin\\*"),KEntryAttMaskSupported);
|
257
|
167 |
test(r==KErrNone);
|
0
|
168 |
d.Close();
|
|
169 |
}
|
|
170 |
|
|
171 |
static void Test3()
|
|
172 |
//
|
|
173 |
// Check you cannot open a directory on a file
|
|
174 |
//
|
|
175 |
{
|
|
176 |
|
|
177 |
test.Next(_L("Open files and directories"));
|
|
178 |
TEntry entry;
|
|
179 |
RFile f;
|
|
180 |
TInt r=f.Replace(TheFs,_L("\\F32-TST\\TDIRS\\TESTFILEORISITA.DIR"),EFileWrite);
|
257
|
181 |
test(r==KErrNone);
|
0
|
182 |
r=f.Write(_L8("TESTDATATESTDATATESTDATATESTDATATESTDATATESTDATATESTDATATESTDATATESTDATATESTDATATESTDATATESTDATA"));
|
257
|
183 |
test(r==KErrNone);
|
0
|
184 |
r=TheFs.Delete(_L("\\F32-TST\\TDIRS\\TESTFILEORISITA.DIR"));
|
257
|
185 |
test(r==KErrInUse);
|
0
|
186 |
f.Close();
|
|
187 |
RDir d;
|
|
188 |
r=d.Open(TheFs,_L("\\F32-TST\\TDIRS\\TESTFILEORISITA.DIR\\*"),KEntryAttMaskSupported);
|
257
|
189 |
test(r==KErrPathNotFound);
|
0
|
190 |
r=d.Open(TheFs,_L("\\F32-TST\\TDIRS\\*.XQP"),KEntryAttMaskSupported);
|
257
|
191 |
test(r==KErrNone);
|
0
|
192 |
r=d.Read(entry);
|
257
|
193 |
test(r==KErrEof);
|
0
|
194 |
d.Close();
|
|
195 |
r=d.Open(TheFs,_L("\\F32-TST\\TDIRS\\TESTFILEORISITA.DIR"),KEntryAttMaskSupported);
|
257
|
196 |
test(r==KErrNone);
|
0
|
197 |
r=d.Read(entry);
|
257
|
198 |
test(r==KErrNone);
|
0
|
199 |
test(entry.iName.FindF(_L("TESTFILEORISITA.DIR"))>=0);
|
|
200 |
r=d.Read(entry);
|
257
|
201 |
test(r==KErrEof);
|
0
|
202 |
d.Close();
|
|
203 |
r=d.Open(TheFs,_L("\\"),KEntryAttMaskSupported);
|
257
|
204 |
test(r==KErrNone);
|
0
|
205 |
d.Close();
|
|
206 |
r=d.Open(TheFs,_L("\\F32-TST\\"),KEntryAttMaskSupported);
|
257
|
207 |
test(r==KErrNone);
|
0
|
208 |
d.Close();
|
|
209 |
r=d.Open(TheFs,_L("\\*"),KEntryAttMaskSupported);
|
257
|
210 |
test(r==KErrNone);
|
0
|
211 |
d.Close();
|
|
212 |
r=d.Open(TheFs,_L("\\F32-TST\\*"),KEntryAttMaskSupported);
|
257
|
213 |
test(r==KErrNone);
|
0
|
214 |
d.Close();
|
|
215 |
|
|
216 |
// create a small file on the root
|
|
217 |
test(f.Replace(TheFs, _L("\\TEST.FILE"), EFileWrite) == KErrNone);
|
|
218 |
test(f.Write(_L8("1234567890987654321234567890")) == KErrNone);
|
|
219 |
f.Close();
|
|
220 |
// try some directory operations on the file
|
|
221 |
test(TheFs.RmDir(_L("\\TEST.FILE\\")) == KErrPathNotFound);
|
|
222 |
test(TheFs.RmDir(_L("\\TEST.FILE\\ZZZ\\")) == KErrPathNotFound);
|
|
223 |
test(TheFs.MkDir(_L("\\TEST.FILE\\ZZZ\\")) == KErrPathNotFound);
|
|
224 |
// cleanup
|
|
225 |
TheFs.Delete(_L("\\TEST.FILE"));
|
|
226 |
|
|
227 |
|
|
228 |
r=TheFs.MkDir(_L("\\F32-TST\\EMPTY\\"));
|
257
|
229 |
test(r==KErrNone || r==KErrAlreadyExists);
|
0
|
230 |
r=d.Open(TheFs,_L("\\F32-TST\\EMPTY\\*"),KEntryAttMaskSupported);
|
257
|
231 |
test(r==KErrNone);
|
0
|
232 |
// r=TheFs.RmDir(_L("\\F32-TST\\EMPTY\\"));
|
|
233 |
r=d.Read(entry);
|
257
|
234 |
test(r==KErrEof);
|
0
|
235 |
// r=TheFs.RmDir(_L("\\F32-TST\\EMPTY\\"));
|
257
|
236 |
// test(r==KErrInUse);
|
0
|
237 |
r=d.Read(entry);
|
|
238 |
r=d.Read(entry);
|
|
239 |
r=d.Read(entry);
|
|
240 |
d.Close();
|
|
241 |
r=TheFs.RmDir(_L("\\F32-TST\\EMPTY\\"));
|
257
|
242 |
test(r==KErrNone);
|
0
|
243 |
}
|
|
244 |
|
|
245 |
|
|
246 |
static void CreateSortNoneTestDirectoryStructure()
|
|
247 |
//
|
|
248 |
// Create files
|
|
249 |
//
|
|
250 |
{
|
|
251 |
// Delete the directory to be tested if it already exists as a result of this
|
|
252 |
// test being run previously. It's necessary remove it and then recreate it
|
|
253 |
// because a later test relies on the time of file/directory creation to be
|
|
254 |
// the time this function was run...
|
|
255 |
|
|
256 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
257 |
test(fMan!=NULL);
|
|
258 |
TInt r=fMan->RmDir(_L("\\F32-TST\\TDIRS\\SORT_NONE\\"));
|
257
|
259 |
test((r==KErrNone)||(r==KErrPathNotFound));
|
0
|
260 |
delete fMan;
|
|
261 |
|
|
262 |
gTimeNow.HomeTime(); // Set global TTime gTimeNow to time now - for later tests
|
|
263 |
r=TheFs.MkDirAll(_L("\\F32-TST\\TDIRS\\SORT_NONE\\"));
|
257
|
264 |
test(r==KErrNone || r==KErrAlreadyExists);
|
0
|
265 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\file1.txt"));
|
|
266 |
r=TheFs.MkDir(_L("\\F32-TST\\TDIRS\\SORT_NONE\\FILE_DIR1.APP\\"));
|
257
|
267 |
test(r==KErrNone || r==KErrAlreadyExists);
|
0
|
268 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\file1.app"));
|
|
269 |
r=TheFs.MkDir(_L("\\F32-TST\\TDIRS\\SORT_NONE\\FILE_DIR2.TXT\\"));
|
257
|
270 |
test(r==KErrNone || r==KErrAlreadyExists);
|
0
|
271 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\file2.txt"));
|
|
272 |
r=TheFs.MkDir(_L("\\F32-TST\\TDIRS\\SORT_NONE\\FILE_DIR3.APP\\"));
|
257
|
273 |
test(r==KErrNone || r==KErrAlreadyExists);
|
0
|
274 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\ZZZZ"));
|
|
275 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\AAAA"));
|
|
276 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\WWWW"));
|
|
277 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\file2.app"));
|
|
278 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\file3.txt"));
|
|
279 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\file3.app"));
|
|
280 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\NOEXT1"));
|
|
281 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\NOEXT2"));
|
|
282 |
MakeFile(_L("\\f32-tst\\tdirs\\sort_none\\EXTMISSING"));
|
|
283 |
}
|
|
284 |
|
|
285 |
static void Test4()
|
|
286 |
//
|
|
287 |
// Test ESortNone
|
|
288 |
//
|
|
289 |
{
|
|
290 |
|
|
291 |
test.Next(_L("Test ESortNone"));
|
|
292 |
CreateSortNoneTestDirectoryStructure();
|
|
293 |
CDir* dir;
|
|
294 |
CDir* dirSorted;
|
|
295 |
|
|
296 |
//
|
|
297 |
// GetDir OOM failure passes 'callback' test from client side but not server side
|
|
298 |
//
|
|
299 |
TheFs.SetAllocFailure(gAllocFailOff);
|
|
300 |
|
|
301 |
TInt r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*"),KEntryAttMaskSupported,ESortNone,dir);
|
257
|
302 |
test(r==KErrNone);
|
0
|
303 |
TInt count=dir->Count();
|
|
304 |
test(count==15);
|
|
305 |
r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*"),KEntryAttMaskSupported,ESortByName,dirSorted);
|
257
|
306 |
test(r==KErrNone);
|
0
|
307 |
test(dirSorted->Count()==15);
|
|
308 |
delete dirSorted;
|
|
309 |
delete dir;
|
|
310 |
|
|
311 |
r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*.txt"),KEntryAttNormal,ESortNone,dir);
|
257
|
312 |
test(r==KErrNone);
|
0
|
313 |
test(dir->Count()==3);
|
|
314 |
delete dir;
|
|
315 |
r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*.app"),KEntryAttNormal,ESortNone,dir);
|
257
|
316 |
test(r==KErrNone);
|
0
|
317 |
test(dir->Count()==3);
|
|
318 |
delete dir;
|
|
319 |
r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*.app"),KEntryAttNormal|KEntryAttDir,ESortNone,dir);
|
257
|
320 |
test(r==KErrNone);
|
0
|
321 |
test(dir->Count()==5);
|
|
322 |
delete dir;
|
|
323 |
r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*.app"),KEntryAttNormal|KEntryAttDir,ESortNone|EDirsFirst,dir);
|
257
|
324 |
test(r==KErrNone);
|
0
|
325 |
test(dir->Count()==5);
|
|
326 |
delete dir;
|
|
327 |
r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*.app"),KEntryAttNormal|KEntryAttDir,ESortNone|EDirsLast,dir);
|
257
|
328 |
test(r==KErrNone);
|
0
|
329 |
test(dir->Count()==5);
|
|
330 |
delete dir;
|
|
331 |
|
|
332 |
TheFs.SetAllocFailure(gAllocFailOn);
|
|
333 |
}
|
|
334 |
|
|
335 |
static void Test5()
|
|
336 |
//
|
|
337 |
// Test return values
|
|
338 |
//
|
|
339 |
{
|
|
340 |
|
|
341 |
test.Next(_L("Test return values"));
|
|
342 |
RDir dir;
|
|
343 |
TInt r=dir.Open(TheFs,_L("\\DoesNotExist\\*"),KEntryAttMaskSupported);
|
257
|
344 |
test(r==KErrPathNotFound);
|
0
|
345 |
r=dir.Open(TheFs,_L("\\"),KEntryAttMaskSupported);
|
257
|
346 |
test(r==KErrNone);
|
0
|
347 |
dir.Close();
|
|
348 |
}
|
|
349 |
|
|
350 |
|
|
351 |
static void Test6()
|
|
352 |
//
|
|
353 |
// Test that "*.*" matches all files/directories
|
|
354 |
//
|
|
355 |
{
|
|
356 |
|
|
357 |
test.Next(_L("Test *.* matches all files"));
|
|
358 |
CDir* dirList;
|
|
359 |
TInt r=TheFs.GetDir(_L("\\f32-tst\\tdirs\\sort_none\\*.*"),KEntryAttNormal|KEntryAttDir,ESortByName|EDirsLast,dirList);
|
257
|
360 |
test(r==KErrNone);
|
0
|
361 |
TInt count=dirList->Count();
|
|
362 |
test(count==15);
|
|
363 |
TEntry entry=(*dirList)[0];
|
|
364 |
test(entry.iName.FindF(_L("AAAA"))>=0);
|
|
365 |
entry=(*dirList)[1];
|
|
366 |
test(entry.iName.FindF(_L("EXTMISSING"))>=0);
|
|
367 |
entry=(*dirList)[2];
|
|
368 |
test(entry.iName.FindF(_L("FILE1.APP"))>=0);
|
|
369 |
entry=(*dirList)[3];
|
|
370 |
test(entry.iName.FindF(_L("FILE1.TXT"))>=0);
|
|
371 |
entry=(*dirList)[4];
|
|
372 |
test(entry.iName.FindF(_L("FILE2.APP"))>=0);
|
|
373 |
entry=(*dirList)[5];
|
|
374 |
test(entry.iName.FindF(_L("FILE2.TXT"))>=0);
|
|
375 |
entry=(*dirList)[6];
|
|
376 |
test(entry.iName.FindF(_L("FILE3.APP"))>=0);
|
|
377 |
entry=(*dirList)[7];
|
|
378 |
test(entry.iName.FindF(_L("FILE3.TXT"))>=0);
|
|
379 |
entry=(*dirList)[8];
|
|
380 |
test(entry.iName.FindF(_L("NOEXT1"))>=0);
|
|
381 |
entry=(*dirList)[9];
|
|
382 |
test(entry.iName.FindF(_L("NOEXT2"))>=0);
|
|
383 |
entry=(*dirList)[10];
|
|
384 |
test(entry.iName.FindF(_L("WWWW"))>=0);
|
|
385 |
entry=(*dirList)[11];
|
|
386 |
test(entry.iName.FindF(_L("ZZZZ"))>=0);
|
|
387 |
entry=(*dirList)[12];
|
|
388 |
test(entry.iName.FindF(_L("FILE_DIR1.APP"))>=0);
|
|
389 |
entry=(*dirList)[13];
|
|
390 |
test(entry.iName.FindF(_L("FILE_DIR2.TXT"))>=0);
|
|
391 |
entry=(*dirList)[14];
|
|
392 |
test(entry.iName.FindF(_L("FILE_DIR3.APP"))>=0);
|
|
393 |
delete dirList;
|
|
394 |
|
|
395 |
RDir dir;
|
|
396 |
r=dir.Open(TheFs,_L("\\f32-tst\\tdirs\\sort_none\\*.*"),KEntryAttNormal|KEntryAttDir);
|
257
|
397 |
test(r==KErrNone);
|
0
|
398 |
|
|
399 |
TTime time;
|
|
400 |
TInt64 difference;
|
|
401 |
TInt64 maxOK=1000000;
|
|
402 |
maxOK*=60;
|
|
403 |
maxOK*=3;
|
|
404 |
|
|
405 |
for (TInt i=0; i<15; i++)
|
|
406 |
{
|
|
407 |
r=dir.Read(entry);
|
257
|
408 |
test(r==KErrNone);
|
0
|
409 |
time=entry.iModified;
|
|
410 |
difference=time.Int64()-gTimeNow.Int64();
|
|
411 |
test(difference<maxOK);
|
|
412 |
}
|
|
413 |
|
|
414 |
r=dir.Read(entry);
|
257
|
415 |
test(r==KErrEof);
|
0
|
416 |
dir.Close();
|
|
417 |
|
|
418 |
TheFs.SetAllocFailure(gAllocFailOn);
|
|
419 |
}
|
|
420 |
|
|
421 |
|
|
422 |
static void Test7()
|
|
423 |
//
|
|
424 |
// Fill up the root directory
|
|
425 |
//
|
|
426 |
{
|
|
427 |
test.Next(_L("Fill up the root directory"));
|
|
428 |
|
|
429 |
if(!Is_Fat12(TheFs, gDriveNum) && !Is_Fat16(TheFs, gDriveNum))
|
|
430 |
{
|
|
431 |
test.Printf(_L("Skipping. Applicable for FAT12/16 only!\n"));
|
|
432 |
return;
|
|
433 |
}
|
|
434 |
|
|
435 |
TInt r = FormatDrive(TheFs, gDriveNum, ETrue);
|
257
|
436 |
test(r==KErrNone);
|
0
|
437 |
|
|
438 |
TBuf<32> baseName=_L("\\RD");
|
|
439 |
TBuf<32> id;
|
|
440 |
TBuf<32> fileName;
|
|
441 |
TInt count=0;
|
|
442 |
|
|
443 |
RFile f;
|
|
444 |
TParsePtrC parser(gSessionPath);
|
|
445 |
FOREVER
|
|
446 |
{
|
|
447 |
id.Num(count+1);
|
|
448 |
fileName=parser.Drive();
|
|
449 |
fileName+=baseName;
|
|
450 |
fileName+=id;
|
|
451 |
TInt r=f.Replace(TheFs,fileName,EFileWrite);
|
|
452 |
if(r==KErrDirFull)
|
|
453 |
{
|
|
454 |
break;
|
|
455 |
}
|
257
|
456 |
test(r==KErrNone);
|
0
|
457 |
f.Close();
|
|
458 |
count++;
|
|
459 |
if(count >= 1000)
|
|
460 |
{
|
|
461 |
break;
|
|
462 |
}
|
|
463 |
test.Printf(_L("CreateFile : %d : %S\r"),count,&fileName);
|
|
464 |
}
|
|
465 |
test.Printf(_L("\n"));
|
|
466 |
|
|
467 |
while (count)
|
|
468 |
{
|
|
469 |
id.Num(count);
|
|
470 |
fileName=parser.Drive();
|
|
471 |
fileName+=baseName;
|
|
472 |
fileName+=id;
|
|
473 |
TInt r=TheFs.Delete(fileName);
|
257
|
474 |
test(r==KErrNone);
|
0
|
475 |
test.Printf(_L("DeleteFile : %d : %S\r"),count,&fileName);
|
|
476 |
--count;
|
|
477 |
}
|
|
478 |
test.Printf(_L("\n"));
|
|
479 |
|
|
480 |
test.Next(_L("Long filenames in root"));
|
|
481 |
TFileName longFileName;
|
|
482 |
longFileName.SetLength(254);
|
|
483 |
// Mem::Fill((TUint8*)longFileName.Ptr(),254,'A');
|
|
484 |
Mem::Fill((TUint8*)longFileName.Ptr(),254*sizeof(TText),'A');
|
|
485 |
longFileName[0]='\\';
|
|
486 |
longFileName[253]='\\';
|
|
487 |
r=TheFs.MkDir(longFileName);
|
257
|
488 |
test(r==KErrNone);
|
0
|
489 |
CDir* dirList=NULL;
|
|
490 |
r=TheFs.GetDir(longFileName,KEntryAttMaskSupported,ESortByName,dirList);
|
257
|
491 |
test(r==KErrNone);
|
0
|
492 |
count=dirList->Count();
|
|
493 |
test(count==0);
|
|
494 |
delete dirList;
|
|
495 |
TParse parse;
|
|
496 |
r=TheFs.Parse(longFileName,parse);
|
257
|
497 |
test(r==KErrNone);
|
0
|
498 |
TEntry entry;
|
|
499 |
r=TheFs.Entry(longFileName,entry);
|
257
|
500 |
test(r==KErrNone);
|
0
|
501 |
r=TheFs.SetSessionPath(longFileName);
|
257
|
502 |
test(r==KErrNone);
|
0
|
503 |
r=TheFs.GetDir(longFileName,KEntryAttMaskSupported,ESortByName,dirList);
|
257
|
504 |
test(r==KErrNone);
|
0
|
505 |
count=dirList->Count();
|
|
506 |
test(count==0);
|
|
507 |
delete dirList;
|
|
508 |
r=TheFs.Parse(longFileName,_L("*"),parse);
|
257
|
509 |
test(r==KErrBadName);
|
0
|
510 |
r=f.Open(TheFs,_L("asdf.asdf"),0);
|
257
|
511 |
test(r==KErrBadName);
|
0
|
512 |
r=TheFs.Entry(longFileName,entry);
|
257
|
513 |
test(r==KErrNone);
|
0
|
514 |
r=TheFs.RmDir(longFileName);
|
257
|
515 |
test(r==KErrNone);
|
0
|
516 |
}
|
|
517 |
|
|
518 |
static void Test8()
|
|
519 |
//
|
|
520 |
// Regression tests
|
|
521 |
//
|
|
522 |
{
|
|
523 |
|
|
524 |
test.Next(_L("Open dir and change drives"));
|
|
525 |
MakeDir(_L("C:\\MOON\\"));
|
|
526 |
RDir dir;
|
|
527 |
TInt r=dir.Open(TheFs,_L("C:\\MOON\\"),0);
|
257
|
528 |
test(r==KErrNone);
|
0
|
529 |
TFileName driveName;
|
|
530 |
r=TheFs.GetDriveName(11,driveName);
|
257
|
531 |
test(r==KErrNone);
|
0
|
532 |
TEntryArray entryArray;
|
|
533 |
r=dir.Read(entryArray);
|
257
|
534 |
test(r==KErrEof);
|
0
|
535 |
test(entryArray.Count()==0);
|
|
536 |
dir.Close();
|
|
537 |
r=TheFs.RmDir(_L("C:\\MOON\\"));
|
257
|
538 |
test(r==KErrNone);
|
0
|
539 |
|
|
540 |
test.Next(_L("MkDir all on nonexistent drive"));
|
|
541 |
r=TheFs.MkDirAll(_L("L:\\MOON"));
|
257
|
542 |
test((r==KErrNotReady)||(r==KErrPathNotFound));
|
0
|
543 |
}
|
|
544 |
|
|
545 |
static void CleanupL()
|
|
546 |
//
|
|
547 |
// Clean up tests
|
|
548 |
//
|
|
549 |
{
|
|
550 |
|
|
551 |
test.Next(_L("Delete test directory"));
|
|
552 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
553 |
TInt r=fMan->RmDir(gSessionPath);
|
257
|
554 |
test(r==KErrNone);
|
0
|
555 |
r=fMan->Delete(_L("\\Filluptherootdir*"));
|
257
|
556 |
test(r==KErrNone || r==KErrNotFound);
|
0
|
557 |
delete fMan;
|
|
558 |
}
|
|
559 |
|
|
560 |
static void Test9()
|
|
561 |
//
|
|
562 |
// Test directories with trailing dots (ref. DEF047684)
|
|
563 |
//
|
|
564 |
{
|
|
565 |
|
|
566 |
test.Next(_L("Testing directory names with trailing dots"));
|
|
567 |
TInt r;
|
|
568 |
r=TheFs.MkDir(_L("\\test9..\\"));
|
257
|
569 |
test(r==KErrBadName);
|
0
|
570 |
r=TheFs.MkDir(_L("\\test9\\"));
|
257
|
571 |
test((r==KErrNone)||(r==KErrAlreadyExists));
|
0
|
572 |
r=TheFs.Rename(_L("\\test9\\"),_L("\\test9..\\"));
|
257
|
573 |
test(r==KErrBadName);
|
0
|
574 |
r= TheFs.RmDir(_L("\\test9\\"));
|
257
|
575 |
test((r==KErrNone));
|
0
|
576 |
r=TheFs.MkDir(_L("\\t.\\"));
|
257
|
577 |
test(r==KErrBadName);
|
0
|
578 |
}
|
|
579 |
|
|
580 |
|
|
581 |
//
|
|
582 |
// Path and File names for sorting by name
|
|
583 |
//
|
|
584 |
// The correctly sorted directory listing should be:
|
|
585 |
//
|
|
586 |
// b.doc
|
|
587 |
// bb.doc
|
|
588 |
// bs.doc
|
|
589 |
//
|
|
590 |
_LIT(KSortByNamePath, "\\F32-TST\\TDIRS\\SORT_NAME\\");
|
|
591 |
_LIT(KFileBS, "bs.doc");
|
|
592 |
_LIT(KFileBB, "bb.doc");
|
|
593 |
_LIT(KFileB, "b.doc");
|
|
594 |
_LIT(KSortAll, "*.*");
|
|
595 |
_LIT(KPrintFileName, "%S\n");
|
|
596 |
|
|
597 |
|
|
598 |
static void DeleteTestDirectoryStructure(const TDesC& aPath)
|
|
599 |
//
|
|
600 |
// Delete the directory to be tested if it already exists as a result of this
|
|
601 |
// test being run previously.
|
|
602 |
//
|
|
603 |
{
|
|
604 |
|
|
605 |
CFileMan* fMan=CFileMan::NewL(TheFs);
|
|
606 |
test(fMan!=NULL);
|
|
607 |
TInt r=fMan->RmDir(aPath);
|
257
|
608 |
test((r==KErrNone)||(r==KErrPathNotFound));
|
0
|
609 |
delete fMan;
|
|
610 |
}
|
|
611 |
|
|
612 |
|
|
613 |
static void CreateTestDirectoryStructure(const TDesC& aPath, const TDesC** aFileArray, TInt aNumFiles)
|
|
614 |
//
|
|
615 |
// Create files
|
|
616 |
//
|
|
617 |
{
|
|
618 |
DeleteTestDirectoryStructure(aPath);
|
|
619 |
|
|
620 |
gTimeNow.HomeTime(); // Set global TTime gTimeNow to time now - for later tests
|
|
621 |
TInt r=TheFs.MkDirAll(aPath);
|
257
|
622 |
test(r==KErrNone || r==KErrAlreadyExists);
|
0
|
623 |
|
|
624 |
TBuf<128> fileName;
|
|
625 |
for (TInt i = 0; i < aNumFiles; i++)
|
|
626 |
{
|
|
627 |
fileName = aPath;
|
|
628 |
fileName.Append(*aFileArray[i]);
|
|
629 |
MakeFile(fileName);
|
|
630 |
}
|
|
631 |
}
|
|
632 |
|
|
633 |
|
|
634 |
static void TestSortByName()
|
|
635 |
//
|
|
636 |
// Test that sorting by name works for different length filenames.
|
|
637 |
//
|
|
638 |
{
|
|
639 |
const TDesC* theFiles[] = {&KFileBS, &KFileBB, &KFileB};
|
|
640 |
TInt numFiles = sizeof(theFiles)/sizeof(theFiles[0]);
|
|
641 |
CreateTestDirectoryStructure(KSortByNamePath, theFiles, numFiles);
|
|
642 |
|
|
643 |
test.Next(_L("Test ESortByName"));
|
|
644 |
CDir* dirList;
|
|
645 |
TBuf<128> sortSpec(KSortByNamePath);
|
|
646 |
sortSpec.Append(KSortAll);
|
|
647 |
TInt r=TheFs.GetDir(sortSpec, KEntryAttNormal | KEntryAttDir, ESortByName | EDirsLast, dirList);
|
257
|
648 |
test(r==KErrNone);
|
0
|
649 |
TInt count=dirList->Count();
|
|
650 |
test(count==numFiles);
|
|
651 |
|
|
652 |
|
|
653 |
TInt i;
|
|
654 |
for (i = 0; i < count; i++)
|
|
655 |
{
|
|
656 |
test.Printf(KPrintFileName, &(*dirList)[i].iName);
|
|
657 |
}
|
|
658 |
|
|
659 |
TEntry entry=(*dirList)[0];
|
|
660 |
test(entry.iName.FindF(KFileB)>=0);
|
|
661 |
entry=(*dirList)[1];
|
|
662 |
test(entry.iName.FindF(KFileBB)>=0);
|
|
663 |
entry=(*dirList)[2];
|
|
664 |
test(entry.iName.FindF(KFileBS)>=0);
|
|
665 |
delete dirList;
|
|
666 |
dirList = 0;
|
|
667 |
|
|
668 |
|
|
669 |
test.Next(_L("Test ESortByName (descending)"));
|
|
670 |
|
|
671 |
|
|
672 |
r=TheFs.GetDir(sortSpec, KEntryAttNormal | KEntryAttDir, ESortByName | EDirsLast | EDescending, dirList);
|
257
|
673 |
test(r==KErrNone);
|
0
|
674 |
count=dirList->Count();
|
|
675 |
test(count==numFiles);
|
|
676 |
|
|
677 |
|
|
678 |
for (i = 0; i < count; i++)
|
|
679 |
{
|
|
680 |
test.Printf(KPrintFileName, &(*dirList)[i].iName);
|
|
681 |
}
|
|
682 |
|
|
683 |
|
|
684 |
entry=(*dirList)[0];
|
|
685 |
test(entry.iName.FindF(KFileBS)>=0);
|
|
686 |
entry=(*dirList)[1];
|
|
687 |
test(entry.iName.FindF(KFileBB)>=0);
|
|
688 |
entry=(*dirList)[2];
|
|
689 |
test(entry.iName.FindF(KFileB)>=0);
|
|
690 |
delete dirList;
|
|
691 |
dirList = 0;
|
|
692 |
|
|
693 |
|
|
694 |
DeleteTestDirectoryStructure(KSortByNamePath);
|
|
695 |
}
|
|
696 |
|
|
697 |
|
|
698 |
|
|
699 |
//
|
|
700 |
// Path and File names for sorting by extension
|
|
701 |
//
|
|
702 |
// The correctly sorted directory listing should be:
|
|
703 |
//
|
|
704 |
// sortext.a
|
|
705 |
// sortext.bbb.a
|
|
706 |
// sortext1.ddd.a
|
|
707 |
// sortext.aaa.b
|
|
708 |
// sortext.b
|
|
709 |
// sortext.c
|
|
710 |
// sortext.ccc.c
|
|
711 |
//
|
|
712 |
// as we should sort by the substring after the last '.'
|
|
713 |
//
|
|
714 |
_LIT(KSortByExtPath, "\\F32-TST\\TDIRS\\SORT_EXT\\");
|
|
715 |
_LIT(KFile1, "sortext.aaa.b");
|
|
716 |
_LIT(KFile2, "sortext.bbb.a");
|
|
717 |
_LIT(KFile3, "sortext.ccc.c");
|
|
718 |
_LIT(KFile4, "sortext1.ddd.a");
|
|
719 |
_LIT(KFile5, "sortext.a");
|
|
720 |
_LIT(KFile6, "sortext.b");
|
|
721 |
_LIT(KFile7, "sortext.c");
|
|
722 |
|
|
723 |
|
|
724 |
static void TestSortByExt()
|
|
725 |
//
|
|
726 |
// Test that sorting by extension works. This includes filenames
|
|
727 |
// that contain multiple .'s
|
|
728 |
//
|
|
729 |
{
|
|
730 |
const TDesC* theFiles[] = {&KFile1, &KFile2, &KFile3, &KFile4, &KFile5, &KFile6, &KFile7};
|
|
731 |
TInt numFiles = sizeof(theFiles)/sizeof(theFiles[0]);
|
|
732 |
CreateTestDirectoryStructure(KSortByExtPath, theFiles, numFiles);
|
|
733 |
|
|
734 |
test.Next(_L("Test ESortByExt"));
|
|
735 |
|
|
736 |
CDir* dirList;
|
|
737 |
TBuf<128> sortSpec(KSortByExtPath);
|
|
738 |
sortSpec.Append(KSortAll);
|
|
739 |
TInt r=TheFs.GetDir(sortSpec, KEntryAttNormal | KEntryAttDir, ESortByExt | EDirsLast, dirList);
|
257
|
740 |
test(r==KErrNone);
|
0
|
741 |
TInt count=dirList->Count();
|
|
742 |
test(count==numFiles);
|
|
743 |
|
|
744 |
|
|
745 |
TInt i;
|
|
746 |
for (i = 0; i < count; i++)
|
|
747 |
{
|
|
748 |
test.Printf(KPrintFileName, &(*dirList)[i].iName);
|
|
749 |
}
|
|
750 |
|
|
751 |
|
|
752 |
//
|
|
753 |
// Verify that the files have been sorted correctly by extension
|
|
754 |
//
|
|
755 |
TEntry entry=(*dirList)[0];
|
|
756 |
test(entry.iName.FindF(KFile5)>=0);
|
|
757 |
entry=(*dirList)[1];
|
|
758 |
test(entry.iName.FindF(KFile2)>=0);
|
|
759 |
entry=(*dirList)[2];
|
|
760 |
test(entry.iName.FindF(KFile4)>=0);
|
|
761 |
entry=(*dirList)[3];
|
|
762 |
test(entry.iName.FindF(KFile1)>=0);
|
|
763 |
entry=(*dirList)[4];
|
|
764 |
test(entry.iName.FindF(KFile6)>=0);
|
|
765 |
entry=(*dirList)[5];
|
|
766 |
test(entry.iName.FindF(KFile7)>=0);
|
|
767 |
entry=(*dirList)[6];
|
|
768 |
test(entry.iName.FindF(KFile3)>=0);
|
|
769 |
delete dirList;
|
|
770 |
dirList = 0;
|
|
771 |
|
|
772 |
|
|
773 |
test.Next(_L("Test ESortByExt (descending)"));
|
|
774 |
|
|
775 |
r=TheFs.GetDir(sortSpec, KEntryAttNormal | KEntryAttDir, ESortByExt | EDirsLast | EDescending, dirList);
|
257
|
776 |
test(r==KErrNone);
|
0
|
777 |
count=dirList->Count();
|
|
778 |
test(count==numFiles);
|
|
779 |
|
|
780 |
|
|
781 |
for (i = 0; i < count; i++)
|
|
782 |
{
|
|
783 |
test.Printf(KPrintFileName, &(*dirList)[i].iName);
|
|
784 |
}
|
|
785 |
|
|
786 |
|
|
787 |
//
|
|
788 |
// Verify that the files have been sorted correctly by extension
|
|
789 |
// Note that this listing should be the reverse of that above.
|
|
790 |
//
|
|
791 |
entry=(*dirList)[0];
|
|
792 |
test(entry.iName.FindF(KFile3)>=0);
|
|
793 |
entry=(*dirList)[1];
|
|
794 |
test(entry.iName.FindF(KFile7)>=0);
|
|
795 |
entry=(*dirList)[2];
|
|
796 |
test(entry.iName.FindF(KFile6)>=0);
|
|
797 |
entry=(*dirList)[3];
|
|
798 |
test(entry.iName.FindF(KFile1)>=0);
|
|
799 |
entry=(*dirList)[4];
|
|
800 |
test(entry.iName.FindF(KFile4)>=0);
|
|
801 |
entry=(*dirList)[5];
|
|
802 |
test(entry.iName.FindF(KFile2)>=0);
|
|
803 |
entry=(*dirList)[6];
|
|
804 |
test(entry.iName.FindF(KFile5)>=0);
|
|
805 |
delete dirList;
|
|
806 |
dirList = 0;
|
|
807 |
|
|
808 |
|
|
809 |
DeleteTestDirectoryStructure(KSortByExtPath);
|
|
810 |
}
|
|
811 |
|
|
812 |
//---------------------------------------------
|
|
813 |
//! @SYMTestCaseID PBASE-T_DIRS-1310
|
|
814 |
//! @SYMTestType CT
|
|
815 |
//! @SYMREQ DEF125143
|
|
816 |
//! @SYMTestCaseDesc Test that directory name is handled by File Server interfaces properly.
|
|
817 |
//! @SYMTestActions Uses RFs::IsValidName(), RFs::MkDir(), RDir::Open(), RFs::RmDir() to test
|
|
818 |
//! various dir name handling.
|
|
819 |
//! @SYMTestExpectedResults Proper error code is returned.
|
|
820 |
//! @SYMTestPriority High
|
|
821 |
//! @SYMTestStatus Implemented
|
|
822 |
//---------------------------------------------
|
|
823 |
void TestDirNameHandling()
|
|
824 |
{
|
|
825 |
test.Next(_L("Test Dir Name Handling Interfaces"));
|
|
826 |
TFileName dirTest1;
|
|
827 |
dirTest1 = _L("\\F32-TST\\TDIRS\\test1\\FILE.TXT");
|
|
828 |
TFileName dirTest2;
|
|
829 |
dirTest2 = _L("\\F32-TST\\TDIRS\\test2.\\FILE.TXT");
|
|
830 |
TFileName dirTest3;
|
|
831 |
dirTest3 = _L("\\F32-TST\\TDIRS\\test3. \\FILE.TXT");
|
|
832 |
TFileName dirTest4;
|
|
833 |
dirTest4 = _L("\\F32-TST\\TDIRS\\test4. . \\FILE.TXT");
|
|
834 |
TFileName dirTest5;
|
|
835 |
dirTest5 = _L("\\F32-TST\\TDIRS\\test5.\\FILE.TXT");
|
|
836 |
TFileName dirTest6;
|
|
837 |
dirTest6 = _L("\\F32-TST\\TDIRS\\test6. .\\FILE.TXT");
|
|
838 |
|
|
839 |
TBool valid = TheFs.IsValidName( dirTest1 );
|
|
840 |
test(valid);
|
|
841 |
valid = TheFs.IsValidName( dirTest2 );
|
|
842 |
test(!valid);
|
|
843 |
valid = TheFs.IsValidName( dirTest3 );
|
|
844 |
test(!valid);
|
|
845 |
valid = TheFs.IsValidName( dirTest4 );
|
|
846 |
test(!valid);
|
|
847 |
valid = TheFs.IsValidName( dirTest5 );
|
|
848 |
test(!valid);
|
|
849 |
valid = TheFs.IsValidName( dirTest6 );
|
|
850 |
test(!valid);
|
|
851 |
|
|
852 |
dirTest1 = _L("\\F32-TST\\TDIRS\\test1\\");
|
|
853 |
dirTest2 = _L("\\F32-TST\\TDIRS\\test2.\\");
|
|
854 |
dirTest3 = _L("\\F32-TST\\TDIRS\\test3. \\");
|
|
855 |
dirTest4 = _L("\\F32-TST\\TDIRS\\test4. . \\");
|
|
856 |
dirTest5 = _L("\\F32-TST\\TDIRS\\test5.\\");
|
|
857 |
dirTest6 = _L("\\F32-TST\\TDIRS\\test6. .\\");
|
|
858 |
|
|
859 |
TInt err = TheFs.MkDir(dirTest1);
|
257
|
860 |
test(err == KErrNone);
|
0
|
861 |
err = TheFs.MkDir(dirTest2);
|
257
|
862 |
test(err == KErrBadName);
|
0
|
863 |
err = TheFs.MkDir(dirTest3);
|
257
|
864 |
test(err == KErrBadName);
|
0
|
865 |
err = TheFs.MkDir(dirTest4);
|
257
|
866 |
test(err == KErrBadName);
|
0
|
867 |
err = TheFs.MkDir(dirTest5);
|
257
|
868 |
test(err == KErrBadName);
|
0
|
869 |
err = TheFs.MkDir(dirTest6);
|
257
|
870 |
test(err == KErrBadName);
|
0
|
871 |
|
|
872 |
RDir rdir;
|
|
873 |
err = rdir.Open(TheFs, dirTest1, 0);
|
|
874 |
rdir.Close();
|
257
|
875 |
test(err == KErrNone);
|
0
|
876 |
|
|
877 |
err = rdir.Open(TheFs, dirTest2, 0);
|
|
878 |
rdir.Close();
|
257
|
879 |
test(err == KErrBadName);
|
0
|
880 |
|
|
881 |
err = rdir.Open(TheFs, dirTest3, 0);
|
|
882 |
rdir.Close();
|
257
|
883 |
test(err == KErrBadName);
|
0
|
884 |
|
|
885 |
err = rdir.Open(TheFs, dirTest4, 0);
|
|
886 |
rdir.Close();
|
257
|
887 |
test(err == KErrBadName);
|
0
|
888 |
|
|
889 |
err = rdir.Open(TheFs, dirTest5, 0);
|
|
890 |
rdir.Close();
|
257
|
891 |
test(err == KErrBadName);
|
0
|
892 |
|
|
893 |
err = rdir.Open(TheFs, dirTest6, 0);
|
|
894 |
rdir.Close();
|
257
|
895 |
test(err == KErrBadName);
|
0
|
896 |
|
|
897 |
err = TheFs.RmDir(dirTest1);
|
257
|
898 |
test(err == KErrNone);
|
0
|
899 |
err = TheFs.RmDir(dirTest2);
|
257
|
900 |
test(err == KErrBadName);
|
0
|
901 |
err = TheFs.RmDir(dirTest3);
|
257
|
902 |
test(err == KErrBadName);
|
0
|
903 |
err = TheFs.RmDir(dirTest4);
|
257
|
904 |
test(err == KErrBadName);
|
0
|
905 |
err = TheFs.RmDir(dirTest5);
|
257
|
906 |
test(err == KErrBadName);
|
0
|
907 |
err = TheFs.RmDir(dirTest6);
|
257
|
908 |
test(err == KErrBadName);
|
0
|
909 |
}
|
|
910 |
|
|
911 |
void CallTestsL()
|
|
912 |
//
|
|
913 |
// Do all tests
|
|
914 |
//
|
|
915 |
{
|
|
916 |
|
|
917 |
//-- set up console output
|
|
918 |
F32_Test_Utils::SetConsole(test.Console());
|
|
919 |
|
|
920 |
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum);
|
257
|
921 |
test(nRes==KErrNone);
|
0
|
922 |
|
|
923 |
PrintDrvInfo(TheFs, gDriveNum);
|
|
924 |
|
|
925 |
TurnAllocFailureOff();
|
|
926 |
CreateTestDirectory(_L("\\F32-TST\\TDIRS\\"));
|
|
927 |
|
|
928 |
if (!gTestedZ)
|
|
929 |
{
|
|
930 |
TInt r=TheFs.SetSessionPath(_L("Z:\\"));
|
257
|
931 |
test(r==KErrNone);
|
0
|
932 |
Test2();
|
|
933 |
TestZ();
|
|
934 |
r=TheFs.SetSessionPath(gSessionPath);
|
257
|
935 |
test(r==KErrNone);
|
0
|
936 |
test.Next(_L("Run all other tests from \\F32-TST\\TDIRS\\"));
|
|
937 |
gTestedZ=ETrue;
|
|
938 |
}
|
|
939 |
|
|
940 |
Test8();
|
|
941 |
|
|
942 |
Test7();
|
|
943 |
|
|
944 |
Test1();
|
|
945 |
Test2();
|
|
946 |
Test3();
|
|
947 |
Test4();
|
|
948 |
Test5();
|
|
949 |
Test6();
|
|
950 |
Test9();
|
|
951 |
|
|
952 |
TestSortByName();
|
|
953 |
TestSortByExt();
|
|
954 |
TestDirNameHandling();
|
|
955 |
|
|
956 |
CleanupL();
|
|
957 |
}
|