persistentstorage/sqlite3api/TEST/t_sqlitewsd.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 0 08ec8eefde2f
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
    17 #include <e32uid.h>
    17 #include <e32uid.h>
    18 #include <f32file.h>
    18 #include <f32file.h>
    19 #include <e32math.h>
    19 #include <e32math.h>
    20 #include <sqlite3.h>
    20 #include <sqlite3.h>
    21 #include "t_sqlitewsd.h"
    21 #include "t_sqlitewsd.h"
       
    22 #include "sqliteTestUtl.h"
    22 
    23 
    23 #include <spawn.h>
    24 #include <spawn.h>
    24 #include <sys/wait.h>
    25 #include <sys/wait.h>
    25 
    26 
    26 ///////////////////////////////////////////////////////////////////////////////////////
    27 ///////////////////////////////////////////////////////////////////////////////////////
    27 
    28 
    28 static RTest	TheTest(_L("t_sqlitewsd test"));
    29 const char* const KTestName = "t_sqlitewsd";
    29 static RFs		TheFs;
    30 static RFs		TheFs;
    30 
    31 
    31 static pid_t	TheKSqliteWsdProc2Pid = 0;
    32 static pid_t	TheKSqliteWsdProc2Pid = 0;
    32 const char* 	KSqliteWsdProc2Name = "z:\\sys\\bin\\t_sqlitewsd2.exe";
    33 const char* 	KSqliteWsdProc2Name = "z:\\sys\\bin\\t_sqlitewsd2.exe";
    33 
    34 
    60 void Check(TInt aValue, TInt aLine)
    61 void Check(TInt aValue, TInt aLine)
    61 	{
    62 	{
    62 	if(!aValue)
    63 	if(!aValue)
    63 		{
    64 		{
    64 		DestroyTestEnv();
    65 		DestroyTestEnv();
    65 		TheTest(EFalse, aLine);
    66 		TestTestLine(EFalse, aLine);
    66 		}
    67 		}
    67 	}
    68 	}
    68 	
    69 	
    69 void Check(TInt aValue, TInt aExpected, TInt aLine)
    70 void Check(TInt aValue, TInt aExpected, TInt aLine)
    70 	{
    71 	{
    77 			TBuf<200> msgBuf;
    78 			TBuf<200> msgBuf;
    78 			msgBuf.Copy(TPtrC8((const TUint8*)errMsg));
    79 			msgBuf.Copy(TPtrC8((const TUint8*)errMsg));
    79 			RDebug::Print(_L("*** SQLITE error msg: \"%S\".\r\n"), &msgBuf);
    80 			RDebug::Print(_L("*** SQLITE error msg: \"%S\".\r\n"), &msgBuf);
    80 			}
    81 			}
    81 		DestroyTestEnv();
    82 		DestroyTestEnv();
    82 		TheTest(EFalse, aLine);
    83 		TestTestLine(EFalse, aLine);
    83 		}
    84 		}
    84 	}
    85 	}
    85 
    86 
    86 ///////////////////////////////////////////////////////////////////////////////////////
    87 ///////////////////////////////////////////////////////////////////////////////////////
    87 
    88 
   180 @SYMTestExpectedResults Test must not fail
   181 @SYMTestExpectedResults Test must not fail
   181 @SYMREQ					REQ8782
   182 @SYMREQ					REQ8782
   182 */
   183 */
   183 static void DoWsdTests()
   184 static void DoWsdTests()
   184 	{
   185 	{
   185 	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQLITE3-UT-4026 Create the test database "));
   186 	TestStart(" @SYMTestCaseID:SYSLIB-SQLITE3-UT-4026 Create the test database ");
   186 	CreateDb();
   187 	CreateDb();
   187 	TheTest.Next(_L("Run the second process: t_sqlitewsd2"));
   188 	TestNext("Run the second process: t_sqlitewsd2");
   188 	RunSqliteWsd2();
   189 	RunSqliteWsd2();
   189 	TheTest.Next(_L("Insert the records"));
   190 	TestNext("Insert the records");
   190 	DoInserts(KWsdProc1Id, KWsdProc1RecId1, KWsdProc1RecId2);
   191 	DoInserts(KWsdProc1Id, KWsdProc1RecId1, KWsdProc1RecId2);
   191 	DestroySqliteWsd2();
   192 	DestroySqliteWsd2();
   192 	TheTest.Next(_L("Verify the inserted records"));
   193 	TestNext("Verify the inserted records");
   193 	DoVerify();
   194 	DoVerify();
   194 	}
   195 	}
   195 
   196 
   196 ///////////////////////////////////////////////////////////////////////////////////////
   197 ///////////////////////////////////////////////////////////////////////////////////////
   197 
   198 
   198 TInt E32Main()
   199 TInt E32Main()
   199 	{
   200 	{
   200 	TheTest.Title();
   201 	TestOpen(KTestName);
       
   202 	TestTitle();
   201 	
   203 	
   202 	CTrapCleanup* tc = CTrapCleanup::New();
   204 	CTrapCleanup* tc = CTrapCleanup::New();
   203 	
   205 	
   204 	__UHEAP_MARK;
   206 	__UHEAP_MARK;
   205 	
   207 	
   207 	DoWsdTests();
   209 	DoWsdTests();
   208 	DestroyTestEnv();
   210 	DestroyTestEnv();
   209 	
   211 	
   210 	__UHEAP_MARKEND;
   212 	__UHEAP_MARKEND;
   211 	
   213 	
   212 	TheTest.End();
   214 	TestEnd();
   213 	TheTest.Close();
   215 	TestClose();
   214 	
   216 	
   215 	delete tc;
   217 	delete tc;
   216 	
   218 	
   217 	User::Heap().Check();
   219 	User::Heap().Check();
   218 	return KErrNone;
   220 	return KErrNone;