kerneltest/e32test/rm_debug/crashmonitor/t_crashmonitor.h
changeset 296 94f2adf59133
parent 293 0659d0e1a03c
child 297 b2826f67641f
equal deleted inserted replaced
293:0659d0e1a03c 296:94f2adf59133
     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 // System Crash Monitor Shared Library tests
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef CRASH_MONITOR
       
    25 #define CRASH_MONITOR
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <e32cons.h>
       
    29 #include <e32test.h>
       
    30 #include <e32cmn.h>
       
    31 #include <scmdatatypes.h>
       
    32 #include <scmbytestreamutil.h>
       
    33 #include <hal.h>
       
    34 
       
    35 using namespace Debug;
       
    36 
       
    37 LOCAL_D RTest test(_L("T_CRASHMONITOR_LIB"));
       
    38 
       
    39 //number of test functions that we have
       
    40 const TInt KMaxTests = 25;
       
    41 const TUint KBufLen =  52224; // 0.5 meg buffer
       
    42 
       
    43 class CSCMLibraryClient;
       
    44 
       
    45 // Create a pointer to function type
       
    46 typedef void (CSCMLibraryClient::*testFunction)();
       
    47 
       
    48 class TFunctionData
       
    49 	{
       
    50 		
       
    51 public:
       
    52 	TFunctionData()
       
    53 	: iFunctionPtr(NULL)
       
    54 	{	
       
    55 	}
       
    56 
       
    57 	testFunction iFunctionPtr;
       
    58 	TBuf<40> iFunctionName;
       
    59 	};
       
    60 
       
    61 //
       
    62 // class CSCMLibraryClient
       
    63 //
       
    64 // The basic SCM Library Client
       
    65 //
       
    66 class CSCMLibraryClient : public CBase
       
    67 	{
       
    68 public:
       
    69 	static CSCMLibraryClient* NewL();
       
    70 	~CSCMLibraryClient();
       
    71 	void ClientAppL();
       
    72 
       
    73 private:
       
    74 	CSCMLibraryClient();
       
    75 	void ConstructL();
       
    76 
       
    77 	TInt TestStartup();
       
    78 	TInt TestShutdown();
       
    79 
       
    80 	void FillArray();
       
    81 	void PrintUsage();
       
    82 	void PrintVersion();
       
    83 
       
    84 	enum TTestMode 
       
    85 		{
       
    86 		//run all the tests
       
    87 		EModeAll = 1<<0,
       
    88 		//run the specified tests in reverse order
       
    89 		EModeReverse = 1<<1,
       
    90 		//print out help
       
    91 		EModeHelp = 1<<2,
       
    92 		//print out help
       
    93 		EModeVersion = 1<<3
       
    94 		};
       
    95 	
       
    96 	//Tests
       
    97 	void TestCheckSum();
       
    98 
       
    99 	void TestLockDataSerialization();
       
   100 	void TestOffsetsHeaderSerialization();
       
   101 	void TestInfoHeaderSerialization();
       
   102 	void TestRawData();
       
   103 	void TestProcessData();
       
   104 	void TestThreadData();
       
   105 	void TestThreadStack();
       
   106 	void TestRegisterValue();
       
   107 	void TestRegisterSet();
       
   108 	
       
   109 	void TestMemoryDump();
       
   110 	void TestCodeSegmentSet();
       
   111 	void TestCodeSegment();
       
   112 	void TestTraceDump();
       
   113 	void TestVariantSpecificData();
       
   114 	void TestRomHeaderData();
       
   115 	void TestSCMLockData();
       
   116 
       
   117 	void RunTest(TInt aTestNumber);
       
   118 	void ParseCommandLineL(TUint32& aMode, RArray<TInt>& aTests);
       
   119 	void HelpStartTestTimer(void) { iStartTick = User::NTickCount(); iStopTick = 0; };
       
   120 	void HelpStopTestTimer(void) { iStopTick = User::NTickCount(); };
       
   121 	TInt HelpGetTestTicks(void) { return (iStopTick - iStartTick); };
       
   122 	TInt HelpTicksPerSecond();
       
   123 	void ReportPerformance();
       
   124 
       
   125 private:
       
   126 	TBool ChecksumHelper(TScmChecksum& aChecksum, TUint aBlocksize, TUint8* aBuffer, TUint aBufferLen);
       
   127 	void DoWrite(MByteStreamSerializable& aObjectToWrite, TInt aPositon = 0);
       
   128 
       
   129 	
       
   130 private:	
       
   131 	TFunctionData iTestArray[KMaxTests];
       
   132 	
       
   133 	// Timing information
       
   134 	TInt iStartTick;
       
   135 	TInt iStopTick;	
       
   136 	
       
   137 	TUint8		iBuffer[KBufLen]; 
       
   138 	
       
   139 	TByteStreamWriter iNonCachedWriter;	
       
   140 	TCachedByteStreamWriter iCachedWriter;
       
   141 	
       
   142 	TByteStreamWriter* iWriter;
       
   143 	TByteStreamReader iReader;
       
   144 	};
       
   145 
       
   146 #endif // CRASH_MONITOR