83
|
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: Implementation of CTFAStifEntryPoint class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <stiftestinterface.h>
|
|
21 |
#include "dsytesttooltrace.h"
|
|
22 |
#include "tfastifentrypoint.h"
|
|
23 |
#include "tfastiftestsuiteadapter.h"
|
|
24 |
#include "tfastiftestsuiteadapterroot.h"
|
|
25 |
#include "tfastiftestcaseadapter.h"
|
|
26 |
#include "tfastiftestenvironment.h"
|
|
27 |
#include "tfastiftestlog.h"
|
|
28 |
|
|
29 |
|
|
30 |
// ================= TRACE FUNCTIONS ==============
|
|
31 |
#ifdef _DEBUG
|
|
32 |
|
|
33 |
const TInt KTFAssertDateSize = 32;
|
|
34 |
|
|
35 |
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
// TraceAssertFunc
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
void TraceAssertFunc( const TDesC8& aFile, TInt aLine )
|
|
40 |
{
|
|
41 |
HBufC* buffer = HBufC::New( aFile.Length() + 1 );
|
|
42 |
HBufC* date = HBufC::New( KTFAssertDateSize );
|
|
43 |
HBufC* time = HBufC::New( KTFAssertDateSize );
|
|
44 |
if ( buffer != NULL && date != NULL && time != NULL )
|
|
45 |
{
|
|
46 |
buffer->Des().Copy( aFile );
|
|
47 |
date->Des().Copy( _L8( __DATE__ ) );
|
|
48 |
time->Des().Copy( _L8( __TIME__ ) );
|
|
49 |
RDebug::Print( _L( "Assertion failed: file=%s, line=%d, compiled=%s %s" ), buffer->Des().PtrZ(), aLine, date->Des().PtrZ(), time->Des().PtrZ() );
|
|
50 |
}
|
|
51 |
else
|
|
52 |
{
|
|
53 |
RDebug::Print( _L( "Assertion and memory allocation failed" ) );
|
|
54 |
}
|
|
55 |
delete buffer;
|
|
56 |
delete date;
|
|
57 |
delete time;
|
|
58 |
}
|
|
59 |
#endif
|
|
60 |
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
// LibEntryL
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
EXPORT_C CTestModuleBase* LibEntryL( void )
|
|
65 |
{
|
|
66 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::LibEntryL()" ) ) );
|
|
67 |
CTFAStifEntryPoint* entry = CTFAStifEntryPoint::NewL();
|
|
68 |
// Stif framework deletes the CTestModuleBase-derived object
|
|
69 |
// which deletes the entry point object.
|
|
70 |
CTestModuleBase* retval = STATIC_CAST( CTFAStifTestSuiteAdapterRoot*, entry->RootSuiteAdapter() );
|
|
71 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::LibEntryL - return 0x%x" ), retval ) );
|
|
72 |
return retval;
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam,
|
|
77 |
TUint32& aParameterValid )
|
|
78 |
{
|
|
79 |
aParameterValid = KStifTestModuleParameterChanged;
|
|
80 |
|
|
81 |
CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
|
|
82 |
|
|
83 |
// Stack size
|
|
84 |
param->iTestThreadStackSize= 65536; // 64K stack
|
|
85 |
|
|
86 |
// Heap sizes
|
|
87 |
param->iTestThreadMinHeap = 4096; // 4K heap min
|
|
88 |
param->iTestThreadMaxHeap = 1260480;// 1.2M heap max
|
|
89 |
|
|
90 |
aTestModuleParam = param;
|
|
91 |
return KErrNone;
|
|
92 |
}
|
|
93 |
|
|
94 |
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
// CTFAStifEntryPoint::NewL
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
CTFAStifEntryPoint* CTFAStifEntryPoint::NewL( void )
|
|
99 |
{
|
|
100 |
CTFAStifEntryPoint* entry = new ( ELeave ) CTFAStifEntryPoint();
|
|
101 |
CleanupStack::PushL( entry );
|
|
102 |
entry->ConstructL();
|
|
103 |
CleanupStack::Pop( entry );
|
|
104 |
return entry;
|
|
105 |
}
|
|
106 |
|
|
107 |
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
// CTFAStifEntryPoint::CTFAStifEntryPoint
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
CTFAStifEntryPoint::CTFAStifEntryPoint( void )
|
|
112 |
{
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
// -----------------------------------------------------------------------------
|
|
117 |
// CTFAStifEntryPoint::~CTFAStifEntryPoint
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
CTFAStifEntryPoint::~CTFAStifEntryPoint( void )
|
|
120 |
{
|
|
121 |
}
|
|
122 |
|
|
123 |
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
// CTFAStifEntryPoint::ConstructL
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
void CTFAStifEntryPoint::ConstructL( void )
|
|
128 |
{
|
|
129 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::ConstructL()" ) ) );
|
|
130 |
CTFAEntryPoint::ConstructL();
|
|
131 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::ConstructL - return void" ) ) );
|
|
132 |
}
|
|
133 |
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// CTFAStifEntryPoint::CreateSuiteAdapterLC
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
MTFATestSuiteAdapter* CTFAStifEntryPoint::CreateSuiteAdapterLC( CTFATestSuite& aSuite, TBool aRoot )
|
|
139 |
{
|
|
140 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateSuiteAdapterLC(0x%x, %d )" ), &aSuite, aRoot ) );
|
|
141 |
MTFATestSuiteAdapter* adapter;
|
|
142 |
if ( aRoot )
|
|
143 |
{
|
|
144 |
adapter = CTFAStifTestSuiteAdapterRoot::NewLC( aSuite, this );
|
|
145 |
}
|
|
146 |
else
|
|
147 |
{
|
|
148 |
adapter = CTFAStifTestSuiteAdapter::NewLC( aSuite, NULL );
|
|
149 |
}
|
|
150 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateSuiteAdapterLC - return 0x%x" ), adapter ) );
|
|
151 |
return adapter;
|
|
152 |
}
|
|
153 |
|
|
154 |
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
// CTFAStifEntryPoint::CreateTestAdapterLC
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
MTFATestCaseAdapter* CTFAStifEntryPoint::CreateTestAdapterLC( CTFATestCase& aCase )
|
|
159 |
{
|
|
160 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateTestAdapterLC(0x%x)" ), &aCase ) );
|
|
161 |
CTFAStifTestCaseAdapter* adapter = CTFAStifTestCaseAdapter::NewLC( aCase,
|
|
162 |
STATIC_CAST( CTFAStifTestSuiteAdapterRoot*, RootSuiteAdapter() ) );
|
|
163 |
STATIC_CAST( CTFAStifTestSuiteAdapterRoot*, RootSuiteAdapter() )->AddTestL( *adapter );
|
|
164 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateTestAdapterLC - return 0x%x" ), adapter ) );
|
|
165 |
return adapter;
|
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
// CTFAStifEntryPoint::CreateEnvironmentL
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
CTFATestEnvironment* CTFAStifEntryPoint::CreateEnvironmentL( void )
|
|
173 |
{
|
|
174 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateEnvironmentL()" ) ) );
|
|
175 |
CTFAStifTestLog* log = CTFAStifTestLog::NewLC();
|
|
176 |
CTFAStifTestEnvironment* env = new ( ELeave ) CTFAStifTestEnvironment( *log );
|
|
177 |
CleanupStack::Pop( log );
|
|
178 |
COMPONENT_TRACE( ( _L( " DSYTESTTOOL - CTFAStifEntryPoint::CreateEnvironmentL - return 0x%x" ), env ) );
|
|
179 |
return env;
|
|
180 |
}
|
|
181 |
|