sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\fsstress\t_sesfs.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
#define __E32TEST_EXTENSION__
|
sl@0
|
18 |
#include "t_sess.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
GLDEF_D TFileName tPath;
|
sl@0
|
21 |
GLREF_D TFileName gExeFileName;
|
sl@0
|
22 |
|
sl@0
|
23 |
LOCAL_C void printDriveAtt(TInt aDrive,TUint anAtt);
|
sl@0
|
24 |
LOCAL_C void printDriveInfo(TInt aDrive,TDriveInfo& anInfo);
|
sl@0
|
25 |
LOCAL_C void DriveInfo(TInt aDrive,TDriveInfo& anInfo);
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
void TSessionTest::Initialise(RFs& aFs)
|
sl@0
|
29 |
//
|
sl@0
|
30 |
// Initialise iFs
|
sl@0
|
31 |
//
|
sl@0
|
32 |
{
|
sl@0
|
33 |
iFs=aFs;
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
void TSessionTest::RunTests()
|
sl@0
|
38 |
//
|
sl@0
|
39 |
// Run tests on iFs file server session
|
sl@0
|
40 |
//
|
sl@0
|
41 |
|
sl@0
|
42 |
{
|
sl@0
|
43 |
|
sl@0
|
44 |
testDriveList();
|
sl@0
|
45 |
testDriveInfo();
|
sl@0
|
46 |
testVolumeInfo();
|
sl@0
|
47 |
testSetVolume();
|
sl@0
|
48 |
testPath();
|
sl@0
|
49 |
CreateTestDirectory(_L("\\SESSION_TEST\\TFSRV\\"));
|
sl@0
|
50 |
testInitialisation();
|
sl@0
|
51 |
testSubst();
|
sl@0
|
52 |
CopyFileToTestDirectory();
|
sl@0
|
53 |
MakeAndDeleteFiles();
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
|
sl@0
|
58 |
void TSessionTest::testDriveList()
|
sl@0
|
59 |
//
|
sl@0
|
60 |
// Test the drive list.
|
sl@0
|
61 |
//
|
sl@0
|
62 |
{
|
sl@0
|
63 |
|
sl@0
|
64 |
test.Start(_L("The drive list"));
|
sl@0
|
65 |
TDriveList list;
|
sl@0
|
66 |
TDriveInfo info;
|
sl@0
|
67 |
TInt r=iFs.DriveList(list);
|
sl@0
|
68 |
test_KErrNone(r);
|
sl@0
|
69 |
for (TInt i=0;i<KMaxDrives;i++)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
if (list[i])
|
sl@0
|
72 |
{
|
sl@0
|
73 |
r = iFs.Drive(info, i);
|
sl@0
|
74 |
test_KErrNone(r);
|
sl@0
|
75 |
printDriveAtt(i,info.iDriveAtt);
|
sl@0
|
76 |
}
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
test.End();
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
void TSessionTest::testDriveInfo()
|
sl@0
|
83 |
//
|
sl@0
|
84 |
// Test the drive info.
|
sl@0
|
85 |
//
|
sl@0
|
86 |
{
|
sl@0
|
87 |
|
sl@0
|
88 |
test.Start(_L("The drive info"));
|
sl@0
|
89 |
TDriveList list;
|
sl@0
|
90 |
TInt r=iFs.DriveList(list);
|
sl@0
|
91 |
test_KErrNone(r);
|
sl@0
|
92 |
for (TInt i=0;i<KMaxDrives;i++)
|
sl@0
|
93 |
{
|
sl@0
|
94 |
TInt att=list[i];
|
sl@0
|
95 |
if (att)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
TDriveInfo d;
|
sl@0
|
98 |
r=iFs.Drive(d,i);
|
sl@0
|
99 |
test_KErrNone(r);
|
sl@0
|
100 |
printDriveInfo(i,d);
|
sl@0
|
101 |
test.Printf(_L("\n"));
|
sl@0
|
102 |
DriveInfo(i,d);
|
sl@0
|
103 |
}
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
test.End();
|
sl@0
|
107 |
}
|
sl@0
|
108 |
|
sl@0
|
109 |
void TSessionTest::testVolumeInfo()
|
sl@0
|
110 |
//
|
sl@0
|
111 |
// Test volume info.
|
sl@0
|
112 |
//
|
sl@0
|
113 |
{
|
sl@0
|
114 |
|
sl@0
|
115 |
test.Start(_L("The volume info"));
|
sl@0
|
116 |
TDriveList list;
|
sl@0
|
117 |
TInt r=iFs.DriveList(list);
|
sl@0
|
118 |
test_KErrNone(r);
|
sl@0
|
119 |
for (TInt i=0;i<KMaxDrives;i++)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
TVolumeInfo v;
|
sl@0
|
122 |
TDriveInfo d;
|
sl@0
|
123 |
switch (r=iFs.Volume(v,i))
|
sl@0
|
124 |
{
|
sl@0
|
125 |
case KErrNone:
|
sl@0
|
126 |
printDriveInfo(i,v.iDrive);
|
sl@0
|
127 |
test.Printf(_L(" VOL=\"%S\" ID=%08x\n"),&v.iName,v.iUniqueID);
|
sl@0
|
128 |
test.Printf(_L(" SIZE=%ldK FREE=%ldK\n"),v.iSize/1024,v.iFree/1024);
|
sl@0
|
129 |
break;
|
sl@0
|
130 |
case KErrNotReady:
|
sl@0
|
131 |
r=iFs.Drive(d, i);
|
sl@0
|
132 |
test_KErrNone(r);
|
sl@0
|
133 |
if (d.iType == EMediaNotPresent)
|
sl@0
|
134 |
test.Printf(_L("%c: Medium not present - cannot perform test.\n"), i + 'A');
|
sl@0
|
135 |
else
|
sl@0
|
136 |
test.Printf(_L("medium found (type %d) but drive %c: not ready\nPrevious test may have hung; else, check hardware.\n"), (TInt)d.iType, i + 'A');
|
sl@0
|
137 |
break;
|
sl@0
|
138 |
case KErrPathNotFound:
|
sl@0
|
139 |
test.Printf(_L("%c: Not Found\n"), i + 'A');
|
sl@0
|
140 |
break;
|
sl@0
|
141 |
case KErrCorrupt:
|
sl@0
|
142 |
test.Printf(_L("%c: Media corruption; previous test may have aborted; else, check hardware\n"), i + 'A');
|
sl@0
|
143 |
default:
|
sl@0
|
144 |
test.Printf(_L("%c: Error %d - aborting test.\n"),i + 'A', r);
|
sl@0
|
145 |
test(0);
|
sl@0
|
146 |
}
|
sl@0
|
147 |
test.Printf(_L("\n"));
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
test.End();
|
sl@0
|
151 |
}
|
sl@0
|
152 |
|
sl@0
|
153 |
|
sl@0
|
154 |
void TSessionTest::testPath()
|
sl@0
|
155 |
//
|
sl@0
|
156 |
// Test the path handling.
|
sl@0
|
157 |
//
|
sl@0
|
158 |
{
|
sl@0
|
159 |
|
sl@0
|
160 |
test.Start(_L("Test path handling"));
|
sl@0
|
161 |
|
sl@0
|
162 |
TInt r;
|
sl@0
|
163 |
|
sl@0
|
164 |
TFileName p;
|
sl@0
|
165 |
r=iFs.SessionPath(p);
|
sl@0
|
166 |
test_KErrNone(r);
|
sl@0
|
167 |
test.Printf(_L("SESSION=\"%S\"\n"),&p);
|
sl@0
|
168 |
r=iFs.SetSessionPath(_L("A:\\TEST\\"));
|
sl@0
|
169 |
test_KErrNone(r);
|
sl@0
|
170 |
r=iFs.SessionPath(p);
|
sl@0
|
171 |
test_KErrNone(r);
|
sl@0
|
172 |
test(p==_L("A:\\TEST\\"));
|
sl@0
|
173 |
r=iFs.SetSessionPath(gTestSessionPath);
|
sl@0
|
174 |
test_KErrNone(r);
|
sl@0
|
175 |
|
sl@0
|
176 |
test.End();
|
sl@0
|
177 |
}
|
sl@0
|
178 |
|
sl@0
|
179 |
|
sl@0
|
180 |
void TSessionTest::testInitialisation()
|
sl@0
|
181 |
//
|
sl@0
|
182 |
// Tests that calls to CheckedClose() are OK, ie, tests bug fix
|
sl@0
|
183 |
//
|
sl@0
|
184 |
{
|
sl@0
|
185 |
test.Next(_L("Test calls to CheckedClose are OK"));
|
sl@0
|
186 |
|
sl@0
|
187 |
RFile file;
|
sl@0
|
188 |
RDir dir;
|
sl@0
|
189 |
|
sl@0
|
190 |
TInt count;
|
sl@0
|
191 |
RFormat format;
|
sl@0
|
192 |
TInt r=format.Open(iFs,_L("Z:\\"),EFullFormat,count);
|
sl@0
|
193 |
|
sl@0
|
194 |
test_Value(r, r==KErrAccessDenied || r==KErrInUse);
|
sl@0
|
195 |
|
sl@0
|
196 |
r=dir.Open(iFs,_L("\\SESSION_TEST\\ERRORTEST\\"),KEntryAttMatchMask);
|
sl@0
|
197 |
test_Value(r, r==KErrPathNotFound);
|
sl@0
|
198 |
|
sl@0
|
199 |
r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest1.txt"),EFileRead);
|
sl@0
|
200 |
test_Value(r, r==KErrNotFound);
|
sl@0
|
201 |
|
sl@0
|
202 |
r=dir.Open(iFs,_L("\\SESSION_TEST\\ERRORTEST2\\"),KEntryAttMatchMask);
|
sl@0
|
203 |
test_Value(r, r==KErrPathNotFound);
|
sl@0
|
204 |
|
sl@0
|
205 |
r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest2.txt"),EFileRead);
|
sl@0
|
206 |
test_Value(r, r==KErrNotFound);
|
sl@0
|
207 |
|
sl@0
|
208 |
r=dir.Open(iFs,_L("\\SESSION_TEST\\ERRORTEST3\\"),KEntryAttMatchMask);
|
sl@0
|
209 |
test_Value(r, r==KErrPathNotFound);
|
sl@0
|
210 |
|
sl@0
|
211 |
r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest3.txt"),EFileRead);
|
sl@0
|
212 |
test_Value(r, r==KErrNotFound);
|
sl@0
|
213 |
|
sl@0
|
214 |
r=file.Open(iFs,_L("\\SESSION_TEST\\SessionTest4.txt"),EFileRead);
|
sl@0
|
215 |
test_Value(r, r==KErrNotFound);
|
sl@0
|
216 |
|
sl@0
|
217 |
format.Close();
|
sl@0
|
218 |
dir.Close();
|
sl@0
|
219 |
file.Close();
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
|
sl@0
|
223 |
void TSessionTest::testSubst()
|
sl@0
|
224 |
//
|
sl@0
|
225 |
// Test the substitute functions.
|
sl@0
|
226 |
//
|
sl@0
|
227 |
{
|
sl@0
|
228 |
|
sl@0
|
229 |
test.Printf(_L("Test subst"));
|
sl@0
|
230 |
TVolumeInfo v;
|
sl@0
|
231 |
TInt r=iFs.Volume(v);
|
sl@0
|
232 |
test_KErrNone(r);
|
sl@0
|
233 |
TDriveInfo origDI;
|
sl@0
|
234 |
r=iFs.Drive(origDI);
|
sl@0
|
235 |
test_KErrNone(r);
|
sl@0
|
236 |
|
sl@0
|
237 |
TDriveInfo driveInfo;
|
sl@0
|
238 |
r=iFs.Drive(driveInfo,EDriveO);
|
sl@0
|
239 |
test_KErrNone(r);
|
sl@0
|
240 |
|
sl@0
|
241 |
testSetVolume();
|
sl@0
|
242 |
|
sl@0
|
243 |
if (driveInfo.iDriveAtt==KDriveAttLocal)
|
sl@0
|
244 |
{
|
sl@0
|
245 |
return; // Subst local drives fails
|
sl@0
|
246 |
}
|
sl@0
|
247 |
|
sl@0
|
248 |
TFileName n;
|
sl@0
|
249 |
r=iFs.Subst(n,EDriveO);
|
sl@0
|
250 |
test_KErrNone(r);
|
sl@0
|
251 |
test(n.Length()==0);
|
sl@0
|
252 |
r=iFs.SetSubst(gTestSessionPath,EDriveO);
|
sl@0
|
253 |
test_KErrNone(r);
|
sl@0
|
254 |
r=iFs.Subst(n,EDriveO);
|
sl@0
|
255 |
test_KErrNone(r);
|
sl@0
|
256 |
test(n==gTestSessionPath);
|
sl@0
|
257 |
TVolumeInfo w;
|
sl@0
|
258 |
r=iFs.Volume(w,EDriveO);
|
sl@0
|
259 |
test_KErrNone(r);
|
sl@0
|
260 |
test(w.iDrive.iType==v.iDrive.iType);
|
sl@0
|
261 |
test(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType);
|
sl@0
|
262 |
test(w.iDrive.iDriveAtt==KDriveAttSubsted);
|
sl@0
|
263 |
test(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt);
|
sl@0
|
264 |
test(w.iUniqueID==v.iUniqueID);
|
sl@0
|
265 |
test(w.iSize==v.iSize);
|
sl@0
|
266 |
|
sl@0
|
267 |
// If this test is being run under windows using drive C then skip free space comparison
|
sl@0
|
268 |
// as it is likely to fail as the windows file system is unlike to have static freespace
|
sl@0
|
269 |
#ifdef __WINS__
|
sl@0
|
270 |
if(User::UpperCase(gTestSessionPath[0]) != 'C')
|
sl@0
|
271 |
{
|
sl@0
|
272 |
#endif
|
sl@0
|
273 |
test(w.iFree==v.iFree);
|
sl@0
|
274 |
|
sl@0
|
275 |
#ifdef __WINS__
|
sl@0
|
276 |
}
|
sl@0
|
277 |
#endif
|
sl@0
|
278 |
|
sl@0
|
279 |
test(w.iName==v.iName);
|
sl@0
|
280 |
TDriveList driveList;
|
sl@0
|
281 |
r=iFs.DriveList(driveList);
|
sl@0
|
282 |
test_KErrNone(r);
|
sl@0
|
283 |
test(driveList[EDriveO]==KDriveAttSubsted);
|
sl@0
|
284 |
TDriveInfo d;
|
sl@0
|
285 |
r=iFs.Drive(d,EDriveO);
|
sl@0
|
286 |
test_KErrNone(r);
|
sl@0
|
287 |
test(d.iDriveAtt==KDriveAttSubsted);
|
sl@0
|
288 |
test(d.iMediaAtt==origDI.iMediaAtt);
|
sl@0
|
289 |
test(d.iType==origDI.iType);
|
sl@0
|
290 |
test(d.iConnectionBusType==origDI.iConnectionBusType);
|
sl@0
|
291 |
|
sl@0
|
292 |
|
sl@0
|
293 |
test.Next(_L("Test real name"));
|
sl@0
|
294 |
r=iFs.RealName(_L("O:\\FILE.XXX"),n);
|
sl@0
|
295 |
test_KErrNone(r);
|
sl@0
|
296 |
TFileName substedPath=gTestSessionPath;
|
sl@0
|
297 |
substedPath.Append(_L("FILE.XXX"));
|
sl@0
|
298 |
test(n.CompareF(substedPath)==KErrNone);
|
sl@0
|
299 |
//
|
sl@0
|
300 |
test.Next(_L("Test MkDir, Rename and RmDir on Substed drive"));
|
sl@0
|
301 |
_LIT(KTurgid,"turgid\\");
|
sl@0
|
302 |
TFileName dir=gTestSessionPath;
|
sl@0
|
303 |
dir+=KTurgid;
|
sl@0
|
304 |
r=iFs.MkDirAll(dir);
|
sl@0
|
305 |
test_KErrNone(r);
|
sl@0
|
306 |
dir+=_L("subdir\\");
|
sl@0
|
307 |
r=iFs.MkDir(dir);
|
sl@0
|
308 |
test_KErrNone(r);
|
sl@0
|
309 |
r=iFs.RmDir(_L("O:\\turgid\\subdir\\"));
|
sl@0
|
310 |
test_KErrNone(r);
|
sl@0
|
311 |
r=iFs.Rename(_L("O:\\turgid"), _L("O:\\facile"));
|
sl@0
|
312 |
test_KErrNone(r);
|
sl@0
|
313 |
r=iFs.MkDir(_L("O:\\insipid\\"));
|
sl@0
|
314 |
test_KErrNone(r);
|
sl@0
|
315 |
r=iFs.Rename(_L("O:\\insipid"), _L("O:\\glib"));
|
sl@0
|
316 |
test_KErrNone(r);
|
sl@0
|
317 |
r=iFs.RmDir(_L("O:\\facile\\"));
|
sl@0
|
318 |
test_KErrNone(r);
|
sl@0
|
319 |
_LIT(KGlib,"glib\\");
|
sl@0
|
320 |
dir=gTestSessionPath;
|
sl@0
|
321 |
dir+=KGlib;
|
sl@0
|
322 |
r=iFs.RmDir(dir);
|
sl@0
|
323 |
test_KErrNone(r);
|
sl@0
|
324 |
test.Next(_L("Test file operations on Substed drive"));
|
sl@0
|
325 |
_LIT(File1,"File1.txt");
|
sl@0
|
326 |
_LIT(File2,"File2.txt");
|
sl@0
|
327 |
_LIT(SubstRoot,"O:\\");
|
sl@0
|
328 |
_LIT(Subdir,"subdir\\");
|
sl@0
|
329 |
TFileName name1,name2;
|
sl@0
|
330 |
name1=gTestSessionPath;
|
sl@0
|
331 |
name1+=File1;
|
sl@0
|
332 |
RFile f1;
|
sl@0
|
333 |
r=f1.Create(iFs,name1,EFileShareExclusive|EFileWrite);
|
sl@0
|
334 |
test_KErrNone(r);
|
sl@0
|
335 |
name2=SubstRoot;
|
sl@0
|
336 |
name2+=File2;
|
sl@0
|
337 |
TBool isValid=iFs.IsValidName(name2);
|
sl@0
|
338 |
test(isValid);
|
sl@0
|
339 |
r=f1.Rename(name2);
|
sl@0
|
340 |
test_KErrNone(r);
|
sl@0
|
341 |
f1.Close();
|
sl@0
|
342 |
r=f1.Create(iFs,name1,EFileShareExclusive|EFileWrite);
|
sl@0
|
343 |
test_KErrNone(r);
|
sl@0
|
344 |
f1.Close();
|
sl@0
|
345 |
r=iFs.Replace(name2,name1);
|
sl@0
|
346 |
test_KErrNone(r);
|
sl@0
|
347 |
r=iFs.Delete(name1);
|
sl@0
|
348 |
test_KErrNone(r);
|
sl@0
|
349 |
test.Next(_L("Test notifications on Substed drive"));
|
sl@0
|
350 |
name1=gTestSessionPath;
|
sl@0
|
351 |
name1+=Subdir;
|
sl@0
|
352 |
name2=SubstRoot;
|
sl@0
|
353 |
name2+=Subdir;
|
sl@0
|
354 |
// set up some extended notifications
|
sl@0
|
355 |
TRequestStatus status1;
|
sl@0
|
356 |
TRequestStatus status2;
|
sl@0
|
357 |
TRequestStatus status3;
|
sl@0
|
358 |
iFs.NotifyChange(ENotifyDir,status1,name1);
|
sl@0
|
359 |
test(status1==KRequestPending);
|
sl@0
|
360 |
iFs.NotifyChange(ENotifyDir,status2,name2);
|
sl@0
|
361 |
test(status2==KRequestPending);
|
sl@0
|
362 |
r=iFs.MkDirAll(name1);
|
sl@0
|
363 |
test_KErrNone(r);
|
sl@0
|
364 |
User::WaitForRequest(status1);
|
sl@0
|
365 |
User::WaitForRequest(status2);
|
sl@0
|
366 |
test(status1==KErrNone && status2==KErrNone);
|
sl@0
|
367 |
iFs.NotifyChange(ENotifyDir,status1,name1);
|
sl@0
|
368 |
test(status1==KRequestPending);
|
sl@0
|
369 |
iFs.NotifyChange(ENotifyDir,status2,name2);
|
sl@0
|
370 |
test(status2==KRequestPending);
|
sl@0
|
371 |
iFs.NotifyChange(ENotifyAll,status3,name2);
|
sl@0
|
372 |
test(status3==KRequestPending);
|
sl@0
|
373 |
r=f1.Temp(iFs,name2,n,EFileShareAny|EFileWrite);
|
sl@0
|
374 |
test_KErrNone(r);
|
sl@0
|
375 |
User::WaitForRequest(status3);
|
sl@0
|
376 |
test(status3==KErrNone && status1==KRequestPending && status2==KRequestPending);
|
sl@0
|
377 |
f1.Close();
|
sl@0
|
378 |
iFs.NotifyChangeCancel();
|
sl@0
|
379 |
test(status1==KErrCancel && status2==KErrCancel);
|
sl@0
|
380 |
User::WaitForRequest(status1);
|
sl@0
|
381 |
User::WaitForRequest(status2);
|
sl@0
|
382 |
r=iFs.Delete(n);
|
sl@0
|
383 |
test_KErrNone(r);
|
sl@0
|
384 |
r=iFs.RmDir(name1);
|
sl@0
|
385 |
test_KErrNone(r);
|
sl@0
|
386 |
//
|
sl@0
|
387 |
test.Next(_L("Test file systems on Substed drive"));
|
sl@0
|
388 |
// test cannot mount file system on substituted drive
|
sl@0
|
389 |
TInt sessionDrv;
|
sl@0
|
390 |
r=iFs.CharToDrive(gTestSessionPath[0],sessionDrv);
|
sl@0
|
391 |
test_KErrNone(r);
|
sl@0
|
392 |
r=iFs.FileSystemName(n,sessionDrv);
|
sl@0
|
393 |
test_Value(r, r==KErrNone || r==KErrNotFound);
|
sl@0
|
394 |
r=iFs.MountFileSystem(n,EDriveO);
|
sl@0
|
395 |
test_Value(r, r==KErrAccessDenied);
|
sl@0
|
396 |
// test file system name on substitued drive is null
|
sl@0
|
397 |
r=iFs.FileSystemName(n,EDriveO);
|
sl@0
|
398 |
test_Value(r, r==KErrNotFound && n==KNullDesC);
|
sl@0
|
399 |
// test cannot format a substitued drive
|
sl@0
|
400 |
RFormat format;
|
sl@0
|
401 |
TInt count;
|
sl@0
|
402 |
r=format.Open(iFs,SubstRoot,EHighDensity,count);
|
sl@0
|
403 |
test_Value(r, r==KErrAccessDenied);
|
sl@0
|
404 |
|
sl@0
|
405 |
r=iFs.SetSubst(_L(""),EDriveO);
|
sl@0
|
406 |
test_KErrNone(r);
|
sl@0
|
407 |
r=iFs.Subst(n,EDriveO);
|
sl@0
|
408 |
test_KErrNone(r);
|
sl@0
|
409 |
test(n==_L(""));
|
sl@0
|
410 |
r=iFs.Drive(d,EDriveO);
|
sl@0
|
411 |
test_KErrNone(r);
|
sl@0
|
412 |
test(d.iDriveAtt==0);
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
|
sl@0
|
416 |
LOCAL_C TInt CreateFileX(const TDesC& aBaseName,TInt aX, RFs iFs)
|
sl@0
|
417 |
//
|
sl@0
|
418 |
// Create a large file. Return KErrEof or KErrNone
|
sl@0
|
419 |
//
|
sl@0
|
420 |
{
|
sl@0
|
421 |
|
sl@0
|
422 |
TBuf<128> fileName=aBaseName;
|
sl@0
|
423 |
fileName.AppendNum(aX);
|
sl@0
|
424 |
RFile file;
|
sl@0
|
425 |
TInt r=file.Replace(iFs,fileName,EFileWrite);
|
sl@0
|
426 |
if (r==KErrDiskFull)
|
sl@0
|
427 |
return(r);
|
sl@0
|
428 |
if (r!=KErrNone)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
test.Printf(_L("ERROR:: Replace returned %d\n"),r);
|
sl@0
|
431 |
return(KErrDiskFull);
|
sl@0
|
432 |
}
|
sl@0
|
433 |
r=file.SetSize(65536);
|
sl@0
|
434 |
if (r==KErrDiskFull)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
file.Close();
|
sl@0
|
437 |
return(r);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
if (r!=KErrNone)
|
sl@0
|
440 |
{
|
sl@0
|
441 |
test.Printf(_L("ERROR:: SetSize returned %d\n"),r);
|
sl@0
|
442 |
file.Close();
|
sl@0
|
443 |
return(KErrDiskFull);
|
sl@0
|
444 |
}
|
sl@0
|
445 |
file.Close();
|
sl@0
|
446 |
// r=iFs.CheckDisk(fileName);
|
sl@0
|
447 |
// if (r!=KErrNone && r!=KErrNotSupported)
|
sl@0
|
448 |
// {
|
sl@0
|
449 |
// test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
|
sl@0
|
450 |
// test.Getch();
|
sl@0
|
451 |
// return(KErrDiskFull);
|
sl@0
|
452 |
// }
|
sl@0
|
453 |
test.Printf(_L("Created file %d size 64k\n"),aX);
|
sl@0
|
454 |
return(KErrNone);
|
sl@0
|
455 |
}
|
sl@0
|
456 |
|
sl@0
|
457 |
LOCAL_C TInt DeleteFileX(TBuf<128>& aBaseName,TInt aX, RFs iFs)
|
sl@0
|
458 |
//
|
sl@0
|
459 |
// Delete a file.
|
sl@0
|
460 |
//
|
sl@0
|
461 |
{
|
sl@0
|
462 |
|
sl@0
|
463 |
TBuf<128> fileName=aBaseName;
|
sl@0
|
464 |
fileName.AppendNum(aX);
|
sl@0
|
465 |
TInt r=iFs.Delete(fileName);
|
sl@0
|
466 |
test_KErrNone(r);
|
sl@0
|
467 |
// r=iFs.CheckDisk(fileName);
|
sl@0
|
468 |
// if (r!=KErrNone && r!=KErrNotSupported)
|
sl@0
|
469 |
// {
|
sl@0
|
470 |
// test.Printf(_L("ERROR:: CheckDisk returned %d\n"),r);
|
sl@0
|
471 |
// test_KErrNone(r);
|
sl@0
|
472 |
// }
|
sl@0
|
473 |
test.Printf(_L("Deleted File %d\n"),aX);
|
sl@0
|
474 |
return(KErrNone);
|
sl@0
|
475 |
}
|
sl@0
|
476 |
|
sl@0
|
477 |
void TSessionTest::MakeAndDeleteFiles()
|
sl@0
|
478 |
//
|
sl@0
|
479 |
// Create and delete large files in a randomish order
|
sl@0
|
480 |
//
|
sl@0
|
481 |
{
|
sl@0
|
482 |
|
sl@0
|
483 |
test.Start(_L("Create and delete large files"));
|
sl@0
|
484 |
TInt r=iFs.MkDirAll(_L("\\SESSION_TEST\\SMALLDIRECTORY\\"));
|
sl@0
|
485 |
test_Value(r, r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
486 |
TBuf<128> fileName=_L("\\SESSION_TEST\\SMALLDIRECTORY\\FILE");
|
sl@0
|
487 |
r=CreateFileX(fileName,0,iFs);
|
sl@0
|
488 |
test_KErrNone(r);
|
sl@0
|
489 |
r=CreateFileX(fileName,1,iFs);
|
sl@0
|
490 |
test_KErrNone(r);
|
sl@0
|
491 |
r=DeleteFileX(fileName,0,iFs);
|
sl@0
|
492 |
test_KErrNone(r);
|
sl@0
|
493 |
r=CreateFileX(fileName,2,iFs);
|
sl@0
|
494 |
test_KErrNone(r);
|
sl@0
|
495 |
r=CreateFileX(fileName,1,iFs);
|
sl@0
|
496 |
test_KErrNone(r);
|
sl@0
|
497 |
r=CreateFileX(fileName,3,iFs);
|
sl@0
|
498 |
test_KErrNone(r);
|
sl@0
|
499 |
r=DeleteFileX(fileName,1,iFs);
|
sl@0
|
500 |
test_KErrNone(r);
|
sl@0
|
501 |
r=CreateFileX(fileName,4,iFs);
|
sl@0
|
502 |
test_KErrNone(r);
|
sl@0
|
503 |
r=DeleteFileX(fileName,2,iFs);
|
sl@0
|
504 |
test_KErrNone(r);
|
sl@0
|
505 |
r=DeleteFileX(fileName,3,iFs);
|
sl@0
|
506 |
test_KErrNone(r);
|
sl@0
|
507 |
r=DeleteFileX(fileName,4,iFs);
|
sl@0
|
508 |
test_KErrNone(r);
|
sl@0
|
509 |
r=CreateFileX(fileName,1,iFs);
|
sl@0
|
510 |
test_KErrNone(r);
|
sl@0
|
511 |
r=DeleteFileX(fileName,1,iFs);
|
sl@0
|
512 |
test_KErrNone(r);
|
sl@0
|
513 |
|
sl@0
|
514 |
r=iFs.CheckDisk(fileName);
|
sl@0
|
515 |
test_Value(r, r==KErrNone || r==KErrNotSupported);
|
sl@0
|
516 |
test.End();
|
sl@0
|
517 |
}
|
sl@0
|
518 |
|
sl@0
|
519 |
void TSessionTest::FillUpDisk()
|
sl@0
|
520 |
//
|
sl@0
|
521 |
// Test that a full disk is ok
|
sl@0
|
522 |
//
|
sl@0
|
523 |
{
|
sl@0
|
524 |
|
sl@0
|
525 |
test.Start(_L("Fill disk to capacity"));
|
sl@0
|
526 |
TInt r=iFs.MkDirAll(_L("\\SESSION_TEST\\BIGDIRECTORY\\"));
|
sl@0
|
527 |
test_Value(r, r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
528 |
TInt count=0;
|
sl@0
|
529 |
TFileName sessionPath;
|
sl@0
|
530 |
r=iFs.SessionPath(sessionPath);
|
sl@0
|
531 |
test_KErrNone(r);
|
sl@0
|
532 |
TBuf<128> fileName=_L("\\SESSION_TEST\\BIGDIRECTORY\\FILE");
|
sl@0
|
533 |
FOREVER
|
sl@0
|
534 |
{
|
sl@0
|
535 |
TInt r=CreateFileX(fileName,count,iFs);
|
sl@0
|
536 |
if (r==KErrDiskFull)
|
sl@0
|
537 |
break;
|
sl@0
|
538 |
test_KErrNone(r);
|
sl@0
|
539 |
count++;
|
sl@0
|
540 |
#if defined(__WINS__)
|
sl@0
|
541 |
if (count==32 && sessionPath[0]=='C') // Don't fill up disk on NT
|
sl@0
|
542 |
break;
|
sl@0
|
543 |
#endif
|
sl@0
|
544 |
}
|
sl@0
|
545 |
|
sl@0
|
546 |
r=iFs.CheckDisk(fileName);
|
sl@0
|
547 |
test_Value(r, r==KErrNone || r==KErrNotSupported);
|
sl@0
|
548 |
|
sl@0
|
549 |
while(count--)
|
sl@0
|
550 |
DeleteFileX(fileName,count,iFs);
|
sl@0
|
551 |
|
sl@0
|
552 |
r=iFs.CheckDisk(fileName);
|
sl@0
|
553 |
test_Value(r, r==KErrNone || r==KErrNotSupported);
|
sl@0
|
554 |
|
sl@0
|
555 |
test.End();
|
sl@0
|
556 |
}
|
sl@0
|
557 |
|
sl@0
|
558 |
void TSessionTest::CopyFileToTestDirectory()
|
sl@0
|
559 |
//
|
sl@0
|
560 |
// Make a copy of the file in ram
|
sl@0
|
561 |
//
|
sl@0
|
562 |
{
|
sl@0
|
563 |
|
sl@0
|
564 |
TFileName fn = _L("Z:\\TEST\\T_FSRV.CPP");
|
sl@0
|
565 |
fn[0] = gExeFileName[0];
|
sl@0
|
566 |
TParse f;
|
sl@0
|
567 |
TInt r=iFs.Parse(fn,f);
|
sl@0
|
568 |
test_KErrNone(r);
|
sl@0
|
569 |
test.Next(_L("Copying file to test directory"));
|
sl@0
|
570 |
TParse fCopy;
|
sl@0
|
571 |
r=iFs.Parse(f.NameAndExt(),fCopy);
|
sl@0
|
572 |
test_KErrNone(r);
|
sl@0
|
573 |
|
sl@0
|
574 |
RFile f1;
|
sl@0
|
575 |
r=f1.Open(iFs,f.FullName(),EFileStreamText|EFileShareReadersOnly);
|
sl@0
|
576 |
test.Printf(_L("r=%d\n"),r);
|
sl@0
|
577 |
test_KErrNone(r);
|
sl@0
|
578 |
RFile f2;
|
sl@0
|
579 |
r=f2.Replace(iFs,fCopy.FullName(),EFileWrite);
|
sl@0
|
580 |
test_KErrNone(r);
|
sl@0
|
581 |
TBuf8<512> copyBuf;
|
sl@0
|
582 |
TInt rem;
|
sl@0
|
583 |
r=f1.Size(rem);
|
sl@0
|
584 |
test_KErrNone(r);
|
sl@0
|
585 |
TInt pos=0;
|
sl@0
|
586 |
while (rem)
|
sl@0
|
587 |
{
|
sl@0
|
588 |
TInt s=Min(rem,copyBuf.MaxSize());
|
sl@0
|
589 |
r=f1.Read(pos,copyBuf,s);
|
sl@0
|
590 |
test_KErrNone(r);
|
sl@0
|
591 |
test(copyBuf.Length()==s);
|
sl@0
|
592 |
r=f2.Write(pos,copyBuf,s);
|
sl@0
|
593 |
test_KErrNone(r);
|
sl@0
|
594 |
pos+=s;
|
sl@0
|
595 |
rem-=s;
|
sl@0
|
596 |
}
|
sl@0
|
597 |
f1.Close();
|
sl@0
|
598 |
f2.Close();
|
sl@0
|
599 |
}
|
sl@0
|
600 |
|
sl@0
|
601 |
|
sl@0
|
602 |
void TSessionTest::testSetVolume()
|
sl@0
|
603 |
//
|
sl@0
|
604 |
// Test setting the volume info.
|
sl@0
|
605 |
//
|
sl@0
|
606 |
{
|
sl@0
|
607 |
|
sl@0
|
608 |
test.Start(_L("Test setting the volume label"));
|
sl@0
|
609 |
|
sl@0
|
610 |
#if defined(_UNICODE)
|
sl@0
|
611 |
test.Printf(_L("Unicode volume label set not implemented ****\n"));
|
sl@0
|
612 |
test.End();
|
sl@0
|
613 |
return;
|
sl@0
|
614 |
#else
|
sl@0
|
615 |
TInt driveNum=CurrentDrive();
|
sl@0
|
616 |
TVolumeInfo v;
|
sl@0
|
617 |
TInt r=iFs.Volume(v,driveNum);
|
sl@0
|
618 |
test_KErrNone(r);
|
sl@0
|
619 |
TFileName n=v.iName;
|
sl@0
|
620 |
test.Printf(_L("VOL=\"%S\"\n"),&n);
|
sl@0
|
621 |
|
sl@0
|
622 |
test.Next(_L("Set volume label to nothing"));
|
sl@0
|
623 |
r=iFs.SetVolumeLabel(_L(""),driveNum);
|
sl@0
|
624 |
#if defined(__WINS__)
|
sl@0
|
625 |
if (r==KErrGeneral || r==KErrAccessDenied || r==KErrNotSupported)
|
sl@0
|
626 |
{
|
sl@0
|
627 |
test.Printf(_L("Error %d: Set volume label not testing on WINS\n"),r);
|
sl@0
|
628 |
test.End();
|
sl@0
|
629 |
return;
|
sl@0
|
630 |
}
|
sl@0
|
631 |
#endif
|
sl@0
|
632 |
test_KErrNone(r);
|
sl@0
|
633 |
r=iFs.Volume(v,driveNum);
|
sl@0
|
634 |
test_KErrNone(r);
|
sl@0
|
635 |
test(v.iName==_L(""));
|
sl@0
|
636 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
|
sl@0
|
637 |
|
sl@0
|
638 |
test.Next(_L("Set volume label to ABCDEFGHIJK"));
|
sl@0
|
639 |
r=iFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum);
|
sl@0
|
640 |
test_KErrNone(r);
|
sl@0
|
641 |
r=iFs.Volume(v,driveNum);
|
sl@0
|
642 |
test_KErrNone(r);
|
sl@0
|
643 |
test(v.iName==_L("ABCDEFGHIJK"));
|
sl@0
|
644 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
|
sl@0
|
645 |
|
sl@0
|
646 |
test.Next(_L("Set volume label back to nothing"));
|
sl@0
|
647 |
r=iFs.SetVolumeLabel(_L(""),driveNum);
|
sl@0
|
648 |
test_KErrNone(r);
|
sl@0
|
649 |
r=iFs.Volume(v,driveNum);
|
sl@0
|
650 |
test_KErrNone(r);
|
sl@0
|
651 |
test(v.iName==_L(""));
|
sl@0
|
652 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
|
sl@0
|
653 |
|
sl@0
|
654 |
test.Next(_L("Set volume label to original"));
|
sl@0
|
655 |
r=iFs.SetVolumeLabel(n,driveNum);
|
sl@0
|
656 |
test_KErrNone(r);
|
sl@0
|
657 |
r=iFs.Volume(v,driveNum);
|
sl@0
|
658 |
test_KErrNone(r);
|
sl@0
|
659 |
test(v.iName==n);
|
sl@0
|
660 |
test.Printf(_L("VOL=\"%S\"\n"),&v.iName);
|
sl@0
|
661 |
|
sl@0
|
662 |
test.End();
|
sl@0
|
663 |
#endif
|
sl@0
|
664 |
}
|
sl@0
|
665 |
|
sl@0
|
666 |
LOCAL_C void printDriveAtt(TInt aDrive,TUint anAtt)
|
sl@0
|
667 |
//
|
sl@0
|
668 |
// Print a drive attribute.
|
sl@0
|
669 |
//
|
sl@0
|
670 |
{
|
sl@0
|
671 |
|
sl@0
|
672 |
test.Printf(_L("%c: "),aDrive+'A');
|
sl@0
|
673 |
if (anAtt&KDriveAttLocal)
|
sl@0
|
674 |
test.Printf(_L("LOCAL "));
|
sl@0
|
675 |
if (anAtt&KDriveAttRom)
|
sl@0
|
676 |
test.Printf(_L("ROM "));
|
sl@0
|
677 |
if (anAtt&KDriveAttRedirected)
|
sl@0
|
678 |
test.Printf(_L("REDIR "));
|
sl@0
|
679 |
if (anAtt&KDriveAttSubsted)
|
sl@0
|
680 |
test.Printf(_L("SUBST "));
|
sl@0
|
681 |
if (anAtt&KDriveAttInternal)
|
sl@0
|
682 |
test.Printf(_L("INTERNAL "));
|
sl@0
|
683 |
if ((anAtt&KDriveAttRemovable) && !(anAtt&KDriveAttLogicallyRemovable))
|
sl@0
|
684 |
test.Printf(_L("PHYSICALLY-REMOVABLE "));
|
sl@0
|
685 |
if (anAtt&KDriveAttLogicallyRemovable)
|
sl@0
|
686 |
test.Printf(_L("LOGICALLY-REMOVABLE "));
|
sl@0
|
687 |
if (anAtt&KDriveAttHidden)
|
sl@0
|
688 |
test.Printf(_L("HIDDEN "));
|
sl@0
|
689 |
test.Printf(_L("\n"));
|
sl@0
|
690 |
}
|
sl@0
|
691 |
|
sl@0
|
692 |
LOCAL_C void printDriveInfo(TInt aDrive,TDriveInfo& anInfo)
|
sl@0
|
693 |
//
|
sl@0
|
694 |
// Print a drive info.
|
sl@0
|
695 |
//
|
sl@0
|
696 |
{
|
sl@0
|
697 |
|
sl@0
|
698 |
printDriveAtt(aDrive,anInfo.iDriveAtt);
|
sl@0
|
699 |
test.Printf(_L(" MEDIA-ATT="));
|
sl@0
|
700 |
if (anInfo.iMediaAtt==0)
|
sl@0
|
701 |
test.Printf(_L("<none>"));
|
sl@0
|
702 |
if (anInfo.iMediaAtt&KMediaAttVariableSize)
|
sl@0
|
703 |
test.Printf(_L("VariableSize "));
|
sl@0
|
704 |
if (anInfo.iMediaAtt&KMediaAttDualDensity)
|
sl@0
|
705 |
test.Printf(_L("DualDensity "));
|
sl@0
|
706 |
if (anInfo.iMediaAtt&KMediaAttFormattable)
|
sl@0
|
707 |
test.Printf(_L("Formattable "));
|
sl@0
|
708 |
if (anInfo.iMediaAtt&KMediaAttWriteProtected)
|
sl@0
|
709 |
test.Printf(_L("WProtected "));
|
sl@0
|
710 |
test.Printf(_L("\n CONNECTION BUS="));
|
sl@0
|
711 |
switch(anInfo.iConnectionBusType)
|
sl@0
|
712 |
{
|
sl@0
|
713 |
case EConnectionBusInternal: test.Printf(_L("Internal\n")); break;
|
sl@0
|
714 |
case EConnectionBusUsb: test.Printf(_L("USB\n")); break;
|
sl@0
|
715 |
default:
|
sl@0
|
716 |
test.Printf(_L("Unknown value\n"));
|
sl@0
|
717 |
}
|
sl@0
|
718 |
test.Printf(_L(" MEDIA="));
|
sl@0
|
719 |
switch(anInfo.iType)
|
sl@0
|
720 |
{
|
sl@0
|
721 |
case EMediaNotPresent: test.Printf(_L("Not present\n")); break;
|
sl@0
|
722 |
case EMediaUnknown: test.Printf(_L("Unknown\n")); break;
|
sl@0
|
723 |
case EMediaFloppy: test.Printf(_L("Floppy\n")); break;
|
sl@0
|
724 |
case EMediaHardDisk: test.Printf(_L("Hard disk\n")); break;
|
sl@0
|
725 |
case EMediaCdRom: test.Printf(_L("CD Rom\n")); break;
|
sl@0
|
726 |
case EMediaRam: test.Printf(_L("Ram\n")); break;
|
sl@0
|
727 |
case EMediaFlash: test.Printf(_L("Flash\n")); break;
|
sl@0
|
728 |
case EMediaRom: test.Printf(_L("Rom\n")); break;
|
sl@0
|
729 |
case EMediaRemote: test.Printf(_L("Remote\n")); break;
|
sl@0
|
730 |
default:
|
sl@0
|
731 |
test.Printf(_L("Unknown value\n"));
|
sl@0
|
732 |
}
|
sl@0
|
733 |
}
|
sl@0
|
734 |
|
sl@0
|
735 |
LOCAL_C void DriveInfo(TInt aDrive,TDriveInfo& anInfo)
|
sl@0
|
736 |
//
|
sl@0
|
737 |
// Test the drive info is reasonable
|
sl@0
|
738 |
//
|
sl@0
|
739 |
{
|
sl@0
|
740 |
|
sl@0
|
741 |
test(anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb);
|
sl@0
|
742 |
|
sl@0
|
743 |
if (aDrive==EDriveZ)
|
sl@0
|
744 |
{
|
sl@0
|
745 |
if (anInfo.iType==EMediaNotPresent)
|
sl@0
|
746 |
return;
|
sl@0
|
747 |
|
sl@0
|
748 |
test(anInfo.iMediaAtt==KMediaAttWriteProtected);
|
sl@0
|
749 |
test(anInfo.iDriveAtt==(KDriveAttRom|KDriveAttInternal));
|
sl@0
|
750 |
test(anInfo.iType==EMediaRom);
|
sl@0
|
751 |
}
|
sl@0
|
752 |
|
sl@0
|
753 |
/*
|
sl@0
|
754 |
Why assume certain drive letters can only refer to certain drive types?
|
sl@0
|
755 |
else if (aDrive==EDriveC || aDrive==EDriveY)
|
sl@0
|
756 |
{
|
sl@0
|
757 |
if (anInfo.iType==EMediaNotPresent)
|
sl@0
|
758 |
return;
|
sl@0
|
759 |
|
sl@0
|
760 |
// test(anInfo.iDriveAtt==(KDriveAttLocal|KDriveAttInternal));
|
sl@0
|
761 |
|
sl@0
|
762 |
test(anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal); // LFFS sets KDriveAttTransaction as well
|
sl@0
|
763 |
test(anInfo.iType==EMediaRam || anInfo.iType==EMediaFlash);
|
sl@0
|
764 |
if(anInfo.iType==EMediaRam) test(anInfo.iMediaAtt==(KMediaAttVariableSize|KMediaAttFormattable));
|
sl@0
|
765 |
else if(anInfo.iType==EMediaFlash) test(anInfo.iMediaAtt==KMediaAttFormattable);
|
sl@0
|
766 |
}
|
sl@0
|
767 |
|
sl@0
|
768 |
else if (aDrive==EDriveD || aDrive==EDriveX)
|
sl@0
|
769 |
{
|
sl@0
|
770 |
if (anInfo.iType==EMediaNotPresent)
|
sl@0
|
771 |
return;
|
sl@0
|
772 |
|
sl@0
|
773 |
test(anInfo.iDriveAtt==(KDriveAttLocal|KDriveAttRemovable));
|
sl@0
|
774 |
test(anInfo.iType==EMediaHardDisk);
|
sl@0
|
775 |
test(anInfo.iMediaAtt&KMediaAttFormattable);
|
sl@0
|
776 |
}
|
sl@0
|
777 |
*/
|
sl@0
|
778 |
}
|
sl@0
|
779 |
|
sl@0
|
780 |
void TSessionTest::CreateTestDirectory(const TDesC& aSessionPath)
|
sl@0
|
781 |
//
|
sl@0
|
782 |
// Create directory for test
|
sl@0
|
783 |
//
|
sl@0
|
784 |
{
|
sl@0
|
785 |
TParsePtrC path(aSessionPath);
|
sl@0
|
786 |
test(path.DrivePresent()==EFalse);
|
sl@0
|
787 |
|
sl@0
|
788 |
TInt r=iFs.SetSessionPath(aSessionPath);
|
sl@0
|
789 |
test_KErrNone(r);
|
sl@0
|
790 |
r=iFs.SessionPath(gTestSessionPath);
|
sl@0
|
791 |
test_KErrNone(r);
|
sl@0
|
792 |
r=iFs.MkDirAll(gTestSessionPath);
|
sl@0
|
793 |
test_Value(r, r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
794 |
}
|
sl@0
|
795 |
|
sl@0
|
796 |
TInt TSessionTest::CurrentDrive()
|
sl@0
|
797 |
//
|
sl@0
|
798 |
// Return the current drive number
|
sl@0
|
799 |
//
|
sl@0
|
800 |
{
|
sl@0
|
801 |
|
sl@0
|
802 |
TInt driveNum;
|
sl@0
|
803 |
TInt r=iFs.CharToDrive(gTestSessionPath[0],driveNum);
|
sl@0
|
804 |
test_KErrNone(r);
|
sl@0
|
805 |
return(driveNum);
|
sl@0
|
806 |
}
|
sl@0
|
807 |
|