author | Mike Kinghan <mikek@symbian.org> |
Mon, 19 Jul 2010 08:40:05 +0100 | |
branch | GCC_SURGE |
changeset 209 | 6035754ebf88 |
parent 109 | b3a1d9898418 |
child 245 | 647ab20fee2e |
permissions | -rw-r--r-- |
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_dcdiskadminallfiles.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
18 |
#define __E32TEST_EXTENSION__ |
0 | 19 |
#include <f32file.h> |
20 |
#include <e32test.h> |
|
21 |
#include <e32std.h> |
|
22 |
#include <e32std_private.h> |
|
23 |
#include <e32def.h> |
|
24 |
#include <e32def_private.h> |
|
25 |
#include <e32svr.h> |
|
26 |
#include "t_server.h" |
|
27 |
||
28 |
GLDEF_D RTest test(_L("T_DCDISKADMINALLFILES")); |
|
29 |
GLDEF_D TTime gTimeNow; |
|
30 |
LOCAL_D TInt gTheDriveNum; |
|
31 |
||
32 |
||
33 |
const TInt KPathPosition = 2; |
|
34 |
_LIT(KExpectedPrivatePath, "\\Private\\00000001\\"); |
|
35 |
_LIT(KResourcePath, "?:\\Resource\\"); |
|
36 |
_LIT(KSystemPath, "?:\\Sys\\"); |
|
37 |
_LIT(KPrivatePath, "?:\\Private\\"); |
|
38 |
_LIT(KPrivateFalseID, "?:\\Private\\FFFFFFFF\\"); |
|
39 |
_LIT(KDriveName, "Billy"); |
|
40 |
_LIT(KVolLable, "Benny"); |
|
41 |
_LIT(KFileSys, "systemfile.txt"); |
|
42 |
_LIT(KFileSys3, "sysfile.rna"); |
|
43 |
_LIT(KFilePri, "privatefile.txt"); |
|
44 |
_LIT(KFilePri2, "privatefile.tmp"); |
|
45 |
_LIT(KFilePri3, "prifile.rna"); |
|
46 |
_LIT(KFileRes, "resourcefile.txt"); |
|
47 |
_LIT(KFileRes3, "resfile.rna"); |
|
48 |
_LIT(KMkDirSub,"Subdir\\"); |
|
49 |
_LIT(KOldFile,"?:\\Anyold.txt"); |
|
50 |
||
51 |
#ifndef __WINS__ |
|
52 |
_LIT(KWildPath, "Z:\\SYSTEM\\"); // Until Loader is modified to use /Sys/ |
|
53 |
#else |
|
54 |
_LIT(KWildPath, "Z:\\SYS\\"); |
|
55 |
#endif |
|
56 |
_LIT(KWildFile, "*"); |
|
57 |
||
58 |
TCapability TheCaps; |
|
59 |
TBuf<4> driveBuf=_L("?:\\"); |
|
60 |
RFormat format; |
|
61 |
TInt count; |
|
62 |
RRawDisk rawdisk; |
|
63 |
RFile file1; |
|
64 |
RFile file2; |
|
65 |
RDir dir; |
|
66 |
||
67 |
TInt r; |
|
68 |
TBuf<40> fsname; |
|
69 |
TBuf<40> systestname; |
|
70 |
TBuf<40> pritestname; |
|
71 |
TBuf<40> restestname; |
|
72 |
TBuf<40> theprivatepath; |
|
73 |
TBuf<40> pritestfalseidname; |
|
74 |
TBuf<40> mkdirname; |
|
75 |
TFileName fromTemp; |
|
76 |
||
77 |
TBuf<25> sysfilename; |
|
78 |
TBuf<30> realName; |
|
79 |
TBuf<40> shortfilename; |
|
80 |
TBuf<40> longfilename; |
|
81 |
||
82 |
TRequestStatus aStat1; |
|
83 |
TRequestStatus aStat2; |
|
84 |
TRequestStatus aStat3; |
|
85 |
TRequestStatus aStat4; |
|
86 |
||
87 |
TVolumeInfo aVolInfo; |
|
88 |
// TDriveInfo adriveInfo; |
|
89 |
||
90 |
TBuf<40> systestfile; |
|
91 |
TBuf<40> pritestfile; |
|
92 |
TBuf<40> restestfile; |
|
93 |
TBuf<40> systestfile1; |
|
94 |
TBuf<40> pritestfile1; |
|
95 |
TBuf<40> restestfile1; |
|
96 |
||
97 |
TTime testtime; |
|
98 |
TBuf<20> oldName; |
|
99 |
||
100 |
TBuf<25> temp; |
|
101 |
||
102 |
TEntry entry; |
|
103 |
||
104 |
||
105 |
LOCAL_C void systemRFsTest() |
|
106 |
// |
|
107 |
// RFs test on system Directory |
|
108 |
// |
|
109 |
{ |
|
110 |
systestname=KSystemPath; |
|
111 |
systestname[0]=(TText)('A' + gTheDriveNum); |
|
112 |
||
113 |
mkdirname.Zero(); |
|
114 |
mkdirname.Append(systestname); |
|
115 |
mkdirname.Append(KMkDirSub); |
|
116 |
r=TheFs.MkDirAll(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
117 |
test_Value(r, r == KErrPermissionDenied); |
0 | 118 |
|
119 |
TheFs.RmDir(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
test_Value(r, r == KErrPermissionDenied); |
0 | 121 |
|
122 |
r=TheFs.SetSubst(systestname,EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
test_Value(r, r == KErrPermissionDenied); |
0 | 124 |
|
125 |
r=TheFs.SetSessionPath(systestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
test_KErrNone(r); |
0 | 127 |
|
128 |
TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
|
129 |
test(aStat1==KRequestPending); |
|
130 |
||
131 |
systestfile=KSystemPath; |
|
132 |
systestfile[0]=(TText)('A' + gTheDriveNum); |
|
133 |
systestfile1=systestfile; |
|
134 |
systestfile.Append(KFileSys); |
|
135 |
systestfile1.Append(KFileSys3); |
|
136 |
||
137 |
oldName=KOldFile; |
|
138 |
oldName[0]=(TText)gDriveToTest; |
|
139 |
||
140 |
r=TheFs.GetShortName(systestfile, shortfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 142 |
|
143 |
r=TheFs.GetLongName(systestfile1, longfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
144 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 145 |
|
146 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
147 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 148 |
file1.Close(); |
149 |
||
150 |
r=TheFs.Replace(oldName,systestfile); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
test_Value(r, r == KErrPermissionDenied); |
0 | 152 |
|
153 |
r=TheFs.Rename(systestfile,systestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
test_Value(r, r == KErrPermissionDenied); |
0 | 155 |
|
156 |
r=TheFs.Entry(systestfile1,entry); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 158 |
|
159 |
r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
test_Value(r, r == KErrPermissionDenied); |
0 | 161 |
|
162 |
r=TheFs.Delete(systestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
test_Value(r, r == KErrPermissionDenied); |
0 | 164 |
} |
165 |
||
166 |
LOCAL_C void ResourceRFsTest() |
|
167 |
// |
|
168 |
// |
|
169 |
// |
|
170 |
{ |
|
171 |
restestname=KResourcePath; |
|
172 |
restestname[0]=(TText)('A' + gTheDriveNum); |
|
173 |
||
174 |
mkdirname.Zero(); |
|
175 |
mkdirname.Append(restestname); |
|
176 |
mkdirname.Append(KMkDirSub); |
|
177 |
r=TheFs.MkDirAll(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
test_Value(r, r == KErrPermissionDenied); |
0 | 179 |
|
180 |
TheFs.RmDir(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
test_Value(r, r == KErrPermissionDenied); |
0 | 182 |
|
183 |
// Change due to defect DEF099546 fix |
|
184 |
// TCB capability is required for following operation. |
|
185 |
r=TheFs.SetSubst(restestname,EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
//test_KErrNone(r); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
test_Value(r, r == KErrPermissionDenied); |
0 | 188 |
|
189 |
// SetSubst will fail. |
|
190 |
//r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
191 |
//test_KErrNone(r); |
0 | 192 |
|
193 |
//r=TheFs.SetSubst(_L(""),EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
//test_KErrNone(r); |
0 | 195 |
|
196 |
r=TheFs.SetSessionPath(restestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
197 |
test_KErrNone(r); |
0 | 198 |
|
199 |
TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
|
200 |
test(aStat4==KRequestPending); |
|
201 |
||
202 |
restestfile=KResourcePath; |
|
203 |
restestfile[0]=(TText)('A' + gTheDriveNum); |
|
204 |
restestfile1=restestfile; |
|
205 |
restestfile.Append(KFileRes); |
|
206 |
restestfile1.Append(KFileRes3); |
|
207 |
||
208 |
oldName=KOldFile; |
|
209 |
oldName[0]=(TText)gDriveToTest; |
|
210 |
||
211 |
r=TheFs.GetShortName(restestfile, shortfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
212 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 213 |
|
214 |
r=TheFs.GetLongName(restestfile1, longfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
215 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 216 |
|
217 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
218 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 219 |
file1.Close(); |
220 |
||
221 |
r=TheFs.Replace(oldName,restestfile); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
test_Value(r, r == KErrPermissionDenied); |
0 | 223 |
|
224 |
r=TheFs.Rename(restestfile,restestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
test_Value(r, r == KErrPermissionDenied); |
0 | 226 |
|
227 |
r=TheFs.Entry(restestfile1,entry); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
228 |
test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
0 | 229 |
|
230 |
r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
231 |
test_Value(r, r == KErrPermissionDenied); |
0 | 232 |
|
233 |
r=TheFs.Delete(restestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
234 |
test_Value(r, r == KErrPermissionDenied); |
0 | 235 |
|
236 |
} |
|
237 |
||
238 |
||
239 |
LOCAL_C void privatefalseIDRFsTest() |
|
240 |
// |
|
241 |
// |
|
242 |
// |
|
243 |
{ |
|
244 |
pritestfalseidname=KPrivateFalseID; |
|
245 |
pritestfalseidname[0]=(TText)('A' + gTheDriveNum); |
|
246 |
||
247 |
mkdirname.Zero(); |
|
248 |
mkdirname.Append(pritestfalseidname); |
|
249 |
mkdirname.Append(KMkDirSub); |
|
250 |
||
251 |
r=TheFs.MkDirAll(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
252 |
test_KErrNone(r); |
0 | 253 |
|
254 |
r=TheFs.RmDir(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
255 |
test_KErrNone(r); |
0 | 256 |
|
257 |
r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
258 |
test_KErrNone(r); |
0 | 259 |
|
260 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
261 |
test_KErrNone(r); |
0 | 262 |
|
263 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
264 |
test_KErrNone(r); |
0 | 265 |
|
266 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
267 |
test_KErrNone(r); |
0 | 268 |
|
269 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
|
270 |
test(aStat2==KRequestPending); |
|
271 |
||
272 |
||
273 |
pritestfile=KPrivateFalseID; |
|
274 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
275 |
pritestfile1=pritestfile; |
|
276 |
pritestfile.Append(KFilePri2); |
|
277 |
pritestfile1.Append(KFilePri3); |
|
278 |
||
279 |
oldName=KOldFile; |
|
280 |
oldName[0]=(TText)gDriveToTest; |
|
281 |
||
282 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
283 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 284 |
|
285 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
286 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 287 |
|
288 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
289 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 290 |
file1.Close(); |
291 |
||
292 |
r=TheFs.Replace(oldName,pritestfile); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
293 |
test_KErrNone(r); |
0 | 294 |
|
295 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
296 |
test_KErrNone(r); |
0 | 297 |
|
298 |
r=TheFs.Entry(pritestfile1,entry); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
299 |
test_KErrNone(r); |
0 | 300 |
|
301 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
302 |
test_KErrNone(r); |
0 | 303 |
|
304 |
r=TheFs.Delete(pritestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
305 |
test_KErrNone(r); |
0 | 306 |
|
307 |
} |
|
308 |
||
309 |
||
310 |
LOCAL_C void privateRFsTest() |
|
311 |
// |
|
312 |
// |
|
313 |
// |
|
314 |
{ |
|
315 |
//private |
|
316 |
pritestname=KPrivatePath; |
|
317 |
pritestname[0]=(TText)('A' + gTheDriveNum); |
|
318 |
||
319 |
mkdirname.Zero(); |
|
320 |
mkdirname.Append(pritestname); |
|
321 |
mkdirname.Append(KMkDirSub); |
|
322 |
||
323 |
r=TheFs.MkDirAll(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
324 |
test_KErrNone(r); |
0 | 325 |
|
326 |
r=TheFs.RmDir(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
327 |
test_KErrNone(r); |
0 | 328 |
|
329 |
r=TheFs.SetSubst(pritestname,EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
330 |
test_KErrNone(r); |
0 | 331 |
|
332 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
333 |
test_KErrNone(r); |
0 | 334 |
|
335 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
336 |
test_KErrNone(r); |
0 | 337 |
|
338 |
r=TheFs.SetSessionPath(pritestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
339 |
test_KErrNone(r); |
0 | 340 |
|
341 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
|
342 |
test(aStat2==KRequestPending); |
|
343 |
||
344 |
||
345 |
pritestfile=KPrivatePath; |
|
346 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
347 |
pritestfile1=pritestfile; |
|
348 |
pritestfile.Append(KFilePri2); |
|
349 |
pritestfile1.Append(KFilePri3); |
|
350 |
||
351 |
oldName=KOldFile; |
|
352 |
oldName[0]=(TText)gDriveToTest; |
|
353 |
||
354 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
355 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 356 |
|
357 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 359 |
|
360 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
361 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 362 |
file1.Close(); |
363 |
||
364 |
r=TheFs.Replace(oldName,pritestfile); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 366 |
|
367 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
test_KErrNone(r); |
0 | 369 |
|
370 |
r=TheFs.Entry(pritestfile1,entry); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
371 |
test_KErrNone(r); |
0 | 372 |
|
373 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
374 |
test_KErrNone(r); |
0 | 375 |
|
376 |
r=TheFs.Delete(pritestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
377 |
test_KErrNone(r); |
0 | 378 |
|
379 |
} |
|
380 |
||
381 |
||
382 |
LOCAL_C void privateSIDRFstest() |
|
383 |
{ |
|
384 |
theprivatepath[0]=(TText)gDriveToTest; |
|
385 |
test.Printf(_L("the Private Path = %S"),&theprivatepath); |
|
386 |
||
387 |
mkdirname.Zero(); |
|
388 |
mkdirname.Append(theprivatepath); |
|
389 |
mkdirname.Append(KMkDirSub); |
|
390 |
r=TheFs.MkDirAll(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
391 |
test_KErrNone(r); |
0 | 392 |
|
393 |
r=TheFs.RmDir(mkdirname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
test_KErrNone(r); |
0 | 395 |
|
396 |
r=TheFs.SetSubst(theprivatepath,EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
397 |
test_KErrNone(r); |
0 | 398 |
|
399 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
400 |
test_KErrNone(r); |
0 | 401 |
|
402 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
403 |
test_KErrNone(r); |
0 | 404 |
|
405 |
r=TheFs.SetSessionPath(theprivatepath); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
406 |
test_KErrNone(r); |
0 | 407 |
|
408 |
TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
|
409 |
test(aStat3==KRequestPending); |
|
410 |
||
411 |
pritestfile=theprivatepath; |
|
412 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
413 |
pritestfile1=pritestfile; |
|
414 |
pritestfile.Append(KFilePri2); |
|
415 |
pritestfile1.Append(KFilePri3); |
|
416 |
||
417 |
oldName=KOldFile; |
|
418 |
oldName[0]=(TText)gDriveToTest; |
|
419 |
||
420 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
421 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 422 |
|
423 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
424 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 425 |
|
426 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
427 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 428 |
file1.Close(); |
429 |
||
430 |
r=TheFs.Replace(oldName,pritestfile); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
431 |
test_KErrNone(r); |
0 | 432 |
|
433 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
434 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 435 |
|
436 |
r=TheFs.Entry(pritestfile1,entry); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
437 |
test_KErrNone(r); |
0 | 438 |
|
439 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
440 |
test_KErrNone(r); |
0 | 441 |
|
442 |
r=TheFs.Delete(pritestfile1); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
test_KErrNone(r); |
0 | 444 |
} |
445 |
||
446 |
||
447 |
LOCAL_C void systemRFiletest() |
|
448 |
// |
|
449 |
//RFile testing with session path set to //system// |
|
450 |
// |
|
451 |
{ |
|
452 |
||
453 |
r=TheFs.SetSessionPath(systestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
454 |
test_KErrNone(r); |
0 | 455 |
|
456 |
r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
457 |
test_Value(r, r == KErrPermissionDenied); |
0 | 458 |
file1.Close(); |
459 |
||
460 |
systestfile=systestname; |
|
461 |
systestfile.Append(KFileSys); |
|
462 |
r=file1.Create(TheFs,systestfile,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
test_Value(r, r == KErrPermissionDenied); |
0 | 464 |
file1.Close(); |
465 |
||
466 |
r=file1.Open(TheFs,systestfile,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
test_Value(r, r == KErrPermissionDenied); |
0 | 468 |
|
469 |
r=file1.Open(TheFs,systestfile,EFileRead); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
test_Value(r, r == KErrNone|| r==KErrNotFound); |
0 | 471 |
|
472 |
r=file1.Replace(TheFs,systestfile,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
473 |
test_Value(r, r == KErrPermissionDenied); |
0 | 474 |
|
475 |
TFindFile finder(TheFs); |
|
476 |
CDir* dir = NULL; |
|
477 |
r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
|
478 |
if (!(r==KErrNone)) |
|
479 |
test.Printf(_L("T_DCDISKADMINALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
test_KErrNone(r); |
0 | 481 |
delete dir; |
482 |
} |
|
483 |
||
484 |
LOCAL_C void resourceRFiletest() |
|
485 |
// |
|
486 |
//RFile testing with session path set to //resource// |
|
487 |
// |
|
488 |
{ |
|
489 |
r=TheFs.SetSessionPath(restestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
test_KErrNone(r); |
0 | 491 |
|
492 |
r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
493 |
test_Value(r, r == KErrPermissionDenied); |
0 | 494 |
file1.Close(); |
495 |
||
496 |
r=file1.Create(TheFs,KFileRes,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
497 |
test_Value(r, r == KErrPermissionDenied); |
0 | 498 |
file1.Close(); |
499 |
||
500 |
r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
test_Value(r, r == KErrPermissionDenied); |
0 | 502 |
|
503 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
504 |
test_Value(r, r == KErrNone || r == KErrPathNotFound || r == KErrNotFound); |
0 | 505 |
file1.Close(); |
506 |
||
507 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
508 |
test_Value(r, r == KErrNone || r == KErrPathNotFound || r == KErrNotFound); |
0 | 509 |
file1.Close(); |
510 |
||
511 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
512 |
test_Value(r, r == KErrPermissionDenied); |
0 | 513 |
file1.Close(); |
514 |
||
515 |
r=file1.Replace(TheFs,KFileRes3,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
516 |
test_Value(r, r == KErrPermissionDenied); |
0 | 517 |
file1.Close(); |
518 |
} |
|
519 |
||
520 |
||
521 |
LOCAL_C void privatefalseIDRFiletest() |
|
522 |
// |
|
523 |
//RFile testing with session path set to //Private//false ID |
|
524 |
// |
|
525 |
{ |
|
526 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
527 |
test_KErrNone(r); |
0 | 528 |
|
529 |
r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
530 |
test_KErrNone(r); |
0 | 531 |
file1.Close(); |
532 |
||
533 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
534 |
test_KErrNone(r); |
0 | 535 |
file1.Close(); |
536 |
||
537 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
test_KErrNone(r); |
0 | 539 |
file1.Close(); |
540 |
||
541 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
test_KErrNone(r); |
0 | 543 |
file1.Close(); |
544 |
||
545 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
546 |
test_KErrNone(r); |
0 | 547 |
|
548 |
r=file1.Rename(KFilePri3); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
549 |
test_KErrNone(r); |
0 | 550 |
file1.Close(); |
551 |
} |
|
552 |
||
553 |
||
554 |
LOCAL_C void privateRFiletest() |
|
555 |
// |
|
556 |
//RFile testing with session path set to //Private// |
|
557 |
// |
|
558 |
{ |
|
559 |
r=TheFs.SetSessionPath(pritestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
560 |
test_KErrNone(r); |
0 | 561 |
|
562 |
r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
563 |
test_KErrNone(r); |
0 | 564 |
file1.Close(); |
565 |
||
566 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
567 |
test_KErrNone(r); |
0 | 568 |
file1.Close(); |
569 |
||
570 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
test_KErrNone(r); |
0 | 572 |
file1.Close(); |
573 |
||
574 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
575 |
test_KErrNone(r); |
0 | 576 |
file1.Close(); |
577 |
||
578 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
579 |
test_KErrNone(r); |
0 | 580 |
|
581 |
r=file1.Rename(KFilePri3); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
582 |
test_KErrNone(r); |
0 | 583 |
file1.Close(); |
584 |
} |
|
585 |
||
586 |
||
587 |
LOCAL_C void privateSIDRFiletest() |
|
588 |
// |
|
589 |
//Rfile Testing with session path set to //Private//UID// |
|
590 |
// |
|
591 |
{ |
|
592 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
test_KErrNone(r); |
0 | 594 |
|
595 |
r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
596 |
test_KErrNone(r); |
0 | 597 |
file1.Close(); |
598 |
||
599 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
600 |
test_KErrNone(r); |
0 | 601 |
file1.Close(); |
602 |
||
603 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
604 |
test_KErrNone(r); |
0 | 605 |
file1.Close(); |
606 |
||
607 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
608 |
test_KErrNone(r); |
0 | 609 |
file1.Close(); |
610 |
||
611 |
||
612 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
613 |
test_KErrNone(r); |
0 | 614 |
|
615 |
r=file1.Rename(KFilePri3); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
616 |
test_KErrNone(r); |
0 | 617 |
file1.Close(); |
618 |
} |
|
619 |
||
620 |
LOCAL_C void RDirtest() |
|
621 |
// |
|
622 |
// |
|
623 |
// |
|
624 |
{ |
|
625 |
||
626 |
//system |
|
627 |
CDir* dirEntries; |
|
628 |
TBuf<30> dirNameBuf(KSystemPath); |
|
629 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
630 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
631 |
test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
0 | 632 |
dir.Close(); |
633 |
if(r==KErrNone) |
|
634 |
{ |
|
635 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
636 |
test_KErrNone(r); |
0 | 637 |
delete dirEntries; |
638 |
} |
|
639 |
dirNameBuf.Zero(); |
|
640 |
//Private//falseID |
|
641 |
dirNameBuf=KPrivateFalseID; |
|
642 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
643 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
644 |
test_KErrNone(r); |
0 | 645 |
dir.Close(); |
646 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
647 |
test_KErrNone(r); |
0 | 648 |
dirNameBuf.Zero(); |
649 |
delete dirEntries; |
|
650 |
//Private |
|
651 |
dirNameBuf=KPrivatePath; |
|
652 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
653 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
654 |
test_KErrNone(r); |
0 | 655 |
dir.Close(); |
656 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
657 |
test_KErrNone(r); |
0 | 658 |
dirNameBuf.Zero(); |
659 |
delete dirEntries; |
|
660 |
//Private/uid |
|
661 |
TheFs.PrivatePath(dirNameBuf); |
|
662 |
dirNameBuf.Insert(0,_L("?:")); |
|
663 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
664 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
test_KErrNone(r); |
0 | 666 |
dir.Close(); |
667 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
668 |
test_KErrNone(r); |
0 | 669 |
dirNameBuf.Zero(); |
670 |
delete dirEntries; |
|
671 |
//Resource |
|
672 |
dirNameBuf=KResourcePath; |
|
673 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
674 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
test_Value(r, r == KErrNone || r==KErrPathNotFound); |
0 | 676 |
if(r==KErrNone) |
677 |
{ |
|
678 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
test_KErrNone(r); |
0 | 680 |
dir.Close(); |
681 |
delete dirEntries; |
|
682 |
} |
|
683 |
} |
|
684 |
||
685 |
||
686 |
LOCAL_C void TestDiskAdminAllfiles() |
|
687 |
// |
|
688 |
// Test with root capabilities |
|
689 |
// |
|
690 |
{ |
|
691 |
r=TheFs.FileSystemName(fsname,gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
692 |
test_KErrNone(r); |
0 | 693 |
r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
694 |
test_KErrNone(r); |
0 | 695 |
// r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
696 |
// test_KErrNone(r); |
0 | 697 |
// r=TheFs.AddFileSystem(fsname); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
698 |
// test_KErrNone(r); |
0 | 699 |
r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
700 |
test_KErrNone(r); |
0 | 701 |
r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
test_KErrNone(r); |
0 | 703 |
#ifndef __WINS__ |
704 |
r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
test_KErrNone(r); |
0 | 706 |
#endif |
707 |
||
708 |
systemRFsTest(); |
|
709 |
ResourceRFsTest(); |
|
710 |
privateRFsTest(); |
|
711 |
privateSIDRFstest(); |
|
712 |
privatefalseIDRFsTest(); |
|
713 |
||
714 |
systemRFiletest(); |
|
715 |
resourceRFiletest(); |
|
716 |
privateRFiletest(); |
|
717 |
privateSIDRFiletest(); |
|
718 |
privatefalseIDRFiletest(); |
|
719 |
||
720 |
//check notifier return values set in rfs testing |
|
721 |
//User::WaitForRequest(aStat1); |
|
722 |
User::WaitForRequest(aStat2); |
|
723 |
User::WaitForRequest(aStat3); |
|
724 |
//User::WaitForRequest(aStat4); |
|
725 |
test(aStat2==KErrNone); |
|
726 |
test(aStat3==KErrNone); |
|
727 |
||
728 |
test(aStat1 == KRequestPending); |
|
729 |
TheFs.NotifyChangeCancel(aStat1); |
|
730 |
test(aStat1==KErrCancel); |
|
731 |
||
732 |
test(aStat4 == KRequestPending); |
|
733 |
TheFs.NotifyChangeCancel(aStat4); |
|
734 |
test(aStat4==KErrCancel); |
|
735 |
||
736 |
r=TheFs.SetSessionPath(systestname); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
737 |
test_KErrNone(r); |
0 | 738 |
|
739 |
//Test RRawDisk class |
|
740 |
r=rawdisk.Open(TheFs,gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
741 |
test_Value(r, r == KErrPermissionDenied); |
0 | 742 |
rawdisk.Close(); |
743 |
||
744 |
RDirtest(); |
|
745 |
||
746 |
#ifdef __WINS__ |
|
747 |
if (User::UpperCase(driveBuf[0]) != 'C') |
|
748 |
#endif |
|
749 |
{ |
|
750 |
//Test RFormat class |
|
751 |
r=format.Open(TheFs,driveBuf,EHighDensity,count); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
752 |
test_KErrNone(r); |
0 | 753 |
while(count) |
754 |
{ |
|
755 |
TInt r=format.Next(count); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
756 |
test_KErrNone(r); |
0 | 757 |
} |
758 |
format.Close(); |
|
759 |
} |
|
760 |
||
761 |
driveBuf[0]=(TText)gDriveToTest; |
|
762 |
r=TheFs.ScanDrive(driveBuf); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
763 |
test_Value(r, r == KErrNone || r==KErrNotSupported || r == KErrInUse); |
0 | 764 |
r=TheFs.CheckDisk(driveBuf); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
765 |
test_Value(r, r == KErrNone || r==KErrNotSupported || r == KErrInUse); |
0 | 766 |
} |
767 |
||
768 |
LOCAL_C void TestCaps() |
|
769 |
// |
|
770 |
// test format etc that require certain capabilities |
|
771 |
// |
|
772 |
{ |
|
773 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
774 |
const char myDiagMsg[] = "Capability Check Failure"; |
|
775 |
#endif //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
776 |
r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
777 |
test(r); |
|
778 |
r=RProcess().HasCapability(ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
779 |
test(r); |
|
780 |
||
781 |
driveBuf[0]=(TText)gDriveToTest; |
|
782 |
r=TheFs.SessionPath(temp); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
783 |
test_KErrNone(r); |
0 | 784 |
|
785 |
test.Printf(_L("Session path: %S"),&temp); |
|
786 |
||
787 |
r=TheFs.CreatePrivatePath(gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
788 |
test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
0 | 789 |
|
790 |
TBuf<18> tempPri; |
|
791 |
r=TheFs.PrivatePath(tempPri); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
792 |
test_KErrNone(r); |
0 | 793 |
theprivatepath = _L("?:"); |
794 |
theprivatepath.Append(tempPri); |
|
795 |
||
796 |
TestDiskAdminAllfiles(); |
|
797 |
||
798 |
TFileName thesessionpath; |
|
799 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
800 |
test_KErrNone(r); |
0 | 801 |
r=TheFs.SessionPath(thesessionpath); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
802 |
test_KErrNone(r); |
0 | 803 |
test(thesessionpath == theprivatepath); |
804 |
} |
|
805 |
||
806 |
||
807 |
LOCAL_C void CleanupL() |
|
808 |
// |
|
809 |
// Clean up tests |
|
810 |
// |
|
811 |
{ |
|
812 |
test.Next(_L("Delete test directory")); |
|
813 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
814 |
TInt r=fMan->RmDir(gSessionPath); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
815 |
test_Value(r, r == KErrNone || r == KErrPathNotFound); |
0 | 816 |
delete fMan; |
817 |
} |
|
818 |
||
819 |
GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
|
820 |
// |
|
821 |
// Do all tests |
|
822 |
// |
|
823 |
{ |
|
824 |
if( !PlatSec::IsCapabilityEnforced(ECapabilityAllFiles) || |
|
825 |
!PlatSec::IsCapabilityEnforced(ECapabilityDiskAdmin)) |
|
826 |
{ |
|
827 |
test.Printf(_L("Capabilities insufficient - leaving t_dcdiskadminallfiles")); |
|
828 |
test.Printf(_L("\n")); // Prevent overwrite by next print |
|
829 |
return; |
|
830 |
} |
|
831 |
TurnAllocFailureOff(); |
|
832 |
TheFs.CharToDrive(gDriveToTest,gTheDriveNum); |
|
833 |
||
834 |
TBuf<30> sesspath; |
|
835 |
sesspath=_L("?:\\"); |
|
836 |
sesspath[0] = (TText)gDriveToTest; |
|
837 |
||
838 |
TInt r= TheFs.SetSessionPath(sesspath); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
839 |
test_KErrNone(r); |
0 | 840 |
|
841 |
TBuf<2> cmd; |
|
842 |
cmd.SetLength(1); |
|
843 |
cmd[0] = (TText)gDriveToTest; |
|
844 |
RProcess tp; |
|
845 |
r=tp.Create(_L("clean_prepdc.exe"),sesspath); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
846 |
test_KErrNone(r); |
0 | 847 |
{ |
848 |
TRequestStatus ps; |
|
849 |
tp.Logon(ps); |
|
850 |
tp.Resume(); |
|
851 |
tp.Close(); |
|
852 |
User::WaitForRequest(ps); |
|
853 |
} |
|
854 |
||
855 |
//check double mode ie that Defpath still works |
|
856 |
RFs fs1; |
|
857 |
RFs fs2; |
|
858 |
||
859 |
r=fs1.Connect(); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
860 |
test_KErrNone(r); |
0 | 861 |
r=fs1.SessionPath(sesspath); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
862 |
test_KErrNone(r); |
0 | 863 |
test.Printf(_L("session1 Path=%S"),&sesspath); |
864 |
||
865 |
TBuf<30> privatepath; |
|
866 |
r=fs1.SetSessionToPrivate(gTheDriveNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
867 |
test_KErrNone(r); |
0 | 868 |
r=fs1.PrivatePath(privatepath); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
869 |
test_KErrNone(r); |
0 | 870 |
r=privatepath.Compare(KExpectedPrivatePath()); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
871 |
test_Value(r, r == 0); |
0 | 872 |
r=fs1.SessionPath(sesspath); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
873 |
test_KErrNone(r); |
0 | 874 |
r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
875 |
test_Value(r, r == 0); |
0 | 876 |
r=fs1.CreatePrivatePath(gTheDriveNum); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
877 |
test_KErrNone(r); |
0 | 878 |
fs1.Close(); |
879 |
||
880 |
r=fs2.Connect(); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
881 |
test_KErrNone(r); |
0 | 882 |
r=fs2.SessionPath(sesspath); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
883 |
test_KErrNone(r); |
0 | 884 |
test.Printf(_L("session2 Path=%S"),&sesspath); |
885 |
fs2.Close(); |
|
886 |
||
887 |
TestCaps(); |
|
888 |
||
889 |
test.Printf(_L("No of files open=%d"), TheFs.ResourceCount()); |
|
890 |
||
891 |
CleanupL(); |
|
892 |
} |