os/persistentdata/persistentstorage/dbms/pcdbms/tdbms/src/t_bug.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1998-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 "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 // Test code for bugs that have been fixed, to help prevent regression
    15 // 
    16 //
    17 
    18 #include <d32dbms.h>
    19 #include <f32file.h>
    20 #include <e32test.h>
    21 #include <s32mem.h>
    22 #include "crccheck.h"
    23 
    24 #undef __UHEAP_MARK
    25 #undef __UHEAP_MARKEND
    26 #define __UHEAP_MARK
    27 #define __UHEAP_MARKEND
    28 
    29 LOCAL_D TDBMS_CRCChecks TheCrcChecker;
    30 
    31 #ifndef __linux__ //No CRC test on LINUX
    32 #ifdef __TOOLS2__
    33 const TPtrC	KCrcRecord=_L("\\epoc32\\winscw\\c\\dbms-tst\\T_BUG.CRC");
    34 #else
    35 const TPtrC	KCrcRecord=_L("C:\\dbms-tst\\T_BUG.CRC");
    36 #endif
    37 #endif
    38 
    39 LOCAL_D RTest test(_L("T_BUG"));
    40 LOCAL_D CTrapCleanup* TheTrapCleanup;
    41 LOCAL_D RFs TheFs;
    42 LOCAL_D RDbNamedDatabase TheDatabase;
    43 
    44 const TInt KTestCleanupStack=0x40;
    45 
    46 void Check(TInt aValue,TInt aExpected,TInt aLine)
    47 	{
    48 	if (aValue!=aExpected)
    49 		{
    50 		test.Printf(_L("*** Expected %d: got %d\r\n"),aExpected,aValue);
    51 		test.operator()(EFalse,aLine);
    52 		}
    53 	}
    54 #define test2(a,b) Check(a,b,__LINE__)
    55 
    56 static void Print(const TText* aString)
    57 	{
    58 	test.Printf(_L("%s\n"),aString);
    59 	}
    60 
    61 ////////////////////////////////////////////
    62 
    63 
    64 #ifdef __TOOLS2__
    65 const TPtrC KTestDatabase=_L(".\\dbms-tst\\t_bug.db");
    66 #else
    67 const TPtrC KTestDatabase=_L("C:\\dbms-tst\\t_bug.db");
    68 #endif
    69 
    70 _LIT(KTableA,"A");
    71 _LIT(KTableB,"B");
    72 _LIT(KTableC,"C");
    73 
    74 class Defect_590829
    75 	{
    76 public:
    77 	static void TestL();
    78 	static const TDesC& Name();
    79 	};
    80 
    81 
    82 const TDesC& Defect_590829::Name()
    83 	{
    84 	_LIT(KName,"590829");
    85 	return KName;
    86 	}
    87 
    88 /////////////////////////////////////////////////
    89 
    90 // Length of text data used for each entry. This will be
    91 // equivalent to 400 bytes for ansi characters. The number of
    92 // bytes must not be less than 256 (or 128 for this const).
    93 // If it is a stream will not be used for transfer of data.
    94 const TInt KTextDataLength = 200;
    95 
    96 // max column size
    97 const TInt KMaxColLength = 1000;
    98 
    99 // Buffer size to cause HDbsBuf::DoReadL() ipc check to be executed
   100 const TInt KBufSizeDoReadL = 1000;
   101 
   102 // Buffer size to cause HDbsBuf::UnderflowL() ipc check to be executed
   103 const TInt KBufSizeUnderflowL = 500;
   104 
   105 class Defect_071149
   106 	{
   107 public:
   108 	static void TestL();
   109 	static const TDesC& Name();
   110 	};
   111 
   112 
   113 const TDesC& Defect_071149::Name()
   114 	{
   115 	_LIT(KName,"071149");
   116 	return KName;
   117 	}
   118 
   119 /**
   120 HDbsBuf did not handle case when iIpc.iHandle is 0 causing IPC calls to panic.
   121 The handle is 0 when opening a stream and all data is retrieved in this request.
   122 
   123 @SYMTestCaseID			SYSLIB-DBMS-CT-1491
   124 @SYMTestCaseDesc		Tests for defect number 590829
   125 @SYMTestPriority			High
   126 @SYMTestActions			Tests by setting up failure conditions.
   127 @SYMTestExpectedResults	Test must not fail
   128 @SYMDEF				INC071149
   129 */
   130 void Defect_071149::TestL()
   131 	{
   132 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1491 "));
   133 	Print(_S("Creating test database"));
   134 
   135 	// Connect to dbms and open db
   136 	RDbs dbs;
   137 	RDbNamedDatabase db;
   138 	test2 (db.Replace(TheFs,KTestDatabase),KErrNone);
   139 	db.Close();
   140 	TheCrcChecker.GenerateCrcL(KTestDatabase);
   141 
   142 #ifndef __TOOLS2__
   143 	test2(dbs.Connect(), KErrNone);
   144 #endif
   145 	test2(db.Open(dbs,KTestDatabase), KErrNone);
   146 
   147 	// creating column to hold LongText
   148 	CDbColSet *colSet = CDbColSet::NewL();
   149 	CleanupStack::PushL(colSet);
   150 	colSet->AddL(TDbCol(_L("Id"), EDbColLongText, KMaxColLength));
   151 	
   152 	// create table
   153 	test2(db.CreateTable(KTableA, *colSet), KErrNone);
   154 	CleanupStack::PopAndDestroy(colSet);
   155 	
   156 	// create text data to add to table	
   157 	HBufC* testText = HBufC::New(KTextDataLength);
   158 	test(testText !=NULL );
   159 	TPtr ptr = testText->Des();
   160 	for(TInt y=0;y<KTextDataLength;++y)
   161 		{
   162 		ptr.Append(TChar('A'));
   163 		}
   164 
   165 	// add data to table
   166 	RDbTable newTable;
   167 	test2 (newTable.Open(db,KTableA),KErrNone);
   168 	db.Begin();
   169 	newTable.InsertL();
   170 	newTable.SetColL(1, ptr);
   171 	newTable.PutL();
   172 
   173 	test2 (db.Commit(),KErrNone);
   174 	test2 (newTable.CountL(), 1);
   175 	newTable.Close();
   176 	
   177 	// cleanup
   178 	delete testText;
   179 
   180 	// disconnect from db and dbms
   181 	db.Close();
   182 	TheCrcChecker.GenerateCrcL(KTestDatabase);
   183 #ifndef __TOOLS2__
   184 	dbs.Close();
   185 #endif
   186 
   187 //
   188 	// Connect to dbms and open db
   189 #ifndef __TOOLS2__
   190 	test2(dbs.Connect(), KErrNone);
   191 #endif
   192 	test2(db.Open(dbs,KTestDatabase), KErrNone);
   193 
   194 	// Test handle check in HDbsBuf::DoReadL() - See defect
   195 	// If the handle check did not exist in the production code then
   196 	// it would panic.
   197 
   198 	// create test table
   199 	RDbTable testTable;
   200 	test2 (testTable.Open(db,KTableA),KErrNone);
   201 	db.Begin();
   202 	testTable.FirstL();
   203 	testTable.GetL();
   204 	
   205 	// Open stream
   206 	RDbColReadStream rs;
   207     	rs.OpenLC( testTable, 1);
   208 	
   209 	// Read data
   210 	TBuf<KBufSizeDoReadL> buf;
   211 	TRAPD(err, rs.ReadL( buf, buf.MaxLength()));
   212 	if(err != KErrNone)
   213 		{
   214 		test2(err, KErrEof);
   215 		}
   216 	CleanupStack::PopAndDestroy();  // Close rs
   217 	testTable.Close();
   218 
   219 //
   220 	// Test handle check in HDbsBuf::UnderflowL() - additional error not in defect
   221 	// If the handle check did not exist in the production code then
   222 	// it would panic.
   223 
   224 	// create test table
   225 	test2 (testTable.Open(db,KTableA),KErrNone);
   226 	testTable.NextL();
   227 	testTable.GetL();
   228 
   229 	// Open stream
   230 	RDbColReadStream rs2;
   231     	rs2.OpenLC( testTable, 1);
   232 
   233 	// Read data
   234 	TBuf<KBufSizeUnderflowL> buf2;
   235 	TRAP(err, rs2.ReadL( buf2, buf2.MaxLength()));
   236 	if(err != KErrNone)
   237 		{
   238 		test2(err, KErrEof);
   239 		}
   240 	CleanupStack::PopAndDestroy();  // Close rs
   241 
   242 	// tidy up
   243 	testTable.Close();
   244 	db.Close();
   245 #ifndef __TOOLS2__
   246 	dbs.Close();
   247 #endif
   248 	}
   249 
   250 /////////////////////////////////////////////////
   251 
   252 /**
   253 Cached, unused tables were breaking the iterator in CDbTableDatabase::CheckIdle
   254 The latter function has been re-written to restart the iteration when tables are Idle()'d
   255 
   256 @SYMTestCaseID          SYSLIB-DBMS-CT-0582
   257 @SYMTestCaseDesc        Tests for defect number 590829
   258 @SYMTestPriority        Medium
   259 @SYMTestActions        	Tests by setting up failure conditions.
   260 @SYMTestExpectedResults Test must not fail
   261 @SYMREQ                 REQ0000
   262 */
   263 void Defect_590829::TestL()
   264 	{
   265 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0582 "));
   266 	Print(_S("Creating test database"));
   267 	test2 (TheDatabase.Replace(TheFs,KTestDatabase),KErrNone);
   268 	TheDatabase.Begin();
   269 	test2 (TheDatabase.Execute(_L("create table A (id counter)")),KErrNone);
   270 	test2 (TheDatabase.Execute(_L("create table B (id counter)")),KErrNone);
   271 	test2 (TheDatabase.Execute(_L("create table C (id counter)")),KErrNone);
   272 	test2 (TheDatabase.Commit(),KErrNone);
   273 //
   274 	Print(_S("Setting up failure"));
   275 	RDbTable tA,tB,tC;
   276 	test2 (tA.Open(TheDatabase,KTableA),KErrNone);
   277 	test2 (tB.Open(TheDatabase,KTableB),KErrNone);
   278 	tB.Close();
   279 	test2 (tC.Open(TheDatabase,KTableC),KErrNone);
   280 	tC.Close();
   281 	TheDatabase.Begin();
   282 	tA.Close();
   283 //
   284 	Print(_S("Testing fix"));
   285 	test2 (TheDatabase.Commit(),KErrNone);
   286 	TheDatabase.Destroy();
   287 	}
   288 
   289 /////////////////////////////////////////////////
   290 
   291 #ifndef TOOLS2_VARIANT
   292 class Defect_394751
   293 	{
   294 public:
   295 	static void TestL();
   296 	static const TDesC& Name();
   297 private:
   298 	static TInt Thread(TAny*);
   299 	static void ThreadL();
   300 	};
   301 
   302 
   303 const TDesC& Defect_394751::Name()
   304 	{
   305 	_LIT(KName,"394751");
   306 	return KName;
   307 	}
   308 
   309 void Defect_394751::ThreadL()
   310 	{
   311 	RDbs dbs;
   312 	RDbNamedDatabase db;
   313 	User::LeaveIfError(dbs.Connect());
   314 	User::LeaveIfError(db.Open(dbs,KTestDatabase));
   315 	db.Begin();
   316 	db.Begin();	/// panic now
   317 	User::Panic(_L("T_BUG failure"),0);
   318 	}
   319 
   320 TInt Defect_394751::Thread(TAny*)
   321 	{
   322 	User::SetJustInTime(EFalse);	// disable debugger panic handling
   323 	CTrapCleanup* cleanup=CTrapCleanup::New();
   324 	if (!cleanup)
   325 		return KErrNoMemory;
   326 	TRAPD(r,ThreadL());
   327 	delete cleanup;
   328 	return r;
   329 	}
   330 
   331 /**
   332 @SYMTestCaseID          SYSLIB-DBMS-CT-0583
   333 @SYMTestCaseDesc        Tests for defect number 394751 
   334 @SYMTestPriority        Medium
   335 @SYMTestActions        	Tests for thread exit status.
   336 @SYMTestExpectedResults Test must not fail
   337 @SYMREQ                 REQ0000
   338 */
   339 void Defect_394751::TestL()
   340 //
   341 //
   342 	{
   343 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0583 "));
   344 	Print(_S("Creating test database"));
   345 	test2 (TheDatabase.Replace(TheFs,KTestDatabase),KErrNone);
   346 	TheDatabase.Close();
   347 	TheCrcChecker.GenerateCrcL(KTestDatabase);
   348 //
   349 	RDbs dbs;
   350 	test2 (dbs.Connect(),KErrNone);
   351 //
   352 	Print(_S("Running test thread"));
   353 	RThread t;
   354 	_LIT(KTestThread,"Defect Fix 394751");
   355 	test2 (t.Create(KTestThread,&Thread,0x2000,0x1000,0x10000,0,EOwnerThread),KErrNone);
   356 	TRequestStatus s;
   357 	t.Logon(s);
   358 	test2 (s.Int(),KRequestPending);
   359 	t.Resume();
   360 	Print(_S("Awaiting completion"));
   361 	User::WaitForRequest(s);
   362 	_LIT(KCategory,"DBMS-Table");
   363 	test2 (t.ExitType(),EExitPanic);
   364 	test (t.ExitCategory()==KCategory);
   365 	test2 (t.ExitReason(),11);		// begin nested transaction
   366 	User::SetJustInTime(ETrue);	// enable debugger panic handling
   367 	t.Close();
   368 //
   369 	test2 (dbs.ResourceCount(),0);
   370 	dbs.Close();
   371 	}
   372 #endif
   373 
   374 ///////////////////////////////////////////////////////////
   375 
   376 #ifndef TOOLS2_VARIANT
   377 class Defect_COMBBAR_463J5D
   378 	{
   379 public:
   380 	static void TestL();
   381 	static const TDesC& Name();
   382 private:
   383 	static void WaitForServerExit();
   384 	static TInt Thread(TAny*);
   385 	};
   386 
   387 const TDesC& Defect_COMBBAR_463J5D::Name()
   388 	{
   389 	_LIT(KName,"COMBBAR_463J5D");
   390 	return KName;
   391 	}
   392 
   393 void Defect_COMBBAR_463J5D::WaitForServerExit()
   394 	{
   395 	_LIT(KDbmsServer,"*!DBMS server");
   396 	TFullName n;
   397 	TFindThread ft(KDbmsServer);
   398 	if (ft.Next(n)==KErrNone)
   399 		{
   400 		RThread t;
   401 		if (t.Open(ft)==KErrNone)
   402 			{
   403 			TRequestStatus s;
   404 			t.Logon(s);
   405 			User::WaitForRequest(s);
   406 			t.Close();
   407 			}
   408 		}
   409 	}
   410 
   411 TInt Defect_COMBBAR_463J5D::Thread(TAny*)
   412 //
   413 // Just try to start the server
   414 //
   415 	{
   416 	RDbs dbs;
   417 	return dbs.Connect();
   418 	}
   419 
   420 /**
   421 @SYMTestCaseID          SYSLIB-DBMS-CT-0584
   422 @SYMTestCaseDesc        Tests for defect number COMBBAR_463J5D  
   423 @SYMTestPriority        Medium
   424 @SYMTestActions        	Testing that defect COMBBAR_463J5D in ER5 Defects database has been fixed
   425 @SYMTestExpectedResults Test must not fail
   426 @SYMREQ                 REQ0000
   427 */
   428 void Defect_COMBBAR_463J5D::TestL()
   429 	{
   430 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0584 "));
   431 	Print(_S("Wait for the server to exit"));
   432 	WaitForServerExit();
   433 //
   434 	Print(_S("Create the launching threads"));
   435 	RThread t1,t2;
   436 	TRequestStatus s1,s2;
   437 	_LIT(KThread1,"t1");
   438 	test2 (t1.Create(KThread1,&Thread,0x2000,0,0,EOwnerThread),KErrNone);
   439 	t1.SetPriority(EPriorityLess);
   440 	t1.Logon(s1);
   441 	_LIT(KThread2,"t2");
   442 	test2 (t2.Create(KThread2,&Thread,0x2000,0,0,EOwnerThread),KErrNone);
   443 	t2.SetPriority(EPriorityLess);
   444 	t2.Logon(s2);
   445 //
   446 	Print(_S("Run the threads and wait"));
   447 	t1.Resume();
   448 	t2.Resume();
   449 	User::WaitForRequest(s1,s2);
   450 	if (s1==KRequestPending)
   451 		User::WaitForRequest(s1);
   452 	else
   453 		User::WaitForRequest(s2);
   454 //
   455 	test2 (t1.ExitType(),EExitKill);
   456 	if (s1.Int()!=KErrNotFound)
   457 		test2 (s1.Int(),KErrNone);
   458 	test2 (t2.ExitType(),EExitKill);
   459 	if (s2.Int()!=KErrNotFound)
   460 		test2 (s2.Int(),KErrNone);
   461 	t1.Close();
   462 	t2.Close();
   463 	}
   464 
   465 #endif
   466 /////////////////////////////////////////////////////////
   467 
   468 class Defect_EDNATHE_48AEZW
   469 	{
   470 public:
   471 	static void TestL();
   472 	static const TDesC& Name();
   473 	};
   474 
   475 const TDesC& Defect_EDNATHE_48AEZW::Name()
   476 	{
   477 	_LIT(KName,"EDNATHE_48AEZW");
   478 	return KName;
   479 	}
   480 /**
   481 @SYMTestCaseID          SYSLIB-DBMS-CT-0585
   482 @SYMTestCaseDesc        Tests for defect number EDNATHE_48AEZW  
   483 @SYMTestPriority        Medium
   484 @SYMTestActions        	Tests for navigation and deletion 
   485 @SYMTestExpectedResults Test must not fail
   486 @SYMREQ                 REQ0000
   487 */
   488 void Defect_EDNATHE_48AEZW::TestL()
   489 	{
   490 	test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0585 "));
   491 	Print(_S("Set up database"));
   492 	test2 (TheDatabase.Replace(TheFs,KTestDatabase),KErrNone);
   493 	test2 (TheDatabase.Begin(),KErrNone);
   494 	test2 (TheDatabase.Execute(_L("create table A (id counter)")),KErrNone);
   495 	RDbView v1;
   496 	test2 (v1.Prepare(TheDatabase,_L("select * from A"),v1.EInsertOnly),KErrNone);
   497 	test2 (v1.EvaluateAll(),KErrNone);
   498 	for (TInt ii=0;ii<4;++ii)
   499 		{
   500 		v1.InsertL();
   501 		v1.PutL();
   502 		}
   503 	test2 (TheDatabase.Commit(),KErrNone);
   504 	v1.Close();
   505 //
   506 	Print(_S("test navigation"));
   507 	test2 (v1.Prepare(TheDatabase,_L("select * from A where id=0")),KErrNone);
   508 	test2 (v1.EvaluateAll(),KErrNone);
   509 	v1.FirstL();
   510 	RDbView v2;
   511 	test2 (v2.Prepare(TheDatabase,_L("select * from A where id=1")),KErrNone);
   512 	test2 (v2.EvaluateAll(),KErrNone);
   513 	v2.FirstL();
   514 	v2.DeleteL();
   515 	TRAPD(r, v1.NextL());
   516 	test2 (r,KErrNone);
   517 	test (v1.AtEnd());
   518 	v2.Close();
   519 //
   520 	Print(_S("test deletion"));
   521 	v1.FirstL();
   522 	test2 (v2.Prepare(TheDatabase,_L("select * from A where id=2")),KErrNone);
   523 	test2 (v2.EvaluateAll(),KErrNone);
   524 	v2.FirstL();
   525 	v2.DeleteL();
   526 	TRAP(r,v1.DeleteL());
   527 	test2 (r,KErrNone);
   528 	TRAP(r, v1.NextL());
   529 	test2 (r,KErrNone);
   530 	test (v1.AtEnd());
   531 //
   532 	v1.Close();
   533 	v2.Close();
   534 	TheDatabase.Close();
   535 	TheCrcChecker.GenerateCrcL(KTestDatabase);
   536 	}
   537 
   538 /////////////////////////////////////////////////////////
   539 
   540 static void NextTest(const TDesC& aName)
   541 	{
   542 	TBuf<80> buf;
   543 	buf=_S("Checking Defect ");
   544 	buf+=aName;
   545 	test.Next(buf);
   546 	}
   547 
   548 template <typename T>
   549 struct RunTest
   550 	{
   551 	RunTest()
   552 		{
   553 		const TDesC& name = T::Name();
   554 		NextTest(name);
   555 		TRAPD(r,T::TestL());
   556 		test2 (r,KErrNone);
   557 		Print(_S("Defect fixed"));
   558 		}
   559 	};
   560 
   561 LOCAL_C void setupTestDirectory()
   562 //
   563 // Prepare the test directory.
   564 //
   565     {
   566 	TInt r=TheFs.Connect();
   567 	test(r==KErrNone);
   568 //
   569 	r=TheFs.MkDir(KTestDatabase);
   570 	test(r==KErrNone || r==KErrAlreadyExists);
   571 	}
   572 
   573 LOCAL_C void setupCleanup()
   574 //
   575 // Initialise the cleanup stack.
   576 //
   577     {
   578 	TheTrapCleanup=CTrapCleanup::New();
   579 	test(TheTrapCleanup!=NULL);
   580 	TRAPD(r,\
   581 		{\
   582 		for (TInt i=KTestCleanupStack;i>0;i--)\
   583 			CleanupStack::PushL((TAny*)0);\
   584 		CleanupStack::Pop(KTestCleanupStack);\
   585 		});
   586 	test(r==KErrNone);
   587 	}
   588 
   589 LOCAL_C void DeleteDataFile(const TDesC& aFullName)
   590 	{
   591 	RFs fsSession;
   592 	TInt err = fsSession.Connect();
   593 	if(err == KErrNone)
   594 		{
   595 		TEntry entry;
   596 		if(fsSession.Entry(aFullName, entry) == KErrNone)
   597 			{
   598 			RDebug::Print(_L("Deleting \"%S\" file.\n"), &aFullName);
   599 			err = fsSession.SetAtt(aFullName, 0, KEntryAttReadOnly);
   600 			if(err != KErrNone) 
   601 				{
   602 				RDebug::Print(_L("Error %d changing \"%S\" file attributes.\n"), err, &aFullName);
   603 				}
   604 			err = fsSession.Delete(aFullName);
   605 			if(err != KErrNone) 
   606 				{
   607 				RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err, &aFullName);
   608 				}
   609 			}
   610 		fsSession.Close();
   611 		}
   612 	else
   613 		{
   614 		RDebug::Print(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName);
   615 		}
   616 	}
   617 
   618 
   619 GLDEF_C TInt E32Main()
   620     {
   621 	__UHEAP_MARK;
   622 	test.Title();
   623 	setupTestDirectory();
   624 	setupCleanup();
   625 
   626 	test.Start(_L("Verifying defect fixes"));
   627 #ifndef TOOLS2_VARIANT
   628 	RunTest<Defect_COMBBAR_463J5D>();
   629 #else
   630 	test.Printf(_L("Skipping defect test Defect_COMBBAR_463J5D\n"));
   631 #endif
   632 // The following short delay is needed for ccover builds only.
   633 // Without the pause, the kernel scheduler would intermittently 
   634 // crash 0.3s after the last test ended.
   635 	User::After(500000);
   636 	test.Printf(_L("Resume test after delay.\n"));
   637 
   638 #ifndef TOOLS2_VARIANT
   639 	RunTest<Defect_394751>();
   640 	User::After(500000);
   641 	test.Printf(_L("Resume test after delay.\n"));
   642 #else
   643 	test.Printf(_L("Skipping defect test of Defect_394751\n"));
   644 #endif
   645 
   646 	RunTest<Defect_590829>();
   647 	User::After(500000);
   648 	test.Printf(_L("Resume test after delay.\n"));
   649 
   650 	RunTest<Defect_071149>();
   651 	User::After(500000);
   652 	test.Printf(_L("Resume test after delay.\n"));
   653 
   654 	RunTest<Defect_EDNATHE_48AEZW>();
   655 	test.Next(_L("Waiting for server exit"));
   656 	const TUint KExitDelay=6*0x100000;	// ~6 seconds
   657 	User::After(KExitDelay);
   658 
   659 	// clean up data files used by this test - must be done before call to End() - DEF047652
   660 	::DeleteDataFile(KTestDatabase);
   661 
   662 #ifndef __linux__
   663 	TInt err;
   664 #ifndef __TOOLS2__
   665 	TRAPD(lc, err = TheCrcChecker.DumpCrcRecordsL(KCrcRecord));
   666 	test(err==KErrNone);
   667 	test(lc==KErrNone);
   668 #else
   669 	TRAPD(lc, err = TheCrcChecker.ValidateCrcRecordsL(KCrcRecord));
   670 	TPtrC errmsg;
   671 	TheCrcChecker.ErrorReportL(err, errmsg);
   672 	RDebug::Print(errmsg);
   673 	test(err==KErrNone || err==TDBMS_CRCChecks::ECrcCheckOk);
   674 #endif // Tools2
   675 #endif // Linux
   676 
   677 	test.End();
   678 //
   679 	delete TheTrapCleanup;
   680 
   681 	TheFs.Close();
   682 	test.Close();
   683 	__UHEAP_MARKEND;
   684 	return 0;
   685     }