|
1 /* |
|
2 * Copyright (c) 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: This module contains implementation of RTestServer, |
|
15 * RTestModule and RTestExecution class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32svr.h> |
|
21 #include <stifinternal/TestServerClient.h> |
|
22 #include "TestServerCommon.h" |
|
23 //--PYTHON-- begin |
|
24 #include "StifPython.h" |
|
25 //--PYTHON-- end |
|
26 |
|
27 // EXTERNAL DATA STRUCTURES |
|
28 |
|
29 // EXTERNAL FUNCTION PROTOTYPES |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // LOCAL CONSTANTS AND MACROS |
|
36 |
|
37 // MODULE DATA STRUCTURES |
|
38 |
|
39 // LOCAL FUNCTION PROTOTYPES |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 |
|
43 |
|
44 // ==================== LOCAL FUNCTIONS ======================================= |
|
45 |
|
46 // None |
|
47 |
|
48 // ================= MEMBER FUNCTIONS ========================================= |
|
49 |
|
50 |
|
51 /* |
|
52 ------------------------------------------------------------------------------- |
|
53 |
|
54 Class: RTestServer |
|
55 |
|
56 Method: RTestServer |
|
57 |
|
58 Description: Default constructor |
|
59 |
|
60 C++ default constructor can NOT contain any code, that |
|
61 might leave. |
|
62 |
|
63 Parameters: None |
|
64 |
|
65 Return Values: None |
|
66 |
|
67 Errors/Exceptions: None |
|
68 |
|
69 Status: Approved |
|
70 |
|
71 ------------------------------------------------------------------------------- |
|
72 */ |
|
73 EXPORT_C RTestServer::RTestServer() |
|
74 { |
|
75 } |
|
76 |
|
77 |
|
78 /* |
|
79 ------------------------------------------------------------------------------- |
|
80 |
|
81 Class: RTestServer |
|
82 |
|
83 Method: Connect |
|
84 |
|
85 Description: Connect method creates new RTestServer session. |
|
86 RTestServer session is used to manage the test case execution. |
|
87 |
|
88 Parameters: const TFileName& aModuleName: in: Module to be loaded |
|
89 const TDesC& aConfigFile: in: Test case(config) file |
|
90 name(Used in TestScripter case for parsing STIF settings). |
|
91 |
|
92 Return Values: TInt Error code |
|
93 |
|
94 Errors/Exceptions: None |
|
95 |
|
96 Status: Proposal |
|
97 |
|
98 ------------------------------------------------------------------------------- |
|
99 */ |
|
100 EXPORT_C TInt RTestServer::Connect( const TFileName& aModuleName, |
|
101 const TDesC& aConfigFile |
|
102 ) |
|
103 { |
|
104 TFileName serverName; |
|
105 |
|
106 TInt ret = KErrNone; |
|
107 |
|
108 // Create global semaphore start-up. It will be indexed (if given name already exsists, index will be increased) |
|
109 RSemaphore startSemaphore; |
|
110 TName semaphoreName = _L("startupSemaphore"); |
|
111 semaphoreName.Append( aModuleName ); |
|
112 TInt x = 0; |
|
113 RBuf semName; |
|
114 ret = semName.Create(KMaxName); |
|
115 if(ret != KErrNone) |
|
116 { |
|
117 RDebug::Print(_L("RTestServer::Connect() Could not create buffer for semaphore name [%d]"), ret); |
|
118 return ret; |
|
119 } |
|
120 do |
|
121 { |
|
122 semName.Format(_L("%S%d"), &semaphoreName, x); |
|
123 ret = startSemaphore.CreateGlobal(semName, 0); |
|
124 RDebug::Print(_L("RTestServer::Connect() Creating global semaphore [%S] with result [%d]"), &semName, ret); |
|
125 if(ret != KErrAlreadyExists) |
|
126 { |
|
127 semaphoreName.Copy(semName); |
|
128 break; |
|
129 } |
|
130 x++; |
|
131 } while (ETrue); |
|
132 semName.Close(); |
|
133 |
|
134 if ( ret != KErrNone ) |
|
135 { |
|
136 startSemaphore.Close(); |
|
137 return ret; |
|
138 } |
|
139 |
|
140 // By default start 'testserverstarter.exe' |
|
141 TFileName pathAndExeModule; |
|
142 if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) |
|
143 { |
|
144 pathAndExeModule.Copy( KDefaultUiExeName ); |
|
145 } |
|
146 else |
|
147 { |
|
148 pathAndExeModule.Copy( KDefaultExeName ); |
|
149 } |
|
150 |
|
151 RProcess pr; |
|
152 |
|
153 // Data to be passed to new process. It will contain module name and synchronization semaphore name separated with space. |
|
154 // I.e. it will be: "mymodule startupSemaphore0" |
|
155 RBuf data; |
|
156 ret = data.Create(KMaxName); |
|
157 if(ret != KErrNone) |
|
158 { |
|
159 RDebug::Print(_L("RTestServer::Connect() Could not create buffer for data to be passed to process [%d]"), ret); |
|
160 return ret; |
|
161 } |
|
162 data.Format(_L("%S %S"), &aModuleName, &semaphoreName); |
|
163 RDebug::Print(_L("RTestServer::Connect() Data for new process prepared [%S]"), &data); |
|
164 |
|
165 |
|
166 // Indication is Create() operation needed |
|
167 TBool doCreate( ETrue ); |
|
168 |
|
169 #ifdef __WINS__ // CodeWarrior(emulator) |
|
170 // Create without path(Uses Symbian default path). |
|
171 // Note: If TestScriter used then module name is format: |
|
172 // testscripter_testcasefilename |
|
173 |
|
174 ret = pr.Create( aModuleName, data ); |
|
175 if( ret == KErrNone ) |
|
176 { |
|
177 RDebug::Print(_L("RTestServer::Connect() Combination (1): Caps modifier [%S], Data [%S]"), &aModuleName, &data); |
|
178 doCreate = EFalse; |
|
179 } |
|
180 #endif // __WINS__ |
|
181 |
|
182 if ( doCreate ) |
|
183 { |
|
184 TInt find_ret( KErrNone ); |
|
185 TInt trapd_ret( KErrNone ); |
|
186 // Check is TestScripter and is caps modifíer name given |
|
187 if( aModuleName.Find( KTestScripterName ) != KErrNotFound && aConfigFile != KNullDesC ) |
|
188 { |
|
189 TInt ret_caps; |
|
190 TFileName capsModifierName; |
|
191 // In TestClass's test case (config) file can give name to caps |
|
192 // modifier module. |
|
193 ret_caps = GetCapsModifier( aConfigFile, capsModifierName ); |
|
194 if( ret_caps != KErrNone ) |
|
195 { |
|
196 RDebug::Print( _L( "RTestServer::Connect() Caps modifier was not defined. Default modifier will be used" ) ); |
|
197 } |
|
198 else |
|
199 { |
|
200 #ifdef __WINS__ // CodeWarrior(emulator) |
|
201 // Create without path(Uses Symbian default path) |
|
202 ret = pr.Create( capsModifierName, data ); |
|
203 if( ret == KErrNone ) |
|
204 { |
|
205 RDebug::Print( _L( "RTestServer::Connect() Combination (2): Caps modifier [%S], Data [%S]"), &capsModifierName, &data); |
|
206 doCreate = EFalse; |
|
207 } |
|
208 #endif // __WINS__ |
|
209 if ( doCreate ) |
|
210 { |
|
211 TRAP( trapd_ret, find_ret = FindExeL( |
|
212 capsModifierName, pathAndExeModule ) ); |
|
213 } |
|
214 } |
|
215 } |
|
216 //--PYTHON-- begin |
|
217 // If this is python module, use caps modifier |
|
218 else if(aModuleName.Length() >= KPythonScripterLength && aModuleName.Mid(0, KPythonScripterLength).Compare(KPythonScripter) == 0) |
|
219 { |
|
220 pathAndExeModule.Copy(KPythonScripter); |
|
221 } |
|
222 //--PYTHON-- end |
|
223 // Find exe from file system |
|
224 else if( aModuleName != _L( "testcombiner" ) ) |
|
225 { |
|
226 // Check if e.g. TestModule.exe is available |
|
227 TRAP( trapd_ret, find_ret = FindExeL( aModuleName, pathAndExeModule ) ); |
|
228 } |
|
229 |
|
230 // Check FindExeL error codes |
|
231 if( find_ret != KErrNone ) |
|
232 { |
|
233 // Module was not found, using default exe: testserverstarter.exe |
|
234 RDebug::Print( _L( "RTestServer::Connect() Correct caps modifier module not found, capabilities cannot set" ) ); |
|
235 if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) |
|
236 { |
|
237 pathAndExeModule.Copy( KDefaultUiExeName ); |
|
238 } |
|
239 else |
|
240 { |
|
241 pathAndExeModule.Copy( KDefaultExeName ); |
|
242 } |
|
243 } |
|
244 if( trapd_ret != KErrNone ) |
|
245 { |
|
246 // FindExeL fails |
|
247 RDebug::Print( _L( "RTestServer::Connect() Caps modifier module searching fails with error: %d" ), trapd_ret ); |
|
248 startSemaphore.Close(); |
|
249 data.Close(); |
|
250 return trapd_ret; |
|
251 } |
|
252 |
|
253 } |
|
254 |
|
255 if ( doCreate ) |
|
256 { |
|
257 ret = pr.Create( pathAndExeModule, data ); |
|
258 RDebug::Print( |
|
259 _L( "RTestServer::Connect() Combination (3): Caps modifier [%S], Data [%S], Result [%d]" ), |
|
260 &pathAndExeModule, &data, ret ); |
|
261 } |
|
262 |
|
263 data.Close(); |
|
264 |
|
265 if ( ret != KErrNone ) |
|
266 { |
|
267 startSemaphore.Close(); |
|
268 return ret; |
|
269 } |
|
270 |
|
271 // Process created, continue start-up |
|
272 pr.Resume(); |
|
273 pr.Close(); |
|
274 |
|
275 // Wait until server is started |
|
276 startSemaphore.Wait(); |
|
277 startSemaphore.Close(); // Close semaphore |
|
278 |
|
279 serverName = aModuleName; |
|
280 |
|
281 // Server is up and running, connect to it |
|
282 ret = CreateSession( serverName, Version() ); |
|
283 return ret; |
|
284 } |
|
285 |
|
286 |
|
287 /* |
|
288 ------------------------------------------------------------------------------- |
|
289 |
|
290 Class: RTestServer |
|
291 |
|
292 Method: Version |
|
293 |
|
294 Description: Return client side version. |
|
295 |
|
296 Parameters: None |
|
297 |
|
298 Return Values: TVersion: Version number |
|
299 |
|
300 Errors/Exceptions: None |
|
301 |
|
302 Status: Approved |
|
303 |
|
304 ------------------------------------------------------------------------------- |
|
305 */ |
|
306 EXPORT_C TVersion RTestServer::Version() const |
|
307 { |
|
308 |
|
309 return( TVersion( KTestServerMajorVersionNumber, |
|
310 KTestServerMinorVersionNumber, |
|
311 KTestServerBuildVersionNumber |
|
312 ) ); |
|
313 |
|
314 } |
|
315 |
|
316 |
|
317 /* |
|
318 ------------------------------------------------------------------------------- |
|
319 |
|
320 Class: RTestServer |
|
321 |
|
322 Method: Close |
|
323 |
|
324 Description: Closes the RTestServer session. |
|
325 |
|
326 Parameters: None |
|
327 |
|
328 Return Values: None |
|
329 |
|
330 Errors/Exceptions: None |
|
331 |
|
332 Status: Approved |
|
333 |
|
334 ------------------------------------------------------------------------------- |
|
335 */ |
|
336 EXPORT_C void RTestServer::Close() |
|
337 { |
|
338 |
|
339 // Check that server is connected |
|
340 if( Handle() != 0 ) |
|
341 { |
|
342 TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
343 SendReceive( ETestServerCloseSession, args ); |
|
344 } |
|
345 |
|
346 RSessionBase::Close(); |
|
347 |
|
348 } |
|
349 /* |
|
350 ------------------------------------------------------------------------------- |
|
351 |
|
352 Class: RTestServer |
|
353 |
|
354 Method: GetServerThreadId |
|
355 |
|
356 Description: Get server thread id |
|
357 |
|
358 Parameters: None |
|
359 |
|
360 Return Values: None |
|
361 |
|
362 Errors/Exceptions: None |
|
363 |
|
364 Status: Approved |
|
365 |
|
366 ------------------------------------------------------------------------------- |
|
367 */ |
|
368 EXPORT_C TInt RTestServer::GetServerThreadId(TThreadId& aThreadId) |
|
369 { |
|
370 |
|
371 TInt ret(0); |
|
372 |
|
373 // Check that server is connected |
|
374 if( Handle() != 0 ) |
|
375 { |
|
376 TThreadId id; |
|
377 TPckg<TThreadId> threadIdPckg( id ); |
|
378 TIpcArgs args( &threadIdPckg, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
379 ret = SendReceive( ETestServerGetServerThreadId, args ); |
|
380 |
|
381 aThreadId = threadIdPckg(); |
|
382 } |
|
383 |
|
384 return ret; |
|
385 |
|
386 } |
|
387 |
|
388 EXPORT_C TInt RTestServer::PassEngineSessionSettings( const TEngineSettings& aEngineSessionSettings ) |
|
389 { |
|
390 TPckgC<TEngineSettings> engineSessionSettingsBuf( aEngineSessionSettings ); |
|
391 return SendReceive( ETestServerPassEngineSessionSettings, |
|
392 TIpcArgs( &engineSessionSettingsBuf ) ); |
|
393 } |
|
394 |
|
395 /* |
|
396 ------------------------------------------------------------------------------- |
|
397 |
|
398 Class: RTestServer |
|
399 |
|
400 Method: FindExeL |
|
401 |
|
402 Description: Find exe(CapsModifier) from file system(Used in EKA2) |
|
403 |
|
404 Parameters: TFileName aModuleName: in: Module name. |
|
405 TFileName& aPathAndExeModule: inout: Module's exe(CapsModifier) |
|
406 path information. |
|
407 |
|
408 Return Values: TBool: Symbian error code: If exe(CapsModifier) is found |
|
409 return KErrNone else other error code will return. |
|
410 |
|
411 Errors/Exceptions: None |
|
412 |
|
413 Status: Proposal |
|
414 |
|
415 ------------------------------------------------------------------------------- |
|
416 */ |
|
417 TBool RTestServer::FindExeL( TFileName aModuleName, |
|
418 TFileName& aPathAndExeModule ) |
|
419 { |
|
420 RFs fsSession; // For the file session handling |
|
421 RFile file; |
|
422 |
|
423 // Connect to file server |
|
424 User::LeaveIfError( fsSession.Connect() ); // Start session |
|
425 |
|
426 TDriveList drivelist; |
|
427 User::LeaveIfError( fsSession.DriveList(drivelist) ); |
|
428 // A TDriveList (the list of available drives), is an array of |
|
429 // 26 bytes. Each byte with a non zero value signifies that the |
|
430 // corresponding drive is available. |
|
431 TInt driveNumber; |
|
432 TChar driveLetter; |
|
433 |
|
434 for( driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++ ) |
|
435 { |
|
436 if( !drivelist[driveNumber] ) |
|
437 { |
|
438 // If drive-list entry is zero, drive is not available |
|
439 continue; |
|
440 } |
|
441 User::LeaveIfError(fsSession.DriveToChar(driveNumber,driveLetter)); |
|
442 |
|
443 aPathAndExeModule.Zero(); |
|
444 aPathAndExeModule.Append( driveLetter ); |
|
445 |
|
446 aPathAndExeModule.Append( _L(":\\sys\\bin\\") ); |
|
447 |
|
448 aPathAndExeModule.Append( aModuleName ); |
|
449 aPathAndExeModule.Append( _L( ".exe" ) ); |
|
450 |
|
451 TInt found( KErrNone ); |
|
452 found = file.Open( fsSession, aPathAndExeModule, EFileRead ); |
|
453 if( found == KErrNone ) |
|
454 { |
|
455 // exe(capsmodifier module) is founded. |
|
456 file.Close(); |
|
457 fsSession.Close(); |
|
458 return KErrNone; |
|
459 } |
|
460 } |
|
461 |
|
462 // If exe not found use testserverstarter.exe but capabilities cannot |
|
463 // set. |
|
464 if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) |
|
465 { |
|
466 aPathAndExeModule.Copy( KDefaultUiExeName ); |
|
467 } |
|
468 else |
|
469 { |
|
470 aPathAndExeModule.Copy( KDefaultExeName ); |
|
471 } |
|
472 file.Close(); |
|
473 fsSession.Close(); |
|
474 |
|
475 return KErrNotFound; |
|
476 |
|
477 } |
|
478 |
|
479 /* |
|
480 ------------------------------------------------------------------------------- |
|
481 |
|
482 Class: RTestServer |
|
483 |
|
484 Method: GetCapsModifierName |
|
485 |
|
486 Description: Get caps modifier module name from TestScripter's test |
|
487 case(config) file. |
|
488 |
|
489 Parameters: const TDesC& aConfigFile: in: TestScripter's test case(config) |
|
490 file path and name. |
|
491 TFileName& aCapsModifierName: inout: Parsed caps modifier name. |
|
492 |
|
493 Return Values: TInt: Symbian error code: Return KErrNone if caps modifier |
|
494 module name is successfully parsed |
|
495 or given else other error code |
|
496 will return. |
|
497 |
|
498 Errors/Exceptions: None |
|
499 |
|
500 Status: Proposal |
|
501 |
|
502 ------------------------------------------------------------------------------- |
|
503 */ |
|
504 TInt RTestServer::GetCapsModifier( const TDesC& aConfigFile, |
|
505 TFileName& aCapsModifierName ) |
|
506 { |
|
507 // Create parser |
|
508 CStifParser* parser = NULL; |
|
509 TRAPD( err, parser = CStifParser::NewL( _L(""), aConfigFile ) ); |
|
510 if( err != KErrNone ) |
|
511 { |
|
512 return err; |
|
513 } |
|
514 |
|
515 CleanupStack::PushL( parser ); |
|
516 |
|
517 // Create section |
|
518 CStifSectionParser* section = NULL; |
|
519 TRAP( err, section = parser->SectionL( KStifSettingsStartTag, |
|
520 KStifSettingsEndTag ) ); |
|
521 if( err != KErrNone || section == NULL) |
|
522 { |
|
523 CleanupStack::PopAndDestroy( parser ); |
|
524 return KErrNotFound; |
|
525 } |
|
526 |
|
527 CleanupStack::PushL( section ); |
|
528 |
|
529 // Create item |
|
530 CStifItemParser* item = NULL; |
|
531 TRAP( err, item = section->GetItemLineL( KCapsModifier ) ); |
|
532 if( err != KErrNone || item == NULL ) |
|
533 { |
|
534 CleanupStack::PopAndDestroy( section ); |
|
535 CleanupStack::PopAndDestroy( parser ); |
|
536 return KErrNotFound; |
|
537 } |
|
538 CleanupStack::PushL( item ); |
|
539 |
|
540 // Get caps modifier module name |
|
541 TPtrC capsModifierName; |
|
542 err = item->GetString( KCapsModifier, capsModifierName ); |
|
543 if( err != KErrNone ) |
|
544 { |
|
545 CleanupStack::PopAndDestroy( item ); |
|
546 CleanupStack::PopAndDestroy( section ); |
|
547 CleanupStack::PopAndDestroy( parser ); |
|
548 return err; |
|
549 } |
|
550 |
|
551 aCapsModifierName.Copy( capsModifierName ); |
|
552 |
|
553 // Remove optional '.EXE' from the name |
|
554 aCapsModifierName.LowerCase(); |
|
555 TParse parse; |
|
556 parse.Set( aCapsModifierName, NULL, NULL ); |
|
557 |
|
558 if ( parse.Ext() == _L(".exe") ) |
|
559 { |
|
560 const TInt len = parse.Ext().Length(); |
|
561 aCapsModifierName.Delete ( aCapsModifierName.Length()-len, len ); |
|
562 } |
|
563 |
|
564 CleanupStack::PopAndDestroy( item ); |
|
565 CleanupStack::PopAndDestroy( section ); |
|
566 CleanupStack::PopAndDestroy( parser ); |
|
567 |
|
568 return KErrNone; |
|
569 |
|
570 } |
|
571 |
|
572 /* |
|
573 ------------------------------------------------------------------------------- |
|
574 |
|
575 Class: RTestModule |
|
576 |
|
577 Method: Open |
|
578 |
|
579 Description: Create new subsession with the RTestServer server |
|
580 |
|
581 Parameters: RTestServer& aServer :inout: Server |
|
582 TFileName& aIniFile :in: Initialization file |
|
583 |
|
584 Return Values: None |
|
585 |
|
586 Errors/Exceptions: None |
|
587 |
|
588 Status: Approved |
|
589 |
|
590 ------------------------------------------------------------------------------- |
|
591 */ |
|
592 EXPORT_C TInt RTestModule::Open( RTestServer& aServer, |
|
593 TFileName& aIniFile |
|
594 ) |
|
595 { |
|
596 TIpcArgs args( &aIniFile, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
597 return CreateSubSession( aServer, ETestModuleCreateSubSession, args ); |
|
598 } |
|
599 |
|
600 |
|
601 /* |
|
602 ------------------------------------------------------------------------------- |
|
603 |
|
604 Class: RTestModule |
|
605 |
|
606 Method: Close |
|
607 |
|
608 Description: Close a subsession |
|
609 |
|
610 Parameters: None |
|
611 |
|
612 Return Values: None |
|
613 |
|
614 Errors/Exceptions: None |
|
615 |
|
616 Status: Approved |
|
617 |
|
618 ------------------------------------------------------------------------------- |
|
619 */ |
|
620 EXPORT_C void RTestModule::Close() |
|
621 { |
|
622 |
|
623 RSubSessionBase::CloseSubSession( ETestModuleCloseSubSession ); |
|
624 |
|
625 } |
|
626 |
|
627 |
|
628 /* |
|
629 ------------------------------------------------------------------------------- |
|
630 |
|
631 Class: RTestModule |
|
632 |
|
633 Method: EnumerateTestCases |
|
634 |
|
635 Description: Enumerates test cases |
|
636 |
|
637 Parameters: TFileName aConfigFile :in: Configuration file name |
|
638 TCaseSize& aCount :out: Package for storing count |
|
639 TRequestStatus& aStatus :out: Status |
|
640 |
|
641 Return Values: None |
|
642 |
|
643 Errors/Exceptions: None |
|
644 |
|
645 Status: Approved |
|
646 |
|
647 ------------------------------------------------------------------------------- |
|
648 */ |
|
649 EXPORT_C void RTestModule::EnumerateTestCases( TDesC& aConfigFile, |
|
650 TCaseSize& aCount, |
|
651 TRequestStatus& aStatus |
|
652 ) |
|
653 { |
|
654 TIpcArgs args( &aConfigFile, &aCount, TIpcArgs::ENothing ); |
|
655 SendReceive( ETestModuleEnumerateTestCases, args, aStatus ); |
|
656 } |
|
657 |
|
658 /* |
|
659 ------------------------------------------------------------------------------- |
|
660 |
|
661 Class: RTestModule |
|
662 |
|
663 Method: GetTestCases |
|
664 |
|
665 Description: Get test cases |
|
666 |
|
667 Parameters: CFixedFlatArray<TTestCaseInfo>& aTestCaseBuffer :Out: Cases |
|
668 |
|
669 Return Values: TInt Return value from operation |
|
670 |
|
671 Errors/Exceptions: None |
|
672 |
|
673 Status: Approved |
|
674 |
|
675 ------------------------------------------------------------------------------- |
|
676 */ |
|
677 EXPORT_C TInt RTestModule::GetTestCases( CFixedFlatArray<TTestCaseInfo>& aTestCaseBuffer ) |
|
678 { |
|
679 TIpcArgs args( &aTestCaseBuffer.Des(), TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
680 return SendReceive( ETestModuleGetTestCases, args ); |
|
681 } |
|
682 |
|
683 /* |
|
684 ------------------------------------------------------------------------------- |
|
685 |
|
686 Class: RTestModule |
|
687 |
|
688 Method: ErrorNotification |
|
689 |
|
690 Description: Request error notification |
|
691 |
|
692 Parameters: None |
|
693 |
|
694 Return Values: None |
|
695 |
|
696 Errors/Exceptions: None |
|
697 |
|
698 Status: Proposal |
|
699 |
|
700 ------------------------------------------------------------------------------- |
|
701 */ |
|
702 EXPORT_C void RTestModule::ErrorNotification( TErrorNotificationPckg& aError, |
|
703 TRequestStatus& aStatus ) |
|
704 { |
|
705 TIpcArgs args( &aError, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
706 SendReceive( ETestModuleErrorNotification, args, aStatus ); |
|
707 } |
|
708 |
|
709 /* |
|
710 ------------------------------------------------------------------------------- |
|
711 |
|
712 Class: RTestModule |
|
713 |
|
714 Method: CancelAsyncRequest |
|
715 |
|
716 Description: Cancel ongoing request |
|
717 |
|
718 Parameters: TInt aReqToCancel :in: Request to be cancelled |
|
719 |
|
720 Return Values: TInt Return value from operation |
|
721 |
|
722 Errors/Exceptions: None |
|
723 |
|
724 Status: Approved |
|
725 |
|
726 ------------------------------------------------------------------------------- |
|
727 */ |
|
728 EXPORT_C TInt RTestModule::CancelAsyncRequest( TInt aReqToCancel ) |
|
729 { |
|
730 TIpcArgs args( aReqToCancel, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
731 return SendReceive( ETestModuleCancelAsyncRequest, args ); |
|
732 } |
|
733 |
|
734 /* |
|
735 ------------------------------------------------------------------------------- |
|
736 |
|
737 Class: RTestExecution |
|
738 |
|
739 Method: Open |
|
740 |
|
741 Description: create new subsession with the RTestModule |
|
742 |
|
743 Parameters: RTestServer& aServer :in: Handle to server |
|
744 const TInt aCaseNumber :in: Case number |
|
745 const TFileName& aConfig :in: Configuration file |
|
746 |
|
747 Return Values: TInt Return value from operation |
|
748 |
|
749 Errors/Exceptions: None |
|
750 |
|
751 Status: Approved |
|
752 |
|
753 ------------------------------------------------------------------------------- |
|
754 */ |
|
755 EXPORT_C TInt RTestExecution::Open( RTestServer& aServer, |
|
756 const TInt aCaseNumber, |
|
757 const TFileName& aConfig |
|
758 ) |
|
759 { |
|
760 TIpcArgs args( aCaseNumber, &aConfig, TIpcArgs::ENothing ); |
|
761 return CreateSubSession( aServer, ETestExecutionCreateSubSession, args ); |
|
762 } |
|
763 |
|
764 /* |
|
765 ------------------------------------------------------------------------------- |
|
766 |
|
767 Class: RTestModule |
|
768 |
|
769 Method: Close |
|
770 |
|
771 Description: close a subsession |
|
772 |
|
773 Parameters: None |
|
774 |
|
775 Return Values: None |
|
776 |
|
777 Errors/Exceptions: None |
|
778 |
|
779 Status: Approved |
|
780 |
|
781 ------------------------------------------------------------------------------- |
|
782 */ |
|
783 EXPORT_C void RTestExecution::Close() |
|
784 { |
|
785 |
|
786 // Close subsession |
|
787 RSubSessionBase::CloseSubSession( ETestExecutionCloseSubSession ); |
|
788 |
|
789 } |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 /* |
|
795 ------------------------------------------------------------------------------- |
|
796 |
|
797 Class: RTestExecution |
|
798 |
|
799 Method: RunTestCase |
|
800 |
|
801 Description: Runs a test case |
|
802 |
|
803 Parameters: TFullTestResultPckg& aResult :out: Case result |
|
804 TRequestStatus& aStatus :out: Request to be completed |
|
805 |
|
806 Return Values: None |
|
807 |
|
808 Errors/Exceptions: None |
|
809 |
|
810 Status: Approved |
|
811 |
|
812 ------------------------------------------------------------------------------- |
|
813 */ |
|
814 EXPORT_C void RTestExecution::RunTestCase( TFullTestResultPckg& aResult, |
|
815 TRequestStatus& aStatus |
|
816 ) |
|
817 { |
|
818 TIpcArgs args( &aResult, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
819 SendReceive( ETestExecutionRunTestCase, args, aStatus ); |
|
820 } |
|
821 |
|
822 /* |
|
823 ------------------------------------------------------------------------------- |
|
824 |
|
825 Class: RTestExecution |
|
826 |
|
827 Method: NotifyProgress |
|
828 |
|
829 Description: Notify about test case progress, i.e test case prints. |
|
830 |
|
831 Parameters: TTestProgressPckg& aProgress :out: Print info |
|
832 TRequestStatus& aStatus :out: Request to be completed |
|
833 |
|
834 Return Values: TInt Always KErrNone |
|
835 |
|
836 Errors/Exceptions: None |
|
837 |
|
838 Status: Approved |
|
839 |
|
840 ------------------------------------------------------------------------------- |
|
841 */ |
|
842 EXPORT_C TInt RTestExecution::NotifyProgress( TTestProgressPckg& aProgress, |
|
843 TRequestStatus& aStatus |
|
844 ) |
|
845 { |
|
846 TIpcArgs args( &aProgress, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
847 SendReceive( ETestExecutionNotifyProgress, args, aStatus ); |
|
848 return KErrNone; |
|
849 } |
|
850 |
|
851 |
|
852 /* |
|
853 ------------------------------------------------------------------------------- |
|
854 |
|
855 Class: RTestModule |
|
856 |
|
857 Method: Pause |
|
858 |
|
859 Description: Pauses a test case |
|
860 |
|
861 Parameters: None |
|
862 |
|
863 Return Values: TInt Return value from operation |
|
864 |
|
865 Errors/Exceptions: None |
|
866 |
|
867 Status: Approved |
|
868 |
|
869 ------------------------------------------------------------------------------- |
|
870 */ |
|
871 EXPORT_C TInt RTestExecution::Pause() |
|
872 { |
|
873 TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
874 return SendReceive( ETestExecutionPause, args ); |
|
875 } |
|
876 |
|
877 /* |
|
878 ------------------------------------------------------------------------------- |
|
879 |
|
880 Class: RTestModule |
|
881 |
|
882 Method: Resume |
|
883 |
|
884 Description: Resumes a test case |
|
885 |
|
886 Parameters: None |
|
887 |
|
888 Return Values: TInt Return value from operation |
|
889 |
|
890 Errors/Exceptions: None |
|
891 |
|
892 Status: Approved |
|
893 |
|
894 ------------------------------------------------------------------------------- |
|
895 */ |
|
896 EXPORT_C TInt RTestExecution::Resume() |
|
897 { |
|
898 TIpcArgs args( TIpcArgs::ENothing, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
899 return SendReceive( ETestExecutionResume, args ); |
|
900 } |
|
901 |
|
902 /* |
|
903 ------------------------------------------------------------------------------- |
|
904 |
|
905 Class: RTestModule |
|
906 |
|
907 Method: CancelAsyncRequest |
|
908 |
|
909 Description: Cancels an asynchronous request. |
|
910 |
|
911 Parameters: TInt aReqToCancel :in: Request to be cancelled. |
|
912 |
|
913 Return Values: TInt Return value from operation |
|
914 |
|
915 Errors/Exceptions: None |
|
916 |
|
917 Status: Approved |
|
918 |
|
919 ------------------------------------------------------------------------------- |
|
920 */ |
|
921 EXPORT_C TInt RTestExecution::CancelAsyncRequest( TInt aReqToCancel ) |
|
922 { |
|
923 TIpcArgs args( aReqToCancel, TIpcArgs::ENothing, TIpcArgs::ENothing ); |
|
924 return SendReceive( ETestExecutionCancelAsyncRequest, args ); |
|
925 } |
|
926 |
|
927 /* |
|
928 ------------------------------------------------------------------------------- |
|
929 |
|
930 Class: RTestModule |
|
931 |
|
932 Method: NotifyEvent |
|
933 |
|
934 Description: NotifyEvent is used to receive event requests |
|
935 from the Test module. |
|
936 |
|
937 Parameters: TEventIfPckg& aEvent :inout: Event package. |
|
938 TRequestStatus& aStatus :out: Request to be completed |
|
939 TInt aError :in: Error from event system |
|
940 |
|
941 Return Values: TInt Always KErrNone |
|
942 |
|
943 Errors/Exceptions: None |
|
944 |
|
945 Status: Proposal |
|
946 |
|
947 ------------------------------------------------------------------------------- |
|
948 */ |
|
949 EXPORT_C TInt RTestExecution::NotifyEvent( TEventIfPckg& aEvent, |
|
950 TRequestStatus& aStatus, |
|
951 TInt aError ) |
|
952 { |
|
953 TIpcArgs args( &aEvent, aError, TIpcArgs::ENothing ); |
|
954 SendReceive( ETestExecutionNotifyEvent, args, aStatus ); |
|
955 return KErrNone; |
|
956 } |
|
957 |
|
958 /* |
|
959 ------------------------------------------------------------------------------- |
|
960 |
|
961 Class: RTestModule |
|
962 |
|
963 Method: NotifyRemoteCmd |
|
964 |
|
965 Description: NotifyRemoteCmd is used to receive RemoteCmd requests |
|
966 from the Test module. |
|
967 |
|
968 Parameters: TRemoteCmdPckg& aRemoteCommand: nout: Remote command's packege. |
|
969 TRemoteCmdType aType: in: Remote type. |
|
970 TRequestStatus& aStatus: inout: Request to be completed |
|
971 |
|
972 Return Values: TInt: Always KErrNone |
|
973 |
|
974 Errors/Exceptions: None |
|
975 |
|
976 Status: Proposal |
|
977 |
|
978 ------------------------------------------------------------------------------- |
|
979 */ |
|
980 EXPORT_C TInt RTestExecution::NotifyRemoteCmd( TStifCommandPckg& aRemoteCommand, |
|
981 TPckg<TInt>& aMsgSizePckg, |
|
982 TRequestStatus& aStatus ) |
|
983 { |
|
984 // Construct message |
|
985 TIpcArgs args( &aRemoteCommand, &aMsgSizePckg, TIpcArgs::ENothing ); |
|
986 SendReceive( ETestExecutionNotifyRemoteCmd, args, aStatus ); |
|
987 return KErrNone; |
|
988 } |
|
989 |
|
990 /* |
|
991 ------------------------------------------------------------------------------- |
|
992 |
|
993 Class: RTestExecution |
|
994 |
|
995 Method: ReadRemoteCmdInfo |
|
996 |
|
997 Description: ReadRemoteCmdInfo is used to receive RemoteCmd requests |
|
998 from the Test module. |
|
999 |
|
1000 Parameters: TDesC& aMsg :inout: message. |
|
1001 TRemoteCommand aType :in: Remote command's type |
|
1002 TInt aError: in: Symbian error code |
|
1003 |
|
1004 Return Values: TInt: Always KErrNone |
|
1005 |
|
1006 Errors/Exceptions: None |
|
1007 |
|
1008 Status: Proposal |
|
1009 |
|
1010 ------------------------------------------------------------------------------- |
|
1011 */ |
|
1012 EXPORT_C TInt RTestExecution::ReadRemoteCmdInfo( TDes8& aMsg, |
|
1013 TStifCommand aType, |
|
1014 TInt aError ) |
|
1015 { |
|
1016 TInt value = 0; |
|
1017 if( aError != KErrNone ) |
|
1018 { |
|
1019 value = aError; |
|
1020 } |
|
1021 else |
|
1022 { |
|
1023 value = aMsg.Length(); |
|
1024 } |
|
1025 |
|
1026 // Construct message |
|
1027 TIpcArgs args( &aMsg, aType, value ); |
|
1028 // Synchronous method so return a value |
|
1029 return SendReceive( ETestExecutionReadRemoteCmdInfo, args ); |
|
1030 } |
|
1031 |
|
1032 /* |
|
1033 ------------------------------------------------------------------------------- |
|
1034 |
|
1035 Class: RTestExecution |
|
1036 |
|
1037 Method: NotifyCommand |
|
1038 |
|
1039 Description: NotifyCommand is used to receive command requests |
|
1040 from the Test module. DEPRECATED !! |
|
1041 Use NotifyCommand2 instead. |
|
1042 |
|
1043 Parameters: aStifCommandPckg: command |
|
1044 aParam1Pckg: parameter of command |
|
1045 aTestCaseHandlePckg: handle to test case |
|
1046 aStatus: request status |
|
1047 aError: error |
|
1048 |
|
1049 Return Values: TInt Always KErrNone |
|
1050 |
|
1051 Errors/Exceptions: None |
|
1052 |
|
1053 Status: Proposal |
|
1054 |
|
1055 ------------------------------------------------------------------------------- |
|
1056 */ |
|
1057 EXPORT_C TInt RTestExecution::NotifyCommand(TCommandPckg& /*aCommandPckg*/, |
|
1058 TBuf8<KMaxCommandParamsLength>& /*aParamsPckg*/, |
|
1059 TRequestStatus& /*aStatus*/, |
|
1060 TInt /*aError*/) |
|
1061 { |
|
1062 /*TIpcArgs args(&aCommandPckg, &aParamsPckg, TIpcArgs::ENothing); |
|
1063 SendReceive(ETestExecutionNotifyCommand, args, aStatus); |
|
1064 return KErrNone;*/ |
|
1065 return KErrNotSupported; |
|
1066 } |
|
1067 |
|
1068 /* |
|
1069 ------------------------------------------------------------------------------- |
|
1070 |
|
1071 Class: RTestExecution |
|
1072 |
|
1073 Method: NotifyCommand2 |
|
1074 |
|
1075 Description: NotifyCommand is used to receive command requests |
|
1076 from the Test module. |
|
1077 |
|
1078 Parameters: aStifCommandPckg: command |
|
1079 aParam1Pckg: parameter of command |
|
1080 aTestCaseHandlePckg: handle to test case |
|
1081 aStatus: request status |
|
1082 aError: error |
|
1083 |
|
1084 Return Values: TInt Always KErrNone |
|
1085 |
|
1086 Errors/Exceptions: None |
|
1087 |
|
1088 Status: Proposal |
|
1089 |
|
1090 ------------------------------------------------------------------------------- |
|
1091 */ |
|
1092 EXPORT_C TInt RTestExecution::NotifyCommand2(TCommandPckg& aCommandPckg, |
|
1093 TDes8& aParamsPckg, |
|
1094 TRequestStatus& aStatus, |
|
1095 TInt /*aError*/) |
|
1096 { |
|
1097 TIpcArgs args(&aCommandPckg, &aParamsPckg, TIpcArgs::ENothing); |
|
1098 SendReceive(ETestExecutionNotifyCommand, args, aStatus); |
|
1099 return KErrNone; |
|
1100 } |
|
1101 |
|
1102 // End of File |