sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\demandpaging\t_chunkcreate.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
//
|
sl@0
|
19 |
#define __E32TEST_EXTENSION__
|
sl@0
|
20 |
#include <e32test.h>
|
sl@0
|
21 |
#include <dptest.h>
|
sl@0
|
22 |
#include <e32hal.h>
|
sl@0
|
23 |
#include <u32exec.h>
|
sl@0
|
24 |
#include <e32svr.h>
|
sl@0
|
25 |
#include <e32panic.h>
|
sl@0
|
26 |
#include "u32std.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
#include "t_dpcmn.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
_LIT(KGlobalChunkName, "TestChunk");
|
sl@0
|
31 |
|
sl@0
|
32 |
enum
|
sl@0
|
33 |
{
|
sl@0
|
34 |
ECreateNormal,
|
sl@0
|
35 |
ECreateCode,
|
sl@0
|
36 |
ECreateGlobal,
|
sl@0
|
37 |
ECreateLocalDE,
|
sl@0
|
38 |
ECreateGlobalDE,
|
sl@0
|
39 |
ECreateLocalDC,
|
sl@0
|
40 |
ECreateGlobalDC,
|
sl@0
|
41 |
};
|
sl@0
|
42 |
|
sl@0
|
43 |
enum
|
sl@0
|
44 |
{
|
sl@0
|
45 |
EPagingUnspec, // Has to be first as can't clear back to unspecified.
|
sl@0
|
46 |
EPagingOn,
|
sl@0
|
47 |
EPagingOff,
|
sl@0
|
48 |
EPagingNumberAttribs,
|
sl@0
|
49 |
};
|
sl@0
|
50 |
|
sl@0
|
51 |
|
sl@0
|
52 |
void VerifyChunkPaged(RChunk& aChunk, TBool aPaged, TInt aR)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
UpdatePaged(aPaged);
|
sl@0
|
55 |
|
sl@0
|
56 |
test_KErrNone(aR);
|
sl@0
|
57 |
test.Printf(_L("aPaged = %d, aChunk.IsPaged() = %d\n"), aPaged, aChunk.IsPaged());
|
sl@0
|
58 |
test_Equal(aPaged, aChunk.IsPaged());
|
sl@0
|
59 |
|
sl@0
|
60 |
// Uses same name for global chunks so needs to be fully closed before next call
|
sl@0
|
61 |
CLOSE_AND_WAIT(aChunk);
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
|
sl@0
|
65 |
void VerifyChunkPaged(TChunkCreateInfo& aCreateInfo)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
TBool paged = EFalse;
|
sl@0
|
68 |
for (TInt i = 0; i < EPagingNumberAttribs; i++)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
switch(i)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
case EPagingUnspec :
|
sl@0
|
73 |
paged = gProcessPaged; // Should default to process's paged status.
|
sl@0
|
74 |
test.Printf(_L("Should default to process's paged status\n"));
|
sl@0
|
75 |
break;
|
sl@0
|
76 |
case EPagingOn :
|
sl@0
|
77 |
aCreateInfo.SetPaging(TChunkCreateInfo::EPaged);
|
sl@0
|
78 |
paged = ETrue;
|
sl@0
|
79 |
test.Printf(_L("Paging should be on\n"));
|
sl@0
|
80 |
break;
|
sl@0
|
81 |
case EPagingOff :
|
sl@0
|
82 |
aCreateInfo.SetPaging(TChunkCreateInfo::EUnpaged);
|
sl@0
|
83 |
paged = EFalse;
|
sl@0
|
84 |
test.Printf(_L("Paging should be off\n"));
|
sl@0
|
85 |
break;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
RChunk chunk;
|
sl@0
|
88 |
TInt r = chunk.Create(aCreateInfo);
|
sl@0
|
89 |
VerifyChunkPaged(chunk, paged, r);
|
sl@0
|
90 |
}
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
TInt PanicChunkCreate(TAny* aCreateInfo)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
TChunkCreateInfo createInfo((*(TChunkCreateInfo*) aCreateInfo));
|
sl@0
|
98 |
gChunk.Create(createInfo);
|
sl@0
|
99 |
return KErrGeneral; // Should never reach here
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
|
sl@0
|
103 |
void TestPanicChunkCreate1(TInt aType, TInt aSize, TInt aMaxSize, TInt aPanicCode)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
TChunkCreateInfo createInfo;
|
sl@0
|
106 |
switch (aType)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
case ECreateNormal:
|
sl@0
|
109 |
createInfo.SetNormal(aSize, aMaxSize);
|
sl@0
|
110 |
break;
|
sl@0
|
111 |
|
sl@0
|
112 |
case ECreateCode:
|
sl@0
|
113 |
createInfo.SetCode(aSize, aMaxSize);
|
sl@0
|
114 |
break;
|
sl@0
|
115 |
|
sl@0
|
116 |
case ECreateGlobal:
|
sl@0
|
117 |
createInfo.SetNormal(aSize, aMaxSize);
|
sl@0
|
118 |
createInfo.SetGlobal(KGlobalChunkName);
|
sl@0
|
119 |
break;
|
sl@0
|
120 |
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
|
sl@0
|
124 |
RThread thread;
|
sl@0
|
125 |
test_KErrNone(thread.Create(_L("Panic CreateChunk"), PanicChunkCreate, KDefaultStackSize, KMinHeapSize,
|
sl@0
|
126 |
KMinHeapSize, (TAny*) &createInfo));
|
sl@0
|
127 |
|
sl@0
|
128 |
test_KErrNone(TestThreadExit(thread, EExitPanic, aPanicCode));
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
void TestPanicChunkCreate2(TInt aType, TInt aBottom, TInt aTop, TInt aMaxSize, TInt aPanicCode)
|
sl@0
|
132 |
{
|
sl@0
|
133 |
TChunkCreateInfo createInfo;
|
sl@0
|
134 |
switch (aType)
|
sl@0
|
135 |
{
|
sl@0
|
136 |
case ECreateLocalDE:
|
sl@0
|
137 |
createInfo.SetDoubleEnded(aBottom, aTop, aMaxSize);
|
sl@0
|
138 |
break;
|
sl@0
|
139 |
|
sl@0
|
140 |
case ECreateGlobalDE:
|
sl@0
|
141 |
createInfo.SetDoubleEnded(aBottom, aTop, aMaxSize);
|
sl@0
|
142 |
createInfo.SetGlobal(KGlobalChunkName);
|
sl@0
|
143 |
break;
|
sl@0
|
144 |
|
sl@0
|
145 |
case ECreateLocalDC:
|
sl@0
|
146 |
createInfo.SetDisconnected(aBottom, aTop, aMaxSize);
|
sl@0
|
147 |
break;
|
sl@0
|
148 |
|
sl@0
|
149 |
case ECreateGlobalDC:
|
sl@0
|
150 |
createInfo.SetDisconnected(aBottom, aTop, aMaxSize);
|
sl@0
|
151 |
createInfo.SetGlobal(KGlobalChunkName);
|
sl@0
|
152 |
break;
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
|
sl@0
|
156 |
RThread thread;
|
sl@0
|
157 |
test_KErrNone(thread.Create(_L("Panic CreateChunk"), PanicChunkCreate, KDefaultStackSize, KMinHeapSize,
|
sl@0
|
158 |
KMinHeapSize, (TAny*) &createInfo));
|
sl@0
|
159 |
|
sl@0
|
160 |
test_KErrNone(TestThreadExit(thread, EExitPanic, aPanicCode));
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
//
|
sl@0
|
164 |
// TestLocalChunk
|
sl@0
|
165 |
//
|
sl@0
|
166 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
167 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
168 |
//! @SYMTestType UT
|
sl@0
|
169 |
//! @SYMPREQ PREQ1954
|
sl@0
|
170 |
//! @SYMTestCaseDesc Verify the local chunk creation implementation.
|
sl@0
|
171 |
//! @SYMTestActions
|
sl@0
|
172 |
//! 1. Create a local chunk and specify the following paging options.
|
sl@0
|
173 |
//! Following this, check the paging status of the chunk by calling IsPaged
|
sl@0
|
174 |
//! a. Not specified
|
sl@0
|
175 |
//! b. Paged
|
sl@0
|
176 |
//! c. Unpaged
|
sl@0
|
177 |
//! 2. Create a local chunk and specify aMaxSize to be negative
|
sl@0
|
178 |
//! 3. Create a local chunk and specify aSize to be negative
|
sl@0
|
179 |
//! 4. Create a local chunk and specify aMaxSize to be less than aSize.
|
sl@0
|
180 |
//!
|
sl@0
|
181 |
//! @SYMTestExpectedResults
|
sl@0
|
182 |
//! 1. The following results are expected:
|
sl@0
|
183 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
184 |
//! b. ETrue
|
sl@0
|
185 |
//! c. EFalse
|
sl@0
|
186 |
//! 2. Panic USER99
|
sl@0
|
187 |
//! 3. Panic USER100
|
sl@0
|
188 |
//! 4. Panic USER101
|
sl@0
|
189 |
//!
|
sl@0
|
190 |
//! @SYMTestPriority High
|
sl@0
|
191 |
//! @SYMTestStatus Implemented
|
sl@0
|
192 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
193 |
void TestLocalChunk()
|
sl@0
|
194 |
{
|
sl@0
|
195 |
test.Start(_L("Test RChunk::CreateLocal - paging attributes"));
|
sl@0
|
196 |
{
|
sl@0
|
197 |
TChunkCreateInfo createInfo;
|
sl@0
|
198 |
createInfo.SetNormal(gPageSize, gPageSize);
|
sl@0
|
199 |
VerifyChunkPaged(createInfo);
|
sl@0
|
200 |
// Test default create method
|
sl@0
|
201 |
TInt r = gChunk.CreateLocal(gPageSize, gPageSize);
|
sl@0
|
202 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
203 |
}
|
sl@0
|
204 |
|
sl@0
|
205 |
test.Next(_L("Test RChunk::CreateLocal - invalid max size"));
|
sl@0
|
206 |
TestPanicChunkCreate1(ECreateNormal, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
207 |
|
sl@0
|
208 |
test.Next(_L("Test RChunk::CreateLocal - invalid size"));
|
sl@0
|
209 |
TestPanicChunkCreate1(ECreateNormal, -1, gPageSize, EChkCreateSizeNotPositive);
|
sl@0
|
210 |
|
sl@0
|
211 |
|
sl@0
|
212 |
test.Next(_L("Test RChunk::CreateLocal - aSize > aMaxSize"));
|
sl@0
|
213 |
TestPanicChunkCreate1(ECreateNormal, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin);
|
sl@0
|
214 |
test.End();
|
sl@0
|
215 |
}
|
sl@0
|
216 |
|
sl@0
|
217 |
//
|
sl@0
|
218 |
// TestCodeChunk
|
sl@0
|
219 |
//
|
sl@0
|
220 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
221 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
222 |
//! @SYMTestType UT
|
sl@0
|
223 |
//! @SYMPREQ PREQ1954
|
sl@0
|
224 |
//! @SYMTestCaseDesc Verify the user code chunk creation implementation
|
sl@0
|
225 |
//! @SYMTestActions
|
sl@0
|
226 |
//! 1. Create a user code chunk and specify the following paging options.
|
sl@0
|
227 |
//! Following this check the paging status of the chunk by calling IsPaged().
|
sl@0
|
228 |
//! a. Not specified
|
sl@0
|
229 |
//! b. Paged
|
sl@0
|
230 |
//! c. Unpaged
|
sl@0
|
231 |
//! 2. Create a user code chunk and specify aMaxSize to be negative
|
sl@0
|
232 |
//! 3. Create a user code chunk and specify aSize to be negative
|
sl@0
|
233 |
//! 4. Create a user code chunk and specify aMaxSize to be less than aSize.
|
sl@0
|
234 |
//!
|
sl@0
|
235 |
//! @SYMTestExpectedResults
|
sl@0
|
236 |
//! 1. The following results are expected:
|
sl@0
|
237 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
238 |
//! b. ETrue
|
sl@0
|
239 |
//! c. EFalse
|
sl@0
|
240 |
//! 2. Panic USER99
|
sl@0
|
241 |
//! 3. Panic USER100
|
sl@0
|
242 |
//! 4. Panic USER101
|
sl@0
|
243 |
//!
|
sl@0
|
244 |
//! @SYMTestPriority High
|
sl@0
|
245 |
//! @SYMTestStatus Implemented
|
sl@0
|
246 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
247 |
void TestCodeChunk()
|
sl@0
|
248 |
{
|
sl@0
|
249 |
test.Start(_L("Test RChunk::CreateLocalCode - paging attributes"));
|
sl@0
|
250 |
{
|
sl@0
|
251 |
TChunkCreateInfo createInfo;
|
sl@0
|
252 |
createInfo.SetCode(gPageSize, gPageSize);
|
sl@0
|
253 |
VerifyChunkPaged(createInfo);
|
sl@0
|
254 |
// Test default create method
|
sl@0
|
255 |
TInt r = gChunk.CreateLocal(gPageSize, gPageSize);
|
sl@0
|
256 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
257 |
}
|
sl@0
|
258 |
|
sl@0
|
259 |
test.Next(_L("Test RChunk::CreateLocalCode - invalid max size"));
|
sl@0
|
260 |
TestPanicChunkCreate1(ECreateCode, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
261 |
|
sl@0
|
262 |
test.Next(_L("Test RChunk::CreateLocalCode - invalid size"));
|
sl@0
|
263 |
TestPanicChunkCreate1(ECreateCode, -1, gPageSize, EChkCreateSizeNotPositive);
|
sl@0
|
264 |
|
sl@0
|
265 |
|
sl@0
|
266 |
test.Next(_L("Test RChunk::CreateLocalCode - aSize > aMaxSize"));
|
sl@0
|
267 |
TestPanicChunkCreate1(ECreateCode, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin);
|
sl@0
|
268 |
|
sl@0
|
269 |
test.End();
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
//
|
sl@0
|
273 |
// TestGlobalChunk
|
sl@0
|
274 |
//
|
sl@0
|
275 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
276 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
277 |
//! @SYMTestType UT
|
sl@0
|
278 |
//! @SYMPREQ PREQ1954
|
sl@0
|
279 |
//! @SYMTestCaseDesc Verify the global chunk creation implementation
|
sl@0
|
280 |
//! @SYMTestActions
|
sl@0
|
281 |
//! 1. Create a global chunk and specify the following paging options.
|
sl@0
|
282 |
//! Following this check the paging status of the chunk by calling IsPaged().
|
sl@0
|
283 |
//! a. Not specified
|
sl@0
|
284 |
//! b. Paged
|
sl@0
|
285 |
//! c. Unpaged
|
sl@0
|
286 |
//! 1. Create a global chunk and specify aMaxSize to be negative
|
sl@0
|
287 |
//! 2. Create a global chunk and specify aSize to be negative
|
sl@0
|
288 |
//! 3. Create a global chunk and specify aMaxSize to be less than aSize.
|
sl@0
|
289 |
//!
|
sl@0
|
290 |
//! @SYMTestExpectedResults
|
sl@0
|
291 |
//! 1. The following results are expected:
|
sl@0
|
292 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
293 |
//! b. ETrue
|
sl@0
|
294 |
//! c. EFalse
|
sl@0
|
295 |
//! 2. Panic USER99
|
sl@0
|
296 |
//! 3. Panic USER100
|
sl@0
|
297 |
//! 4. Panic USER101
|
sl@0
|
298 |
//!
|
sl@0
|
299 |
//! @SYMTestPriority High
|
sl@0
|
300 |
//! @SYMTestStatus Implemented
|
sl@0
|
301 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
302 |
void TestGlobalChunk()
|
sl@0
|
303 |
{
|
sl@0
|
304 |
test.Start(_L("Test RChunk::CreateGlobal - paging attributes"));
|
sl@0
|
305 |
{
|
sl@0
|
306 |
TChunkCreateInfo createInfo;
|
sl@0
|
307 |
createInfo.SetNormal(gPageSize, gPageSize);
|
sl@0
|
308 |
createInfo.SetGlobal(KGlobalChunkName);
|
sl@0
|
309 |
VerifyChunkPaged(createInfo);
|
sl@0
|
310 |
// Test default create method
|
sl@0
|
311 |
TInt r = gChunk.CreateLocal(gPageSize, gPageSize);
|
sl@0
|
312 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
313 |
}
|
sl@0
|
314 |
|
sl@0
|
315 |
test.Next(_L("Test RChunk::CreateGlobal - invalid max size"));
|
sl@0
|
316 |
TestPanicChunkCreate1(ECreateGlobal, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
317 |
|
sl@0
|
318 |
test.Next(_L("Test RChunk::CreateGlobal - invalid size"));
|
sl@0
|
319 |
TestPanicChunkCreate1(ECreateGlobal, -1, gPageSize, EChkCreateSizeNotPositive);
|
sl@0
|
320 |
|
sl@0
|
321 |
|
sl@0
|
322 |
test.Next(_L("Test RChunk::CreateGlobal - aSize > aMaxSize"));
|
sl@0
|
323 |
TestPanicChunkCreate1(ECreateGlobal, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin);
|
sl@0
|
324 |
|
sl@0
|
325 |
test.End();
|
sl@0
|
326 |
}
|
sl@0
|
327 |
|
sl@0
|
328 |
//
|
sl@0
|
329 |
// TestLocDEChunk
|
sl@0
|
330 |
//
|
sl@0
|
331 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
332 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
333 |
//! @SYMTestType UT
|
sl@0
|
334 |
//! @SYMPREQ PREQ1954
|
sl@0
|
335 |
//! @SYMTestCaseDesc Verify the local double ended chunk creation implementation
|
sl@0
|
336 |
//! @SYMTestActions
|
sl@0
|
337 |
//! 1. Create a local, double ended, chunk and specify the following paging options.
|
sl@0
|
338 |
//! Following this check the paging status of the chunk by calling IsPaged().
|
sl@0
|
339 |
//! a. Not specified
|
sl@0
|
340 |
//! b. Paged
|
sl@0
|
341 |
//! c. Unpaged
|
sl@0
|
342 |
//! 2. Create a local, double ended, chunk and specify aMaxSize to be negative
|
sl@0
|
343 |
//! 3. Create a local, double ended, chunk and specify aInitialBottom to be negative
|
sl@0
|
344 |
//! 4. Create a local, double ended, chunk and specify aInitialTop to be negative.
|
sl@0
|
345 |
//! 5. Create a local, double ended, chunk and specify aInitialBottom to be greater than aInitialTop.
|
sl@0
|
346 |
//! 6. Create a local, double ended, chunk and specify aInitialTop to be greater than aMaxSize.
|
sl@0
|
347 |
//!
|
sl@0
|
348 |
//! @SYMTestExpectedResults
|
sl@0
|
349 |
//! 1. 1. The following results are expected:
|
sl@0
|
350 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
351 |
//! b. ETrue
|
sl@0
|
352 |
//! c. EFalse
|
sl@0
|
353 |
//! 2. Panic USER99
|
sl@0
|
354 |
//! 3. Panic USER120
|
sl@0
|
355 |
//! 4. Panic USER121
|
sl@0
|
356 |
//! 5. Panic USER122
|
sl@0
|
357 |
//! 6. Panic USER123
|
sl@0
|
358 |
//!
|
sl@0
|
359 |
//! @SYMTestPriority High
|
sl@0
|
360 |
//! @SYMTestStatus Implemented
|
sl@0
|
361 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
362 |
void TestLocDEChunk()
|
sl@0
|
363 |
{
|
sl@0
|
364 |
test.Start(_L("Test RChunk::CreateDoubleEndedLocal - paging attributes"));
|
sl@0
|
365 |
{
|
sl@0
|
366 |
TChunkCreateInfo createInfo;
|
sl@0
|
367 |
createInfo.SetDoubleEnded(0, gPageSize, gPageSize);
|
sl@0
|
368 |
VerifyChunkPaged(createInfo);
|
sl@0
|
369 |
// Test default create method
|
sl@0
|
370 |
TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
|
sl@0
|
371 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
372 |
}
|
sl@0
|
373 |
|
sl@0
|
374 |
|
sl@0
|
375 |
test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid max size"));
|
sl@0
|
376 |
TestPanicChunkCreate2(ECreateLocalDE, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
377 |
|
sl@0
|
378 |
test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid bottom"));
|
sl@0
|
379 |
TestPanicChunkCreate2(ECreateLocalDE, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
|
sl@0
|
380 |
|
sl@0
|
381 |
test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid top"));
|
sl@0
|
382 |
TestPanicChunkCreate2(ECreateLocalDE, 0, -1, gPageSize, EChkCreateTopNegative);
|
sl@0
|
383 |
|
sl@0
|
384 |
test.Next(_L("Test RChunk::CreateDoubleEndedLocal - bottom > top"));
|
sl@0
|
385 |
TestPanicChunkCreate2(ECreateLocalDE, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
|
sl@0
|
386 |
|
sl@0
|
387 |
test.Next(_L("Test RChunk::CreateDoubleEndedLocal - top > max size"));
|
sl@0
|
388 |
TestPanicChunkCreate2(ECreateLocalDE, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
|
sl@0
|
389 |
|
sl@0
|
390 |
test.End();
|
sl@0
|
391 |
}
|
sl@0
|
392 |
|
sl@0
|
393 |
|
sl@0
|
394 |
//
|
sl@0
|
395 |
// TestGlobDEChunk
|
sl@0
|
396 |
//
|
sl@0
|
397 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
398 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
399 |
//! @SYMTestType UT
|
sl@0
|
400 |
//! @SYMPREQ PREQ1954
|
sl@0
|
401 |
//! @SYMTestCaseDesc Verify the global double ended chunk creation implementation
|
sl@0
|
402 |
//! @SYMTestActions
|
sl@0
|
403 |
//! 1. Create a global, double ended, chunk and specify the following paging options.
|
sl@0
|
404 |
//! Following this check the paging status of the chunk by calling IsPaged().
|
sl@0
|
405 |
//! a. Not specified
|
sl@0
|
406 |
//! b. Paged
|
sl@0
|
407 |
//! c. Unpaged
|
sl@0
|
408 |
//! 2. Create a global, double ended, chunk and specify aMaxSize to be negative
|
sl@0
|
409 |
//! 3. Create a global, double ended, chunk and specify aInitialBottom to be negative
|
sl@0
|
410 |
//! 4. Create a global, double ended, chunk and specify aInitialTop to be negative.
|
sl@0
|
411 |
//! 5. Create a global, double ended, chunk and specify aInitialBottom to be greater than aInitialTop.
|
sl@0
|
412 |
//! 6. Create a global, double ended, chunk and specify aInitialBottom to be greater than aMaxSize.
|
sl@0
|
413 |
//! 7. Create a global, double ended, chunk and specify aInitialTop to be greater than aMaxSize.
|
sl@0
|
414 |
//!
|
sl@0
|
415 |
//! @SYMTestExpectedResults
|
sl@0
|
416 |
//! 1. 1. The following results are expected:
|
sl@0
|
417 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
418 |
//! b. ETrue
|
sl@0
|
419 |
//! c. EFalse
|
sl@0
|
420 |
//! 2. Panic USER99
|
sl@0
|
421 |
//! 3. Panic USER120
|
sl@0
|
422 |
//! 4. Panic USER121
|
sl@0
|
423 |
//! 5. Panic USER122
|
sl@0
|
424 |
//! 6. Panic USER123
|
sl@0
|
425 |
//! 7. Panic USER123
|
sl@0
|
426 |
//!
|
sl@0
|
427 |
//! @SYMTestPriority High
|
sl@0
|
428 |
//! @SYMTestStatus Implemented
|
sl@0
|
429 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
430 |
void TestGlobDEChunk()
|
sl@0
|
431 |
{
|
sl@0
|
432 |
test.Start(_L("Test RChunk::CreateDoubleEndedGlobal - paging attributes"));
|
sl@0
|
433 |
{
|
sl@0
|
434 |
TChunkCreateInfo createInfo;
|
sl@0
|
435 |
createInfo.SetDoubleEnded(0, gPageSize, gPageSize);
|
sl@0
|
436 |
createInfo.SetGlobal(KGlobalChunkName);
|
sl@0
|
437 |
VerifyChunkPaged(createInfo);
|
sl@0
|
438 |
// Test default create method
|
sl@0
|
439 |
TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
|
sl@0
|
440 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
|
sl@0
|
444 |
test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid max size"));
|
sl@0
|
445 |
TestPanicChunkCreate2(ECreateGlobalDE, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
446 |
|
sl@0
|
447 |
test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid bottom"));
|
sl@0
|
448 |
TestPanicChunkCreate2(ECreateGlobalDE, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
|
sl@0
|
449 |
|
sl@0
|
450 |
test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid top"));
|
sl@0
|
451 |
TestPanicChunkCreate2(ECreateGlobalDE, 0, -1, gPageSize, EChkCreateTopNegative);
|
sl@0
|
452 |
|
sl@0
|
453 |
test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - bottom > top"));
|
sl@0
|
454 |
TestPanicChunkCreate2(ECreateGlobalDE, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
|
sl@0
|
455 |
|
sl@0
|
456 |
test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - top > max size"));
|
sl@0
|
457 |
TestPanicChunkCreate2(ECreateGlobalDE, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
|
sl@0
|
458 |
test.End();
|
sl@0
|
459 |
}
|
sl@0
|
460 |
|
sl@0
|
461 |
|
sl@0
|
462 |
//
|
sl@0
|
463 |
// TestLocDiscChunk
|
sl@0
|
464 |
//
|
sl@0
|
465 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
466 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
467 |
//! @SYMTestType UT
|
sl@0
|
468 |
//! @SYMPREQ PREQ1954
|
sl@0
|
469 |
//! @SYMTestCaseDesc Verify the local disconnected chunk creation implementation
|
sl@0
|
470 |
//! @SYMTestActions
|
sl@0
|
471 |
//! 1. Create a local, disconnected chunk and specify the following paging options.
|
sl@0
|
472 |
//! Following this check the paging status of the chunk by calling IsPaged().
|
sl@0
|
473 |
//! a. Not specified
|
sl@0
|
474 |
//! b. Paged
|
sl@0
|
475 |
//! c. Unpaged
|
sl@0
|
476 |
//! 2. Create a local, disconnected chunk and specify aMaxSize to be negative
|
sl@0
|
477 |
//! 3. Create a local, disconnected chunk and specify aInitialBottom to be negative
|
sl@0
|
478 |
//! 4. Create a local, disconnected chunk and specify aInitialTop to be negative.
|
sl@0
|
479 |
//! 5. Create a local, disconnected chunk and specify aInitialBottom to be greater than aInitialTop.
|
sl@0
|
480 |
//! 6. Create a local, disconnected chunk and specify aInitialBottom to be greater than aMaxSize.
|
sl@0
|
481 |
//! 7. Create local, disconnected chunk and specify aInitialTop to be greater than aMaxSize.
|
sl@0
|
482 |
//!
|
sl@0
|
483 |
//! @SYMTestExpectedResults
|
sl@0
|
484 |
//! 1. 1. The following results are expected:
|
sl@0
|
485 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
486 |
//! b. ETrue
|
sl@0
|
487 |
//! c. EFalse
|
sl@0
|
488 |
//! 2. Panic USER99
|
sl@0
|
489 |
//! 3. Panic USER120
|
sl@0
|
490 |
//! 4. Panic USER121
|
sl@0
|
491 |
//! 5. Panic USER122
|
sl@0
|
492 |
//! 6. Panic USER123
|
sl@0
|
493 |
//! 7. Panic USER123
|
sl@0
|
494 |
//!
|
sl@0
|
495 |
//! @SYMTestPriority High
|
sl@0
|
496 |
//! @SYMTestStatus Implemented
|
sl@0
|
497 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
498 |
void TestLocDiscChunk()
|
sl@0
|
499 |
{
|
sl@0
|
500 |
test.Start(_L("Test RChunk::CreateDisconnectedLocal - paging attributes"));
|
sl@0
|
501 |
{
|
sl@0
|
502 |
TChunkCreateInfo createInfo;
|
sl@0
|
503 |
createInfo.SetDisconnected(0, gPageSize, gPageSize);
|
sl@0
|
504 |
VerifyChunkPaged(createInfo);
|
sl@0
|
505 |
// Test default create method
|
sl@0
|
506 |
TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
|
sl@0
|
507 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
508 |
}
|
sl@0
|
509 |
|
sl@0
|
510 |
|
sl@0
|
511 |
test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid max size"));
|
sl@0
|
512 |
TestPanicChunkCreate2(ECreateLocalDC, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
513 |
|
sl@0
|
514 |
test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid bottom"));
|
sl@0
|
515 |
TestPanicChunkCreate2(ECreateLocalDC, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
|
sl@0
|
516 |
|
sl@0
|
517 |
test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid top"));
|
sl@0
|
518 |
TestPanicChunkCreate2(ECreateLocalDC, 0, -1, gPageSize, EChkCreateTopNegative);
|
sl@0
|
519 |
|
sl@0
|
520 |
test.Next(_L("Test RChunk::CreateDisconnectedLocal - bottom > top"));
|
sl@0
|
521 |
TestPanicChunkCreate2(ECreateLocalDC, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
|
sl@0
|
522 |
|
sl@0
|
523 |
test.Next(_L("Test RChunk::CreateDisconnectedLocal - top > max size"));
|
sl@0
|
524 |
TestPanicChunkCreate2(ECreateLocalDC, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
|
sl@0
|
525 |
|
sl@0
|
526 |
test.End();
|
sl@0
|
527 |
}
|
sl@0
|
528 |
|
sl@0
|
529 |
|
sl@0
|
530 |
//
|
sl@0
|
531 |
// TestGlobDiscChunk
|
sl@0
|
532 |
//
|
sl@0
|
533 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
534 |
//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
|
sl@0
|
535 |
//! @SYMTestType UT
|
sl@0
|
536 |
//! @SYMPREQ PREQ1954
|
sl@0
|
537 |
//! @SYMTestCaseDesc Verify the global disconnected chunk creation implementation
|
sl@0
|
538 |
//! @SYMTestActions
|
sl@0
|
539 |
//! 1. Create a global, disconnected chunk and specify the following paging options.
|
sl@0
|
540 |
//! Following this check the paging status of the chunk by calling IsPaged().
|
sl@0
|
541 |
//! a. Not specified
|
sl@0
|
542 |
//! b. Paged
|
sl@0
|
543 |
//! c. Unpaged
|
sl@0
|
544 |
//! 2. Create a global, disconnected chunk and specify aMaxSize to be negative
|
sl@0
|
545 |
//! 3. Create a global, disconnected chunk and specify aInitialBottom to be negative
|
sl@0
|
546 |
//! 4. Create a global, disconnected chunk and specify aInitialTop to be negative.
|
sl@0
|
547 |
//! 5. Create a global, disconnected chunk and specify aInitialBottom to be greater than aInitialTop.
|
sl@0
|
548 |
//! 6. Create a global, disconnected chunk and specify aInitialBottom to be greater than aMaxSize.
|
sl@0
|
549 |
//! 7. Create global, disconnected chunk and specify aInitialTop to be greater than aMaxSize.
|
sl@0
|
550 |
//!
|
sl@0
|
551 |
//! @SYMTestExpectedResults
|
sl@0
|
552 |
//! 1. 1. The following results are expected:
|
sl@0
|
553 |
//! a. The chunk should take on the paging status of the process
|
sl@0
|
554 |
//! b. ETrue
|
sl@0
|
555 |
//! c. EFalse
|
sl@0
|
556 |
//! 2. Panic USER99
|
sl@0
|
557 |
//! 3. Panic USER120
|
sl@0
|
558 |
//! 4. Panic USER121
|
sl@0
|
559 |
//! 5. Panic USER122
|
sl@0
|
560 |
//! 6. Panic USER123
|
sl@0
|
561 |
//! 7. Panic USER123
|
sl@0
|
562 |
//!
|
sl@0
|
563 |
//! @SYMTestPriority High
|
sl@0
|
564 |
//! @SYMTestStatus Implemented
|
sl@0
|
565 |
//----------------------------------------------------------------------------------------------
|
sl@0
|
566 |
void TestGlobDiscChunk()
|
sl@0
|
567 |
{
|
sl@0
|
568 |
test.Start(_L("Test RChunk::CreateDisconnectedGlobal - paging attributes"));
|
sl@0
|
569 |
{
|
sl@0
|
570 |
TChunkCreateInfo createInfo;
|
sl@0
|
571 |
createInfo.SetDisconnected(0, gPageSize, gPageSize);
|
sl@0
|
572 |
createInfo.SetGlobal(KGlobalChunkName);
|
sl@0
|
573 |
VerifyChunkPaged(createInfo);
|
sl@0
|
574 |
// Test default create method
|
sl@0
|
575 |
TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
|
sl@0
|
576 |
VerifyChunkPaged(gChunk, gProcessPaged, r);
|
sl@0
|
577 |
}
|
sl@0
|
578 |
|
sl@0
|
579 |
|
sl@0
|
580 |
test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid max size"));
|
sl@0
|
581 |
TestPanicChunkCreate2(ECreateGlobalDC, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
|
sl@0
|
582 |
|
sl@0
|
583 |
test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid bottom"));
|
sl@0
|
584 |
TestPanicChunkCreate2(ECreateGlobalDC, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
|
sl@0
|
585 |
|
sl@0
|
586 |
test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid top"));
|
sl@0
|
587 |
TestPanicChunkCreate2(ECreateGlobalDC, 0, -1, gPageSize, EChkCreateTopNegative);
|
sl@0
|
588 |
|
sl@0
|
589 |
test.Next(_L("Test RChunk::CreateDisconnectedGlobal - bottom > top"));
|
sl@0
|
590 |
TestPanicChunkCreate2(ECreateGlobalDC, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
|
sl@0
|
591 |
|
sl@0
|
592 |
test.Next(_L("Test RChunk::CreateDisconnectedGlobal - top > max size"));
|
sl@0
|
593 |
TestPanicChunkCreate2(ECreateGlobalDC, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
|
sl@0
|
594 |
|
sl@0
|
595 |
test.End();
|
sl@0
|
596 |
}
|
sl@0
|
597 |
|
sl@0
|
598 |
|
sl@0
|
599 |
|
sl@0
|
600 |
|
sl@0
|
601 |
TInt TestingTChunkCreate()
|
sl@0
|
602 |
{
|
sl@0
|
603 |
test.Start(_L("Test TChunkCreateInfo - Local Chunk"));
|
sl@0
|
604 |
TestLocalChunk();
|
sl@0
|
605 |
|
sl@0
|
606 |
test.Next(_L("Test TChunkCreateInfo - Code Chunk"));
|
sl@0
|
607 |
TestCodeChunk();
|
sl@0
|
608 |
|
sl@0
|
609 |
test.Next(_L("Test TChunkCreateInfo - Global Chunk"));
|
sl@0
|
610 |
TestGlobalChunk();
|
sl@0
|
611 |
|
sl@0
|
612 |
test.Next(_L("Test TChunkCreateInfo - Local Double Ended Chunk"));
|
sl@0
|
613 |
TestLocDEChunk();
|
sl@0
|
614 |
|
sl@0
|
615 |
test.Next(_L("Test TChunkCreateInfo - Global Double Ended Chunk"));
|
sl@0
|
616 |
TestGlobDEChunk();
|
sl@0
|
617 |
|
sl@0
|
618 |
test.Next(_L("Test TChunkCreateInfo - Local Disconnected Chunk"));
|
sl@0
|
619 |
TestLocDiscChunk();
|
sl@0
|
620 |
|
sl@0
|
621 |
test.Next(_L("Test TChunkCreateInfo - Global Disconnected Chunk"));
|
sl@0
|
622 |
TestGlobDiscChunk();
|
sl@0
|
623 |
|
sl@0
|
624 |
test.End();
|
sl@0
|
625 |
return 0;
|
sl@0
|
626 |
}
|