|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 // Include Files |
|
19 #include <e32base.h> |
|
20 #include <e32std.h> |
|
21 #include <e32test.h> // RTest |
|
22 #include <bacline.h> // CCommandLineArguments |
|
23 #include "FuzzTest.h" |
|
24 #include "IpcFuzzTest.h" |
|
25 |
|
26 // Constants |
|
27 |
|
28 _LIT(KTextTestTitle, "FuzzTest"); |
|
29 const TInt KMinIPCFuncRange = 0; |
|
30 const TInt KMaxIPCFuncRange = 300; |
|
31 |
|
32 // Global Variables |
|
33 |
|
34 LOCAL_D RTest gTest(KTextTestTitle()); // write all messages to this |
|
35 |
|
36 |
|
37 // Local Functions |
|
38 |
|
39 LOCAL_C void DoTestL() |
|
40 { |
|
41 // |
|
42 // Checking command line arguements and create fuzz test instance. |
|
43 // |
|
44 CCommandLineArguments* args = CCommandLineArguments::NewLC(); |
|
45 |
|
46 TInt minRange = KMinIPCFuncRange; |
|
47 TInt maxRange = KMaxIPCFuncRange; |
|
48 |
|
49 const TInt argsCount = args->Count(); |
|
50 if(argsCount == 1) |
|
51 { |
|
52 gTest.Printf(_L("Please give target server name and IPC funtion ranges")); |
|
53 User::Leave(KErrArgument); |
|
54 } |
|
55 |
|
56 TPtrC targetNamePtr = args->Arg(1); |
|
57 if(argsCount == 3) |
|
58 { |
|
59 TLex maxRangeLex(args->Arg(2)); |
|
60 maxRangeLex.Val(maxRange); |
|
61 } |
|
62 else if(argsCount > 3) |
|
63 { |
|
64 TLex minRangeLex(args->Arg(2)); |
|
65 TLex maxRangeLex(args->Arg(3)); |
|
66 maxRangeLex.Val(maxRange); |
|
67 minRangeLex.Val(minRange); |
|
68 } |
|
69 |
|
70 if(minRange > maxRange) |
|
71 { |
|
72 TInt temp = minRange; |
|
73 minRange = maxRange; |
|
74 maxRange = temp; |
|
75 } |
|
76 |
|
77 RIpcFuzzTest ipcFuzzTest(gTest); |
|
78 |
|
79 ipcFuzzTest.RunTestL(targetNamePtr, minRange, maxRange); |
|
80 CleanupStack::PopAndDestroy(args); |
|
81 } |
|
82 |
|
83 |
|
84 // Global Functions |
|
85 /** |
|
86 |
|
87 @SYMTestCaseID PIM-FUZZTEST-0001 |
|
88 |
|
89 */ |
|
90 |
|
91 GLDEF_C TInt E32Main() |
|
92 { |
|
93 __UHEAP_MARK; |
|
94 gtest.Start(_L("@SYMTESTCaseID:PIM-FUZZTEST-0001 FuzzTest")); |
|
95 |
|
96 CActiveScheduler* scheduler=new CActiveScheduler; |
|
97 if (scheduler) |
|
98 { |
|
99 CActiveScheduler::Install(scheduler); |
|
100 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
101 if (cleanup) |
|
102 { |
|
103 TRAPD(err,DoTestL()); |
|
104 gTest(err == KErrNone); |
|
105 delete cleanup; |
|
106 } |
|
107 delete scheduler; |
|
108 } |
|
109 |
|
110 gTest.Close(); |
|
111 __UHEAP_MARKEND; |
|
112 return KErrNone; |
|
113 } |
|
114 |