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