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