author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 17:13:29 +0300 | |
changeset 109 | b3a1d9898418 |
parent 90 | 947f0dc9f7a8 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1999-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_rename.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
18 |
#define __E32TEST_EXTENSION__ |
0 | 19 |
#include <f32file.h> |
20 |
#include <e32test.h> |
|
21 |
#include "t_server.h" |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#include "f32_test_utils.h" |
0 | 23 |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
using namespace F32_Test_Utils; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
TInt gDriveNum = -1; |
0 | 26 |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
RTest test(_L("T_RENAME")); |
0 | 28 |
|
29 |
TBuf8<26> alphaBuffer=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
|
30 |
TPtr8 alphaPtr((TText8*)alphaBuffer.Ptr(),alphaBuffer.Size(),alphaBuffer.Size()); |
|
31 |
||
32 |
TBuf8<17> BeckBuffer=_L8("A Devil's Haircut"); |
|
33 |
TPtr8 BeckPtr((TText8*)BeckBuffer.Ptr(),BeckBuffer.Size(),BeckBuffer.Size()); |
|
34 |
||
35 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
static void CreateTestFiles() |
0 | 37 |
{ |
38 |
test.Next(_L("Create test files")); |
|
39 |
TInt r=TheFs.MkDir(_L("\\F32-TST\\")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
40 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 41 |
|
42 |
RFile file; |
|
43 |
||
44 |
// Create \\SessionPath\\testfile |
|
45 |
r=file.Replace(TheFs,_L("\\F32-TST\\testfile"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
46 |
test_KErrNone(r); |
0 | 47 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
48 |
test_KErrNone(r); |
0 | 49 |
file.Close(); |
50 |
||
51 |
// Create \\SessionPath\\rfsfile |
|
52 |
r=file.Replace(TheFs,_L("\\F32-TST\\rfsfile"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
53 |
test_KErrNone(r); |
0 | 54 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
55 |
test_KErrNone(r); |
0 | 56 |
file.Close(); |
57 |
||
58 |
// Create \\SessionPath\\eikfile |
|
59 |
r=file.Replace(TheFs,_L("\\F32-TST\\eikfile"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
60 |
test_KErrNone(r); |
0 | 61 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
62 |
test_KErrNone(r); |
0 | 63 |
file.Close(); |
64 |
||
65 |
} |
|
66 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
67 |
static TInt CountFiles(TPtrC aDirectory, TPtrC aFileName) |
0 | 68 |
// |
69 |
// Return the number of files of aFileName found in aDirectory |
|
70 |
// |
|
71 |
{ |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
RDir dir; |
0 | 74 |
TFileName sessionPath; |
75 |
TInt r=TheFs.SessionPath(sessionPath); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
76 |
test_KErrNone(r); |
0 | 77 |
TFileName path=_L("?:"); |
78 |
path[0]=sessionPath[0]; |
|
79 |
path+=aDirectory; |
|
80 |
if (path[path.Length()-1]==KPathDelimiter) |
|
81 |
path.Append('*'); |
|
82 |
else |
|
83 |
path.Append(_L("\\*")); |
|
84 |
||
85 |
r=dir.Open(TheFs,path,KEntryAttMaskSupported); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
86 |
test_KErrNone(r); |
0 | 87 |
|
88 |
CDir* anEntryList; |
|
89 |
r=TheFs.GetDir(path,KEntryAttMaskSupported,ESortByName,anEntryList); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
90 |
test_KErrNone(r); |
0 | 91 |
|
92 |
// Sets the new length of path to the position of the last path delimiter +1 |
|
93 |
path.SetLength(path.LocateReverse(KPathDelimiter)+1); |
|
94 |
TInt fileCount=0; |
|
95 |
TEntry entry; |
|
96 |
||
97 |
TInt count=anEntryList->Count(); |
|
98 |
for (TInt j=0;j<count;j++) |
|
99 |
{ |
|
100 |
entry=anEntryList->operator[](j); |
|
101 |
if ((entry.iName)==(aFileName)) |
|
102 |
fileCount++; |
|
103 |
} |
|
104 |
||
105 |
dir.Close(); |
|
106 |
delete anEntryList; |
|
107 |
return(fileCount); |
|
108 |
} |
|
109 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
static void TestRFileRename() |
0 | 111 |
// |
112 |
// Test RFile::Rename() function |
|
113 |
// |
|
114 |
{ |
|
115 |
test.Next(_L("Rename file with DOS compatible name using RFile function")); |
|
116 |
TInt r; |
|
117 |
RFile file; |
|
118 |
||
119 |
r=file.Open(TheFs,_L("\\F32-TST\\testfile"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
120 |
test_KErrNone(r); |
0 | 121 |
|
122 |
r=file.Rename(_L("\\F32-TST\\TESTFILE")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
123 |
test_KErrNone(r); |
0 | 124 |
|
125 |
file.Close(); |
|
126 |
||
127 |
test.Next(_L("Write in some data")); |
|
128 |
r=file.Open(TheFs,_L("\\F32-TST\\TESTFILE"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
129 |
test_KErrNone(r); |
0 | 130 |
|
131 |
r=file.Write(alphaPtr); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
132 |
test_KErrNone(r); |
0 | 133 |
|
134 |
file.Close(); |
|
135 |
} |
|
136 |
||
137 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
static void TestRFsRename() |
0 | 139 |
// |
140 |
// Test RFs::Rename() function |
|
141 |
// |
|
142 |
{ |
|
143 |
test.Next(_L("Rename file with DOS compatible name using RFs function")); |
|
144 |
TInt r; |
|
145 |
||
146 |
r=TheFs.Rename(_L("\\F32-TST\\rfsfile"),_L("\\F32-TST\\RFSFILE")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
147 |
test_KErrNone(r); |
0 | 148 |
|
149 |
RFile file; |
|
150 |
test.Next(_L("Write in some data")); |
|
151 |
r=file.Open(TheFs,_L("\\F32-TST\\RFSFILE"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
152 |
test_KErrNone(r); |
0 | 153 |
|
154 |
r=file.Write(alphaPtr); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
155 |
test_KErrNone(r); |
0 | 156 |
|
157 |
file.Close(); |
|
158 |
} |
|
159 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
static void TestEikonRename() |
0 | 161 |
// |
162 |
// Test EIKON style rename by creating a new file, and copying old data into new file |
|
163 |
// |
|
164 |
{ |
|
165 |
test.Next(_L("Rename file with DOS compatible name simulating EIKON")); |
|
166 |
TInt r; |
|
167 |
RFile file; |
|
168 |
||
169 |
test.Next(_L("Create a new file with DOS compatible equivalent name")); |
|
170 |
r=file.Create(TheFs,_L("\\F32-TST\\EIKFILE"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
171 |
test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
0 | 172 |
file.Close(); |
173 |
||
174 |
test.Next(_L("Copy data from original file into new file")); |
|
175 |
r=TheFs.Replace(_L("\\F32-TST\\eikfile"),_L("\\F32-TST\\EIKFILE")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
176 |
test_KErrNone(r); |
0 | 177 |
|
178 |
test.Next(_L("Open the new file and write into it")); |
|
179 |
r=file.Open(TheFs,_L("\\F32-TST\\EIKFILE"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
180 |
test_KErrNone(r); |
0 | 181 |
|
182 |
r=file.Write(alphaPtr); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
183 |
test_KErrNone(r); |
0 | 184 |
|
185 |
file.Close(); |
|
186 |
} |
|
187 |
||
188 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
static void TestReplaceAndRename() |
0 | 190 |
// |
191 |
// Tests the bug which allows 2 files of the same name to be created has been fixed |
|
192 |
// |
|
193 |
{ |
|
194 |
TInt r; |
|
195 |
RFile file; |
|
196 |
||
197 |
// ************************************************************************* |
|
198 |
// First test with a non DOS compatible name renamed to a DOS compatible name |
|
199 |
test.Next(_L("Rename test to TEST and replace temp with TEST")); |
|
200 |
r=file.Replace(TheFs,_L("\\F32-TST\\test"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
201 |
test_KErrNone(r); |
0 | 202 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
203 |
test_KErrNone(r); |
0 | 204 |
file.Close(); |
205 |
||
206 |
r=TheFs.Rename(_L("\\F32-TST\\test"),_L("\\F32-TST\\TEST")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
207 |
test_KErrNone(r); |
0 | 208 |
r=file.Replace(TheFs,_L("\\F32-TST\\temp"),EFileWrite); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
209 |
test_KErrNone(r); |
0 | 210 |
r=file.Write(alphaPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
211 |
test_KErrNone(r); |
0 | 212 |
file.Close(); |
213 |
||
214 |
// Replace(oldName, newName) |
|
215 |
// Copy oldName to newName (ie temp to TEST) |
|
216 |
// If TEST does not exist, it is created and then temp's attributes etc are copied into it |
|
217 |
// then temp is deleted. If it does exist, it must be closed |
|
218 |
// The bug created a second file of the same name |
|
219 |
r=TheFs.Replace(_L("\\F32-TST\\temp"),_L("\\F32-TST\\TEST")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
220 |
test_KErrNone(r); |
0 | 221 |
|
222 |
// Check that there's only one file named TEST |
|
223 |
TInt fileCount=0; |
|
224 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("TEST")); |
|
225 |
test(fileCount==1); |
|
226 |
r=TheFs.Delete(_L("\\F32-TST\\TEST")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
227 |
test_KErrNone(r); |
0 | 228 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("TEST")); |
229 |
test(fileCount==0); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
230 |
test_KErrNone(r); |
0 | 231 |
|
232 |
||
233 |
//***************************************************** |
|
234 |
// The same test but with different source directories |
|
235 |
test.Next(_L("Rename test to and replace \\SYSTEM\\temp with TEST")); |
|
236 |
r=file.Replace(TheFs,_L("\\F32-TST\\test"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
237 |
test_KErrNone(r); |
0 | 238 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
239 |
test_KErrNone(r); |
0 | 240 |
file.Close(); |
241 |
||
242 |
r=TheFs.Rename(_L("\\F32-TST\\test"),_L("\\F32-TST\\TEST")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
243 |
test_KErrNone(r); |
0 | 244 |
r=file.Replace(TheFs,_L("\\F32-TST\\SYSTEM\\temp"),EFileWrite); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
245 |
test_KErrNone(r); |
0 | 246 |
r=file.Write(alphaPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
247 |
test_KErrNone(r); |
0 | 248 |
file.Close(); |
249 |
||
250 |
// The bug created a second file of the same name |
|
251 |
r=TheFs.Replace(_L("\\F32-TST\\SYSTEM\\temp"),_L("\\F32-TST\\TEST")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
252 |
test_KErrNone(r); |
0 | 253 |
|
254 |
fileCount=0; |
|
255 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("TEST")); |
|
256 |
test(fileCount==1); |
|
257 |
r=TheFs.Delete(_L("\\F32-TST\\TEST")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
258 |
test_KErrNone(r); |
0 | 259 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("TEST")); |
260 |
test(fileCount==0); |
|
261 |
// Test that system directory is now empty |
|
262 |
fileCount=0; |
|
263 |
fileCount=CountFiles(_L("\\F32-TST\\SYSTEM\\"),_L("temp")); |
|
264 |
test(fileCount==0); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
265 |
test_KErrNone(r); |
0 | 266 |
|
267 |
// ************************************************************************* |
|
268 |
// Test with a DOS compatible name renamed to a different DOS compatible name |
|
269 |
test.Next(_L("Rename little to BIG and replace temp with BIG")); |
|
270 |
r=file.Replace(TheFs,_L("\\F32-TST\\little"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
271 |
test_KErrNone(r); |
0 | 272 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
273 |
test_KErrNone(r); |
0 | 274 |
file.Close(); |
275 |
||
276 |
// Test a long path (>250 chrs) |
|
277 |
r=TheFs.Rename(_L("\\F32-TST\\little"),_L("\\F32-TST\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\0495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\middle.gif")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
278 |
test_Value(r, r == KErrBadName); |
0 | 279 |
|
280 |
r=TheFs.Rename(_L("\\F32-TST\\little"),_L("\\F32-TST\\BIG")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
281 |
test_KErrNone(r); |
0 | 282 |
r=file.Replace(TheFs,_L("\\F32-TST\\temp"),EFileWrite); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
283 |
test_KErrNone(r); |
0 | 284 |
r=file.Write(alphaPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
285 |
test_KErrNone(r); |
0 | 286 |
file.Close(); |
287 |
||
288 |
r=TheFs.Replace(_L("\\F32-TST\\temp"),_L("\\F32-TST\\BIG")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
289 |
test_KErrNone(r); |
0 | 290 |
|
291 |
fileCount=0; |
|
292 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("BIG")); |
|
293 |
test(fileCount==1); |
|
294 |
r=TheFs.Delete(_L("\\F32-TST\\BIG")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
295 |
test_KErrNone(r); |
0 | 296 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("BIG")); |
297 |
test(fileCount==0); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
298 |
test_KErrNone(r); |
0 | 299 |
|
300 |
// *********************************** |
|
301 |
// Test with a non-DOS compatible name |
|
302 |
test.Next(_L("Rename veryLongFileName to VERYLONGFILENAME")); |
|
303 |
r=file.Replace(TheFs,_L("\\F32-TST\\veryLongFileName"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
304 |
test_KErrNone(r); |
0 | 305 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
306 |
test_KErrNone(r); |
0 | 307 |
file.Close(); |
308 |
||
309 |
r=TheFs.Rename(_L("\\F32-TST\\veryLongFileName"),_L("\\F32-TST\\VERYLONGFILENAME")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
310 |
test_KErrNone(r); |
0 | 311 |
r=file.Replace(TheFs,_L("\\F32-TST\\temp"),EFileWrite); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
312 |
test_KErrNone(r); |
0 | 313 |
r=file.Write(alphaPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
314 |
test_KErrNone(r); |
0 | 315 |
file.Close(); |
316 |
||
317 |
r=TheFs.Replace(_L("\\F32-TST\\temp"),_L("\\F32-TST\\VERYLONGFILENAME")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
318 |
test_KErrNone(r); |
0 | 319 |
|
320 |
fileCount=0; |
|
321 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("VERYLONGFILENAME")); |
|
322 |
test(fileCount==1); |
|
323 |
r=TheFs.Delete(_L("\\F32-TST\\VERYLONGFILENAME")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
324 |
test_KErrNone(r); |
0 | 325 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("VERYLONGFILENAME")); |
326 |
test(fileCount==0); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
327 |
test_KErrNone(r); |
0 | 328 |
|
329 |
// ******************************* |
|
330 |
// Test with a DOS compatible name |
|
331 |
test.Next(_L("Rename FILE to FILE and replace temp with FILE")); |
|
332 |
r=file.Replace(TheFs,_L("\\F32-TST\\FILE"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
333 |
test_KErrNone(r); |
0 | 334 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
335 |
test_KErrNone(r); |
0 | 336 |
file.Close(); |
337 |
||
338 |
r=TheFs.Rename(_L("\\F32-TST\\FILE"),_L("\\F32-TST\\FILE")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
339 |
test_KErrNone(r); |
0 | 340 |
r=file.Replace(TheFs,_L("\\F32-TST\\temp"),EFileWrite); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
341 |
test_KErrNone(r); |
0 | 342 |
r=file.Write(alphaPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
343 |
test_KErrNone(r); |
0 | 344 |
file.Close(); |
345 |
||
346 |
r=TheFs.Replace(_L("\\F32-TST\\temp"),_L("\\F32-TST\\FILE")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
347 |
test_KErrNone(r); |
0 | 348 |
|
349 |
fileCount=0; |
|
350 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("FILE")); |
|
351 |
test(fileCount==1); |
|
352 |
r=TheFs.Delete(_L("\\F32-TST\\FILE")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
353 |
test_KErrNone(r); |
0 | 354 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("FILE")); |
355 |
test(fileCount==0); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
356 |
test_KErrNone(r); |
0 | 357 |
|
358 |
// ************************************************** |
|
359 |
// Test with a DOS compatible name which is kept open |
|
360 |
test.Next(_L("Rename test1 to TEST1 and replace temp1 with TEST1 while it's open")); |
|
361 |
r=file.Replace(TheFs,_L("\\F32-TST\\test1"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
362 |
test_KErrNone(r); |
0 | 363 |
r=file.Write(BeckPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
364 |
test_KErrNone(r); |
0 | 365 |
file.Close(); |
366 |
||
367 |
r=TheFs.Rename(_L("\\F32-TST\\test1"),_L("\\F32-TST\\TEST1")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
368 |
test_KErrNone(r); |
0 | 369 |
|
370 |
// Try with the file open |
|
371 |
RFile openFile; |
|
372 |
r=openFile.Open(TheFs,_L("\\F32-TST\\TEST1"),EFileRead|EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
373 |
test_KErrNone(r); |
0 | 374 |
|
375 |
r=file.Replace(TheFs,_L("\\F32-TST\\temp"),EFileWrite); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
376 |
test_KErrNone(r); |
0 | 377 |
r=file.Write(alphaPtr); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
378 |
test_KErrNone(r); |
0 | 379 |
file.Close(); |
380 |
||
381 |
r=TheFs.Replace(_L("\\F32-TST\\temp"),_L("\\F32-TST\\TEST1")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
382 |
test_Value(r, r == KErrInUse); // Fails as it should! But not intuitive bearing in mind the other bug... |
0 | 383 |
|
384 |
openFile.Close(); |
|
385 |
||
386 |
r=TheFs.Replace(_L("\\F32-TST\\temp"),_L("\\F32-TST\\TEST1")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
387 |
test_KErrNone(r); |
0 | 388 |
|
389 |
fileCount=0; |
|
390 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("TEST1")); |
|
391 |
test(fileCount==1); |
|
392 |
r=TheFs.Delete(_L("\\F32-TST\\TEST1")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
393 |
test_KErrNone(r); |
0 | 394 |
fileCount=CountFiles(_L("\\F32-TST\\"),_L("TEST1")); |
395 |
test(fileCount==0); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
396 |
test_KErrNone(r); |
0 | 397 |
|
398 |
} |
|
399 |
||
400 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
401 |
//------------------------------------------------------------------- |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
402 |
/** |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
403 |
Create a directory; create many files in it (the directory will become more that 1 cluster) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
404 |
Then rename every file in this directory to a new name. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
405 |
*/ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
406 |
void TestRenameManyFilesInTheSameDir() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
407 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
408 |
test.Next(_L("TestRenameManyFilesInTheSameDir")); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
409 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
410 |
if(Is_Win32(TheFs, gDriveNum)) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
411 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
412 |
test.Printf(_L("Skipping on WINS drive\n")); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
413 |
return; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
414 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
415 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
416 |
_LIT(KDir, "\\dir1\\"); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
417 |
_LIT(KFile, "filename_long-"); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
418 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
419 |
//-- the number of files is chosen the way to have the directory file at least 2 clusters long (on FAT) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
420 |
//-- "filename_long-XXX" will correspond to 2 VFAT entries in the directory; max. cluster size of FAT is 32K |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
421 |
//-- 2*32*600 = 38400 > 32K |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
422 |
const TInt KNumFiles = 600; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
423 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
424 |
TName fName; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
425 |
TInt i; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
426 |
TInt nRes; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
427 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
428 |
//-- quick format the drive |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
429 |
nRes = FormatDrive(TheFs, gDriveNum, ETrue); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
430 |
test_KErrNone(nRes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
431 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
432 |
MakeDir(KDir); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
433 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
434 |
//-- create a number of files in a single directory, it shall be larger than 1 cluster. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
435 |
for(i=0; i<KNumFiles; ++i) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
436 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
437 |
fName.Format(_L("%S%S%03d"), &KDir, &KFile, i); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
438 |
nRes = CreateEmptyFile(TheFs, fName, 0); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
439 |
test_KErrNone(nRes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
440 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
441 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
442 |
//-- rename all files in the same directory |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
443 |
TName fNameNew; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
444 |
for(i=0; i<KNumFiles; ++i) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
445 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
446 |
fName.Format(_L("%S%S%03d"), &KDir, &KFile, i); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
447 |
fNameNew.Format(_L("%S%S%03d_new"), &KDir, &KFile, i); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
448 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
449 |
nRes = TheFs.Rename(fName, fNameNew); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
450 |
test_KErrNone(nRes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
451 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
452 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
453 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
454 |
fName.Format(_L("%c:"), gDriveNum+'A'); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
455 |
nRes = TheFs.CheckDisk(fName); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
456 |
test_Value(nRes, nRes == KErrNone || nRes == KErrNotSupported); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
457 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
458 |
//-- clean up |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
459 |
for(i=0; i<KNumFiles; ++i) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
460 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
461 |
fNameNew.Format(_L("%S%S%03d_new"), &KDir, &KFile, i); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
462 |
nRes = TheFs.Delete(fNameNew); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
463 |
test_KErrNone(nRes); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
464 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
465 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
466 |
fName.Format(_L("%c:"), gDriveNum+'A'); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
467 |
nRes = TheFs.CheckDisk(fName); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
468 |
test_Value(nRes, nRes == KErrNone || nRes == KErrNotSupported); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
469 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
470 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
471 |
nRes = TheFs.RmDir(KDir); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
472 |
test_KErrNone(nRes); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
473 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
474 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
475 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
476 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
477 |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
478 |
void CallTestsL(void) |
0 | 479 |
{ |
480 |
||
481 |
test.Title(); |
|
482 |
test.Start(_L("Testing rename")); |
|
483 |
||
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
//-- set up console output |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
485 |
F32_Test_Utils::SetConsole(test.Console()); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
486 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
488 |
test_KErrNone(nRes); |
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
489 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
PrintDrvInfo(TheFs, gDriveNum); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
491 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
492 |
if(!Is_Win32(TheFs, gDriveNum)) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
493 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
nRes = FormatDrive(TheFs, gDriveNum, ETrue); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
495 |
test_KErrNone(nRes); |
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
496 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
497 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
499 |
MakeDir(_L("\\F32-TST\\SYSTEM\\")); |
0 | 500 |
CreateTestFiles(); |
501 |
TestRFsRename(); |
|
502 |
TestRFileRename(); |
|
503 |
TestEikonRename(); |
|
504 |
TestReplaceAndRename(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
505 |
TestRenameManyFilesInTheSameDir(); |
0 | 506 |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
507 |
if(!Is_Win32(TheFs, gDriveNum)) |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
508 |
{ |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
509 |
nRes = FormatDrive(TheFs, gDriveNum, ETrue); |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
510 |
test_KErrNone(nRes); |
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
511 |
} |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
512 |
|
0 | 513 |
test.End(); |
514 |
test.Close(); |
|
515 |
} |
|
516 |