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