sl@0
|
1 |
// Copyright (c) 2006-2010 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 "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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "cdtest.h"
|
sl@0
|
17 |
#include "hashing.h"
|
sl@0
|
18 |
#include "common.h"
|
sl@0
|
19 |
#include<bautils.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
//Constants taken from SqlSrvConfig.h
|
sl@0
|
22 |
#ifdef __WINSCW__
|
sl@0
|
23 |
const TInt KDefaultSoftHeapLimitKb = 1024;
|
sl@0
|
24 |
#else
|
sl@0
|
25 |
const TInt KDefaultSoftHeapLimitKb = 8192;
|
sl@0
|
26 |
#endif
|
sl@0
|
27 |
|
sl@0
|
28 |
// Includes any code required for 'Code-Driven' testing, generally tests
|
sl@0
|
29 |
// that cannot be data-driven (or not completely).
|
sl@0
|
30 |
|
sl@0
|
31 |
CSQLCDT::~CSQLCDT()
|
sl@0
|
32 |
{
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
CSQLCDT::CSQLCDT()
|
sl@0
|
36 |
{
|
sl@0
|
37 |
SetTestStepName(KSQLCDT);
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
|
sl@0
|
41 |
// Look at 'arg' and call whichever function is required.
|
sl@0
|
42 |
void CSQLCDT::ResolveTestFunctionL(const TDesC &acfgblk, const TInt acnnum,
|
sl@0
|
43 |
const TPtrC &arg )
|
sl@0
|
44 |
{
|
sl@0
|
45 |
_LIT(KTestFunction, "cdtest::ResolveTestFunction");
|
sl@0
|
46 |
INFO_PRINTF3(_L("In %S, arg is %S"), &KTestFunction, &arg);
|
sl@0
|
47 |
|
sl@0
|
48 |
if(arg == _L("WriteBigTable"))
|
sl@0
|
49 |
WriteBigTableL(acfgblk, acnnum);
|
sl@0
|
50 |
else if(arg == _L("ReadBigTable"))
|
sl@0
|
51 |
ReadBigTableL(acfgblk);
|
sl@0
|
52 |
|
sl@0
|
53 |
// This assumes that a ParameterIndex and ColumnIndex call has been
|
sl@0
|
54 |
// set up previously - the apidxs/apicxs array access below will
|
sl@0
|
55 |
// certainly PANIC if you haven't done the require preparation..
|
sl@0
|
56 |
else if(arg == _L("CopyCellsUsingStreams"))
|
sl@0
|
57 |
CopyCellsUsingStreamsL(acfgblk);
|
sl@0
|
58 |
else if(arg == _L("WriteIntsToStream"))
|
sl@0
|
59 |
WriteIntsToStream(acfgblk, acnnum);
|
sl@0
|
60 |
else if(arg == _L("NearFillDisk"))
|
sl@0
|
61 |
NearFillDisk(acfgblk);
|
sl@0
|
62 |
else if(arg == _L("ScalarFullSelect"))
|
sl@0
|
63 |
ScalarFullSelectL(acfgblk, acnnum);
|
sl@0
|
64 |
else if(arg == _L("FilesDifferBySize"))
|
sl@0
|
65 |
FilesDifferBySize(acfgblk, acnnum);
|
sl@0
|
66 |
else if(arg == _L("SecurityPolicyCheck"))
|
sl@0
|
67 |
SecurityPolicyCheck(acfgblk, acnnum);
|
sl@0
|
68 |
else if(arg == _L("CollationTest"))
|
sl@0
|
69 |
CollationTest(acfgblk, acnnum);
|
sl@0
|
70 |
|
sl@0
|
71 |
else User::Panic(_L("Unknown Function"), 42);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
// ------------------------------------------------------------------------
|
sl@0
|
75 |
//
|
sl@0
|
76 |
// There's some hardwired nastiness in here - which we might be able to remove
|
sl@0
|
77 |
// if we can restructure the code (with the parameter index array as a
|
sl@0
|
78 |
// member variable in sqlfn), but until we can get reporting (INFO_PRINTF etc)
|
sl@0
|
79 |
// working in new objects that isn't going to happen.
|
sl@0
|
80 |
// There should have been a
|
sl@0
|
81 |
// 'Insert into t(what, ever, whatever) values (:FInt, :FReal, :FText)'
|
sl@0
|
82 |
// ... before this is called. Those on the right are the nasty hardwiring,
|
sl@0
|
83 |
// and should correspond to integer, real, and text fields.
|
sl@0
|
84 |
void CSQLCDT::WriteBigTableL(const TDesC &acfgblk, TInt acnnum )
|
sl@0
|
85 |
{
|
sl@0
|
86 |
_LIT(KTestFunction, "WriteBigTable");
|
sl@0
|
87 |
|
sl@0
|
88 |
// Parameters for the loop.
|
sl@0
|
89 |
TInt low=1, high=10, step=1, experr = KErrNone;
|
sl@0
|
90 |
TReal mult; TPtrC text, experrS;
|
sl@0
|
91 |
FromConfig(KTestFunction, acfgblk, _L("LowCount"), low);
|
sl@0
|
92 |
FromConfig(KTestFunction, acfgblk, _L("HighCount"), high);
|
sl@0
|
93 |
FromConfig(KTestFunction, acfgblk, _L("CountStep"), step);
|
sl@0
|
94 |
FromConfig(KTestFunction, acfgblk, _L("Multiplier"), mult);
|
sl@0
|
95 |
FromConfig(KTestFunction, acfgblk, _L("Text"), text);
|
sl@0
|
96 |
if( FromConfig(KTestFunction, acfgblk, _L("EventuallyExpectedError"), experrS) )
|
sl@0
|
97 |
experr = ErrStringToEnum(experrS);
|
sl@0
|
98 |
|
sl@0
|
99 |
// First work out if out text is actually a filename..
|
sl@0
|
100 |
TInt textfromfile=0;
|
sl@0
|
101 |
textfromfile = BaflUtils::FileExists(irfs, text);
|
sl@0
|
102 |
|
sl@0
|
103 |
// Ahoy! Nasty hardwiring ahead!
|
sl@0
|
104 |
TInt pidxi = ParamIndex(_L(":FInt"), acfgblk, 0 );
|
sl@0
|
105 |
TInt pidxr = ParamIndex(_L(":FReal"), acfgblk, 0 );
|
sl@0
|
106 |
TInt pidxt = ParamIndex(_L(":FText"), acfgblk, 0 );
|
sl@0
|
107 |
|
sl@0
|
108 |
TInt i;
|
sl@0
|
109 |
for(i=low ; i<=high ; i+=step)
|
sl@0
|
110 |
{
|
sl@0
|
111 |
TInt err=KErrNone;
|
sl@0
|
112 |
// Can use a stream write for speed to write the text to the disk. Don't
|
sl@0
|
113 |
// make the file too big or a memory error (server side) will result.
|
sl@0
|
114 |
if(textfromfile)
|
sl@0
|
115 |
SWBindTextL(pidxt, text, acfgblk, acnnum);
|
sl@0
|
116 |
else
|
sl@0
|
117 |
{
|
sl@0
|
118 |
err = isqlst.BindText(pidxt, text);
|
sl@0
|
119 |
ReportOnError( KTestFunction, _L("BindText"), acfgblk, acnnum, err );
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
TReal tr = i * mult;
|
sl@0
|
123 |
err = isqlst.BindInt(pidxi, i);
|
sl@0
|
124 |
ReportOnError( KTestFunction, _L("BindInt"), acfgblk, acnnum, err );
|
sl@0
|
125 |
err = isqlst.BindReal(pidxr, tr);
|
sl@0
|
126 |
ReportOnError( KTestFunction, _L("BindReal"), acfgblk, acnnum, err);
|
sl@0
|
127 |
|
sl@0
|
128 |
err = isqlst.Exec();
|
sl@0
|
129 |
if((err != KErrNone) && (err == experr))
|
sl@0
|
130 |
{
|
sl@0
|
131 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
132 |
INFO_PRINTF3(_L("Loop dropped out with expected error %S, i=%d"), &experrS, i );
|
sl@0
|
133 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
134 |
break;
|
sl@0
|
135 |
}
|
sl@0
|
136 |
else if(err < 0) // <0 a real error we weren't expecting.
|
sl@0
|
137 |
{
|
sl@0
|
138 |
ReportOnError( KTestFunction, _L("Exec"), acfgblk, acnnum, err );
|
sl@0
|
139 |
INFO_PRINTF3(_L("%S: counter i is %d"), &KTestFunction, i );
|
sl@0
|
140 |
break;
|
sl@0
|
141 |
}
|
sl@0
|
142 |
|
sl@0
|
143 |
err = isqlst.Reset();
|
sl@0
|
144 |
ReportOnError( KTestFunction, _L("Reset"), acfgblk, acnnum, err );
|
sl@0
|
145 |
acnnum++;
|
sl@0
|
146 |
}
|
sl@0
|
147 |
isqlst.Close();
|
sl@0
|
148 |
|
sl@0
|
149 |
return;
|
sl@0
|
150 |
}
|
sl@0
|
151 |
void CSQLCDT::ReadBigTableL(const TDesC &acfgblk)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
_LIT(KTestFunction, "ReadBigTable");
|
sl@0
|
154 |
|
sl@0
|
155 |
// Parameters for the loop.
|
sl@0
|
156 |
TInt low=1, high=10, step=1, err;
|
sl@0
|
157 |
TReal mult; TPtrC text;
|
sl@0
|
158 |
FromConfig(KTestFunction, acfgblk, _L("LowCount"), low);
|
sl@0
|
159 |
FromConfig(KTestFunction, acfgblk, _L("HighCount"), high);
|
sl@0
|
160 |
FromConfig(KTestFunction, acfgblk, _L("CountStep"), step);
|
sl@0
|
161 |
FromConfig(KTestFunction, acfgblk, _L("Multiplier"), mult);
|
sl@0
|
162 |
FromConfig(KTestFunction, acfgblk, _L("Text"), text);
|
sl@0
|
163 |
|
sl@0
|
164 |
// First work out if out text is actually a filename..
|
sl@0
|
165 |
TInt textfromfile=0;
|
sl@0
|
166 |
textfromfile = BaflUtils::FileExists(irfs, text);
|
sl@0
|
167 |
|
sl@0
|
168 |
// Ahoy! Nasty hardwiring ahead!
|
sl@0
|
169 |
TInt cidxi = ColumnIndex(_L("Someint"), acfgblk, 0 );
|
sl@0
|
170 |
TInt cidxr = ColumnIndex(_L("Somereal"), acfgblk, 0 );
|
sl@0
|
171 |
TInt cidxt = ColumnIndex(_L("Sometext"), acfgblk, 0 );
|
sl@0
|
172 |
|
sl@0
|
173 |
for(TInt i=low ; i<=high ; i+=step)
|
sl@0
|
174 |
{
|
sl@0
|
175 |
TReal tr = i * mult;
|
sl@0
|
176 |
// INFO_PRINTF3(_L("CFGBLK: %S COUNT: %d"), &acfgblk, i);
|
sl@0
|
177 |
|
sl@0
|
178 |
TInt cint = isqlst.ColumnInt(cidxi);
|
sl@0
|
179 |
TReal creal = isqlst.ColumnReal(cidxr);
|
sl@0
|
180 |
if((cint != i) || (creal != tr))
|
sl@0
|
181 |
{
|
sl@0
|
182 |
SetTestStepResult(EFail);
|
sl@0
|
183 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
184 |
ERR_PRINTF4(_L("%S: ColumnInt gave %d, wanted %d"),
|
sl@0
|
185 |
&KTestFunction, cint, i );
|
sl@0
|
186 |
ERR_PRINTF4(_L("%S: ColumnReal gave %f, wanted %f"),
|
sl@0
|
187 |
&KTestFunction, creal, tr );
|
sl@0
|
188 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
189 |
break;
|
sl@0
|
190 |
}
|
sl@0
|
191 |
// Now check the text..
|
sl@0
|
192 |
if(textfromfile)
|
sl@0
|
193 |
SRColumnTextL(cidxt, text, acfgblk, -1 );
|
sl@0
|
194 |
else
|
sl@0
|
195 |
ColumnTextL(cidxt, text, acfgblk, -1 );
|
sl@0
|
196 |
if(isqlst.Next()==KSqlAtEnd)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
// This expected error was for *writing* the table - we don't
|
sl@0
|
199 |
// get an error reading it back, just KSqlAtEnd. But lets assume
|
sl@0
|
200 |
// that an expected error on write implies a short table and
|
sl@0
|
201 |
// so no failure if we get KSqlAtEnd early.
|
sl@0
|
202 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
203 |
INFO_PRINTF3(_L("%S: Next gave KSqlAtEnd, i is %d"),
|
sl@0
|
204 |
&KTestFunction, i );
|
sl@0
|
205 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
206 |
break;
|
sl@0
|
207 |
}
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
if( (err = isqlst.Next()) != KSqlErrMisuse )
|
sl@0
|
211 |
{
|
sl@0
|
212 |
SetTestStepResult(EFail);
|
sl@0
|
213 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
214 |
ERR_PRINTF3(_L("%S: Next gave %d, is there some table left? Expected KSqlErrMisuse"), &KTestFunction, err );
|
sl@0
|
215 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
return;
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
|
sl@0
|
221 |
// Copy a single cell in a table using streams. We'll use the BindBinary
|
sl@0
|
222 |
// and ColumnBinary methods of RSqlParamWriteStream and RSqlColumnReadStream
|
sl@0
|
223 |
// respectively. Don't try to copy integers or reals, as the API spec
|
sl@0
|
224 |
// says very clearly in a table, converting most of these to Binary
|
sl@0
|
225 |
// gives KNullDesc8.
|
sl@0
|
226 |
void CSQLCDT::CopyCellsUsingStreamsL(const TDesC &acfgblk)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
_LIT(KTestFunction, "CopyCellUsingStreams");
|
sl@0
|
229 |
|
sl@0
|
230 |
// We only have one RSqlStatement around, and we must have two - a
|
sl@0
|
231 |
// source and destination, so lets get another one - we'll write to
|
sl@0
|
232 |
// this.
|
sl@0
|
233 |
RSqlStatement sqlst2;
|
sl@0
|
234 |
|
sl@0
|
235 |
// The prepare statement used to add to the second table.
|
sl@0
|
236 |
TPtrC prep;
|
sl@0
|
237 |
FromConfig(KTestFunction, acfgblk, _L("PrepareStatement"), prep);
|
sl@0
|
238 |
// The parameter name (e.g :freddy) in the above.
|
sl@0
|
239 |
TPtrC paramname;
|
sl@0
|
240 |
FromConfig(KTestFunction, acfgblk, _L("ParamName"), paramname);
|
sl@0
|
241 |
|
sl@0
|
242 |
// Prepare and get pidx.
|
sl@0
|
243 |
TInt err = sqlst2.Prepare(isqldb, prep);
|
sl@0
|
244 |
TInt pidx = sqlst2.ParameterIndex(paramname);
|
sl@0
|
245 |
|
sl@0
|
246 |
// Whilst we're reading
|
sl@0
|
247 |
while(isqlst.Next() == KSqlAtRow)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
// First lets find a cell to copy. This assumes there is a single
|
sl@0
|
250 |
// column selected..
|
sl@0
|
251 |
// Set up where we're reading from. ColumnIndex will be zero.
|
sl@0
|
252 |
// Obviously a prepare must already have been done.
|
sl@0
|
253 |
RSqlColumnReadStream sqlr;
|
sl@0
|
254 |
err = sqlr.ColumnText(isqlst, 0);
|
sl@0
|
255 |
|
sl@0
|
256 |
// Read a cell from the database as a stream. Pass that stream to
|
sl@0
|
257 |
// another stream, an RSqlParamWriteStream to copy the cell into
|
sl@0
|
258 |
// another db.
|
sl@0
|
259 |
|
sl@0
|
260 |
// Get our writable stream..
|
sl@0
|
261 |
RSqlParamWriteStream sqlw;
|
sl@0
|
262 |
|
sl@0
|
263 |
// Set up where we're writing to.
|
sl@0
|
264 |
err = sqlw.BindText(sqlst2, pidx);
|
sl@0
|
265 |
|
sl@0
|
266 |
// Write.
|
sl@0
|
267 |
sqlw.WriteL(sqlr);
|
sl@0
|
268 |
sqlw.Close();
|
sl@0
|
269 |
err = sqlst2.Exec();
|
sl@0
|
270 |
err = sqlst2.Reset();
|
sl@0
|
271 |
}
|
sl@0
|
272 |
sqlst2.Close();
|
sl@0
|
273 |
return;
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
// Write to 32-bit signed integers to a stream (a cell in a table) until
|
sl@0
|
277 |
// the write operation Leaves with a KErrNoMem. A 'prepare' statement
|
sl@0
|
278 |
// must already have been run, and a parameterindex also. We assume
|
sl@0
|
279 |
// that the parameterindex is zero.
|
sl@0
|
280 |
// If the user wants to do an Exec and Reset, that's up to them. That
|
sl@0
|
281 |
// would end up sticking a NULL into the current cell though.
|
sl@0
|
282 |
void CSQLCDT::WriteIntsToStream(const TDesC &acfgblk, const TInt acnnum)
|
sl@0
|
283 |
|
sl@0
|
284 |
{
|
sl@0
|
285 |
_LIT(KTestFunction, "WriteIntsToStream");
|
sl@0
|
286 |
|
sl@0
|
287 |
// Get our writable stream..
|
sl@0
|
288 |
RSqlParamWriteStream sqlw;
|
sl@0
|
289 |
// Find out how many integers to write..
|
sl@0
|
290 |
TInt count;
|
sl@0
|
291 |
FromConfig(KTestFunction, acfgblk, _L("Count"), count);
|
sl@0
|
292 |
if(count == -1) count = 2000000000;
|
sl@0
|
293 |
|
sl@0
|
294 |
// Assume only one 'ParameterIndex' has been run..
|
sl@0
|
295 |
sqlw.BindBinary(isqlst,0);
|
sl@0
|
296 |
|
sl@0
|
297 |
TInt i, leavecode;
|
sl@0
|
298 |
for(i=0 ; i<count ; i++)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
// A fast way to send a lot of data down a stream..
|
sl@0
|
301 |
TRAP(leavecode, sqlw.WriteInt32L(i));
|
sl@0
|
302 |
if(leavecode != KErrNone) break;
|
sl@0
|
303 |
}
|
sl@0
|
304 |
// Close the stream immediately. If we've run out of memory (a common test)
|
sl@0
|
305 |
// this will free it up and allow (e.g) LogEngine to function so we get
|
sl@0
|
306 |
// proper error reports.
|
sl@0
|
307 |
sqlw.Close();
|
sl@0
|
308 |
|
sl@0
|
309 |
ReportOnError( KTestFunction, _L("Stream Write"), acfgblk, acnnum, leavecode );
|
sl@0
|
310 |
INFO_PRINTF3(_L("%S bound %d integers"), &KTestFunction, i );
|
sl@0
|
311 |
|
sl@0
|
312 |
return;
|
sl@0
|
313 |
}
|
sl@0
|
314 |
|
sl@0
|
315 |
//This function is needed for drives with more free space than KMaxTUint32 (4GB -1)
|
sl@0
|
316 |
//This is because in a FAT32 file system, the maximum file size is (4GB-1)
|
sl@0
|
317 |
//In the case where the free space is larger than this limit, this function will create additional
|
sl@0
|
318 |
//file(s)until the disk is under the (4GB-1) limit. After that CSQLCDT::NearFillDisk will fill the
|
sl@0
|
319 |
//disk up to the required amount.
|
sl@0
|
320 |
void CSQLCDT::PrepareLargeDisk(const TDesC& /*acfgblk*/, const TDriveUnit atdu, TInt64 &atowrite)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
_LIT(KTestFunction, "PrepareLargeDisk");
|
sl@0
|
323 |
_LIT(KFillDiskName,"\\FillDisk");
|
sl@0
|
324 |
_LIT(KFillDiskExt,".txt");
|
sl@0
|
325 |
TFileName fname;
|
sl@0
|
326 |
TInt count = 1;
|
sl@0
|
327 |
TInt err = 0;
|
sl@0
|
328 |
|
sl@0
|
329 |
while(atowrite > KMaxTUint32)
|
sl@0
|
330 |
{
|
sl@0
|
331 |
RFile64 fillDiskFile;
|
sl@0
|
332 |
fname.Copy(atdu.Name());
|
sl@0
|
333 |
fname.Append(KFillDiskName);
|
sl@0
|
334 |
fname.AppendNum(count);
|
sl@0
|
335 |
fname.Append(KFillDiskExt);
|
sl@0
|
336 |
|
sl@0
|
337 |
if( (err = fillDiskFile.Create(irfs, fname, EFileWrite)) != KErrNone )
|
sl@0
|
338 |
{
|
sl@0
|
339 |
SetTestStepResult(EFail);
|
sl@0
|
340 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
341 |
ERR_PRINTF4(_L("%S: Failed to open RFile64 for file %S, err %d"),
|
sl@0
|
342 |
&KTestFunction, &fname, err );
|
sl@0
|
343 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
344 |
return;
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
if( (err = fillDiskFile.SetSize(KMaxTUint32)) != KErrNone )
|
sl@0
|
348 |
{
|
sl@0
|
349 |
SetTestStepResult(EFail);
|
sl@0
|
350 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
351 |
ERR_PRINTF4(_L("%S: Failed on RFile64::SetSize for file %S, err %d"),
|
sl@0
|
352 |
&KTestFunction, &fname, err );
|
sl@0
|
353 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
354 |
fillDiskFile.Close();
|
sl@0
|
355 |
return;
|
sl@0
|
356 |
}
|
sl@0
|
357 |
|
sl@0
|
358 |
fillDiskFile.Close();
|
sl@0
|
359 |
atowrite-=KMaxTUint32;
|
sl@0
|
360 |
count++;
|
sl@0
|
361 |
}
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
// Create a file specified by 'FillFile' in the config and write to
|
sl@0
|
365 |
// it until 'DiskFree' bytes remain. Note that because files use whole
|
sl@0
|
366 |
// sectors (512/1024/2048/4096 or whatever bytes), that attempting to leave
|
sl@0
|
367 |
// (e.g) 1023 bytes could result in 512 bytes remaining on a file system
|
sl@0
|
368 |
// with 512 byte sectors, or zero bytes remaining if the sectors are bigger.
|
sl@0
|
369 |
void CSQLCDT::NearFillDisk(const TDesC &acfgblk)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
_LIT(KTestFunction, "NearFillDisk");
|
sl@0
|
372 |
|
sl@0
|
373 |
// What file should we use? Requires a full path.
|
sl@0
|
374 |
TPtrC fillfile;
|
sl@0
|
375 |
(void)FromConfig(KTestFunction, acfgblk, _L("FillFile"), fillfile);
|
sl@0
|
376 |
irfs.Delete(fillfile);
|
sl@0
|
377 |
|
sl@0
|
378 |
// Get the drive number. This method ignores trailing text.
|
sl@0
|
379 |
// Probably wants upper case.
|
sl@0
|
380 |
TDriveUnit tdu(fillfile);
|
sl@0
|
381 |
|
sl@0
|
382 |
// Find out how much disk we want left..
|
sl@0
|
383 |
TInt free, err;
|
sl@0
|
384 |
(void)FromConfig(KTestFunction, acfgblk, _L("DiskFree"), free);
|
sl@0
|
385 |
|
sl@0
|
386 |
// Find out how much disk space currently remains..
|
sl@0
|
387 |
TVolumeInfo vol;
|
sl@0
|
388 |
if((err = irfs.Volume(vol, tdu )) != KErrNone)
|
sl@0
|
389 |
{
|
sl@0
|
390 |
SetTestStepResult(EFail);
|
sl@0
|
391 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
392 |
ERR_PRINTF4(_L("%S: Failed to get volume info for %S, err %d"),
|
sl@0
|
393 |
&KTestFunction, &fillfile, err );
|
sl@0
|
394 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
395 |
return;
|
sl@0
|
396 |
}
|
sl@0
|
397 |
|
sl@0
|
398 |
// So how many bytes do we need to write?
|
sl@0
|
399 |
TInt64 towrite = vol.iFree - free;
|
sl@0
|
400 |
INFO_PRINTF4(_L("%S: Disk writing %Ld, free %Ld"), &KTestFunction,
|
sl@0
|
401 |
towrite, vol.iFree );
|
sl@0
|
402 |
INFO_PRINTF3(_L("%S: free %Ld"), &KTestFunction, vol.iFree );
|
sl@0
|
403 |
INFO_PRINTF3(_L("%S: writing %Ld"), &KTestFunction, towrite );
|
sl@0
|
404 |
|
sl@0
|
405 |
if( towrite < 0 )
|
sl@0
|
406 |
{
|
sl@0
|
407 |
SetTestStepResult(EFail);
|
sl@0
|
408 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
409 |
ERR_PRINTF3(_L("%S: Disk wanted remaining less than current(%Ld)"),
|
sl@0
|
410 |
&KTestFunction, vol.iFree );
|
sl@0
|
411 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
412 |
return;
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
//In case the disk is large (i.e >4G -1 bytes) we need another function to
|
sl@0
|
416 |
//create more files to fill it
|
sl@0
|
417 |
PrepareLargeDisk(acfgblk, tdu, towrite);
|
sl@0
|
418 |
|
sl@0
|
419 |
// Get a file.
|
sl@0
|
420 |
RFile64 myfile;
|
sl@0
|
421 |
if( (err = myfile.Create(irfs, fillfile, EFileWrite)) != KErrNone )
|
sl@0
|
422 |
{
|
sl@0
|
423 |
SetTestStepResult(EFail);
|
sl@0
|
424 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
425 |
ERR_PRINTF4(_L("%S: Failed to open RFile64 for file %S, err %d"),
|
sl@0
|
426 |
&KTestFunction, &fillfile, err );
|
sl@0
|
427 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
428 |
return;
|
sl@0
|
429 |
}
|
sl@0
|
430 |
// Write it.
|
sl@0
|
431 |
|
sl@0
|
432 |
// We seem to hit trouble if we just try to write 'towrite' bytes, so
|
sl@0
|
433 |
// here we write 50% of them and check the remainder repeatedly until
|
sl@0
|
434 |
// the right amount remains. Actually it is unlikely to be exactly the
|
sl@0
|
435 |
// right amount - depending on sector sizes and other factors the
|
sl@0
|
436 |
// remaining space tends to be a kilobyte or two less than requested.
|
sl@0
|
437 |
// Obviously this is likely to be different between file system types,
|
sl@0
|
438 |
// between hardware and emulator and so on.
|
sl@0
|
439 |
|
sl@0
|
440 |
|
sl@0
|
441 |
TInt64 size = 0;
|
sl@0
|
442 |
while(towrite > 0)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
if(towrite < 1024) break;
|
sl@0
|
445 |
TInt64 tow = towrite/2;
|
sl@0
|
446 |
if(towrite < 4096) tow = towrite;
|
sl@0
|
447 |
size += tow;
|
sl@0
|
448 |
if( (err = myfile.SetSize(size)) != KErrNone )
|
sl@0
|
449 |
{
|
sl@0
|
450 |
SetTestStepResult(EFail);
|
sl@0
|
451 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
452 |
ERR_PRINTF4(_L("%S: Failed on RFile64::SetSize for file %S, err %d"),
|
sl@0
|
453 |
&KTestFunction, &fillfile, err );
|
sl@0
|
454 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
455 |
break;
|
sl@0
|
456 |
}
|
sl@0
|
457 |
err = irfs.Volume(vol, tdu );
|
sl@0
|
458 |
if(err != KErrNone)
|
sl@0
|
459 |
{
|
sl@0
|
460 |
SetTestStepResult(EFail);
|
sl@0
|
461 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
462 |
ERR_PRINTF3(_L("%S: 2-RFs::Volume() has failed, err=%d"),
|
sl@0
|
463 |
&KTestFunction, err);
|
sl@0
|
464 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
465 |
break;
|
sl@0
|
466 |
}
|
sl@0
|
467 |
towrite = vol.iFree - free;
|
sl@0
|
468 |
}
|
sl@0
|
469 |
|
sl@0
|
470 |
err = irfs.Volume(vol, tdu );
|
sl@0
|
471 |
if(err != KErrNone)
|
sl@0
|
472 |
{
|
sl@0
|
473 |
SetTestStepResult(EFail);
|
sl@0
|
474 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
475 |
ERR_PRINTF3(_L("%S: 3-RFs::Volume() has failed, err=%d"),
|
sl@0
|
476 |
&KTestFunction, err);
|
sl@0
|
477 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
478 |
}
|
sl@0
|
479 |
INFO_PRINTF3(_L("%S: Disk remaining is %Ld"), &KTestFunction, vol.iFree );
|
sl@0
|
480 |
myfile.Close();
|
sl@0
|
481 |
return;
|
sl@0
|
482 |
}
|
sl@0
|
483 |
|
sl@0
|
484 |
// This method exercises the TSqlScalarFullSelectQuery class, which is
|
sl@0
|
485 |
// just a wrapper. Its methods expect a select statement whose result will
|
sl@0
|
486 |
// be a single cell. Perhaps this should be in sqlfn.cpp.
|
sl@0
|
487 |
void CSQLCDT::ScalarFullSelectL(const TDesC &acfgblk, const TInt acnnum)
|
sl@0
|
488 |
|
sl@0
|
489 |
{
|
sl@0
|
490 |
_LIT(KTestFunction, "ScalarFullSelect");
|
sl@0
|
491 |
|
sl@0
|
492 |
// Look for an integer called 'Use_SetNN'.
|
sl@0
|
493 |
TInt useset;
|
sl@0
|
494 |
TBuf<KConfigItemMaxNameLength> conS(_L("Use_Set"));
|
sl@0
|
495 |
conS.AppendNum(acnnum);
|
sl@0
|
496 |
FromConfig(KTestFunction, acfgblk, conS, useset);
|
sl@0
|
497 |
// Look for a string called 'MethodNN'.
|
sl@0
|
498 |
TPtrC meth;
|
sl@0
|
499 |
TBuf<KConfigItemMaxNameLength> methS(_L("Method"));
|
sl@0
|
500 |
methS.AppendNum(acnnum);
|
sl@0
|
501 |
FromConfig(KTestFunction, acfgblk, methS, meth);
|
sl@0
|
502 |
// Look for a string called 'StatementNN'.
|
sl@0
|
503 |
TPtrC stmt;
|
sl@0
|
504 |
TBuf<KConfigItemMaxNameLength> stmtS(_L("Statement"));
|
sl@0
|
505 |
stmtS.AppendNum(acnnum);
|
sl@0
|
506 |
FromConfig(KTestFunction, acfgblk, stmtS, stmt);
|
sl@0
|
507 |
// Convert the SQL statement to an UTF-8 version.
|
sl@0
|
508 |
RBuf8 stmt8;
|
sl@0
|
509 |
stmt8.Create(stmt.Length());
|
sl@0
|
510 |
stmt8.Copy(stmt);
|
sl@0
|
511 |
CleanupClosePushL(stmt8);
|
sl@0
|
512 |
|
sl@0
|
513 |
// Look for a string called 'ResultNN'.
|
sl@0
|
514 |
TPtrC res;
|
sl@0
|
515 |
TBuf<KConfigItemMaxNameLength> resS(_L("Result"));
|
sl@0
|
516 |
resS.AppendNum(acnnum);
|
sl@0
|
517 |
FromConfig(KTestFunction, acfgblk, resS, res);
|
sl@0
|
518 |
// We may want to convert the expected result to a real or int or something
|
sl@0
|
519 |
TLex conv = res;
|
sl@0
|
520 |
|
sl@0
|
521 |
// Ok, now create a TSqlScalarFullSelectQuery object.
|
sl@0
|
522 |
TSqlScalarFullSelectQuery *asfs;
|
sl@0
|
523 |
TSqlScalarFullSelectQuery one(isqldb);
|
sl@0
|
524 |
TSqlScalarFullSelectQuery two;
|
sl@0
|
525 |
two.SetDatabase(isqldb);
|
sl@0
|
526 |
// Use one of the above objects.
|
sl@0
|
527 |
asfs = useset ? &two : &one;
|
sl@0
|
528 |
|
sl@0
|
529 |
// Get the action hash for this..
|
sl@0
|
530 |
CSQLSFSTEFAction *cs = new CSQLSFSTEFAction();
|
sl@0
|
531 |
TInt action = cs->GetNumFromString(meth);
|
sl@0
|
532 |
switch(action)
|
sl@0
|
533 |
{
|
sl@0
|
534 |
case CSQLSFSTEFAction::ESFS_SelectIntL:
|
sl@0
|
535 |
{
|
sl@0
|
536 |
TInt actual;
|
sl@0
|
537 |
if(i8bit)
|
sl@0
|
538 |
actual = asfs->SelectIntL(stmt8);
|
sl@0
|
539 |
else
|
sl@0
|
540 |
actual = asfs->SelectIntL(stmt);
|
sl@0
|
541 |
|
sl@0
|
542 |
TInt expected;
|
sl@0
|
543 |
if (res.CompareF(_L("DEFAULT_SOFT_HEAP_LIMIT")) == 0)
|
sl@0
|
544 |
{
|
sl@0
|
545 |
expected = KDefaultSoftHeapLimitKb;
|
sl@0
|
546 |
}
|
sl@0
|
547 |
else
|
sl@0
|
548 |
{
|
sl@0
|
549 |
conv.Val(expected);
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
if( actual != expected )
|
sl@0
|
553 |
{
|
sl@0
|
554 |
SetTestStepResult(EFail);
|
sl@0
|
555 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
556 |
ERR_PRINTF4(_L("%S: SelectIntL gave %d, wanted %d"),
|
sl@0
|
557 |
&KTestFunction, actual, expected);
|
sl@0
|
558 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
559 |
}
|
sl@0
|
560 |
else
|
sl@0
|
561 |
{
|
sl@0
|
562 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
563 |
INFO_PRINTF3(_L("%S: SelectIntL gave %d, as expected"),
|
sl@0
|
564 |
&KTestFunction, actual);
|
sl@0
|
565 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
566 |
}
|
sl@0
|
567 |
}
|
sl@0
|
568 |
break;
|
sl@0
|
569 |
|
sl@0
|
570 |
case CSQLSFSTEFAction::ESFS_SelectInt64L:
|
sl@0
|
571 |
{
|
sl@0
|
572 |
TInt64 actual;
|
sl@0
|
573 |
if(i8bit)
|
sl@0
|
574 |
actual = asfs->SelectInt64L(stmt8);
|
sl@0
|
575 |
else
|
sl@0
|
576 |
actual = asfs->SelectInt64L(stmt);
|
sl@0
|
577 |
TInt64 expected;
|
sl@0
|
578 |
conv.Val(expected);
|
sl@0
|
579 |
if( actual != expected )
|
sl@0
|
580 |
{
|
sl@0
|
581 |
SetTestStepResult(EFail);
|
sl@0
|
582 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
583 |
ERR_PRINTF4(_L("%S: SelectInt64L gave %d, wanted %d"),
|
sl@0
|
584 |
&KTestFunction, actual, expected);
|
sl@0
|
585 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
586 |
}
|
sl@0
|
587 |
else
|
sl@0
|
588 |
{
|
sl@0
|
589 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
590 |
INFO_PRINTF3(_L("%S: SelectInt64L gave %d, as expected"),
|
sl@0
|
591 |
&KTestFunction, actual);
|
sl@0
|
592 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
593 |
}
|
sl@0
|
594 |
}
|
sl@0
|
595 |
break;
|
sl@0
|
596 |
|
sl@0
|
597 |
case CSQLSFSTEFAction::ESFS_SelectRealL:
|
sl@0
|
598 |
{
|
sl@0
|
599 |
TReal actual;
|
sl@0
|
600 |
if(i8bit)
|
sl@0
|
601 |
actual = asfs->SelectRealL(stmt8);
|
sl@0
|
602 |
else
|
sl@0
|
603 |
actual = asfs->SelectRealL(stmt);
|
sl@0
|
604 |
TReal expected;
|
sl@0
|
605 |
conv.Val(expected);
|
sl@0
|
606 |
if( actual != expected )
|
sl@0
|
607 |
{
|
sl@0
|
608 |
SetTestStepResult(EFail);
|
sl@0
|
609 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
610 |
ERR_PRINTF4(_L("%S: SelectRealL gave %f, wanted %f"),
|
sl@0
|
611 |
&KTestFunction, actual, expected);
|
sl@0
|
612 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
613 |
}
|
sl@0
|
614 |
else
|
sl@0
|
615 |
{
|
sl@0
|
616 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
617 |
INFO_PRINTF3(_L("%S: SelectRealL gave %f, as expected"),
|
sl@0
|
618 |
&KTestFunction, actual);
|
sl@0
|
619 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
620 |
}
|
sl@0
|
621 |
}
|
sl@0
|
622 |
break;
|
sl@0
|
623 |
|
sl@0
|
624 |
case CSQLSFSTEFAction::ESFS_SelectTextL:
|
sl@0
|
625 |
{
|
sl@0
|
626 |
RBuf actual;
|
sl@0
|
627 |
actual.Create(32768);
|
sl@0
|
628 |
CleanupClosePushL(actual);
|
sl@0
|
629 |
TInt rc = KErrNone;
|
sl@0
|
630 |
if(i8bit)
|
sl@0
|
631 |
rc = asfs->SelectTextL(stmt8, actual);
|
sl@0
|
632 |
else
|
sl@0
|
633 |
rc = asfs->SelectTextL(stmt, actual);
|
sl@0
|
634 |
if( actual != res )
|
sl@0
|
635 |
{
|
sl@0
|
636 |
SetTestStepResult(EFail);
|
sl@0
|
637 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
638 |
ERR_PRINTF4(_L("%S: SelectTextL gave %S, wanted %S"),
|
sl@0
|
639 |
&KTestFunction, &actual, &res);
|
sl@0
|
640 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
641 |
}
|
sl@0
|
642 |
else
|
sl@0
|
643 |
{
|
sl@0
|
644 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
645 |
INFO_PRINTF3(_L("%S: SelectTextL gave %S, as expected"),
|
sl@0
|
646 |
&KTestFunction, &actual);
|
sl@0
|
647 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
648 |
}
|
sl@0
|
649 |
ReportOnError( KTestFunction, _L("SelectTextL"), acfgblk, acnnum,
|
sl@0
|
650 |
rc );
|
sl@0
|
651 |
CleanupStack::PopAndDestroy(1, &actual);
|
sl@0
|
652 |
}
|
sl@0
|
653 |
break;
|
sl@0
|
654 |
|
sl@0
|
655 |
case CSQLSFSTEFAction::ESFS_SelectBinaryL:
|
sl@0
|
656 |
{
|
sl@0
|
657 |
RBuf8 actual;
|
sl@0
|
658 |
actual.Create(32768);
|
sl@0
|
659 |
CleanupClosePushL(actual);
|
sl@0
|
660 |
TInt rc = KErrNone;
|
sl@0
|
661 |
if(i8bit)
|
sl@0
|
662 |
rc = asfs->SelectBinaryL(stmt8, actual);
|
sl@0
|
663 |
else
|
sl@0
|
664 |
rc = asfs->SelectBinaryL(stmt, actual);
|
sl@0
|
665 |
ReportOnError( KTestFunction, _L("SelectBinaryL"), acfgblk, acnnum, rc );
|
sl@0
|
666 |
if(!rc)
|
sl@0
|
667 |
{
|
sl@0
|
668 |
TInt rc2 = CompareBinaryAgainstFileL(actual, res);
|
sl@0
|
669 |
if(rc2)
|
sl@0
|
670 |
{
|
sl@0
|
671 |
SetTestStepResult(EFail);
|
sl@0
|
672 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
673 |
ERR_PRINTF3(_L("%S: File compare gave error %d"),
|
sl@0
|
674 |
&KTestFunction, rc2 );
|
sl@0
|
675 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
676 |
}
|
sl@0
|
677 |
else
|
sl@0
|
678 |
{
|
sl@0
|
679 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
680 |
_LIT(KSelectBinaryStr, "SelectBinaryL");
|
sl@0
|
681 |
ERR_PRINTF3(_L("%S: File compare successful, %S"), &KTestFunction, &KSelectBinaryStr);
|
sl@0
|
682 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
683 |
}
|
sl@0
|
684 |
|
sl@0
|
685 |
}
|
sl@0
|
686 |
CleanupStack::PopAndDestroy(1, &actual);
|
sl@0
|
687 |
}
|
sl@0
|
688 |
break;
|
sl@0
|
689 |
|
sl@0
|
690 |
default: User::Panic(_L("Unknown Function"), 49);
|
sl@0
|
691 |
|
sl@0
|
692 |
}
|
sl@0
|
693 |
CleanupStack::PopAndDestroy(1, &stmt8);
|
sl@0
|
694 |
}
|
sl@0
|
695 |
|
sl@0
|
696 |
// Verifies that two files differ by size.
|
sl@0
|
697 |
void CSQLCDT::FilesDifferBySize(const TDesC &acfgblk, const TInt acnnum)
|
sl@0
|
698 |
|
sl@0
|
699 |
{
|
sl@0
|
700 |
_LIT(KTestFunction, "FilesDifferBySize");
|
sl@0
|
701 |
|
sl@0
|
702 |
// Look for a string called 'FileANN'.
|
sl@0
|
703 |
TPtrC filea;
|
sl@0
|
704 |
TBuf<KConfigItemMaxNameLength> fileaS(_L("FileA"));
|
sl@0
|
705 |
fileaS.AppendNum(acnnum);
|
sl@0
|
706 |
FromConfig(KTestFunction, acfgblk, fileaS, filea);
|
sl@0
|
707 |
// Look for a string called 'FileBNN'.
|
sl@0
|
708 |
TPtrC fileb;
|
sl@0
|
709 |
TBuf<KConfigItemMaxNameLength> filebS(_L("FileB"));
|
sl@0
|
710 |
filebS.AppendNum(acnnum);
|
sl@0
|
711 |
FromConfig(KTestFunction, acfgblk, filebS, fileb);
|
sl@0
|
712 |
|
sl@0
|
713 |
TInt fza = FileSize(filea);
|
sl@0
|
714 |
TInt fzb = FileSize(fileb);
|
sl@0
|
715 |
if(fza == fzb)
|
sl@0
|
716 |
{
|
sl@0
|
717 |
SetTestStepResult(EFail);
|
sl@0
|
718 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
719 |
ERR_PRINTF4(_L("%S: File A %d, File B %d"), &KTestFunction, fza, fzb);
|
sl@0
|
720 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
721 |
}
|
sl@0
|
722 |
else
|
sl@0
|
723 |
{
|
sl@0
|
724 |
INFO_PRINTF1(HTML_GREEN);
|
sl@0
|
725 |
INFO_PRINTF6(_L("%S: Files %S and %S differ in size as expected, %d, %d"), &KTestFunction, &fileaS, &filebS, fza, fzb);
|
sl@0
|
726 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
727 |
}
|
sl@0
|
728 |
}
|
sl@0
|
729 |
|
sl@0
|
730 |
// Tests the method that retrive security policies.
|
sl@0
|
731 |
void CSQLCDT::SecurityPolicyCheck(const TDesC &/*acfgblk*/, const TInt /*acnnum*/)
|
sl@0
|
732 |
{
|
sl@0
|
733 |
// _LIT(KTestFunction, "SecurityPolicyCheck");
|
sl@0
|
734 |
|
sl@0
|
735 |
// The methods to be tested here have been tested in the developer test:
|
sl@0
|
736 |
// t_sqlsecurityXX.cpp. The work here has been deferred because it has been
|
sl@0
|
737 |
// duplicated in the unit tests.
|
sl@0
|
738 |
}
|
sl@0
|
739 |
|
sl@0
|
740 |
// Tests for Locale change
|
sl@0
|
741 |
// This test has been deferred pending a defect fix, defect is:
|
sl@0
|
742 |
// DEF091753 "Initialize locale" should be part of the system startup
|
sl@0
|
743 |
void CSQLCDT::CollationTest(const TDesC &/*acfgblk*/, const TInt /*acnnum*/)
|
sl@0
|
744 |
{
|
sl@0
|
745 |
TExtendedLocale myExtendedLocale;
|
sl@0
|
746 |
myExtendedLocale.LoadSystemSettings();
|
sl@0
|
747 |
|
sl@0
|
748 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
sl@0
|
749 |
|
sl@0
|
750 |
TBuf<100> DllLanguage;
|
sl@0
|
751 |
DllLanguage.Copy(_L("elocl_lan.003"));
|
sl@0
|
752 |
|
sl@0
|
753 |
TBuf<100> DllRegion;
|
sl@0
|
754 |
DllRegion.Copy(_L("elocl_reg.056"));
|
sl@0
|
755 |
|
sl@0
|
756 |
TBuf<100> DllCollation;
|
sl@0
|
757 |
DllCollation.Copy(_L("elocl_col.003"));
|
sl@0
|
758 |
|
sl@0
|
759 |
// Change the locale
|
sl@0
|
760 |
TInt err = myExtendedLocale.LoadLocale(DllLanguage, DllRegion, DllCollation);
|
sl@0
|
761 |
|
sl@0
|
762 |
#else
|
sl@0
|
763 |
|
sl@0
|
764 |
TBuf<100> DllName;
|
sl@0
|
765 |
DllName.Copy(_L("elocl.sc"));
|
sl@0
|
766 |
|
sl@0
|
767 |
// Change the locale to Scandinavian Locale
|
sl@0
|
768 |
TInt err = myExtendedLocale.LoadLocale(DllName);
|
sl@0
|
769 |
|
sl@0
|
770 |
#endif
|
sl@0
|
771 |
if( err != KErrNone )
|
sl@0
|
772 |
{
|
sl@0
|
773 |
_LIT(KTestFunction, "CollationTest");
|
sl@0
|
774 |
SetTestStepResult(EFail);
|
sl@0
|
775 |
INFO_PRINTF1(HTML_RED);
|
sl@0
|
776 |
ERR_PRINTF4(_L("%S: TExtendedLocale::LoadLocale gave %d, wanted %d"),
|
sl@0
|
777 |
&KTestFunction, err, KErrNone);
|
sl@0
|
778 |
INFO_PRINTF1(HTML_COLOUR_OFF);
|
sl@0
|
779 |
}
|
sl@0
|
780 |
|
sl@0
|
781 |
// Save the changes to system settings
|
sl@0
|
782 |
myExtendedLocale.SaveSystemSettings();
|
sl@0
|
783 |
|
sl@0
|
784 |
// Wait
|
sl@0
|
785 |
User::After(1000000);
|
sl@0
|
786 |
}
|
sl@0
|
787 |
|
sl@0
|
788 |
|