blob: d5ea4331ea43bfe2250fb9bc9c627afaf30c3f65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/*
* Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
* Contact: http://www.qt-project.org/legal
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
// Include Files
#include <e32base.h>
#include <e32std.h>
#include <e32test.h> // rtest
#include <bacline.h> // ccommandlinearguments
#include "fuzztest.h"
#include "ipcfuzztest.h"
// Constants
_LIT(KTextTestTitle, "FuzzTest");
const TInt KMinIPCFuncRange = 0;
const TInt KMaxIPCFuncRange = 300;
// Global Variables
LOCAL_D RTest gTest(KTextTestTitle()); // write all messages to this
// Local Functions
LOCAL_C void DoTestL()
{
//
// Checking command line arguements and create fuzz test instance.
//
CCommandLineArguments* args = CCommandLineArguments::NewLC();
TInt minRange = KMinIPCFuncRange;
TInt maxRange = KMaxIPCFuncRange;
const TInt argsCount = args->Count();
if(argsCount == 1)
{
gTest.Printf(_L("Please give target server name and IPC funtion ranges"));
User::Leave(KErrArgument);
}
TPtrC targetNamePtr = args->Arg(1);
if(argsCount == 3)
{
TLex maxRangeLex(args->Arg(2));
maxRangeLex.Val(maxRange);
}
else if(argsCount > 3)
{
TLex minRangeLex(args->Arg(2));
TLex maxRangeLex(args->Arg(3));
maxRangeLex.Val(maxRange);
minRangeLex.Val(minRange);
}
if(minRange > maxRange)
{
TInt temp = minRange;
minRange = maxRange;
maxRange = temp;
}
RIpcFuzzTest ipcFuzzTest(gTest);
ipcFuzzTest.RunTestL(targetNamePtr, minRange, maxRange);
CleanupStack::PopAndDestroy(args);
}
// Global Functions
/**
@SYMTestCaseID PIM-FUZZTEST-0001
*/
GLDEF_C TInt E32Main()
{
__UHEAP_MARK;
gtest.Start(_L("@SYMTESTCaseID:PIM-FUZZTEST-0001 FuzzTest"));
CActiveScheduler* scheduler=new CActiveScheduler;
if (scheduler)
{
CActiveScheduler::Install(scheduler);
CTrapCleanup* cleanup=CTrapCleanup::New();
if (cleanup)
{
TRAPD(err,DoTestL());
gTest(err == KErrNone);
delete cleanup;
}
delete scheduler;
}
gTest.Close();
__UHEAP_MARKEND;
return KErrNone;
}
|