|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include <c32comm.h> |
|
22 |
|
23 #if defined (__WINS__) |
|
24 #define PDD_NAME _L("ECDRV") |
|
25 #else |
|
26 #define PDD_NAME _L("EUART1") |
|
27 #define PDD2_NAME _L("EUART2") |
|
28 #define PDD3_NAME _L("EUART3") |
|
29 #define PDD4_NAME _L("EUART4") |
|
30 #endif |
|
31 |
|
32 #define LDD_NAME _L("ECOMM") |
|
33 |
|
34 /** |
|
35 * @file |
|
36 * |
|
37 * Pipe test server implementation |
|
38 */ |
|
39 #include "tsyscallsserver.h" |
|
40 #include "tsyscalls.h" |
|
41 |
|
42 |
|
43 _LIT(KServerName, "tsyscalls"); |
|
44 |
|
45 CSyscallsTestServer* CSyscallsTestServer::NewL() |
|
46 { |
|
47 CSyscallsTestServer *server = new(ELeave) CSyscallsTestServer(); |
|
48 CleanupStack::PushL(server); |
|
49 server->ConstructL(KServerName); |
|
50 CleanupStack::Pop(server); |
|
51 return server; |
|
52 } |
|
53 |
|
54 static void InitCommsL() |
|
55 { |
|
56 TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
|
57 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
58 |
|
59 #ifndef __WINS__ |
|
60 ret = User::LoadPhysicalDevice(PDD2_NAME); |
|
61 ret = User::LoadPhysicalDevice(PDD3_NAME); |
|
62 ret = User::LoadPhysicalDevice(PDD4_NAME); |
|
63 #endif |
|
64 |
|
65 ret = User::LoadLogicalDevice(LDD_NAME); |
|
66 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
67 ret = StartC32(); |
|
68 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
69 } |
|
70 |
|
71 LOCAL_C void MainL() |
|
72 { |
|
73 // Leave the hooks in for platform security |
|
74 #if (defined __DATA_CAGING__) |
|
75 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
76 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
77 #endif |
|
78 InitCommsL(); |
|
79 |
|
80 CActiveScheduler* sched=NULL; |
|
81 sched=new(ELeave) CActiveScheduler; |
|
82 CActiveScheduler::Install(sched); |
|
83 CSyscallsTestServer* server = NULL; |
|
84 // Create the CTestServer derived server |
|
85 TRAPD(err, server = CSyscallsTestServer::NewL()); |
|
86 if(!err) |
|
87 { |
|
88 // Sync with the client and enter the active scheduler |
|
89 RProcess::Rendezvous(KErrNone); |
|
90 sched->Start(); |
|
91 } |
|
92 delete server; |
|
93 delete sched; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Server entry point |
|
98 * @return Standard Epoc error code on exit |
|
99 */ |
|
100 TInt main() |
|
101 { |
|
102 __UHEAP_MARK; |
|
103 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
104 if(cleanup == NULL) |
|
105 { |
|
106 return KErrNoMemory; |
|
107 } |
|
108 TRAP_IGNORE(MainL()); |
|
109 delete cleanup; |
|
110 __UHEAP_MARKEND; |
|
111 |
|
112 return KErrNone; |
|
113 } |
|
114 |
|
115 CTestStep* CSyscallsTestServer::CreateTestStep(const TDesC& aStepName) |
|
116 { |
|
117 CTestStep* testStep = NULL; |
|
118 |
|
119 // This server creates just one step but create as many as you want |
|
120 // They are created "just in time" when the worker thread is created |
|
121 // install steps |
|
122 |
|
123 if(aStepName == KCreat) |
|
124 { |
|
125 testStep = new CTestSyscalls(aStepName); |
|
126 } |
|
127 if(aStepName == Kopen1) |
|
128 { |
|
129 testStep = new CTestSyscalls(aStepName); |
|
130 } |
|
131 if(aStepName == Kopen2) |
|
132 { |
|
133 testStep = new CTestSyscalls(aStepName); |
|
134 } |
|
135 if(aStepName == Kopen3) |
|
136 { |
|
137 testStep = new CTestSyscalls(aStepName); |
|
138 } |
|
139 if(aStepName == Kopen4) |
|
140 { |
|
141 testStep = new CTestSyscalls(aStepName); |
|
142 } |
|
143 if(aStepName == Kopen5) |
|
144 { |
|
145 testStep = new CTestSyscalls(aStepName); |
|
146 } |
|
147 if(aStepName == Kopen6) |
|
148 { |
|
149 testStep = new CTestSyscalls(aStepName); |
|
150 } |
|
151 if(aStepName == KOpenTruncate1) |
|
152 { |
|
153 testStep = new CTestSyscalls(aStepName); |
|
154 } |
|
155 if(aStepName == KOpenTruncate2) |
|
156 { |
|
157 testStep = new CTestSyscalls(aStepName); |
|
158 } |
|
159 if(aStepName == Kopen7) |
|
160 { |
|
161 testStep = new CTestSyscalls(aStepName); |
|
162 } |
|
163 if(aStepName == KOpenInAppendMode) |
|
164 { |
|
165 testStep = new CTestSyscalls(aStepName); |
|
166 } |
|
167 |
|
168 if(aStepName == Kwrite1) |
|
169 { |
|
170 testStep = new CTestSyscalls(aStepName); |
|
171 } |
|
172 if(aStepName == Kwrite2) |
|
173 { |
|
174 testStep = new CTestSyscalls(aStepName); |
|
175 } |
|
176 if(aStepName == Kwrite3) |
|
177 { |
|
178 testStep = new CTestSyscalls(aStepName); |
|
179 } |
|
180 if(aStepName == Kwrite5) |
|
181 { |
|
182 testStep = new CTestSyscalls(aStepName); |
|
183 } |
|
184 |
|
185 if(aStepName == Kread1) |
|
186 { |
|
187 testStep = new CTestSyscalls(aStepName); |
|
188 } |
|
189 if(aStepName == Kread2) |
|
190 { |
|
191 testStep = new CTestSyscalls(aStepName); |
|
192 } |
|
193 if(aStepName == Kread3) |
|
194 { |
|
195 testStep = new CTestSyscalls(aStepName); |
|
196 } |
|
197 if(aStepName == Kread4) |
|
198 { |
|
199 testStep = new CTestSyscalls(aStepName); |
|
200 } |
|
201 |
|
202 if(aStepName == KOpendir) |
|
203 { |
|
204 testStep = new CTestSyscalls(aStepName); |
|
205 } |
|
206 if(aStepName == KClosedir) |
|
207 { |
|
208 testStep = new CTestSyscalls(aStepName); |
|
209 } |
|
210 |
|
211 if(aStepName == KReaddir) |
|
212 { |
|
213 testStep = new CTestSyscalls(aStepName); |
|
214 } |
|
215 if(aStepName == KLseek) |
|
216 { |
|
217 testStep = new CTestSyscalls(aStepName); |
|
218 } |
|
219 if(aStepName == KLseek1) |
|
220 { |
|
221 testStep = new CTestSyscalls(aStepName); |
|
222 } |
|
223 if(aStepName == KAccess) |
|
224 { |
|
225 testStep = new CTestSyscalls(aStepName); |
|
226 } |
|
227 if(aStepName == KAccess1) |
|
228 { |
|
229 testStep = new CTestSyscalls(aStepName); |
|
230 } |
|
231 if(aStepName == KDup) |
|
232 { |
|
233 testStep = new CTestSyscalls(aStepName); |
|
234 } |
|
235 if(aStepName == KDup2) |
|
236 { |
|
237 testStep = new CTestSyscalls(aStepName); |
|
238 } |
|
239 |
|
240 |
|
241 if(aStepName == KRename) |
|
242 { |
|
243 testStep = new CTestSyscalls(aStepName); |
|
244 } |
|
245 if(aStepName == KRename1) |
|
246 { |
|
247 testStep = new CTestSyscalls(aStepName); |
|
248 } |
|
249 |
|
250 if(aStepName == KChmod) |
|
251 { |
|
252 testStep = new CTestSyscalls(aStepName); |
|
253 } |
|
254 if(aStepName == KChmod1) |
|
255 { |
|
256 testStep = new CTestSyscalls(aStepName); |
|
257 } |
|
258 if(aStepName == KChmod_dir) |
|
259 { |
|
260 testStep = new CTestSyscalls(aStepName); |
|
261 } |
|
262 if(aStepName == KFChmod) |
|
263 { |
|
264 testStep = new CTestSyscalls(aStepName); |
|
265 } |
|
266 if(aStepName == KFChmod_dir) |
|
267 { |
|
268 testStep = new CTestSyscalls(aStepName); |
|
269 } |
|
270 |
|
271 if(aStepName == KExit) |
|
272 { |
|
273 testStep = new CTestSyscalls(aStepName); |
|
274 } |
|
275 if(aStepName == KClose) |
|
276 { |
|
277 testStep = new CTestSyscalls(aStepName); |
|
278 } |
|
279 |
|
280 if(aStepName == KMkdir) |
|
281 { |
|
282 testStep = new CTestSyscalls(aStepName); |
|
283 } |
|
284 if(aStepName == KMk_dir) |
|
285 { |
|
286 testStep = new CTestSyscalls(aStepName); |
|
287 } |
|
288 |
|
289 if(aStepName == KRmdir) |
|
290 { |
|
291 testStep = new CTestSyscalls(aStepName); |
|
292 } |
|
293 if(aStepName == KRm_dir) |
|
294 { |
|
295 testStep = new CTestSyscalls(aStepName); |
|
296 } |
|
297 if(aStepName == KRmdir1) |
|
298 { |
|
299 testStep = new CTestSyscalls(aStepName); |
|
300 } |
|
301 if(aStepName == KRmdir_Chdir) |
|
302 { |
|
303 testStep = new CTestSyscalls(aStepName); |
|
304 } |
|
305 |
|
306 if(aStepName == KFsync) |
|
307 { |
|
308 testStep = new CTestSyscalls(aStepName); |
|
309 } |
|
310 |
|
311 if(aStepName == KUtimes) |
|
312 { |
|
313 testStep = new CTestSyscalls(aStepName); |
|
314 } |
|
315 if(aStepName == KUtime) |
|
316 { |
|
317 testStep = new CTestSyscalls(aStepName); |
|
318 } |
|
319 |
|
320 if(aStepName == KChdir) |
|
321 { |
|
322 testStep = new CTestSyscalls(aStepName); |
|
323 } |
|
324 |
|
325 if(aStepName == KFcntl) |
|
326 { |
|
327 testStep = new CTestSyscalls(aStepName); |
|
328 } |
|
329 if(aStepName == KIoctl) |
|
330 { |
|
331 testStep = new CTestSyscalls(aStepName); |
|
332 } |
|
333 if(aStepName == KFstat) |
|
334 { |
|
335 testStep = new CTestSyscalls(aStepName); |
|
336 } |
|
337 if(aStepName == KStat) |
|
338 { |
|
339 testStep = new CTestSyscalls(aStepName); |
|
340 } |
|
341 if(aStepName == KStat1) |
|
342 { |
|
343 testStep = new CTestSyscalls(aStepName); |
|
344 } |
|
345 if(aStepName == KStat2) |
|
346 { |
|
347 testStep = new CTestSyscalls(aStepName); |
|
348 } |
|
349 if(aStepName == KStat3) |
|
350 { |
|
351 testStep = new CTestSyscalls(aStepName); |
|
352 } |
|
353 if(aStepName == KGetpid) |
|
354 { |
|
355 testStep = new CTestSyscalls(aStepName); |
|
356 } |
|
357 if(aStepName == KClock) |
|
358 { |
|
359 testStep = new CTestSyscalls(aStepName); |
|
360 } |
|
361 if(aStepName == KTime) |
|
362 { |
|
363 testStep = new CTestSyscalls(aStepName); |
|
364 } |
|
365 if(aStepName == KWaitPid) |
|
366 { |
|
367 testStep = new CTestSyscalls(aStepName); |
|
368 } |
|
369 if(aStepName == KReadV) |
|
370 { |
|
371 testStep = new CTestSyscalls(aStepName); |
|
372 } |
|
373 if(aStepName == KWriteV) |
|
374 { |
|
375 testStep = new CTestSyscalls(aStepName); |
|
376 } |
|
377 if(aStepName == KSleep) |
|
378 { |
|
379 testStep = new CTestSyscalls(aStepName); |
|
380 } |
|
381 if(aStepName == KSeekDir) |
|
382 { |
|
383 testStep = new CTestSyscalls(aStepName); |
|
384 } |
|
385 if(aStepName == KRewindDir) |
|
386 { |
|
387 testStep = new CTestSyscalls(aStepName); |
|
388 } |
|
389 if(aStepName == KTelldir) |
|
390 { |
|
391 testStep = new CTestSyscalls(aStepName); |
|
392 } |
|
393 if(aStepName == KTestClock) |
|
394 { |
|
395 testStep = new CTestSyscalls(aStepName); |
|
396 } |
|
397 if(aStepName == KCreat2) |
|
398 { |
|
399 testStep = new CTestSyscalls(aStepName); |
|
400 } |
|
401 if(aStepName == Kopen8) |
|
402 { |
|
403 testStep = new CTestSyscalls(aStepName); |
|
404 } |
|
405 if (aStepName == KTestStat) |
|
406 { |
|
407 testStep = new CTestSyscalls(aStepName); |
|
408 } |
|
409 if(aStepName == KLseekttytest1) |
|
410 { |
|
411 testStep = new CTestSyscalls(aStepName); |
|
412 } |
|
413 if(aStepName == KLseekttytest2) |
|
414 { |
|
415 testStep = new CTestSyscalls(aStepName); |
|
416 } |
|
417 if(aStepName == KWaitPidtest) |
|
418 { |
|
419 testStep = new CTestSyscalls(aStepName); |
|
420 } |
|
421 if(aStepName == KWaittest) |
|
422 { |
|
423 testStep = new CTestSyscalls(aStepName); |
|
424 } |
|
425 if(aStepName == KOpen_FileDes_Test) |
|
426 { |
|
427 testStep = new CTestSyscalls(aStepName); |
|
428 } |
|
429 if(aStepName == Kopenuid) |
|
430 { |
|
431 testStep = new CTestSyscalls(aStepName); |
|
432 } |
|
433 if(aStepName == KMkdir1) |
|
434 { |
|
435 testStep = new CTestSyscalls(aStepName); |
|
436 } |
|
437 if(aStepName == KMkdir2) |
|
438 { |
|
439 testStep = new CTestSyscalls(aStepName); |
|
440 } |
|
441 if(aStepName == KRename2) |
|
442 { |
|
443 testStep = new CTestSyscalls(aStepName); |
|
444 } |
|
445 if(aStepName == Ktestfsync) |
|
446 { |
|
447 testStep = new CTestSyscalls(aStepName); |
|
448 } |
|
449 if(aStepName == Ktestrename) |
|
450 { |
|
451 testStep = new CTestSyscalls(aStepName); |
|
452 } |
|
453 if(aStepName == Ktestopenvalidate) |
|
454 { |
|
455 testStep = new CTestSyscalls(aStepName); |
|
456 } |
|
457 if(aStepName == Ksync_safe) |
|
458 { |
|
459 testStep = new CTestSyscalls(aStepName); |
|
460 } |
|
461 if(aStepName == KFstat1) |
|
462 { |
|
463 testStep = new CTestSyscalls(aStepName); |
|
464 } |
|
465 if(aStepName == KUtimes1) |
|
466 { |
|
467 testStep = new CTestSyscalls(aStepName); |
|
468 } |
|
469 if(aStepName == KMkdir_test1) |
|
470 { |
|
471 testStep = new CTestSyscalls(aStepName); |
|
472 } |
|
473 if(aStepName == KChmod_test) |
|
474 { |
|
475 testStep = new CTestSyscalls(aStepName); |
|
476 } |
|
477 if(aStepName == KChdir1) |
|
478 { |
|
479 testStep = new CTestSyscalls(aStepName); |
|
480 } |
|
481 if(aStepName == KRmdir2) |
|
482 { |
|
483 testStep = new CTestSyscalls(aStepName); |
|
484 } |
|
485 if(aStepName == KRename_test) |
|
486 { |
|
487 testStep = new CTestSyscalls(aStepName); |
|
488 } |
|
489 if(aStepName == KRename3) |
|
490 { |
|
491 testStep = new CTestSyscalls(aStepName); |
|
492 } |
|
493 if(aStepName == KCreat1) |
|
494 { |
|
495 testStep = new CTestSyscalls(aStepName); |
|
496 } |
|
497 if(aStepName == KReadV1) |
|
498 { |
|
499 testStep = new CTestSyscalls(aStepName); |
|
500 } |
|
501 if(aStepName == KUtimes2) |
|
502 { |
|
503 testStep = new CTestSyscalls(aStepName); |
|
504 } |
|
505 if(aStepName == KStat_test) |
|
506 { |
|
507 testStep = new CTestSyscalls(aStepName); |
|
508 } |
|
509 if(aStepName == KMkdir_test2) |
|
510 { |
|
511 testStep = new CTestSyscalls(aStepName); |
|
512 } |
|
513 if(aStepName == KChmod2) |
|
514 { |
|
515 testStep = new CTestSyscalls(aStepName); |
|
516 } |
|
517 if(aStepName == KChdir2) |
|
518 { |
|
519 testStep = new CTestSyscalls(aStepName); |
|
520 } |
|
521 if(aStepName == KRename4) |
|
522 { |
|
523 testStep = new CTestSyscalls(aStepName); |
|
524 } |
|
525 if(aStepName == KRename5) |
|
526 { |
|
527 testStep = new CTestSyscalls(aStepName); |
|
528 } |
|
529 if(aStepName == KRmdir3) |
|
530 { |
|
531 testStep = new CTestSyscalls(aStepName); |
|
532 } |
|
533 if(aStepName == Kread5) |
|
534 { |
|
535 testStep = new CTestSyscalls(aStepName); |
|
536 } |
|
537 return testStep; |
|
538 } |
|
539 |