72
|
1 |
/**
|
|
2 |
* Copyright (c) Symbian Ltd 2008
|
|
3 |
*
|
|
4 |
* @file TE_mbufmgrServer.cpp
|
|
5 |
*
|
|
6 |
* Example file/test code to demonstrate how to develop a TestExecute Server
|
|
7 |
* Developers should take this project as a template and substitute their own
|
|
8 |
* code at the __EDIT_ME__ tags
|
|
9 |
*
|
|
10 |
* for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
|
|
11 |
* in the process of the client. The client initialises the server by calling the
|
|
12 |
* one and only ordinal.
|
|
13 |
*/
|
|
14 |
#include "TE_mbufmgrServer.h"
|
|
15 |
#include "TestStepCTMbufmgr.h"
|
|
16 |
|
|
17 |
#include "Test01CreateDeleteMBufMgr.h"
|
|
18 |
#include "Test02AllocDealloc.h"
|
|
19 |
#include "Test03AllocLeave.h"
|
|
20 |
#include "Test04CopyInOut.h"
|
|
21 |
#include "Test05CopyInOutOffset.h"
|
|
22 |
#include "Test06SplitL.h"
|
|
23 |
#include "Test07TrimStart.h"
|
|
24 |
#include "Test08TrimEnd.h"
|
|
25 |
#include "Test09Align.h"
|
|
26 |
#include "Test10CopyL.h"
|
|
27 |
#include "Test11AsyncAlloc.h"
|
|
28 |
#include "Test12General.h"
|
|
29 |
#include "Test13Performance.h"
|
|
30 |
#include "Test14HeapFreeCheck.h"
|
|
31 |
#include "Test15Concurrency.h"
|
|
32 |
#include "test16memoryfull.h"
|
|
33 |
#include "test17requestsizelimits.h"
|
|
34 |
#include "test18exhaustmidsizepools.h"
|
|
35 |
#include "test19prepend.h"
|
|
36 |
#include "test20poolceilingfull.h"
|
|
37 |
#include "test21commsbufs.h"
|
|
38 |
#include "Test22Append.h"
|
|
39 |
#include "Test23RMBufQ.h"
|
|
40 |
|
|
41 |
EXPORT_C CTE_mbufmgrServer* NewMbufmgrServer( void )
|
|
42 |
{
|
|
43 |
return new (ELeave) CTE_mbufmgrServer;
|
|
44 |
}
|
|
45 |
|
|
46 |
// __EDIT_ME__ - Substitute the name of your test server
|
|
47 |
_LIT(KServerName,"te_ctmbufmgr");
|
|
48 |
// __EDIT_ME__ - Use your own server class name
|
|
49 |
CTE_mbufmgrServer* CTE_mbufmgrServer::NewL()
|
|
50 |
/**
|
|
51 |
* @return - Instance of the test server
|
|
52 |
* Called inside the MainL() function to create and start the
|
|
53 |
* CTestServer derived server.
|
|
54 |
*/
|
|
55 |
{
|
|
56 |
// __EDIT_ME__ new your server class here
|
|
57 |
CTE_mbufmgrServer * server = new (ELeave) CTE_mbufmgrServer();
|
|
58 |
CleanupStack::PushL(server);
|
|
59 |
|
|
60 |
// Either use a StartL or ConstructL, the latter will permit
|
|
61 |
// Server Logging.
|
|
62 |
|
|
63 |
//server->StartL(KServerName);
|
|
64 |
server->ConstructL(KServerName);
|
|
65 |
CleanupStack::Pop(server);
|
|
66 |
return server;
|
|
67 |
}
|
|
68 |
|
|
69 |
// EKA2 much simpler
|
|
70 |
// Just an E32Main and a MainL()
|
|
71 |
LOCAL_C void MainL()
|
|
72 |
/**
|
|
73 |
* Much simpler, uses the new Rendezvous() call to sync with the client
|
|
74 |
*/
|
|
75 |
{
|
|
76 |
// Leave the hooks in for platform security
|
|
77 |
#if (defined __DATA_CAGING__)
|
|
78 |
RProcess().DataCaging(RProcess::EDataCagingOn);
|
|
79 |
RProcess().SecureApi(RProcess::ESecureApiOn);
|
|
80 |
#endif
|
|
81 |
CActiveScheduler* sched=NULL;
|
|
82 |
sched=new(ELeave) CActiveScheduler;
|
|
83 |
CActiveScheduler::Install(sched);
|
|
84 |
// __EDIT_ME__ Your server name
|
|
85 |
CTE_mbufmgrServer* server = NULL;
|
|
86 |
// Create the CTestServer derived server
|
|
87 |
// __EDIT_ME__ Your server name
|
|
88 |
TRAPD(err,server = CTE_mbufmgrServer::NewL());
|
|
89 |
if(!err)
|
|
90 |
{
|
|
91 |
// Sync with the client and enter the active scheduler
|
|
92 |
RProcess::Rendezvous(KErrNone);
|
|
93 |
sched->Start();
|
|
94 |
}
|
|
95 |
delete server;
|
|
96 |
delete sched;
|
|
97 |
}
|
|
98 |
|
|
99 |
// Only a DLL on emulator for typhoon and earlier
|
|
100 |
|
|
101 |
GLDEF_C TInt E32Main()
|
|
102 |
/**
|
|
103 |
* @return - Standard Epoc error code on exit
|
|
104 |
*/
|
|
105 |
{
|
|
106 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
107 |
if(cleanup == NULL)
|
|
108 |
{
|
|
109 |
return KErrNoMemory;
|
|
110 |
}
|
|
111 |
TRAP_IGNORE(MainL());
|
|
112 |
delete cleanup;
|
|
113 |
return KErrNone;
|
|
114 |
}
|
|
115 |
|
|
116 |
// Create a thread in the calling process
|
|
117 |
// Emulator typhoon and earlier
|
|
118 |
|
|
119 |
// __EDIT_ME__ - Use your own server class name
|
|
120 |
CTestStep* CTE_mbufmgrServer::CreateTestStep(const TDesC& aStepName)
|
|
121 |
/**
|
|
122 |
* @return - A CTestStep derived instance
|
|
123 |
* Implementation of CTestServer pure virtual
|
|
124 |
*/
|
|
125 |
{
|
|
126 |
CTestStep* testStep = NULL;
|
|
127 |
// __EDIT_ME__ - Create your own test steps here
|
|
128 |
// This server creates just one step but create as many as you want
|
|
129 |
// They are created "just in time" when the worker thread is created
|
|
130 |
|
|
131 |
if(aStepName.Compare(_L("MBufMgrTest01")) == 0 )
|
|
132 |
testStep = new(ELeave) CTest01CreateDeleteMBufMgr;
|
|
133 |
else if(aStepName.Compare(_L("MBufMgrTest02")) == 0 )
|
|
134 |
testStep = new(ELeave) CTest02AllocDealloc;
|
|
135 |
else if(aStepName.Compare(_L("MBufMgrTest03")) == 0 )
|
|
136 |
testStep = new(ELeave) CTest03AllocLeave;
|
|
137 |
else if(aStepName.Compare(_L("MBufMgrTest04")) == 0 )
|
|
138 |
testStep = new(ELeave) CTest04CopyInOut;
|
|
139 |
else if(aStepName.Compare(_L("MBufMgrTest05")) == 0 )
|
|
140 |
testStep = new(ELeave) CTest05CopyInOutOffset;
|
|
141 |
else if(aStepName.Compare(_L("MBufMgrTest06")) == 0 )
|
|
142 |
testStep = new(ELeave) CTest06Split;
|
|
143 |
else if(aStepName.Compare(_L("MBufMgrTest07")) == 0 )
|
|
144 |
testStep = new(ELeave) CTest07TrimStart;
|
|
145 |
else if(aStepName.Compare(_L("MBufMgrTest08")) == 0 )
|
|
146 |
testStep = new(ELeave) CTest08TrimEnd;
|
|
147 |
else if(aStepName.Compare(_L("MBufMgrTest09")) == 0 )
|
|
148 |
testStep = new(ELeave) CTest09Align;
|
|
149 |
else if(aStepName.Compare(_L("MBufMgrTest10")) == 0 )
|
|
150 |
testStep = new(ELeave) CTest10Copy;
|
|
151 |
else if(aStepName.Compare(_L("MBufMgrTest11")) == 0 )
|
|
152 |
testStep = new(ELeave) CTest11AsyncAlloc;
|
|
153 |
else if(aStepName.Compare(_L("MBufMgrTest12")) == 0 )
|
|
154 |
testStep = new(ELeave) CTest12General;
|
|
155 |
else if(aStepName.Compare(_L("MBufMgrTest13")) == 0 )
|
|
156 |
testStep = new(ELeave) CTest13Performance;
|
|
157 |
else if(aStepName.Compare(_L("MBufMgrTest14")) == 0 )
|
|
158 |
testStep = new(ELeave) CTest14HeapFreeCheck;
|
|
159 |
else if(aStepName.Compare(_L("MBufMgrTest15")) == 0 )
|
|
160 |
testStep = new(ELeave) CTest15Concurrency;
|
|
161 |
else if(aStepName.Compare(_L("MBufMgrTest16")) == 0 )
|
|
162 |
testStep = new(ELeave) CTest16MemoryFull;
|
|
163 |
else if(aStepName.Compare(_L("MBufMgrTest17")) == 0 )
|
|
164 |
testStep = new(ELeave) CTest17RequestSizeLimits;
|
|
165 |
else if(aStepName.Compare(_L("MBufMgrTest18")) == 0 )
|
|
166 |
testStep = new(ELeave) CTest18ExhaustMidSizePools;
|
|
167 |
else if(aStepName.Compare(_L("MBufMgrTest19")) == 0 )
|
|
168 |
testStep = new(ELeave) CTest19Prepend;
|
|
169 |
else if(aStepName.Compare(_L("MBufMgrTest20")) == 0 )
|
|
170 |
testStep = new(ELeave) CTest20PoolCeilingFull;
|
|
171 |
else if(aStepName.Compare(_L("MBufMgrTest21")) == 0 )
|
|
172 |
testStep = new(ELeave) CTest21CommsBufs;
|
|
173 |
else if(aStepName.Compare(_L("MBufMgrTest22")) == 0 )
|
|
174 |
testStep = new(ELeave) CTest22Append;
|
|
175 |
else if(aStepName.Compare(_L("MBufMgrTest23")) == 0 )
|
|
176 |
testStep = new(ELeave) CTest23RMBufQ;
|
|
177 |
|
|
178 |
return testStep;
|
|
179 |
}
|
|
180 |
|