os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_028_xx.cpp
First public contribution.
1 // Copyright (c) 2003-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // See the test specification for details of what these test cases do.
16 #include "teststepcomsdbg.h"
17 #include "TestMessage.h"
18 #include "step_028_xx.h"
21 #include <comms-infras/commsdebugutility.h>
23 const TInt KWaitForFloggerShutdown = 2000000;
24 const TInt KMultipleWriteStressTimes = 100;
27 * 028_Sync_Setup - creates flogger.ini to include token "synchronous"
28 * doTestStep returns whether test case passed or failed.
32 CFloggerTest028_Sync_Setup::CFloggerTest028_Sync_Setup()
34 // Store the name of this test case
35 SetTestStepName(_L("step_028_Sync_Setup"));
39 CFloggerTest028_Sync_Setup::~CFloggerTest028_Sync_Setup()
45 TVerdict CFloggerTest028_Sync_Setup::doTestStepL( )
47 if ( executeStepL() == KErrNone )
48 SetTestStepResult(EPass);
51 SetTestStepResult(EFail);
54 return TestStepResult();
58 TInt CFloggerTest028_Sync_Setup::executeStepL(TBool)
63 TInt CFloggerTest028_Sync_Setup::executeStepL()
68 flogger.__DbgShutDownServer();
70 User::After(KWaitForFloggerShutdown);
71 TRAP(ret,constructFloggerIniL(KSyncTestsIniFileSettings));
73 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
81 * 028_Sync_ConWriteUni - test sync with connected unicode write
82 * doTestStep returns whether test case passed or failed.
85 CFloggerTest028_Sync_ConWriteUni::CFloggerTest028_Sync_ConWriteUni()
87 // Store the name of this test case
88 SetTestStepName(_L("step_028_Sync_ConWriteUni"));
94 CFloggerTest028_Sync_ConWriteUni::~CFloggerTest028_Sync_ConWriteUni()
101 TVerdict CFloggerTest028_Sync_ConWriteUni::doTestStepL( )
103 if ( executeStepL() == KErrNone )
104 SetTestStepResult(EPass);
107 SetTestStepResult(EFail);
110 return TestStepResult();
115 TInt CFloggerTest028_Sync_ConWriteUni::executeStepL(TBool)
120 TInt CFloggerTest028_Sync_ConWriteUni::executeStepL()
125 ret = flogger.Connect();
127 if ( ret == KErrNone )
129 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
131 flogger.Write(KTestMessage);
133 TRAPD(r, ret = DoTestCheckWriteL());
144 TInt CFloggerTest028_Sync_ConWriteUni::DoTestCheckWriteL()
148 TInt listfilesize,returnCode;
149 RFs fileSystem; //For file operation create a file system
150 TBuf8<KTestMessageSize> testData; //To hold the test descriptor
152 User::LeaveIfError(fileSystem.Connect());
154 //Open the file in the read mode
155 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
157 CleanupClosePushL(logFile);
159 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
161 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
162 CleanupStack::PushL(hBuffer);
164 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
166 // Read from position 0: start of file
167 User::LeaveIfError(returnCode = logFile.Read(ptrString));
169 testData.Copy(KTestMessage); //Copy the test descriptor
170 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
173 CleanupStack::PopAndDestroy(hBuffer);
174 CleanupStack::PopAndDestroy(); //logFile
184 * 028_Sync_ConWriteUniBound - test sync with connected unicode write and long string
185 * doTestStep returns whether test case passed or failed.
188 CFloggerTest028_Sync_ConWriteUniBound::CFloggerTest028_Sync_ConWriteUniBound()
190 // Store the name of this test case
191 SetTestStepName(_L("step_028_Sync_ConWriteUniBound"));
197 CFloggerTest028_Sync_ConWriteUniBound::~CFloggerTest028_Sync_ConWriteUniBound()
204 TVerdict CFloggerTest028_Sync_ConWriteUniBound::doTestStepL( )
206 if ( executeStepL() == KErrNone )
207 SetTestStepResult(EPass);
210 SetTestStepResult(EFail);
213 return TestStepResult();
217 TInt CFloggerTest028_Sync_ConWriteUniBound::executeStepL(TBool)
223 TInt CFloggerTest028_Sync_ConWriteUniBound::executeStepL()
228 ret = flogger.Connect();
230 if ( ret == KErrNone )
232 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
234 flogger.Write(KTestTooLongMessage16);
236 TRAPD(r, ret = DoTestCheckWriteL());
247 TInt CFloggerTest028_Sync_ConWriteUniBound::DoTestCheckWriteL()
251 TInt listfilesize,returnCode;
252 RFs fileSystem; //For file operation create a file system
253 TBuf8<KLogBufferSize> testData; //We expect the maximum chars this time
255 User::LeaveIfError(fileSystem.Connect());
257 //Open the file in the read mode
258 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
260 CleanupClosePushL(logFile);
262 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
264 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
265 CleanupStack::PushL(hBuffer);
267 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
269 // Read from position 0: start of file
270 User::LeaveIfError(returnCode = logFile.Read(ptrString));
272 testData.Copy(KTestTooLongExpectedMessage); //Copy the test descriptor
273 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
276 CleanupStack::PopAndDestroy(hBuffer);
277 CleanupStack::PopAndDestroy(); //logFile
286 * 028_Sync_ConWriteFormatEUni - test sync with connected unicode write
287 * doTestStep returns whether test case passed or failed.
290 CFloggerTest028_Sync_ConWriteFormatEUni::CFloggerTest028_Sync_ConWriteFormatEUni()
292 // Store the name of this test case
293 SetTestStepName(_L("step_028_Sync_ConWriteFormatEUni"));
299 CFloggerTest028_Sync_ConWriteFormatEUni::~CFloggerTest028_Sync_ConWriteFormatEUni()
306 TVerdict CFloggerTest028_Sync_ConWriteFormatEUni::doTestStepL( )
308 if ( executeStepL() == KErrNone )
309 SetTestStepResult(EPass);
312 SetTestStepResult(EFail);
315 return TestStepResult();
318 TInt CFloggerTest028_Sync_ConWriteFormatEUni::executeStepL(TBool)
324 TInt CFloggerTest028_Sync_ConWriteFormatEUni::executeStepL()
329 ret = flogger.Connect();
331 if ( ret == KErrNone )
333 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
335 flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
337 TRAPD(r, ret = DoTestCheckWriteL());
348 TInt CFloggerTest028_Sync_ConWriteFormatEUni::DoTestCheckWriteL()
352 TInt listfilesize,returnCode;
353 RFs fileSystem; //For file operation create a file system
354 TBuf8<KTestMessageSize> testData; //To hold the test descriptor
356 User::LeaveIfError(fileSystem.Connect());
358 //Open the file in the read mode
359 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
361 CleanupClosePushL(logFile);
363 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
365 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
366 CleanupStack::PushL(hBuffer);
368 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
370 // Read from position 0: start of file
371 User::LeaveIfError(returnCode = logFile.Read(ptrString));
373 testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
374 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
377 CleanupStack::PopAndDestroy(hBuffer);
378 CleanupStack::PopAndDestroy(); //logFile
388 * 028_Sync_ConWriteFormatEUniBound - test sync with connected unicode write and long string
389 * doTestStep returns whether test case passed or failed.
392 CFloggerTest028_Sync_ConWriteFormatEUniBound::CFloggerTest028_Sync_ConWriteFormatEUniBound()
394 // Store the name of this test case
395 SetTestStepName(_L("step_028_Sync_ConWriteFormatEUniBound"));
401 CFloggerTest028_Sync_ConWriteFormatEUniBound::~CFloggerTest028_Sync_ConWriteFormatEUniBound()
408 TVerdict CFloggerTest028_Sync_ConWriteFormatEUniBound::doTestStepL( )
410 if ( executeStepL() == KErrNone )
411 SetTestStepResult(EPass);
414 SetTestStepResult(EFail);
417 return TestStepResult();
421 TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::executeStepL(TBool)
426 TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::executeStepL()
431 ret = flogger.Connect();
433 if ( ret == KErrNone )
435 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
437 flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
439 TRAPD(r, ret = DoTestCheckWriteL());
450 TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::DoTestCheckWriteL()
454 TInt listfilesize,returnCode;
455 RFs fileSystem; //For file operation create a file system
456 TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
458 User::LeaveIfError(fileSystem.Connect());
460 //Open the file in the read mode
461 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
463 CleanupClosePushL(logFile);
465 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
467 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
468 CleanupStack::PushL(hBuffer);
470 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
472 // Read from position 0: start of file
473 User::LeaveIfError(returnCode = logFile.Read(ptrString));
475 testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
476 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
479 CleanupStack::PopAndDestroy(hBuffer);
480 CleanupStack::PopAndDestroy(); //logFile
490 * 028_Sync_ConWriteFormatV8Bit - test sync with connected unicode write
491 * doTestStep returns whether test case passed or failed.
494 CFloggerTest028_Sync_ConWriteFormatV8Bit::CFloggerTest028_Sync_ConWriteFormatV8Bit()
496 // Store the name of this test case
497 SetTestStepName(_L("step_028_Sync_ConWriteFormatV8Bit"));
503 CFloggerTest028_Sync_ConWriteFormatV8Bit::~CFloggerTest028_Sync_ConWriteFormatV8Bit()
510 TVerdict CFloggerTest028_Sync_ConWriteFormatV8Bit::doTestStepL( )
512 if ( executeStepL() == KErrNone )
513 SetTestStepResult(EPass);
516 SetTestStepResult(EFail);
519 return TestStepResult();
523 TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::executeStepL(TBool)
528 TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::executeStepL()
532 ret = flogger.Connect();
534 if ( ret == KErrNone )
536 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
538 DoTestWriteFormat(KTestMessageOneParam8,KTestMessageOneParamValue);
540 TRAPD(r, ret = DoTestCheckWriteL());
550 void CFloggerTest028_Sync_ConWriteFormatV8Bit::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
554 flogger.WriteFormat(aFmt,list);
559 TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::DoTestCheckWriteL()
563 TInt listfilesize,returnCode;
564 RFs fileSystem; //For file operation create a file system
565 TBuf8<KTestMessageSize> testData; //To hold the test descriptor
567 User::LeaveIfError(fileSystem.Connect());
569 //Open the file in the read mode
570 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
572 CleanupClosePushL(logFile);
574 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
576 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
577 CleanupStack::PushL(hBuffer);
579 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
581 // Read from position 0: start of file
582 User::LeaveIfError(returnCode = logFile.Read(ptrString));
584 testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
585 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
588 CleanupStack::PopAndDestroy(hBuffer);
589 CleanupStack::PopAndDestroy(); //logFile
599 * 028_Sync_ConWriteFormatV8BitBound - test sync with connected unicode write and long string
600 * doTestStep returns whether test case passed or failed.
603 CFloggerTest028_Sync_ConWriteFormatV8BitBound::CFloggerTest028_Sync_ConWriteFormatV8BitBound()
605 // Store the name of this test case
606 SetTestStepName(_L("step_028_Sync_ConWriteFormatV8BitBound"));
612 CFloggerTest028_Sync_ConWriteFormatV8BitBound::~CFloggerTest028_Sync_ConWriteFormatV8BitBound()
619 TVerdict CFloggerTest028_Sync_ConWriteFormatV8BitBound::doTestStepL( )
621 if ( executeStepL() == KErrNone )
622 SetTestStepResult(EPass);
625 SetTestStepResult(EFail);
628 return TestStepResult();
632 TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::executeStepL(TBool)
637 TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::executeStepL()
641 ret = flogger.Connect();
643 if ( ret == KErrNone )
645 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
647 DoTestWriteFormat(KTestTooLongMessageOneParam8,KTestTooLongMessageOneParamValue);
649 TRAPD(r, ret = DoTestCheckWriteL());
659 void CFloggerTest028_Sync_ConWriteFormatV8BitBound::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
663 flogger.WriteFormat(aFmt,list);
667 TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::DoTestCheckWriteL()
671 TInt listfilesize,returnCode;
672 RFs fileSystem; //For file operation create a file system
673 TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
675 User::LeaveIfError(fileSystem.Connect());
677 //Open the file in the read mode
678 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
680 CleanupClosePushL(logFile);
682 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
684 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
685 CleanupStack::PushL(hBuffer);
687 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
689 // Read from position 0: start of file
690 User::LeaveIfError(returnCode = logFile.Read(ptrString));
692 testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
693 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
696 CleanupStack::PopAndDestroy(hBuffer);
697 CleanupStack::PopAndDestroy(); //logFile
708 * 028_Sync_Static_WriteUni - test sync with connected unicode write
709 * doTestStep returns whether test case passed or failed.
712 CFloggerTest028_Sync_Static_WriteUni::CFloggerTest028_Sync_Static_WriteUni()
714 // Store the name of this test case
715 SetTestStepName(_L("step_028_Sync_Static_WriteUni"));
721 CFloggerTest028_Sync_Static_WriteUni::~CFloggerTest028_Sync_Static_WriteUni()
728 TVerdict CFloggerTest028_Sync_Static_WriteUni::doTestStepL( )
730 if ( executeStepL() == KErrNone )
731 SetTestStepResult(EPass);
734 SetTestStepResult(EFail);
737 return TestStepResult();
741 TInt CFloggerTest028_Sync_Static_WriteUni::executeStepL(TBool)
746 TInt CFloggerTest028_Sync_Static_WriteUni::executeStepL()
750 // clear the old log messages
752 ret = flogger.Connect();
754 if ( ret == KErrNone )
756 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
760 RFileLogger::Write(KStdSubsysTag8, KStdCompTag8, KTestMessage);
762 TRAPD(r, ret = DoTestCheckWriteL());
773 TInt CFloggerTest028_Sync_Static_WriteUni::DoTestCheckWriteL()
777 TInt listfilesize,returnCode;
778 RFs fileSystem; //For file operation create a file system
779 TBuf8<KTestMessageSize> testData; //To hold the test descriptor
781 User::LeaveIfError(fileSystem.Connect());
783 //Open the file in the read mode
784 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
786 CleanupClosePushL(logFile);
788 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
790 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
791 CleanupStack::PushL(hBuffer);
793 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
795 // Read from position 0: start of file
796 User::LeaveIfError(returnCode = logFile.Read(ptrString));
798 testData.Copy(KTestMessage); //Copy the test descriptor
799 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
802 CleanupStack::PopAndDestroy(hBuffer);
803 CleanupStack::PopAndDestroy(); //logFile
813 * 028_Sync_Static_WriteUniBound - test sync with connected unicode write and long string
814 * doTestStep returns whether test case passed or failed.
817 CFloggerTest028_Sync_Static_WriteUniBound::CFloggerTest028_Sync_Static_WriteUniBound()
819 // Store the name of this test case
820 SetTestStepName(_L("step_028_Sync_Static_WriteUniBound"));
826 CFloggerTest028_Sync_Static_WriteUniBound::~CFloggerTest028_Sync_Static_WriteUniBound()
833 TVerdict CFloggerTest028_Sync_Static_WriteUniBound::doTestStepL( )
835 if ( executeStepL() == KErrNone )
836 SetTestStepResult(EPass);
839 SetTestStepResult(EFail);
842 return TestStepResult();
846 TInt CFloggerTest028_Sync_Static_WriteUniBound::executeStepL(TBool)
851 TInt CFloggerTest028_Sync_Static_WriteUniBound::executeStepL()
856 // clear the old log messages
858 ret = flogger.Connect();
860 if ( ret == KErrNone )
862 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
866 RFileLogger::Write(KStdSubsysTag8, KStdCompTag8, KTestTooLongMessage16);
868 TRAPD(r, ret = DoTestCheckWriteL());
879 TInt CFloggerTest028_Sync_Static_WriteUniBound::DoTestCheckWriteL()
883 TInt listfilesize,returnCode;
884 RFs fileSystem; //For file operation create a file system
885 TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
887 User::LeaveIfError(fileSystem.Connect());
889 //Open the file in the read mode
890 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
892 CleanupClosePushL(logFile);
894 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
896 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
897 CleanupStack::PushL(hBuffer);
899 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
901 // Read from position 0: start of file
902 User::LeaveIfError(returnCode = logFile.Read(ptrString));
904 testData.Copy(KTestTooLongExpectedMessage); //Copy the test descriptor
905 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
908 CleanupStack::PopAndDestroy(hBuffer);
909 CleanupStack::PopAndDestroy(); //logFile
921 * 028_Sync_Static_WriteFormatVUni - test sync with static formatted VA_LIST unicode write
922 * doTestStep returns whether test case passed or failed.
925 CFloggerTest028_Sync_Static_WriteFormatVUni::CFloggerTest028_Sync_Static_WriteFormatVUni()
927 // Store the name of this test case
928 SetTestStepName(_L("step_028_Sync_Static_WriteFormatVUni"));
934 CFloggerTest028_Sync_Static_WriteFormatVUni::~CFloggerTest028_Sync_Static_WriteFormatVUni()
941 TVerdict CFloggerTest028_Sync_Static_WriteFormatVUni::doTestStepL( )
943 if ( executeStepL() == KErrNone )
944 SetTestStepResult(EPass);
947 SetTestStepResult(EFail);
950 return TestStepResult();
954 TInt CFloggerTest028_Sync_Static_WriteFormatVUni::executeStepL(TBool)
959 TInt CFloggerTest028_Sync_Static_WriteFormatVUni::executeStepL()
963 // clear the old log messages
965 ret = flogger.Connect();
967 if ( ret == KErrNone )
969 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
973 DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
975 TRAPD(r, ret = DoTestCheckWriteL());
986 void CFloggerTest028_Sync_Static_WriteFormatVUni::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
990 RFileLogger::WriteFormat(KStdSubsysTag8,KStdCompTag8,aFmt,list);
995 TInt CFloggerTest028_Sync_Static_WriteFormatVUni::DoTestCheckWriteL()
999 TInt listfilesize,returnCode;
1000 RFs fileSystem; //For file operation create a file system
1001 TBuf8<KTestMessageSize> testData; //To hold the test descriptor
1003 User::LeaveIfError(fileSystem.Connect());
1005 //Open the file in the read mode
1006 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1008 CleanupClosePushL(logFile);
1010 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1012 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1013 CleanupStack::PushL(hBuffer);
1015 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
1017 // Read from position 0: start of file
1018 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1020 testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
1021 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1024 CleanupStack::PopAndDestroy(hBuffer);
1025 CleanupStack::PopAndDestroy(); //logFile
1029 return KErrNotFound;
1035 * 028_Sync_Static_WriteFormatVUniBound - test sync with static formatted VA_LIST unicode write and long string
1036 * doTestStep returns whether test case passed or failed.
1039 CFloggerTest028_Sync_Static_WriteFormatVUniBound::CFloggerTest028_Sync_Static_WriteFormatVUniBound()
1041 // Store the name of this test case
1042 SetTestStepName(_L("step_028_Sync_Static_WriteFormatVUniBound"));
1048 CFloggerTest028_Sync_Static_WriteFormatVUniBound::~CFloggerTest028_Sync_Static_WriteFormatVUniBound()
1055 TVerdict CFloggerTest028_Sync_Static_WriteFormatVUniBound::doTestStepL( )
1057 if ( executeStepL() == KErrNone )
1058 SetTestStepResult(EPass);
1061 SetTestStepResult(EFail);
1064 return TestStepResult();
1068 TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::executeStepL(TBool)
1073 TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::executeStepL()
1078 // clear the old log messages
1079 RFileLogger flogger;
1080 ret = flogger.Connect();
1082 if ( ret == KErrNone )
1084 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1088 DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
1090 TRAPD(r, ret = DoTestCheckWriteL());
1100 void CFloggerTest028_Sync_Static_WriteFormatVUniBound::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
1103 VA_START(list,aFmt);
1104 RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8, aFmt,list);
1109 TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::DoTestCheckWriteL()
1113 TInt listfilesize,returnCode;
1114 RFs fileSystem; //For file operation create a file system
1115 TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
1117 User::LeaveIfError(fileSystem.Connect());
1119 //Open the file in the read mode
1120 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1122 CleanupClosePushL(logFile);
1124 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1126 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1127 CleanupStack::PushL(hBuffer);
1129 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
1131 // Read from position 0: start of file
1132 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1134 testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
1135 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1138 CleanupStack::PopAndDestroy(hBuffer);
1139 CleanupStack::PopAndDestroy(); //logFile
1143 return KErrNotFound;
1150 * 028_Sync_Static_HexDump - test sync with connected unicode write
1151 * doTestStep returns whether test case passed or failed.
1154 CFloggerTest028_Sync_Static_HexDump::CFloggerTest028_Sync_Static_HexDump()
1156 // Store the name of this test case
1157 SetTestStepName(_L("step_028_Sync_Static_HexDump"));
1163 CFloggerTest028_Sync_Static_HexDump::~CFloggerTest028_Sync_Static_HexDump()
1170 TVerdict CFloggerTest028_Sync_Static_HexDump::doTestStepL( )
1172 if ( executeStepL() == KErrNone )
1173 SetTestStepResult(EPass);
1176 SetTestStepResult(EFail);
1179 return TestStepResult();
1183 TInt CFloggerTest028_Sync_Static_HexDump::executeStepL(TBool)
1188 TInt CFloggerTest028_Sync_Static_HexDump::executeStepL()
1192 // clear the old log messages
1193 RFileLogger flogger;
1194 ret = flogger.Connect();
1196 if ( ret == KErrNone )
1198 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1202 RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8, KTestMessage8);
1204 TRAPD(r, ret = DoTestCheckWriteL());
1215 TInt CFloggerTest028_Sync_Static_HexDump::DoTestCheckWriteL()
1219 TInt listfilesize,returnCode;
1220 RFs fileSystem; //For file operation create a file system
1222 User::LeaveIfError(fileSystem.Connect());
1224 //Open the file in the read mode
1225 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1227 CleanupClosePushL(logFile);
1229 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1231 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1232 CleanupStack::PushL(hBuffer);
1234 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
1236 // Read from position 0: start of file
1237 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1239 returnCode = ptrString.Find(KTestMessageAsHex8); //find the test descriptor in the buffer read
1242 CleanupStack::PopAndDestroy(hBuffer);
1243 CleanupStack::PopAndDestroy(); //logFile
1247 return KErrNotFound;
1253 * 028_Sync_ClearLog - test sync with clearlog
1254 * doTestStep returns whether test case passed or failed.
1257 CFloggerTest028_Sync_ClearLog::CFloggerTest028_Sync_ClearLog()
1259 // Store the name of this test case
1260 SetTestStepName(_L("step_028_Sync_ClearLog"));
1266 CFloggerTest028_Sync_ClearLog::~CFloggerTest028_Sync_ClearLog()
1273 TVerdict CFloggerTest028_Sync_ClearLog::doTestStepL( )
1275 if ( executeStepL() == KErrNone )
1276 SetTestStepResult(EPass);
1279 SetTestStepResult(EFail);
1282 return TestStepResult();
1286 TInt CFloggerTest028_Sync_ClearLog::executeStepL(TBool)
1291 TInt CFloggerTest028_Sync_ClearLog::executeStepL()
1295 // clear the old log messages
1296 RFileLogger flogger;
1297 ret = flogger.Connect();
1299 if ( ret == KErrNone )
1301 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1305 TRAPD(r, ret = DoTestCheckWriteL());
1316 TInt CFloggerTest028_Sync_ClearLog::DoTestCheckWriteL()
1320 TInt listfilesize,returnCode;
1321 RFs fileSystem; //For file operation create a file system
1322 TBuf8<KTestMessageSize> testData; //To hold the test descriptor
1324 User::LeaveIfError(fileSystem.Connect());
1326 //Open the file in the read mode
1327 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1329 CleanupClosePushL(logFile);
1331 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1333 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1334 CleanupStack::PushL(hBuffer);
1336 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
1338 // Read from position 0: start of file
1339 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1341 testData.Copy(KTestMessage); //Copy the test descriptor
1342 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1345 CleanupStack::PopAndDestroy(hBuffer);
1346 CleanupStack::PopAndDestroy(); //logFile
1347 if (returnCode == KErrNotFound)
1357 * 028_Sync_Binary - test sync with write binary
1358 * doTestStep returns whether test case passed or failed.
1361 CFloggerTest028_Sync_Binary::CFloggerTest028_Sync_Binary()
1363 // Store the name of this test case
1364 SetTestStepName(_L("step_028_Sync_Binary"));
1370 CFloggerTest028_Sync_Binary::~CFloggerTest028_Sync_Binary()
1377 TVerdict CFloggerTest028_Sync_Binary::doTestStepL( )
1379 if ( executeStepL() == KErrNone )
1380 SetTestStepResult(EPass);
1383 SetTestStepResult(EFail);
1386 return TestStepResult();
1390 TInt CFloggerTest028_Sync_Binary::executeStepL(TBool)
1395 TInt CFloggerTest028_Sync_Binary::executeStepL()
1399 // clear the old log messages
1400 ret = flogger.Connect();
1402 if ( ret == KErrNone )
1404 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1407 flogger.WriteBinary(KTestMessage8);
1411 TRAPD(r, ret = DoTestCheckWriteL());
1422 TInt CFloggerTest028_Sync_Binary::DoTestCheckWriteL()
1426 TInt listfilesize,returnCode;
1427 RFs fileSystem; //For file operation create a file system
1428 TInt numSuccessful = 0;
1430 User::LeaveIfError(fileSystem.Connect());
1432 //Open the file in the read mode
1433 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1435 CleanupClosePushL(logFile);
1437 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1439 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1440 CleanupStack::PushL(hBuffer);
1442 TPtr8 ptrString = hBuffer->Des(); ; //To access the buffer
1444 // Read from position 0: start of file
1445 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1447 returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
1454 returnCode = ptrString.Find(KStdSubsysTag8);
1460 returnCode = ptrString.Find(KStdCompTag8);
1468 CleanupStack::PopAndDestroy(hBuffer);
1469 CleanupStack::PopAndDestroy(); //logFile
1470 if (numSuccessful ==3)
1479 * 028_Sync_ConMultiple - test connect and multiple writes
1480 * doTestStep returns whether test case passed or failed.
1483 CFloggerTest028_Sync_ConMultiple::CFloggerTest028_Sync_ConMultiple()
1485 // Store the name of this test case
1486 SetTestStepName(_L("step_028_Sync_ConMultiple"));
1492 CFloggerTest028_Sync_ConMultiple::~CFloggerTest028_Sync_ConMultiple()
1499 TVerdict CFloggerTest028_Sync_ConMultiple::doTestStepL( )
1501 if ( executeStepL() == KErrNone )
1502 SetTestStepResult(EPass);
1505 SetTestStepResult(EFail);
1508 return TestStepResult();
1511 TInt CFloggerTest028_Sync_ConMultiple::executeStepL(TBool)
1517 TInt CFloggerTest028_Sync_ConMultiple::executeStepL()
1521 // clear the old log messages
1522 ret = flogger.Connect();
1524 if ( ret == KErrNone )
1526 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1529 flogger.Write(KTestMessage);
1530 flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
1531 flogger.Write(KTestTooLongMessage16);
1532 flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
1533 DoTestWriteFormat(KTestMessageOneParam8,KTestMessageOneParamValue);
1536 dataSeg.Set(K1KilobyteOfData,K1KilobyteOfDataSize);
1537 flogger.WriteBinary(dataSeg);
1541 TRAPD(r, ret = DoTestCheckWriteL());
1551 void CFloggerTest028_Sync_ConMultiple::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
1554 VA_START(list,aFmt);
1555 flogger.WriteFormat(aFmt,list);
1558 TInt CFloggerTest028_Sync_ConMultiple::DoTestCheckWriteL()
1562 TInt listfilesize,returnCode;
1563 RFs fileSystem; //For file operation create a file system
1564 TInt numSuccessful = 0;
1566 User::LeaveIfError(fileSystem.Connect());
1568 //Open the file in the read mode
1569 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1571 CleanupClosePushL(logFile);
1573 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1575 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1576 CleanupStack::PushL(hBuffer);
1578 TPtr8 ptrString = hBuffer->Des(); //To access the buffer
1580 // Read from position 0: start of file
1581 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1583 returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
1591 returnCode = ptrString.Find(KTestMessageOneParamExpected);
1597 TPtrC8 ptrStringOffsetForSearching = ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length());
1599 returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
1605 returnCode = ptrString.Find(KTestTooLongExpectedMessage);
1611 returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected);
1617 // we don't check that all the binary data is there - just that the file is nice and long
1618 if ( listfilesize > K1KilobyteOfDataSize)
1625 CleanupStack::PopAndDestroy(hBuffer);
1626 CleanupStack::PopAndDestroy(); //logFile
1627 if ( numSuccessful == 6 )
1639 * 028_Sync_Static_Multiple - test static multiple writes
1640 * doTestStep returns whether test case passed or failed.
1643 CFloggerTest028_Sync_Static_Multiple::CFloggerTest028_Sync_Static_Multiple()
1645 // Store the name of this test case
1646 SetTestStepName(_L("step_028_Sync_Static_Multiple"));
1652 CFloggerTest028_Sync_Static_Multiple::~CFloggerTest028_Sync_Static_Multiple()
1659 TVerdict CFloggerTest028_Sync_Static_Multiple::doTestStepL( )
1661 if ( executeStepL() == KErrNone )
1662 SetTestStepResult(EPass);
1665 SetTestStepResult(EFail);
1668 return TestStepResult();
1671 TInt CFloggerTest028_Sync_Static_Multiple::executeStepL(TBool)
1677 TInt CFloggerTest028_Sync_Static_Multiple::executeStepL()
1681 // clear the old log messages
1682 RFileLogger flogger;
1683 ret = flogger.Connect();
1685 if ( ret == KErrNone )
1687 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1691 RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestMessage);
1692 RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
1693 DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
1694 DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
1696 RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8,KTestMessage8);
1698 TRAPD(r, ret = DoTestCheckWriteL());
1708 void CFloggerTest028_Sync_Static_Multiple::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
1711 VA_START(list,aFmt);
1712 RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,aFmt,list);
1717 TInt CFloggerTest028_Sync_Static_Multiple::DoTestCheckWriteL()
1721 TInt listfilesize,returnCode;
1722 RFs fileSystem; //For file operation create a file system
1723 TInt numSuccessful = 0;
1725 User::LeaveIfError(fileSystem.Connect());
1727 //Open the file in the read mode
1728 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1730 CleanupClosePushL(logFile);
1732 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1734 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1735 CleanupStack::PushL(hBuffer);
1737 TPtr8 ptrString = hBuffer->Des(); //To access the buffer
1739 // Read from position 0: start of file
1740 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1742 returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
1749 returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected);
1755 // search for the occurance that the VA_LIST put in
1756 // when testing serial, the length will be negative, so skip
1758 len = (ptrString.Length()-returnCode)-KTestTooLongMessageOneParamExpected().Length();
1761 TPtrC8 ptrStringOffsetForSearching = ptrString.Right(len);
1763 returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
1771 returnCode = ptrString.Find(KTestMessageOneParamExpected);
1777 returnCode = ptrString.Find(KTestMessageAsHex8);
1784 CleanupStack::PopAndDestroy(hBuffer);
1785 CleanupStack::PopAndDestroy(); //logFile
1786 if ( numSuccessful == 5 )
1795 * 028_Sync_ConMultiple2 - test connect and multiple2 writes
1796 * doTestStep returns whether test case passed or failed.
1799 CFloggerTest028_Sync_ConMultiple2::CFloggerTest028_Sync_ConMultiple2()
1801 // Store the name of this test case
1802 SetTestStepName(_L("step_028_Sync_ConMultiple2"));
1808 CFloggerTest028_Sync_ConMultiple2::~CFloggerTest028_Sync_ConMultiple2()
1815 TVerdict CFloggerTest028_Sync_ConMultiple2::doTestStepL( )
1817 if ( executeStepL() == KErrNone )
1818 SetTestStepResult(EPass);
1821 SetTestStepResult(EFail);
1824 return TestStepResult();
1827 TInt CFloggerTest028_Sync_ConMultiple2::executeStepL(TBool)
1833 TInt CFloggerTest028_Sync_ConMultiple2::executeStepL()
1837 // clear the old log messages
1838 ret = flogger.Connect();
1840 if ( ret == KErrNone )
1842 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
1845 for (TInt loop = 1; loop <= KMultipleWriteStressTimes; loop++)
1847 flogger.Write(KTestMessage);
1848 flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
1849 flogger.Write(KTestTooLongMessage16);
1850 flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
1851 DoTestWriteFormat(KTestTooLongMessageOneParam8,KTestTooLongMessageOneParamValue);
1854 dataSeg.Set(K1KilobyteOfData,K1KilobyteOfDataSize);
1855 flogger.WriteBinary(dataSeg);
1857 flogger.Write(KTestEndMessage8);
1861 TRAPD(r, ret = DoTestCheckWriteL());
1871 void CFloggerTest028_Sync_ConMultiple2::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
1874 VA_START(list,aFmt);
1875 flogger.WriteFormat(aFmt,list);
1878 TInt CFloggerTest028_Sync_ConMultiple2::DoTestCheckWriteL()
1882 TInt listfilesize,returnCode;
1883 RFs fileSystem; //For file operation create a file system
1884 TInt numSuccessful = 0;
1887 User::LeaveIfError(fileSystem.Connect());
1889 //Open the file in the read mode
1890 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
1892 CleanupClosePushL(logFile);
1894 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
1896 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer. This is about 176K in size
1897 CleanupStack::PushL(hBuffer);
1899 TPtr8 ptrString = hBuffer->Des(); //To access the buffer
1901 // Read from position 0: start of file
1902 User::LeaveIfError(returnCode = logFile.Read(ptrString));
1904 // the test case writes 6 elements 100 times, but we only check these things:
1905 // 1. that the test message with one parameter is written 100 times
1906 // 2. that the long message is written 100 times
1907 // 3. that the end of test message has been written
1908 // 4. that the file is suitably big enough to be expected to contain the
1909 // 1K data segment 100 times in it.
1911 TPtrC8 ptrStringOffsetForSearching;
1912 returnCode = ptrString.Find(KTestMessageOneParamExpected);
1920 ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
1921 for (loop=0; loop < KMultipleWriteStressTimes; loop++)
1923 returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
1929 newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
1932 User::Leave(KErrUnknown);
1934 ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
1938 returnCode = ptrString.Find(KTestTooLongExpectedMessage);
1945 ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestTooLongExpectedMessage().Length()));
1947 for (loop=0; loop < KMultipleWriteStressTimes; loop++)
1950 returnCode = ptrStringOffsetForSearching.Find(KTestTooLongExpectedMessage); //find the next occurance
1955 newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongExpectedMessage().Length();
1958 User::Leave(KErrUnknown);
1960 ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
1965 returnCode = ptrString.Find(KTestEndMessage8);
1972 // we don't check that all the binary data is there - just that the file is nice and long
1973 if ( listfilesize > (K1KilobyteOfDataSize * KMultipleWriteStressTimes))
1980 CleanupStack::PopAndDestroy(hBuffer);
1981 CleanupStack::PopAndDestroy(); //logFile
1982 if ( numSuccessful == 202 )
1994 * 028_Sync_Static_Multiple2 - test static multiple2 writes
1995 * doTestStep returns whether test case passed or failed.
1998 CFloggerTest028_Sync_Static_Multiple2::CFloggerTest028_Sync_Static_Multiple2()
2000 // Store the name of this test case
2001 SetTestStepName(_L("step_028_Sync_Static_Multiple2"));
2007 CFloggerTest028_Sync_Static_Multiple2::~CFloggerTest028_Sync_Static_Multiple2()
2014 TVerdict CFloggerTest028_Sync_Static_Multiple2::doTestStepL( )
2016 if ( executeStepL() == KErrNone )
2017 SetTestStepResult(EPass);
2020 SetTestStepResult(EFail);
2023 return TestStepResult();
2027 TInt CFloggerTest028_Sync_Static_Multiple2::executeStepL(TBool)
2032 TInt CFloggerTest028_Sync_Static_Multiple2::executeStepL()
2036 // clear the old log messages
2037 RFileLogger flogger;
2038 ret = flogger.Connect();
2040 if ( ret == KErrNone )
2042 flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
2046 for (TInt loop = 1; loop <= KMultipleWriteStressTimes; loop++)
2048 RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestMessage);
2049 RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestTooLongMessage16);
2050 DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
2051 DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
2053 RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8,KTestMessage8);
2055 RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestEndMessage8);
2057 TRAPD(r, ret = DoTestCheckWriteL());
2067 void CFloggerTest028_Sync_Static_Multiple2::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
2070 VA_START(list,aFmt);
2071 RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,aFmt,list);
2076 TInt CFloggerTest028_Sync_Static_Multiple2::DoTestCheckWriteL()
2080 TInt listfilesize,returnCode;
2081 RFs fileSystem; //For file operation create a file system
2082 TInt numSuccessful = 0;
2084 User::LeaveIfError(fileSystem.Connect());
2086 //Open the file in the read mode
2087 User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
2089 CleanupClosePushL(logFile);
2091 User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
2093 hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
2094 CleanupStack::PushL(hBuffer);
2096 TPtr8 ptrString = hBuffer->Des(); //To access the buffer
2098 // Read from position 0: start of file
2099 User::LeaveIfError(returnCode = logFile.Read(ptrString));
2102 // the test case writes 5 elements 100 times, but we only check these things:
2103 // 1. that the long test message with one parameter is written 100 times
2104 // 2. that the test message with one param is written 100 times
2105 // 3. that the end of test message has been written
2107 TPtrC8 ptrStringOffsetForSearching;
2108 returnCode = ptrString.Find(KTestMessageOneParamExpected);
2115 TInt newLength; // allow length to be watched during debugging
2118 ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
2119 for (loop=0; loop < KMultipleWriteStressTimes; loop++)
2121 returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
2127 newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
2130 User::Leave(KErrUnknown);
2133 ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
2138 returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected);
2145 newLength = ptrString.Length()-returnCode-KTestTooLongMessageOneParamExpected().Length();
2146 ptrStringOffsetForSearching.Set(ptrString.Right(newLength));
2147 for (loop=0; loop < KMultipleWriteStressTimes; loop++)
2149 returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
2155 if (loop < (KMultipleWriteStressTimes - 1))
2157 newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongMessageOneParamExpected().Length();
2160 User::Leave(KErrUnknown);
2162 ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
2167 returnCode = ptrString.Find(KTestEndMessage8);
2174 CleanupStack::PopAndDestroy(hBuffer);
2175 CleanupStack::PopAndDestroy(); //logFile
2176 if ( numSuccessful == 201 )