1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/demandpaging/t_chunkcreate.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,626 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\demandpaging\t_chunkcreate.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +//
1.22 +#define __E32TEST_EXTENSION__
1.23 +#include <e32test.h>
1.24 +#include <dptest.h>
1.25 +#include <e32hal.h>
1.26 +#include <u32exec.h>
1.27 +#include <e32svr.h>
1.28 +#include <e32panic.h>
1.29 +#include "u32std.h"
1.30 +
1.31 +#include "t_dpcmn.h"
1.32 +
1.33 +_LIT(KGlobalChunkName, "TestChunk");
1.34 +
1.35 +enum
1.36 + {
1.37 + ECreateNormal,
1.38 + ECreateCode,
1.39 + ECreateGlobal,
1.40 + ECreateLocalDE,
1.41 + ECreateGlobalDE,
1.42 + ECreateLocalDC,
1.43 + ECreateGlobalDC,
1.44 + };
1.45 +
1.46 +enum
1.47 + {
1.48 + EPagingUnspec, // Has to be first as can't clear back to unspecified.
1.49 + EPagingOn,
1.50 + EPagingOff,
1.51 + EPagingNumberAttribs,
1.52 + };
1.53 +
1.54 +
1.55 +void VerifyChunkPaged(RChunk& aChunk, TBool aPaged, TInt aR)
1.56 + {
1.57 + UpdatePaged(aPaged);
1.58 +
1.59 + test_KErrNone(aR);
1.60 + test.Printf(_L("aPaged = %d, aChunk.IsPaged() = %d\n"), aPaged, aChunk.IsPaged());
1.61 + test_Equal(aPaged, aChunk.IsPaged());
1.62 +
1.63 + // Uses same name for global chunks so needs to be fully closed before next call
1.64 + CLOSE_AND_WAIT(aChunk);
1.65 + }
1.66 +
1.67 +
1.68 +void VerifyChunkPaged(TChunkCreateInfo& aCreateInfo)
1.69 + {
1.70 + TBool paged = EFalse;
1.71 + for (TInt i = 0; i < EPagingNumberAttribs; i++)
1.72 + {
1.73 + switch(i)
1.74 + {
1.75 + case EPagingUnspec :
1.76 + paged = gProcessPaged; // Should default to process's paged status.
1.77 + test.Printf(_L("Should default to process's paged status\n"));
1.78 + break;
1.79 + case EPagingOn :
1.80 + aCreateInfo.SetPaging(TChunkCreateInfo::EPaged);
1.81 + paged = ETrue;
1.82 + test.Printf(_L("Paging should be on\n"));
1.83 + break;
1.84 + case EPagingOff :
1.85 + aCreateInfo.SetPaging(TChunkCreateInfo::EUnpaged);
1.86 + paged = EFalse;
1.87 + test.Printf(_L("Paging should be off\n"));
1.88 + break;
1.89 + }
1.90 + RChunk chunk;
1.91 + TInt r = chunk.Create(aCreateInfo);
1.92 + VerifyChunkPaged(chunk, paged, r);
1.93 + }
1.94 + }
1.95 +
1.96 +
1.97 +
1.98 +TInt PanicChunkCreate(TAny* aCreateInfo)
1.99 + {
1.100 + TChunkCreateInfo createInfo((*(TChunkCreateInfo*) aCreateInfo));
1.101 + gChunk.Create(createInfo);
1.102 + return KErrGeneral; // Should never reach here
1.103 + }
1.104 +
1.105 +
1.106 +void TestPanicChunkCreate1(TInt aType, TInt aSize, TInt aMaxSize, TInt aPanicCode)
1.107 + {
1.108 + TChunkCreateInfo createInfo;
1.109 + switch (aType)
1.110 + {
1.111 + case ECreateNormal:
1.112 + createInfo.SetNormal(aSize, aMaxSize);
1.113 + break;
1.114 +
1.115 + case ECreateCode:
1.116 + createInfo.SetCode(aSize, aMaxSize);
1.117 + break;
1.118 +
1.119 + case ECreateGlobal:
1.120 + createInfo.SetNormal(aSize, aMaxSize);
1.121 + createInfo.SetGlobal(KGlobalChunkName);
1.122 + break;
1.123 +
1.124 + }
1.125 +
1.126 +
1.127 + RThread thread;
1.128 + test_KErrNone(thread.Create(_L("Panic CreateChunk"), PanicChunkCreate, KDefaultStackSize, KMinHeapSize,
1.129 + KMinHeapSize, (TAny*) &createInfo));
1.130 +
1.131 + test_KErrNone(TestThreadExit(thread, EExitPanic, aPanicCode));
1.132 + }
1.133 +
1.134 +void TestPanicChunkCreate2(TInt aType, TInt aBottom, TInt aTop, TInt aMaxSize, TInt aPanicCode)
1.135 + {
1.136 + TChunkCreateInfo createInfo;
1.137 + switch (aType)
1.138 + {
1.139 + case ECreateLocalDE:
1.140 + createInfo.SetDoubleEnded(aBottom, aTop, aMaxSize);
1.141 + break;
1.142 +
1.143 + case ECreateGlobalDE:
1.144 + createInfo.SetDoubleEnded(aBottom, aTop, aMaxSize);
1.145 + createInfo.SetGlobal(KGlobalChunkName);
1.146 + break;
1.147 +
1.148 + case ECreateLocalDC:
1.149 + createInfo.SetDisconnected(aBottom, aTop, aMaxSize);
1.150 + break;
1.151 +
1.152 + case ECreateGlobalDC:
1.153 + createInfo.SetDisconnected(aBottom, aTop, aMaxSize);
1.154 + createInfo.SetGlobal(KGlobalChunkName);
1.155 + break;
1.156 + }
1.157 +
1.158 +
1.159 + RThread thread;
1.160 + test_KErrNone(thread.Create(_L("Panic CreateChunk"), PanicChunkCreate, KDefaultStackSize, KMinHeapSize,
1.161 + KMinHeapSize, (TAny*) &createInfo));
1.162 +
1.163 + test_KErrNone(TestThreadExit(thread, EExitPanic, aPanicCode));
1.164 + }
1.165 +
1.166 +//
1.167 +// TestLocalChunk
1.168 +//
1.169 +//----------------------------------------------------------------------------------------------
1.170 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.171 +//! @SYMTestType UT
1.172 +//! @SYMPREQ PREQ1954
1.173 +//! @SYMTestCaseDesc Verify the local chunk creation implementation.
1.174 +//! @SYMTestActions
1.175 +//! 1. Create a local chunk and specify the following paging options.
1.176 +//! Following this, check the paging status of the chunk by calling IsPaged
1.177 +//! a. Not specified
1.178 +//! b. Paged
1.179 +//! c. Unpaged
1.180 +//! 2. Create a local chunk and specify aMaxSize to be negative
1.181 +//! 3. Create a local chunk and specify aSize to be negative
1.182 +//! 4. Create a local chunk and specify aMaxSize to be less than aSize.
1.183 +//!
1.184 +//! @SYMTestExpectedResults
1.185 +//! 1. The following results are expected:
1.186 +//! a. The chunk should take on the paging status of the process
1.187 +//! b. ETrue
1.188 +//! c. EFalse
1.189 +//! 2. Panic USER99
1.190 +//! 3. Panic USER100
1.191 +//! 4. Panic USER101
1.192 +//!
1.193 +//! @SYMTestPriority High
1.194 +//! @SYMTestStatus Implemented
1.195 +//----------------------------------------------------------------------------------------------
1.196 +void TestLocalChunk()
1.197 + {
1.198 + test.Start(_L("Test RChunk::CreateLocal - paging attributes"));
1.199 + {
1.200 + TChunkCreateInfo createInfo;
1.201 + createInfo.SetNormal(gPageSize, gPageSize);
1.202 + VerifyChunkPaged(createInfo);
1.203 + // Test default create method
1.204 + TInt r = gChunk.CreateLocal(gPageSize, gPageSize);
1.205 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.206 + }
1.207 +
1.208 + test.Next(_L("Test RChunk::CreateLocal - invalid max size"));
1.209 + TestPanicChunkCreate1(ECreateNormal, gPageSize, -1, EChkCreateMaxSizeNegative);
1.210 +
1.211 + test.Next(_L("Test RChunk::CreateLocal - invalid size"));
1.212 + TestPanicChunkCreate1(ECreateNormal, -1, gPageSize, EChkCreateSizeNotPositive);
1.213 +
1.214 +
1.215 + test.Next(_L("Test RChunk::CreateLocal - aSize > aMaxSize"));
1.216 + TestPanicChunkCreate1(ECreateNormal, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin);
1.217 + test.End();
1.218 + }
1.219 +
1.220 +//
1.221 +// TestCodeChunk
1.222 +//
1.223 +//----------------------------------------------------------------------------------------------
1.224 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.225 +//! @SYMTestType UT
1.226 +//! @SYMPREQ PREQ1954
1.227 +//! @SYMTestCaseDesc Verify the user code chunk creation implementation
1.228 +//! @SYMTestActions
1.229 +//! 1. Create a user code chunk and specify the following paging options.
1.230 +//! Following this check the paging status of the chunk by calling IsPaged().
1.231 +//! a. Not specified
1.232 +//! b. Paged
1.233 +//! c. Unpaged
1.234 +//! 2. Create a user code chunk and specify aMaxSize to be negative
1.235 +//! 3. Create a user code chunk and specify aSize to be negative
1.236 +//! 4. Create a user code chunk and specify aMaxSize to be less than aSize.
1.237 +//!
1.238 +//! @SYMTestExpectedResults
1.239 +//! 1. The following results are expected:
1.240 +//! a. The chunk should take on the paging status of the process
1.241 +//! b. ETrue
1.242 +//! c. EFalse
1.243 +//! 2. Panic USER99
1.244 +//! 3. Panic USER100
1.245 +//! 4. Panic USER101
1.246 +//!
1.247 +//! @SYMTestPriority High
1.248 +//! @SYMTestStatus Implemented
1.249 +//----------------------------------------------------------------------------------------------
1.250 +void TestCodeChunk()
1.251 + {
1.252 + test.Start(_L("Test RChunk::CreateLocalCode - paging attributes"));
1.253 + {
1.254 + TChunkCreateInfo createInfo;
1.255 + createInfo.SetCode(gPageSize, gPageSize);
1.256 + VerifyChunkPaged(createInfo);
1.257 + // Test default create method
1.258 + TInt r = gChunk.CreateLocal(gPageSize, gPageSize);
1.259 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.260 + }
1.261 +
1.262 + test.Next(_L("Test RChunk::CreateLocalCode - invalid max size"));
1.263 + TestPanicChunkCreate1(ECreateCode, gPageSize, -1, EChkCreateMaxSizeNegative);
1.264 +
1.265 + test.Next(_L("Test RChunk::CreateLocalCode - invalid size"));
1.266 + TestPanicChunkCreate1(ECreateCode, -1, gPageSize, EChkCreateSizeNotPositive);
1.267 +
1.268 +
1.269 + test.Next(_L("Test RChunk::CreateLocalCode - aSize > aMaxSize"));
1.270 + TestPanicChunkCreate1(ECreateCode, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin);
1.271 +
1.272 + test.End();
1.273 + }
1.274 +
1.275 +//
1.276 +// TestGlobalChunk
1.277 +//
1.278 +//----------------------------------------------------------------------------------------------
1.279 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.280 +//! @SYMTestType UT
1.281 +//! @SYMPREQ PREQ1954
1.282 +//! @SYMTestCaseDesc Verify the global chunk creation implementation
1.283 +//! @SYMTestActions
1.284 +//! 1. Create a global chunk and specify the following paging options.
1.285 +//! Following this check the paging status of the chunk by calling IsPaged().
1.286 +//! a. Not specified
1.287 +//! b. Paged
1.288 +//! c. Unpaged
1.289 +//! 1. Create a global chunk and specify aMaxSize to be negative
1.290 +//! 2. Create a global chunk and specify aSize to be negative
1.291 +//! 3. Create a global chunk and specify aMaxSize to be less than aSize.
1.292 +//!
1.293 +//! @SYMTestExpectedResults
1.294 +//! 1. The following results are expected:
1.295 +//! a. The chunk should take on the paging status of the process
1.296 +//! b. ETrue
1.297 +//! c. EFalse
1.298 +//! 2. Panic USER99
1.299 +//! 3. Panic USER100
1.300 +//! 4. Panic USER101
1.301 +//!
1.302 +//! @SYMTestPriority High
1.303 +//! @SYMTestStatus Implemented
1.304 +//----------------------------------------------------------------------------------------------
1.305 +void TestGlobalChunk()
1.306 + {
1.307 + test.Start(_L("Test RChunk::CreateGlobal - paging attributes"));
1.308 + {
1.309 + TChunkCreateInfo createInfo;
1.310 + createInfo.SetNormal(gPageSize, gPageSize);
1.311 + createInfo.SetGlobal(KGlobalChunkName);
1.312 + VerifyChunkPaged(createInfo);
1.313 + // Test default create method
1.314 + TInt r = gChunk.CreateLocal(gPageSize, gPageSize);
1.315 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.316 + }
1.317 +
1.318 + test.Next(_L("Test RChunk::CreateGlobal - invalid max size"));
1.319 + TestPanicChunkCreate1(ECreateGlobal, gPageSize, -1, EChkCreateMaxSizeNegative);
1.320 +
1.321 + test.Next(_L("Test RChunk::CreateGlobal - invalid size"));
1.322 + TestPanicChunkCreate1(ECreateGlobal, -1, gPageSize, EChkCreateSizeNotPositive);
1.323 +
1.324 +
1.325 + test.Next(_L("Test RChunk::CreateGlobal - aSize > aMaxSize"));
1.326 + TestPanicChunkCreate1(ECreateGlobal, gPageSize << 1, gPageSize, EChkCreateMaxLessThanMin);
1.327 +
1.328 + test.End();
1.329 + }
1.330 +
1.331 +//
1.332 +// TestLocDEChunk
1.333 +//
1.334 +//----------------------------------------------------------------------------------------------
1.335 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.336 +//! @SYMTestType UT
1.337 +//! @SYMPREQ PREQ1954
1.338 +//! @SYMTestCaseDesc Verify the local double ended chunk creation implementation
1.339 +//! @SYMTestActions
1.340 +//! 1. Create a local, double ended, chunk and specify the following paging options.
1.341 +//! Following this check the paging status of the chunk by calling IsPaged().
1.342 +//! a. Not specified
1.343 +//! b. Paged
1.344 +//! c. Unpaged
1.345 +//! 2. Create a local, double ended, chunk and specify aMaxSize to be negative
1.346 +//! 3. Create a local, double ended, chunk and specify aInitialBottom to be negative
1.347 +//! 4. Create a local, double ended, chunk and specify aInitialTop to be negative.
1.348 +//! 5. Create a local, double ended, chunk and specify aInitialBottom to be greater than aInitialTop.
1.349 +//! 6. Create a local, double ended, chunk and specify aInitialTop to be greater than aMaxSize.
1.350 +//!
1.351 +//! @SYMTestExpectedResults
1.352 +//! 1. 1. The following results are expected:
1.353 +//! a. The chunk should take on the paging status of the process
1.354 +//! b. ETrue
1.355 +//! c. EFalse
1.356 +//! 2. Panic USER99
1.357 +//! 3. Panic USER120
1.358 +//! 4. Panic USER121
1.359 +//! 5. Panic USER122
1.360 +//! 6. Panic USER123
1.361 +//!
1.362 +//! @SYMTestPriority High
1.363 +//! @SYMTestStatus Implemented
1.364 +//----------------------------------------------------------------------------------------------
1.365 +void TestLocDEChunk()
1.366 + {
1.367 + test.Start(_L("Test RChunk::CreateDoubleEndedLocal - paging attributes"));
1.368 + {
1.369 + TChunkCreateInfo createInfo;
1.370 + createInfo.SetDoubleEnded(0, gPageSize, gPageSize);
1.371 + VerifyChunkPaged(createInfo);
1.372 + // Test default create method
1.373 + TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
1.374 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.375 + }
1.376 +
1.377 +
1.378 + test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid max size"));
1.379 + TestPanicChunkCreate2(ECreateLocalDE, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
1.380 +
1.381 + test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid bottom"));
1.382 + TestPanicChunkCreate2(ECreateLocalDE, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
1.383 +
1.384 + test.Next(_L("Test RChunk::CreateDoubleEndedLocal - invalid top"));
1.385 + TestPanicChunkCreate2(ECreateLocalDE, 0, -1, gPageSize, EChkCreateTopNegative);
1.386 +
1.387 + test.Next(_L("Test RChunk::CreateDoubleEndedLocal - bottom > top"));
1.388 + TestPanicChunkCreate2(ECreateLocalDE, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
1.389 +
1.390 + test.Next(_L("Test RChunk::CreateDoubleEndedLocal - top > max size"));
1.391 + TestPanicChunkCreate2(ECreateLocalDE, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
1.392 +
1.393 + test.End();
1.394 + }
1.395 +
1.396 +
1.397 +//
1.398 +// TestGlobDEChunk
1.399 +//
1.400 +//----------------------------------------------------------------------------------------------
1.401 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.402 +//! @SYMTestType UT
1.403 +//! @SYMPREQ PREQ1954
1.404 +//! @SYMTestCaseDesc Verify the global double ended chunk creation implementation
1.405 +//! @SYMTestActions
1.406 +//! 1. Create a global, double ended, chunk and specify the following paging options.
1.407 +//! Following this check the paging status of the chunk by calling IsPaged().
1.408 +//! a. Not specified
1.409 +//! b. Paged
1.410 +//! c. Unpaged
1.411 +//! 2. Create a global, double ended, chunk and specify aMaxSize to be negative
1.412 +//! 3. Create a global, double ended, chunk and specify aInitialBottom to be negative
1.413 +//! 4. Create a global, double ended, chunk and specify aInitialTop to be negative.
1.414 +//! 5. Create a global, double ended, chunk and specify aInitialBottom to be greater than aInitialTop.
1.415 +//! 6. Create a global, double ended, chunk and specify aInitialBottom to be greater than aMaxSize.
1.416 +//! 7. Create a global, double ended, chunk and specify aInitialTop to be greater than aMaxSize.
1.417 +//!
1.418 +//! @SYMTestExpectedResults
1.419 +//! 1. 1. The following results are expected:
1.420 +//! a. The chunk should take on the paging status of the process
1.421 +//! b. ETrue
1.422 +//! c. EFalse
1.423 +//! 2. Panic USER99
1.424 +//! 3. Panic USER120
1.425 +//! 4. Panic USER121
1.426 +//! 5. Panic USER122
1.427 +//! 6. Panic USER123
1.428 +//! 7. Panic USER123
1.429 +//!
1.430 +//! @SYMTestPriority High
1.431 +//! @SYMTestStatus Implemented
1.432 +//----------------------------------------------------------------------------------------------
1.433 +void TestGlobDEChunk()
1.434 + {
1.435 + test.Start(_L("Test RChunk::CreateDoubleEndedGlobal - paging attributes"));
1.436 + {
1.437 + TChunkCreateInfo createInfo;
1.438 + createInfo.SetDoubleEnded(0, gPageSize, gPageSize);
1.439 + createInfo.SetGlobal(KGlobalChunkName);
1.440 + VerifyChunkPaged(createInfo);
1.441 + // Test default create method
1.442 + TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
1.443 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.444 + }
1.445 +
1.446 +
1.447 + test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid max size"));
1.448 + TestPanicChunkCreate2(ECreateGlobalDE, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
1.449 +
1.450 + test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid bottom"));
1.451 + TestPanicChunkCreate2(ECreateGlobalDE, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
1.452 +
1.453 + test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - invalid top"));
1.454 + TestPanicChunkCreate2(ECreateGlobalDE, 0, -1, gPageSize, EChkCreateTopNegative);
1.455 +
1.456 + test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - bottom > top"));
1.457 + TestPanicChunkCreate2(ECreateGlobalDE, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
1.458 +
1.459 + test.Next(_L("Test RChunk::CreateDoubleEndedGlobal - top > max size"));
1.460 + TestPanicChunkCreate2(ECreateGlobalDE, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
1.461 + test.End();
1.462 + }
1.463 +
1.464 +
1.465 +//
1.466 +// TestLocDiscChunk
1.467 +//
1.468 +//----------------------------------------------------------------------------------------------
1.469 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.470 +//! @SYMTestType UT
1.471 +//! @SYMPREQ PREQ1954
1.472 +//! @SYMTestCaseDesc Verify the local disconnected chunk creation implementation
1.473 +//! @SYMTestActions
1.474 +//! 1. Create a local, disconnected chunk and specify the following paging options.
1.475 +//! Following this check the paging status of the chunk by calling IsPaged().
1.476 +//! a. Not specified
1.477 +//! b. Paged
1.478 +//! c. Unpaged
1.479 +//! 2. Create a local, disconnected chunk and specify aMaxSize to be negative
1.480 +//! 3. Create a local, disconnected chunk and specify aInitialBottom to be negative
1.481 +//! 4. Create a local, disconnected chunk and specify aInitialTop to be negative.
1.482 +//! 5. Create a local, disconnected chunk and specify aInitialBottom to be greater than aInitialTop.
1.483 +//! 6. Create a local, disconnected chunk and specify aInitialBottom to be greater than aMaxSize.
1.484 +//! 7. Create local, disconnected chunk and specify aInitialTop to be greater than aMaxSize.
1.485 +//!
1.486 +//! @SYMTestExpectedResults
1.487 +//! 1. 1. The following results are expected:
1.488 +//! a. The chunk should take on the paging status of the process
1.489 +//! b. ETrue
1.490 +//! c. EFalse
1.491 +//! 2. Panic USER99
1.492 +//! 3. Panic USER120
1.493 +//! 4. Panic USER121
1.494 +//! 5. Panic USER122
1.495 +//! 6. Panic USER123
1.496 +//! 7. Panic USER123
1.497 +//!
1.498 +//! @SYMTestPriority High
1.499 +//! @SYMTestStatus Implemented
1.500 +//----------------------------------------------------------------------------------------------
1.501 +void TestLocDiscChunk()
1.502 + {
1.503 + test.Start(_L("Test RChunk::CreateDisconnectedLocal - paging attributes"));
1.504 + {
1.505 + TChunkCreateInfo createInfo;
1.506 + createInfo.SetDisconnected(0, gPageSize, gPageSize);
1.507 + VerifyChunkPaged(createInfo);
1.508 + // Test default create method
1.509 + TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
1.510 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.511 + }
1.512 +
1.513 +
1.514 + test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid max size"));
1.515 + TestPanicChunkCreate2(ECreateLocalDC, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
1.516 +
1.517 + test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid bottom"));
1.518 + TestPanicChunkCreate2(ECreateLocalDC, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
1.519 +
1.520 + test.Next(_L("Test RChunk::CreateDisconnectedLocal - invalid top"));
1.521 + TestPanicChunkCreate2(ECreateLocalDC, 0, -1, gPageSize, EChkCreateTopNegative);
1.522 +
1.523 + test.Next(_L("Test RChunk::CreateDisconnectedLocal - bottom > top"));
1.524 + TestPanicChunkCreate2(ECreateLocalDC, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
1.525 +
1.526 + test.Next(_L("Test RChunk::CreateDisconnectedLocal - top > max size"));
1.527 + TestPanicChunkCreate2(ECreateLocalDC, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
1.528 +
1.529 + test.End();
1.530 + }
1.531 +
1.532 +
1.533 +//
1.534 +// TestGlobDiscChunk
1.535 +//
1.536 +//----------------------------------------------------------------------------------------------
1.537 +//! @SYMTestCaseID KBASE-T_CHUNKCREATE-xxxx
1.538 +//! @SYMTestType UT
1.539 +//! @SYMPREQ PREQ1954
1.540 +//! @SYMTestCaseDesc Verify the global disconnected chunk creation implementation
1.541 +//! @SYMTestActions
1.542 +//! 1. Create a global, disconnected chunk and specify the following paging options.
1.543 +//! Following this check the paging status of the chunk by calling IsPaged().
1.544 +//! a. Not specified
1.545 +//! b. Paged
1.546 +//! c. Unpaged
1.547 +//! 2. Create a global, disconnected chunk and specify aMaxSize to be negative
1.548 +//! 3. Create a global, disconnected chunk and specify aInitialBottom to be negative
1.549 +//! 4. Create a global, disconnected chunk and specify aInitialTop to be negative.
1.550 +//! 5. Create a global, disconnected chunk and specify aInitialBottom to be greater than aInitialTop.
1.551 +//! 6. Create a global, disconnected chunk and specify aInitialBottom to be greater than aMaxSize.
1.552 +//! 7. Create global, disconnected chunk and specify aInitialTop to be greater than aMaxSize.
1.553 +//!
1.554 +//! @SYMTestExpectedResults
1.555 +//! 1. 1. The following results are expected:
1.556 +//! a. The chunk should take on the paging status of the process
1.557 +//! b. ETrue
1.558 +//! c. EFalse
1.559 +//! 2. Panic USER99
1.560 +//! 3. Panic USER120
1.561 +//! 4. Panic USER121
1.562 +//! 5. Panic USER122
1.563 +//! 6. Panic USER123
1.564 +//! 7. Panic USER123
1.565 +//!
1.566 +//! @SYMTestPriority High
1.567 +//! @SYMTestStatus Implemented
1.568 +//----------------------------------------------------------------------------------------------
1.569 +void TestGlobDiscChunk()
1.570 + {
1.571 + test.Start(_L("Test RChunk::CreateDisconnectedGlobal - paging attributes"));
1.572 + {
1.573 + TChunkCreateInfo createInfo;
1.574 + createInfo.SetDisconnected(0, gPageSize, gPageSize);
1.575 + createInfo.SetGlobal(KGlobalChunkName);
1.576 + VerifyChunkPaged(createInfo);
1.577 + // Test default create method
1.578 + TInt r = gChunk.CreateDoubleEndedLocal(0, gPageSize, gPageSize);
1.579 + VerifyChunkPaged(gChunk, gProcessPaged, r);
1.580 + }
1.581 +
1.582 +
1.583 + test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid max size"));
1.584 + TestPanicChunkCreate2(ECreateGlobalDC, 0, gPageSize, -1, EChkCreateMaxSizeNegative);
1.585 +
1.586 + test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid bottom"));
1.587 + TestPanicChunkCreate2(ECreateGlobalDC, -1, gPageSize, gPageSize, EChkCreateBottomNegative);
1.588 +
1.589 + test.Next(_L("Test RChunk::CreateDisconnectedGlobal - invalid top"));
1.590 + TestPanicChunkCreate2(ECreateGlobalDC, 0, -1, gPageSize, EChkCreateTopNegative);
1.591 +
1.592 + test.Next(_L("Test RChunk::CreateDisconnectedGlobal - bottom > top"));
1.593 + TestPanicChunkCreate2(ECreateGlobalDC, gPageSize, 0, gPageSize, EChkCreateTopLessThanBottom);
1.594 +
1.595 + test.Next(_L("Test RChunk::CreateDisconnectedGlobal - top > max size"));
1.596 + TestPanicChunkCreate2(ECreateGlobalDC, 0, gPageSize << 1, gPageSize, EChkCreateTopBiggerThanMax);
1.597 +
1.598 + test.End();
1.599 + }
1.600 +
1.601 +
1.602 +
1.603 +
1.604 +TInt TestingTChunkCreate()
1.605 + {
1.606 + test.Start(_L("Test TChunkCreateInfo - Local Chunk"));
1.607 + TestLocalChunk();
1.608 +
1.609 + test.Next(_L("Test TChunkCreateInfo - Code Chunk"));
1.610 + TestCodeChunk();
1.611 +
1.612 + test.Next(_L("Test TChunkCreateInfo - Global Chunk"));
1.613 + TestGlobalChunk();
1.614 +
1.615 + test.Next(_L("Test TChunkCreateInfo - Local Double Ended Chunk"));
1.616 + TestLocDEChunk();
1.617 +
1.618 + test.Next(_L("Test TChunkCreateInfo - Global Double Ended Chunk"));
1.619 + TestGlobDEChunk();
1.620 +
1.621 + test.Next(_L("Test TChunkCreateInfo - Local Disconnected Chunk"));
1.622 + TestLocDiscChunk();
1.623 +
1.624 + test.Next(_L("Test TChunkCreateInfo - Global Disconnected Chunk"));
1.625 + TestGlobDiscChunk();
1.626 +
1.627 + test.End();
1.628 + return 0;
1.629 + }