sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// @SYMTestCaseID KBASE-DP_FUNC_ATTRIBUTES-0303
|
sl@0
|
15 |
// @SYMTestCaseDesc Symbian OS Toolchain's Paging Override and the
|
sl@0
|
16 |
// Paging Policy settings
|
sl@0
|
17 |
// @SYMREQ REQ6808
|
sl@0
|
18 |
// @SYMPREQ PREQ1110
|
sl@0
|
19 |
// @SYMTestPriority High
|
sl@0
|
20 |
// @SYMTestActions
|
sl@0
|
21 |
// 1. Load executables with the RProcess API and run them. Each executable has a
|
sl@0
|
22 |
// different set of attributes:
|
sl@0
|
23 |
// " Paging attribute: paged, unpaged or no paging attribute in MMP and/or
|
sl@0
|
24 |
// OBY files
|
sl@0
|
25 |
// " Compression mode: specified or not
|
sl@0
|
26 |
// " Executable built in ROM as 'data' or 'file'
|
sl@0
|
27 |
// " Solid binaries or aliases
|
sl@0
|
28 |
// Retrieve and analyse the demand paging activity trace caused by the preceding
|
sl@0
|
29 |
// action, in order to determine whether this binary is paged on demand or not.
|
sl@0
|
30 |
// 2. Repeat the preceding action by loading DLLs with the RLibrary API and
|
sl@0
|
31 |
// making calls to them.
|
sl@0
|
32 |
// @SYMTestExpectedResults
|
sl@0
|
33 |
// 1. Process complete without error. If, according to the trace data gathered,
|
sl@0
|
34 |
// the main thread newly created process causes the executable to be paged in,
|
sl@0
|
35 |
// then it is a proof that the executable is paged. Depending on the Paging
|
sl@0
|
36 |
// Override setting and the Loader Paging Policy specified at the time the ROM was
|
sl@0
|
37 |
// built, the Loader makes a decision as to whether page the binary or not,
|
sl@0
|
38 |
// according to the rules listed in the Design Sketch. This is how we determine
|
sl@0
|
39 |
// this, in this order:
|
sl@0
|
40 |
// a. If ROM paging is disabled: not paged
|
sl@0
|
41 |
// b. If executable was built in ROM as 'data': not paged
|
sl@0
|
42 |
// c. If the a file compression scheme was specified at ROM build time: not paged
|
sl@0
|
43 |
// d. If the Loader Paging policy is 'NOT PAGED': not paged
|
sl@0
|
44 |
// e. If the Loader Paging policy is 'ALWAYS PAGE': paged
|
sl@0
|
45 |
// f. If the Paging Override is 'NOT PAGED': not paged
|
sl@0
|
46 |
// g. If the Paging Override is 'ALWAYS PAGE': paged
|
sl@0
|
47 |
// h. If the OBY paging keyword for this executable is 'PAGED': paged
|
sl@0
|
48 |
// i. If the OBY paging keyword for this executable is 'NOT PAGED': unpaged
|
sl@0
|
49 |
// j. If the MMP paging keyword for this executable is 'PAGED': paged
|
sl@0
|
50 |
// k. If the MMP paging keyword for this executable is 'NOT PAGED': not paged
|
sl@0
|
51 |
// l. If the Paging Override is 'DEFAULT UNPAGED': not paged
|
sl@0
|
52 |
// m. If the Paging Override is 'DEFAULT PAGED': paged
|
sl@0
|
53 |
// n. If the Paging Policy is 'DEFAULT UNPAGED': not paged
|
sl@0
|
54 |
// o. The executable must be paged
|
sl@0
|
55 |
// 2. DLL is loaded. Functions are called and complete without errors. The rules
|
sl@0
|
56 |
// to determine whether the binary should be paged or not are the same as in the
|
sl@0
|
57 |
// preceding action.
|
sl@0
|
58 |
//
|
sl@0
|
59 |
//
|
sl@0
|
60 |
|
sl@0
|
61 |
#include <e32test.h>
|
sl@0
|
62 |
#include <e32ldr.h>
|
sl@0
|
63 |
#include <d32btrace.h>
|
sl@0
|
64 |
#include "u32std.h"
|
sl@0
|
65 |
#include <f32file.h>
|
sl@0
|
66 |
#include <dptest.h>
|
sl@0
|
67 |
|
sl@0
|
68 |
#define TEST_EQ(a,b) { if (a != b) { test.Printf(_L("%d != %d\n"), a, b); test(EFalse); } }
|
sl@0
|
69 |
#define TEST_CONDITION(a) { if (!a) { test.Printf(_L("TEST FAILED at line %d\n"), __LINE__); pass = EFalse; } }
|
sl@0
|
70 |
#define LE4(a) ((TUint) (*((a) + 3) << 24) + (*((a) + 2) << 16) + (*((a) + 1) << 8) + *(a))
|
sl@0
|
71 |
|
sl@0
|
72 |
RTest test(_L("T_DPATTR"));
|
sl@0
|
73 |
RBTrace btrace;
|
sl@0
|
74 |
RFs fs;
|
sl@0
|
75 |
|
sl@0
|
76 |
// ROM paging settings
|
sl@0
|
77 |
TBool gIsRomDemangPagingEnabled;
|
sl@0
|
78 |
TInt gPagingOverride;
|
sl@0
|
79 |
TInt gPagingPolicy;
|
sl@0
|
80 |
|
sl@0
|
81 |
// This process
|
sl@0
|
82 |
TUint32 gNThreadId = 0;
|
sl@0
|
83 |
|
sl@0
|
84 |
// Test executables attributes flags
|
sl@0
|
85 |
enum
|
sl@0
|
86 |
{
|
sl@0
|
87 |
ENone = 0,
|
sl@0
|
88 |
EMMPPaged = 1 << 0, // "PAGED" keyword in MMP file
|
sl@0
|
89 |
EMMPUnpaged = 1 << 1, // "UNPAGED" keyword in MMP file
|
sl@0
|
90 |
EMMPCompressTarget = 1 << 2, // "COMPRESSTARGET" keyword in MMP file
|
sl@0
|
91 |
EMMPNoCompressTarget = 1 << 3, // "UNCOMPRESSTARGET" keyword in MMP file
|
sl@0
|
92 |
EIBYData = 1 << 4, // File included as "data" in IBY file
|
sl@0
|
93 |
EIBYFile = 1 << 5, // File included as "file" in IBY file
|
sl@0
|
94 |
EIBYFileCompress = 1 << 6, // File included as "file_x_" in IBY file (_x_=compression scheme)
|
sl@0
|
95 |
EIBYPaged = 1 << 7, // File declared "paged" in IBY file
|
sl@0
|
96 |
EIBYUnpaged = 1 << 8, // File declared "unpaged in IBY file
|
sl@0
|
97 |
EIBYAlias = 1 << 9, // File name is an alias
|
sl@0
|
98 |
EDLLWritableStaticData = 1 << 10 // DLL contains writable static data
|
sl@0
|
99 |
};
|
sl@0
|
100 |
|
sl@0
|
101 |
// Test executables attributes
|
sl@0
|
102 |
const TUint testExeAttr[] =
|
sl@0
|
103 |
{
|
sl@0
|
104 |
/* 000 - does not exist */ ENone,
|
sl@0
|
105 |
/* 001 */ EIBYFile,
|
sl@0
|
106 |
/* 002 */ EMMPPaged | EIBYFile,
|
sl@0
|
107 |
/* 003 */ EMMPUnpaged | EIBYFile,
|
sl@0
|
108 |
/* 004 */ EIBYFileCompress,
|
sl@0
|
109 |
/* 005 */ EMMPPaged | EIBYFileCompress,
|
sl@0
|
110 |
/* 006 */ EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
111 |
/* 007 */ EIBYFileCompress,
|
sl@0
|
112 |
/* 008 */ EMMPPaged | EIBYFileCompress,
|
sl@0
|
113 |
/* 009 */ EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
114 |
/* 010 */ EIBYFileCompress,
|
sl@0
|
115 |
/* 011 */ EMMPPaged | EIBYFileCompress,
|
sl@0
|
116 |
/* 012 */ EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
117 |
/* 013 */ EIBYFile | EMMPCompressTarget,
|
sl@0
|
118 |
/* 014 */ EMMPPaged | EIBYFile | EMMPNoCompressTarget,
|
sl@0
|
119 |
/* 015 */ EMMPUnpaged | EIBYFile | EIBYFileCompress | EIBYPaged,
|
sl@0
|
120 |
/* 016 */ EIBYData,
|
sl@0
|
121 |
/* 017 */ EMMPPaged | EIBYData,
|
sl@0
|
122 |
/* 018 */ EMMPUnpaged | EIBYData,
|
sl@0
|
123 |
/* 019 */ EIBYFile | EIBYPaged,
|
sl@0
|
124 |
/* 020 */ EMMPPaged | EIBYFile | EIBYPaged,
|
sl@0
|
125 |
/* 021 */ EMMPUnpaged | EIBYFile | EIBYPaged,
|
sl@0
|
126 |
/* 022 */ EIBYFile | EIBYUnpaged,
|
sl@0
|
127 |
/* 023 */ EMMPPaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
128 |
/* 024 */ EMMPUnpaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
129 |
/* 025 */ EIBYData | EIBYPaged,
|
sl@0
|
130 |
/* 026 */ EMMPPaged | EIBYData | EIBYPaged,
|
sl@0
|
131 |
/* 027 */ EMMPUnpaged | EIBYData | EIBYPaged,
|
sl@0
|
132 |
/* 028 */ EIBYData | EIBYUnpaged,
|
sl@0
|
133 |
/* 029 */ EMMPPaged | EIBYData | EIBYUnpaged,
|
sl@0
|
134 |
/* 030 */ EMMPUnpaged | EIBYData | EIBYUnpaged,
|
sl@0
|
135 |
/* 031 */ EIBYAlias | EIBYFile,
|
sl@0
|
136 |
/* 032 */ EIBYAlias | EMMPPaged | EIBYFile,
|
sl@0
|
137 |
/* 033 */ EIBYAlias | EMMPUnpaged | EIBYFile,
|
sl@0
|
138 |
/* 034 */ EIBYAlias | EIBYFileCompress,
|
sl@0
|
139 |
/* 035 */ EIBYAlias | EMMPPaged | EIBYFileCompress,
|
sl@0
|
140 |
/* 036 */ EIBYAlias | EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
141 |
/* 037 */ EIBYAlias | EIBYFileCompress,
|
sl@0
|
142 |
/* 038 */ EIBYAlias | EMMPPaged | EIBYFileCompress,
|
sl@0
|
143 |
/* 039 */ EIBYAlias | EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
144 |
/* 040 */ EIBYAlias | EIBYFileCompress,
|
sl@0
|
145 |
/* 041 */ EIBYAlias | EMMPPaged | EIBYFileCompress,
|
sl@0
|
146 |
/* 042 */ EIBYAlias | EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
147 |
/* 043 */ EIBYAlias | EIBYFile | EMMPCompressTarget,
|
sl@0
|
148 |
/* 044 */ EIBYAlias | EMMPPaged | EIBYFile | EMMPNoCompressTarget,
|
sl@0
|
149 |
/* 045 */ EIBYAlias | EMMPUnpaged | EIBYFile | EIBYFileCompress | EIBYPaged,
|
sl@0
|
150 |
/* 046 */ EIBYAlias | EIBYData,
|
sl@0
|
151 |
/* 047 */ EIBYAlias | EMMPPaged | EIBYData,
|
sl@0
|
152 |
/* 048 */ EIBYAlias | EMMPUnpaged | EIBYData,
|
sl@0
|
153 |
/* 049 */ EIBYAlias | EIBYFile | EIBYPaged,
|
sl@0
|
154 |
/* 050 */ EIBYAlias | EMMPPaged | EIBYFile | EIBYPaged,
|
sl@0
|
155 |
/* 051 */ EIBYAlias | EMMPUnpaged | EIBYFile | EIBYPaged,
|
sl@0
|
156 |
/* 052 */ EIBYAlias | EIBYFile | EIBYUnpaged,
|
sl@0
|
157 |
/* 053 */ EIBYAlias | EMMPPaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
158 |
/* 054 */ EIBYAlias | EMMPUnpaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
159 |
/* 055 */ EIBYAlias | EIBYData | EIBYPaged,
|
sl@0
|
160 |
/* 056 */ EIBYAlias | EMMPPaged | EIBYData | EIBYPaged,
|
sl@0
|
161 |
/* 057 */ EIBYAlias | EMMPUnpaged | EIBYData | EIBYPaged,
|
sl@0
|
162 |
/* 058 */ EIBYAlias | EIBYData | EIBYUnpaged,
|
sl@0
|
163 |
/* 059 */ EIBYAlias | EMMPPaged | EIBYData | EIBYUnpaged,
|
sl@0
|
164 |
/* 060 */ EIBYAlias | EMMPUnpaged | EIBYData | EIBYUnpaged
|
sl@0
|
165 |
};
|
sl@0
|
166 |
const TUint testDllAttr[] =
|
sl@0
|
167 |
{
|
sl@0
|
168 |
/* 000 - does not exist */ ENone,
|
sl@0
|
169 |
/* 001 */ EIBYFile,
|
sl@0
|
170 |
/* 002 */ EMMPPaged | EIBYFile,
|
sl@0
|
171 |
/* 003 */ EMMPUnpaged | EIBYFile,
|
sl@0
|
172 |
/* 004 */ EIBYFileCompress,
|
sl@0
|
173 |
/* 005 */ EMMPPaged | EIBYFileCompress,
|
sl@0
|
174 |
/* 006 */ EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
175 |
/* 007 */ EDLLWritableStaticData,
|
sl@0
|
176 |
/* 008 */ EMMPPaged | EDLLWritableStaticData,
|
sl@0
|
177 |
/* 009 */ EMMPUnpaged | EDLLWritableStaticData,
|
sl@0
|
178 |
/* 010 */ EIBYFileCompress,
|
sl@0
|
179 |
/* 011 */ EMMPPaged | EIBYFileCompress,
|
sl@0
|
180 |
/* 012 */ EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
181 |
/* 013 */ EIBYFile | EMMPCompressTarget,
|
sl@0
|
182 |
/* 014 */ EMMPPaged | EIBYFile | EMMPNoCompressTarget,
|
sl@0
|
183 |
/* 015 */ EMMPUnpaged | EIBYFile | EIBYFileCompress | EIBYPaged,
|
sl@0
|
184 |
/* 016 */ EIBYData,
|
sl@0
|
185 |
/* 017 */ EMMPPaged | EIBYData,
|
sl@0
|
186 |
/* 018 */ EMMPUnpaged | EIBYData,
|
sl@0
|
187 |
/* 019 */ EIBYFile | EIBYPaged,
|
sl@0
|
188 |
/* 020 */ EMMPPaged | EIBYFile | EIBYPaged,
|
sl@0
|
189 |
/* 021 */ EMMPUnpaged | EIBYFile | EIBYPaged,
|
sl@0
|
190 |
/* 022 */ EIBYFile | EIBYUnpaged,
|
sl@0
|
191 |
/* 023 */ EMMPPaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
192 |
/* 024 */ EMMPUnpaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
193 |
/* 025 */ EIBYData | EIBYPaged,
|
sl@0
|
194 |
/* 026 */ EMMPPaged | EIBYData | EIBYPaged,
|
sl@0
|
195 |
/* 027 */ EMMPUnpaged | EIBYData | EIBYPaged,
|
sl@0
|
196 |
/* 028 */ EIBYData | EIBYUnpaged,
|
sl@0
|
197 |
/* 029 */ EMMPPaged | EIBYData | EIBYUnpaged,
|
sl@0
|
198 |
/* 030 */ EMMPUnpaged | EIBYData | EIBYUnpaged,
|
sl@0
|
199 |
/* 031 */ EIBYAlias | EIBYFile,
|
sl@0
|
200 |
/* 032 */ EIBYAlias | EMMPPaged | EIBYFile,
|
sl@0
|
201 |
/* 033 */ EIBYAlias | EMMPUnpaged | EIBYFile,
|
sl@0
|
202 |
/* 034 */ EIBYAlias | EIBYFileCompress,
|
sl@0
|
203 |
/* 035 */ EIBYAlias | EMMPPaged | EIBYFileCompress,
|
sl@0
|
204 |
/* 036 */ EIBYAlias | EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
205 |
/* 037 */ EIBYAlias | EDLLWritableStaticData,
|
sl@0
|
206 |
/* 038 */ EIBYAlias | EMMPPaged | EDLLWritableStaticData,
|
sl@0
|
207 |
/* 039 */ EIBYAlias | EMMPUnpaged | EDLLWritableStaticData,
|
sl@0
|
208 |
/* 040 */ EIBYAlias | EIBYFileCompress,
|
sl@0
|
209 |
/* 041 */ EIBYAlias | EMMPPaged | EIBYFileCompress,
|
sl@0
|
210 |
/* 042 */ EIBYAlias | EMMPUnpaged | EIBYFileCompress,
|
sl@0
|
211 |
/* 043 */ EIBYAlias | EIBYFile | EMMPCompressTarget,
|
sl@0
|
212 |
/* 044 */ EIBYAlias | EMMPPaged | EIBYFile | EMMPNoCompressTarget,
|
sl@0
|
213 |
/* 045 */ EIBYAlias | EMMPUnpaged | EIBYFile | EIBYFileCompress | EIBYPaged,
|
sl@0
|
214 |
/* 046 */ EIBYAlias | EIBYData,
|
sl@0
|
215 |
/* 047 */ EIBYAlias | EMMPPaged | EIBYData,
|
sl@0
|
216 |
/* 048 */ EIBYAlias | EMMPUnpaged | EIBYData,
|
sl@0
|
217 |
/* 049 */ EIBYAlias | EIBYFile | EIBYPaged,
|
sl@0
|
218 |
/* 050 */ EIBYAlias | EMMPPaged | EIBYFile | EIBYPaged,
|
sl@0
|
219 |
/* 051 */ EIBYAlias | EMMPUnpaged | EIBYFile | EIBYPaged,
|
sl@0
|
220 |
/* 052 */ EIBYAlias | EIBYFile | EIBYUnpaged,
|
sl@0
|
221 |
/* 053 */ EIBYAlias | EMMPPaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
222 |
/* 054 */ EIBYAlias | EMMPUnpaged | EIBYFile | EIBYUnpaged,
|
sl@0
|
223 |
/* 055 */ EIBYAlias | EIBYData | EIBYPaged,
|
sl@0
|
224 |
/* 056 */ EIBYAlias | EMMPPaged | EIBYData | EIBYPaged,
|
sl@0
|
225 |
/* 057 */ EIBYAlias | EMMPUnpaged | EIBYData | EIBYPaged,
|
sl@0
|
226 |
/* 058 */ EIBYAlias | EIBYData | EIBYUnpaged,
|
sl@0
|
227 |
/* 059 */ EIBYAlias | EMMPPaged | EIBYData | EIBYUnpaged,
|
sl@0
|
228 |
/* 060 */ EIBYAlias | EMMPUnpaged | EIBYData | EIBYUnpaged
|
sl@0
|
229 |
};
|
sl@0
|
230 |
|
sl@0
|
231 |
void InitNThreadID()
|
sl@0
|
232 |
{
|
sl@0
|
233 |
_LIT(KThreadName, "ARandomThreadName");
|
sl@0
|
234 |
btrace.SetFilter(BTrace::EThreadIdentification, ETrue);
|
sl@0
|
235 |
btrace.Empty();
|
sl@0
|
236 |
btrace.SetMode(RBTrace::EEnable);
|
sl@0
|
237 |
// rename the current thread to force a ThreadID trace
|
sl@0
|
238 |
User::RenameThread(KThreadName);
|
sl@0
|
239 |
btrace.SetMode(0);
|
sl@0
|
240 |
TInt size;
|
sl@0
|
241 |
TUint8* pDataStart;
|
sl@0
|
242 |
TUint8* pCurrentRecord;
|
sl@0
|
243 |
// extract the nano-kernel thread ID from the trace
|
sl@0
|
244 |
while ((size = btrace.GetData(pDataStart)) != 0)
|
sl@0
|
245 |
{
|
sl@0
|
246 |
pCurrentRecord = pDataStart;
|
sl@0
|
247 |
while (pCurrentRecord - pDataStart < size)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
TInt extensionCount = 4 * (
|
sl@0
|
250 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EHeader2Present ? 1 : 0) +
|
sl@0
|
251 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::ETimestampPresent ? 1 : 0) +
|
sl@0
|
252 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::ETimestamp2Present ? 1 : 0) +
|
sl@0
|
253 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EContextIdPresent ? 1 : 0) +
|
sl@0
|
254 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EPcPresent ? 1 : 0) +
|
sl@0
|
255 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EExtraPresent ? 1 : 0));
|
sl@0
|
256 |
//
|
sl@0
|
257 |
if ((pCurrentRecord[BTrace::ECategoryIndex] == BTrace::EThreadIdentification) && (pCurrentRecord[BTrace::ESubCategoryIndex] == BTrace::EThreadName))
|
sl@0
|
258 |
{
|
sl@0
|
259 |
TBuf<255> threadName;
|
sl@0
|
260 |
threadName.Format(_L(""));
|
sl@0
|
261 |
for (TUint8* j = pCurrentRecord + 12 + extensionCount; j < pCurrentRecord + *pCurrentRecord; j++)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
threadName.AppendFormat(_L("%c"), *j);
|
sl@0
|
264 |
}
|
sl@0
|
265 |
if (threadName == KThreadName)
|
sl@0
|
266 |
{
|
sl@0
|
267 |
test.Printf(_L("This thread's NThread ID: %08x\n"), LE4(pCurrentRecord + 4 + extensionCount));
|
sl@0
|
268 |
gNThreadId = LE4(pCurrentRecord + 4 + extensionCount);
|
sl@0
|
269 |
}
|
sl@0
|
270 |
}
|
sl@0
|
271 |
pCurrentRecord = BTrace::NextRecord(pCurrentRecord);
|
sl@0
|
272 |
}
|
sl@0
|
273 |
btrace.DataUsed();
|
sl@0
|
274 |
}
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
void LoadExesRom()
|
sl@0
|
278 |
{
|
sl@0
|
279 |
TInt r;
|
sl@0
|
280 |
TBool pass = ETrue;
|
sl@0
|
281 |
r = btrace.ResizeBuffer(32768); // 32k should be large enough
|
sl@0
|
282 |
TEST_EQ(r, KErrNone);
|
sl@0
|
283 |
btrace.SetFilter(BTrace::EPaging, ETrue);
|
sl@0
|
284 |
btrace.SetFilter(BTrace::EThreadIdentification, ETrue);
|
sl@0
|
285 |
btrace.SetMode(0);
|
sl@0
|
286 |
|
sl@0
|
287 |
for (TInt i = 1; i <= 60; i++)
|
sl@0
|
288 |
{
|
sl@0
|
289 |
TBuf<255> filename;
|
sl@0
|
290 |
filename.Format(_L("Z:\\SYS\\BIN\\DPEXE%03d.EXE"), i);
|
sl@0
|
291 |
|
sl@0
|
292 |
test.Printf(_L("Loading %S... "), &filename);
|
sl@0
|
293 |
|
sl@0
|
294 |
TBool paged = EFalse;
|
sl@0
|
295 |
TBool inRom = EFalse;
|
sl@0
|
296 |
|
sl@0
|
297 |
TUint32 nthreadAddr = 0;
|
sl@0
|
298 |
TBuf<255> processName;
|
sl@0
|
299 |
|
sl@0
|
300 |
if (fs.IsFileInRom(filename) != NULL)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
inRom = ETrue;
|
sl@0
|
303 |
}
|
sl@0
|
304 |
else
|
sl@0
|
305 |
{
|
sl@0
|
306 |
inRom = EFalse;
|
sl@0
|
307 |
}
|
sl@0
|
308 |
|
sl@0
|
309 |
// Ensure that the paging live list is empty
|
sl@0
|
310 |
r = DPTest::FlushCache();
|
sl@0
|
311 |
if (gIsRomDemangPagingEnabled)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
TEST_EQ(r, KErrNone);
|
sl@0
|
314 |
}
|
sl@0
|
315 |
else
|
sl@0
|
316 |
{
|
sl@0
|
317 |
TEST_EQ(r, KErrNotSupported);
|
sl@0
|
318 |
}
|
sl@0
|
319 |
|
sl@0
|
320 |
btrace.Empty(); // empty the BTrace buffer
|
sl@0
|
321 |
btrace.SetMode(RBTrace::EEnable);
|
sl@0
|
322 |
RProcess proc;
|
sl@0
|
323 |
r = proc.Create(filename, _L(""));
|
sl@0
|
324 |
|
sl@0
|
325 |
if ((testExeAttr[i] & EIBYAlias) && (testExeAttr[i] & EIBYData) && (gIsRomDemangPagingEnabled))
|
sl@0
|
326 |
// There cannot be aliases mapping to "data" files since they are moved to ROFS if the ROM is paged
|
sl@0
|
327 |
{
|
sl@0
|
328 |
TEST_EQ(r, KErrNotFound);
|
sl@0
|
329 |
continue;
|
sl@0
|
330 |
}
|
sl@0
|
331 |
else
|
sl@0
|
332 |
{
|
sl@0
|
333 |
TEST_EQ(r, KErrNone);
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
// Resume the process and wait until it completes
|
sl@0
|
337 |
TRequestStatus ps;
|
sl@0
|
338 |
proc.Logon(ps);
|
sl@0
|
339 |
proc.Resume();
|
sl@0
|
340 |
proc.Close();
|
sl@0
|
341 |
User::WaitForRequest(ps);
|
sl@0
|
342 |
|
sl@0
|
343 |
// Disable trace
|
sl@0
|
344 |
btrace.SetMode(0);
|
sl@0
|
345 |
|
sl@0
|
346 |
TInt size;
|
sl@0
|
347 |
TUint8* pDataStart;
|
sl@0
|
348 |
TUint8* pCurrentRecord;
|
sl@0
|
349 |
|
sl@0
|
350 |
// We have a while loop here, in the unlikely case that our trace is fragmented
|
sl@0
|
351 |
while ((size = btrace.GetData(pDataStart)) != 0)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
pCurrentRecord = pDataStart;
|
sl@0
|
354 |
while (pCurrentRecord - pDataStart < size)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
// Number of bytes used by the BTrace extensions
|
sl@0
|
357 |
TInt extensionCount = 4 * (
|
sl@0
|
358 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EHeader2Present ? 1 : 0) +
|
sl@0
|
359 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::ETimestampPresent ? 1 : 0) +
|
sl@0
|
360 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::ETimestamp2Present ? 1 : 0) +
|
sl@0
|
361 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EContextIdPresent ? 1 : 0) +
|
sl@0
|
362 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EPcPresent ? 1 : 0) +
|
sl@0
|
363 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EExtraPresent ? 1 : 0));
|
sl@0
|
364 |
|
sl@0
|
365 |
if ((pCurrentRecord[BTrace::ECategoryIndex] == BTrace::EThreadIdentification) && (pCurrentRecord[BTrace::ESubCategoryIndex] == BTrace::EProcessName))
|
sl@0
|
366 |
// Process renamed
|
sl@0
|
367 |
{
|
sl@0
|
368 |
processName.Format(_L(""));
|
sl@0
|
369 |
for (TUint8* j = pCurrentRecord + 12 + extensionCount; j < pCurrentRecord + *pCurrentRecord; j++)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
processName.AppendFormat(_L("%c"), *j);
|
sl@0
|
372 |
}
|
sl@0
|
373 |
TBuf<255> expected;
|
sl@0
|
374 |
expected.Format(_L("dpexe%03d.exe[%08x]%04x"), i, 0, 1);
|
sl@0
|
375 |
|
sl@0
|
376 |
if (processName == expected)
|
sl@0
|
377 |
{
|
sl@0
|
378 |
nthreadAddr = LE4(pCurrentRecord + 4 + extensionCount);
|
sl@0
|
379 |
}
|
sl@0
|
380 |
}
|
sl@0
|
381 |
if ((pCurrentRecord[BTrace::ECategoryIndex] == BTrace::EPaging) && (LE4(pCurrentRecord + 8) == nthreadAddr))
|
sl@0
|
382 |
/* The main thread of the test process tries to page in the test executable */
|
sl@0
|
383 |
{
|
sl@0
|
384 |
paged = ETrue;
|
sl@0
|
385 |
}
|
sl@0
|
386 |
pCurrentRecord = BTrace::NextRecord(pCurrentRecord); // move on to the next record
|
sl@0
|
387 |
}
|
sl@0
|
388 |
btrace.DataUsed();
|
sl@0
|
389 |
}
|
sl@0
|
390 |
|
sl@0
|
391 |
if (paged)
|
sl@0
|
392 |
test.Printf(_L("paged!\n"));
|
sl@0
|
393 |
else
|
sl@0
|
394 |
test.Printf(_L("not paged!\n"));
|
sl@0
|
395 |
|
sl@0
|
396 |
if (!gIsRomDemangPagingEnabled)
|
sl@0
|
397 |
// ROM paging disabled. All files are in ROM and unpaged
|
sl@0
|
398 |
{
|
sl@0
|
399 |
test.Printf(_L("ROM Paging disabled: shouldn't be paged\n"));
|
sl@0
|
400 |
TEST_CONDITION(inRom);
|
sl@0
|
401 |
TEST_CONDITION(!paged);
|
sl@0
|
402 |
}
|
sl@0
|
403 |
else if (testExeAttr[i] & EIBYData)
|
sl@0
|
404 |
// data - if ROM paged, then these executables will be moved to ROFS
|
sl@0
|
405 |
// these are always expected to be RAM loaded
|
sl@0
|
406 |
{
|
sl@0
|
407 |
test.Printf(_L("EXE is DATA in ROFS\n"));
|
sl@0
|
408 |
TEST_CONDITION(!inRom);
|
sl@0
|
409 |
}
|
sl@0
|
410 |
else if (testExeAttr[i] & EIBYFileCompress)
|
sl@0
|
411 |
// Compression format specified in the IBY file
|
sl@0
|
412 |
// These are expected to be stay in ROM, but will be RAM-loaded
|
sl@0
|
413 |
{
|
sl@0
|
414 |
test.Printf(_L("EXE has own compression method: shouldn't be paged\n"));
|
sl@0
|
415 |
TEST_CONDITION(inRom);
|
sl@0
|
416 |
TEST_CONDITION(!paged);
|
sl@0
|
417 |
}
|
sl@0
|
418 |
// from this point onwards, all executables can potentially be paged - paging policy takes precedence
|
sl@0
|
419 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyNoPaging)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
test.Printf(_L("Paging policy is No Paging: shouldn't be paged\n"));
|
sl@0
|
422 |
TEST_CONDITION(inRom);
|
sl@0
|
423 |
TEST_CONDITION(!paged);
|
sl@0
|
424 |
}
|
sl@0
|
425 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyAlwaysPage)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
test.Printf(_L("Paging policy is No Paging: shouldn't be paged\n"));
|
sl@0
|
428 |
TEST_CONDITION(inRom);
|
sl@0
|
429 |
TEST_CONDITION(paged);
|
sl@0
|
430 |
}
|
sl@0
|
431 |
// from this point onwards, paging policy is either Default Paged or Default Unpaged - paging override takes precedence
|
sl@0
|
432 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyNoPaging)
|
sl@0
|
433 |
{
|
sl@0
|
434 |
test.Printf(_L("Paging override is No Paging: shouldn't be paged\n"));
|
sl@0
|
435 |
TEST_CONDITION(inRom);
|
sl@0
|
436 |
TEST_CONDITION(!paged);
|
sl@0
|
437 |
}
|
sl@0
|
438 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyAlwaysPage)
|
sl@0
|
439 |
{
|
sl@0
|
440 |
test.Printf(_L("Paging override is Always Page: should be paged\n"));
|
sl@0
|
441 |
TEST_CONDITION(inRom);
|
sl@0
|
442 |
TEST_CONDITION(paged);
|
sl@0
|
443 |
}
|
sl@0
|
444 |
// from this point onwards, paging policy and override are either Default Paged or Default Unpaged - IBY setting takes precedence
|
sl@0
|
445 |
else if (testExeAttr[i] & EIBYPaged)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
test.Printf(_L("Paged keyword in OBY: should be paged\n"));
|
sl@0
|
448 |
TEST_CONDITION(inRom);
|
sl@0
|
449 |
TEST_CONDITION(paged);
|
sl@0
|
450 |
}
|
sl@0
|
451 |
else if (testExeAttr[i] & EIBYUnpaged)
|
sl@0
|
452 |
{
|
sl@0
|
453 |
test.Printf(_L("Unpaged keyword in OBY: shouldn't be paged\n"));
|
sl@0
|
454 |
TEST_CONDITION(inRom);
|
sl@0
|
455 |
TEST_CONDITION(!paged);
|
sl@0
|
456 |
}
|
sl@0
|
457 |
// Next, MMP setting takes precedence
|
sl@0
|
458 |
else if (testExeAttr[i] & EMMPPaged)
|
sl@0
|
459 |
{
|
sl@0
|
460 |
test.Printf(_L("Paged keyword in MMP: should be paged\n"));
|
sl@0
|
461 |
TEST_CONDITION(inRom);
|
sl@0
|
462 |
TEST_CONDITION(paged);
|
sl@0
|
463 |
}
|
sl@0
|
464 |
else if (testExeAttr[i] & EMMPUnpaged)
|
sl@0
|
465 |
{
|
sl@0
|
466 |
test.Printf(_L("Unpaged keyword in MMP: shouldn't be paged\n"));
|
sl@0
|
467 |
TEST_CONDITION(inRom);
|
sl@0
|
468 |
TEST_CONDITION(!paged);
|
sl@0
|
469 |
}
|
sl@0
|
470 |
// The test exe has no attribute. Paging overright default paging mode takes precedence
|
sl@0
|
471 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyDefaultUnpaged)
|
sl@0
|
472 |
{
|
sl@0
|
473 |
test.Printf(_L("Paging override is Default Unpaged: shouldn't be paged\n"));
|
sl@0
|
474 |
TEST_CONDITION(inRom);
|
sl@0
|
475 |
TEST_CONDITION(!paged);
|
sl@0
|
476 |
}
|
sl@0
|
477 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyDefaultPaged)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
test.Printf(_L("Paging override is Default Paged: should be paged\n"));
|
sl@0
|
480 |
TEST_CONDITION(inRom);
|
sl@0
|
481 |
TEST_CONDITION(paged);
|
sl@0
|
482 |
}
|
sl@0
|
483 |
// Paging policy default paging mode takes precedence
|
sl@0
|
484 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyDefaultUnpaged)
|
sl@0
|
485 |
{
|
sl@0
|
486 |
test.Printf(_L("Paging policy is Default Unpaged: shouldn't be paged\n"));
|
sl@0
|
487 |
TEST_CONDITION(inRom);
|
sl@0
|
488 |
TEST_CONDITION(!paged);
|
sl@0
|
489 |
}
|
sl@0
|
490 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyDefaultPaged)
|
sl@0
|
491 |
{
|
sl@0
|
492 |
test.Printf(_L("Paging policy is Default paged: should be paged\n"));
|
sl@0
|
493 |
TEST_CONDITION(inRom);
|
sl@0
|
494 |
TEST_CONDITION(paged);
|
sl@0
|
495 |
}
|
sl@0
|
496 |
// ROM Paging enabled without a default paging policy - this should not happen (default policy is No Paging)
|
sl@0
|
497 |
else
|
sl@0
|
498 |
{
|
sl@0
|
499 |
test.Printf(_L("No paging policy!\n"));
|
sl@0
|
500 |
test(EFalse);
|
sl@0
|
501 |
}
|
sl@0
|
502 |
}
|
sl@0
|
503 |
test(pass);
|
sl@0
|
504 |
}
|
sl@0
|
505 |
|
sl@0
|
506 |
|
sl@0
|
507 |
void LoadDllsRom()
|
sl@0
|
508 |
{
|
sl@0
|
509 |
TInt r;
|
sl@0
|
510 |
TBool pass = ETrue;
|
sl@0
|
511 |
r = btrace.ResizeBuffer(32768); // 32k should be large enough
|
sl@0
|
512 |
TEST_EQ(r, KErrNone);
|
sl@0
|
513 |
btrace.SetFilter(BTrace::EPaging, ETrue);
|
sl@0
|
514 |
btrace.SetFilter(BTrace::EThreadIdentification, ETrue);
|
sl@0
|
515 |
btrace.SetMode(0);
|
sl@0
|
516 |
|
sl@0
|
517 |
for (TInt i = 1; i <= 60; i++)
|
sl@0
|
518 |
{
|
sl@0
|
519 |
TBuf<255> filename;
|
sl@0
|
520 |
filename.Format(_L("Z:\\SYS\\BIN\\DPDLL%03d.DLL"), i);
|
sl@0
|
521 |
|
sl@0
|
522 |
test.Printf(_L("Loading %S... "), &filename);
|
sl@0
|
523 |
|
sl@0
|
524 |
TBool paged = EFalse;
|
sl@0
|
525 |
TBool inRom = EFalse;
|
sl@0
|
526 |
|
sl@0
|
527 |
TUint libLoadEnd;
|
sl@0
|
528 |
TInt filesize;
|
sl@0
|
529 |
|
sl@0
|
530 |
TUint8* addr;
|
sl@0
|
531 |
if ((addr = fs.IsFileInRom(filename)) != NULL)
|
sl@0
|
532 |
{
|
sl@0
|
533 |
inRom = ETrue;
|
sl@0
|
534 |
}
|
sl@0
|
535 |
else
|
sl@0
|
536 |
{
|
sl@0
|
537 |
inRom = EFalse;
|
sl@0
|
538 |
}
|
sl@0
|
539 |
|
sl@0
|
540 |
RFile file;
|
sl@0
|
541 |
r = file.Open(fs, filename, EFileRead);
|
sl@0
|
542 |
if ((testDllAttr[i] & EIBYAlias) && (testDllAttr[i] & EIBYData) && (gIsRomDemangPagingEnabled))
|
sl@0
|
543 |
// There cannot be aliases mapping to "data" files since they are moved to ROFS if the ROM is paged
|
sl@0
|
544 |
{
|
sl@0
|
545 |
TEST_EQ(r, KErrNotFound);
|
sl@0
|
546 |
continue;
|
sl@0
|
547 |
}
|
sl@0
|
548 |
else
|
sl@0
|
549 |
{
|
sl@0
|
550 |
TEST_EQ(r, KErrNone);
|
sl@0
|
551 |
}
|
sl@0
|
552 |
r = file.Size(filesize);
|
sl@0
|
553 |
TEST_EQ(r, KErrNone);
|
sl@0
|
554 |
file.Close();
|
sl@0
|
555 |
|
sl@0
|
556 |
// Ensure that the paging live list is empty
|
sl@0
|
557 |
r = DPTest::FlushCache();
|
sl@0
|
558 |
if (gIsRomDemangPagingEnabled)
|
sl@0
|
559 |
{
|
sl@0
|
560 |
TEST_EQ(r, KErrNone);
|
sl@0
|
561 |
}
|
sl@0
|
562 |
else
|
sl@0
|
563 |
{
|
sl@0
|
564 |
TEST_EQ(r, KErrNotSupported);
|
sl@0
|
565 |
}
|
sl@0
|
566 |
|
sl@0
|
567 |
btrace.Empty(); // empty the BTrace buffer
|
sl@0
|
568 |
btrace.SetMode(RBTrace::EEnable);
|
sl@0
|
569 |
RLibrary lib;
|
sl@0
|
570 |
r = lib.Load(filename);
|
sl@0
|
571 |
libLoadEnd = User::FastCounter();
|
sl@0
|
572 |
|
sl@0
|
573 |
TEST_EQ(r, KErrNone);
|
sl@0
|
574 |
|
sl@0
|
575 |
TLibraryFunction function1;
|
sl@0
|
576 |
TLibraryFunction function2;
|
sl@0
|
577 |
TLibraryFunction function3;
|
sl@0
|
578 |
TLibraryFunction function4;
|
sl@0
|
579 |
|
sl@0
|
580 |
function1 = lib.Lookup(1);
|
sl@0
|
581 |
function2 = lib.Lookup(2);
|
sl@0
|
582 |
function3 = lib.Lookup(3);
|
sl@0
|
583 |
function4 = lib.Lookup(4);
|
sl@0
|
584 |
|
sl@0
|
585 |
test(function1 != NULL);
|
sl@0
|
586 |
test(function2 != NULL);
|
sl@0
|
587 |
test(function3 != NULL);
|
sl@0
|
588 |
test(function4 == NULL);
|
sl@0
|
589 |
|
sl@0
|
590 |
// Resume the process and wait until it completes
|
sl@0
|
591 |
|
sl@0
|
592 |
function1();
|
sl@0
|
593 |
function2();
|
sl@0
|
594 |
function3();
|
sl@0
|
595 |
|
sl@0
|
596 |
lib.Close();
|
sl@0
|
597 |
|
sl@0
|
598 |
//processResumeStart = User::FastCounter();
|
sl@0
|
599 |
//processResumeEnd = User::FastCounter();
|
sl@0
|
600 |
|
sl@0
|
601 |
// Disable trace
|
sl@0
|
602 |
btrace.SetMode(0);
|
sl@0
|
603 |
|
sl@0
|
604 |
TInt size;
|
sl@0
|
605 |
TUint8* pDataStart;
|
sl@0
|
606 |
TUint8* pCurrentRecord;
|
sl@0
|
607 |
|
sl@0
|
608 |
// We have a while loop here, in the unlikely case that our trace is fragmented
|
sl@0
|
609 |
while ((size = btrace.GetData(pDataStart)) != 0)
|
sl@0
|
610 |
{
|
sl@0
|
611 |
pCurrentRecord = pDataStart;
|
sl@0
|
612 |
while (pCurrentRecord - pDataStart < size)
|
sl@0
|
613 |
{
|
sl@0
|
614 |
// Number of bytes used by the BTrace extensions
|
sl@0
|
615 |
TInt extensionCount = 4 * (
|
sl@0
|
616 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EHeader2Present ? 1 : 0) +
|
sl@0
|
617 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::ETimestampPresent ? 1 : 0) +
|
sl@0
|
618 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::ETimestamp2Present ? 1 : 0) +
|
sl@0
|
619 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EContextIdPresent ? 1 : 0) +
|
sl@0
|
620 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EPcPresent ? 1 : 0) +
|
sl@0
|
621 |
(pCurrentRecord[BTrace::EFlagsIndex] & BTrace::EExtraPresent ? 1 : 0));
|
sl@0
|
622 |
|
sl@0
|
623 |
if ((pCurrentRecord[BTrace::ECategoryIndex] == BTrace::EPaging)
|
sl@0
|
624 |
&& (pCurrentRecord[BTrace::ESubCategoryIndex] == BTrace::EPagingPageInBegin)
|
sl@0
|
625 |
&& (LE4(pCurrentRecord + 4) > libLoadEnd)
|
sl@0
|
626 |
&& (LE4(pCurrentRecord + extensionCount) == gNThreadId)
|
sl@0
|
627 |
&& (LE4(pCurrentRecord + 4 + extensionCount) >= (TUint32) addr)
|
sl@0
|
628 |
&& (LE4(pCurrentRecord + 4 + extensionCount) < ((TUint32) addr) + filesize))
|
sl@0
|
629 |
// If the DLL is paged in under this thread after it's been RLibrary::Load'ed, then we assume the DLL is paged
|
sl@0
|
630 |
{
|
sl@0
|
631 |
paged = ETrue;
|
sl@0
|
632 |
}
|
sl@0
|
633 |
pCurrentRecord = BTrace::NextRecord(pCurrentRecord); // move on to the next record
|
sl@0
|
634 |
}
|
sl@0
|
635 |
btrace.DataUsed();
|
sl@0
|
636 |
}
|
sl@0
|
637 |
|
sl@0
|
638 |
if (paged)
|
sl@0
|
639 |
test.Printf(_L("paged!\n"));
|
sl@0
|
640 |
else
|
sl@0
|
641 |
test.Printf(_L("not paged!\n"));
|
sl@0
|
642 |
|
sl@0
|
643 |
if (!gIsRomDemangPagingEnabled)
|
sl@0
|
644 |
// ROM paging disabled. All files are in ROM and unpaged
|
sl@0
|
645 |
{
|
sl@0
|
646 |
test.Printf(_L("ROM Paging disabled: shouldn't be paged\n"));
|
sl@0
|
647 |
test(inRom);
|
sl@0
|
648 |
TEST_CONDITION(!paged);
|
sl@0
|
649 |
}
|
sl@0
|
650 |
else if (testDllAttr[i] & EIBYData)
|
sl@0
|
651 |
// data - if ROM paged, then these executables will be moved to ROFS
|
sl@0
|
652 |
// these are always expected to be RAM loaded
|
sl@0
|
653 |
{
|
sl@0
|
654 |
test.Printf(_L("DLL is DATA in ROFS: shouldn't be paged\n"));
|
sl@0
|
655 |
TEST_CONDITION(!inRom);
|
sl@0
|
656 |
TEST_CONDITION(!paged);
|
sl@0
|
657 |
}
|
sl@0
|
658 |
else if (testDllAttr[i] & EIBYFileCompress)
|
sl@0
|
659 |
// Compression format specified in the IBY file
|
sl@0
|
660 |
// These are expected to be stay in ROM, but will be RAM-loaded
|
sl@0
|
661 |
{
|
sl@0
|
662 |
test.Printf(_L("DLL has own compression method: shouldn't be paged\n"));
|
sl@0
|
663 |
TEST_CONDITION(inRom);
|
sl@0
|
664 |
TEST_CONDITION(!paged);
|
sl@0
|
665 |
}
|
sl@0
|
666 |
// from this point onwards, all executables can potentially be paged - paging policy takes precedence
|
sl@0
|
667 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyNoPaging)
|
sl@0
|
668 |
{
|
sl@0
|
669 |
test.Printf(_L("Paging policy is No Paging: shouldn't be paged\n"));
|
sl@0
|
670 |
TEST_CONDITION(inRom);
|
sl@0
|
671 |
TEST_CONDITION(!paged);
|
sl@0
|
672 |
}
|
sl@0
|
673 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyAlwaysPage)
|
sl@0
|
674 |
{
|
sl@0
|
675 |
test.Printf(_L("Paging policy is Always Page: should be paged\n"));
|
sl@0
|
676 |
TEST_CONDITION(inRom);
|
sl@0
|
677 |
TEST_CONDITION(paged);
|
sl@0
|
678 |
}
|
sl@0
|
679 |
// from this point onwards, paging policy is either Default Paged or Default Unpaged - paging override takes precedence
|
sl@0
|
680 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyNoPaging)
|
sl@0
|
681 |
{
|
sl@0
|
682 |
test.Printf(_L("Paging override is No Paging: shouldn't be paged\n"));
|
sl@0
|
683 |
TEST_CONDITION(inRom);
|
sl@0
|
684 |
TEST_CONDITION(!paged);
|
sl@0
|
685 |
}
|
sl@0
|
686 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyAlwaysPage)
|
sl@0
|
687 |
{
|
sl@0
|
688 |
test.Printf(_L("Paging override is Always Page: should be paged\n"));
|
sl@0
|
689 |
TEST_CONDITION(inRom);
|
sl@0
|
690 |
TEST_CONDITION(paged);
|
sl@0
|
691 |
}
|
sl@0
|
692 |
// from this point onwards, paging policy and override are either Default Paged or Default Unpaged - IBY setting takes precedence
|
sl@0
|
693 |
else if (testDllAttr[i] & EIBYPaged)
|
sl@0
|
694 |
{
|
sl@0
|
695 |
test.Printf(_L("Paged keyword in OBY: should be paged\n"));
|
sl@0
|
696 |
TEST_CONDITION(inRom);
|
sl@0
|
697 |
TEST_CONDITION(paged);
|
sl@0
|
698 |
}
|
sl@0
|
699 |
else if (testDllAttr[i] & EIBYUnpaged)
|
sl@0
|
700 |
{
|
sl@0
|
701 |
test.Printf(_L("Unpaged keyword in OBY: shouldn't be paged\n"));
|
sl@0
|
702 |
TEST_CONDITION(inRom);
|
sl@0
|
703 |
TEST_CONDITION(!paged);
|
sl@0
|
704 |
}
|
sl@0
|
705 |
// Next, MMP setting takes precedence
|
sl@0
|
706 |
else if (testDllAttr[i] & EMMPPaged)
|
sl@0
|
707 |
{
|
sl@0
|
708 |
test.Printf(_L("Paged keyword in MMP: should be paged\n"));
|
sl@0
|
709 |
TEST_CONDITION(inRom);
|
sl@0
|
710 |
TEST_CONDITION(paged);
|
sl@0
|
711 |
}
|
sl@0
|
712 |
else if (testDllAttr[i] & EMMPUnpaged)
|
sl@0
|
713 |
{
|
sl@0
|
714 |
test.Printf(_L("Unpaged keyword in MMP: shouldn't be paged\n"));
|
sl@0
|
715 |
TEST_CONDITION(inRom);
|
sl@0
|
716 |
TEST_CONDITION(!paged);
|
sl@0
|
717 |
}
|
sl@0
|
718 |
// The test exe has no attribute. Paging overright default paging mode takes precedence
|
sl@0
|
719 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyDefaultUnpaged)
|
sl@0
|
720 |
{
|
sl@0
|
721 |
test.Printf(_L("Paging override is Default Unpaged: shouldn't be paged\n"));
|
sl@0
|
722 |
TEST_CONDITION(inRom);
|
sl@0
|
723 |
TEST_CONDITION(!paged);
|
sl@0
|
724 |
}
|
sl@0
|
725 |
else if (gPagingOverride == EKernelConfigCodePagingPolicyDefaultPaged)
|
sl@0
|
726 |
{
|
sl@0
|
727 |
test.Printf(_L("Paging override is Default Paged: should be paged\n"));
|
sl@0
|
728 |
TEST_CONDITION(inRom);
|
sl@0
|
729 |
TEST_CONDITION(paged);
|
sl@0
|
730 |
}
|
sl@0
|
731 |
// Paging policy default paging mode takes precedence
|
sl@0
|
732 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyDefaultUnpaged)
|
sl@0
|
733 |
{
|
sl@0
|
734 |
test.Printf(_L("Paging policy is Default Unpaged: shouldn't be paged\n"));
|
sl@0
|
735 |
TEST_CONDITION(inRom);
|
sl@0
|
736 |
TEST_CONDITION(!paged);
|
sl@0
|
737 |
}
|
sl@0
|
738 |
else if (gPagingPolicy == EKernelConfigCodePagingPolicyDefaultPaged)
|
sl@0
|
739 |
{
|
sl@0
|
740 |
test.Printf(_L("Paging policy is Default paged: should be paged\n"));
|
sl@0
|
741 |
TEST_CONDITION(inRom);
|
sl@0
|
742 |
TEST_CONDITION(paged);
|
sl@0
|
743 |
}
|
sl@0
|
744 |
// ROM Paging enabled without a default paging policy - this should not happen (default policy is No Paging)
|
sl@0
|
745 |
else
|
sl@0
|
746 |
{
|
sl@0
|
747 |
test.Printf(_L("No paging policy!\n"));
|
sl@0
|
748 |
test(EFalse);
|
sl@0
|
749 |
}
|
sl@0
|
750 |
}
|
sl@0
|
751 |
test(pass);
|
sl@0
|
752 |
}
|
sl@0
|
753 |
|
sl@0
|
754 |
GLDEF_C TInt E32Main()
|
sl@0
|
755 |
{
|
sl@0
|
756 |
TInt r;
|
sl@0
|
757 |
test.Title();
|
sl@0
|
758 |
test.Start(_L("Check environment"));
|
sl@0
|
759 |
|
sl@0
|
760 |
// Open the BTrace handler
|
sl@0
|
761 |
r = btrace.Open();
|
sl@0
|
762 |
TEST_EQ(r, KErrNone);
|
sl@0
|
763 |
|
sl@0
|
764 |
// capture the NThread ID of the main thread of the current process
|
sl@0
|
765 |
InitNThreadID();
|
sl@0
|
766 |
test(gNThreadId != 0);
|
sl@0
|
767 |
|
sl@0
|
768 |
gPagingPolicy = E32Loader::PagingPolicy();
|
sl@0
|
769 |
gPagingOverride = -1;
|
sl@0
|
770 |
|
sl@0
|
771 |
r = fs.Connect();
|
sl@0
|
772 |
TEST_EQ(r, KErrNone);
|
sl@0
|
773 |
|
sl@0
|
774 |
if (fs.IsFileInRom(_L("\\ovr_nopaging")) != NULL)
|
sl@0
|
775 |
{
|
sl@0
|
776 |
gPagingOverride = EKernelConfigCodePagingPolicyNoPaging;
|
sl@0
|
777 |
}
|
sl@0
|
778 |
if (fs.IsFileInRom(_L("\\ovr_alwayspage")) != NULL)
|
sl@0
|
779 |
{
|
sl@0
|
780 |
gPagingOverride = EKernelConfigCodePagingPolicyAlwaysPage;
|
sl@0
|
781 |
}
|
sl@0
|
782 |
if (fs.IsFileInRom(_L("\\ovr_defaultunpaged")) != NULL)
|
sl@0
|
783 |
{
|
sl@0
|
784 |
gPagingOverride = EKernelConfigCodePagingPolicyDefaultUnpaged;
|
sl@0
|
785 |
}
|
sl@0
|
786 |
if (fs.IsFileInRom(_L("\\ovr_defaultpaged")) != NULL)
|
sl@0
|
787 |
{
|
sl@0
|
788 |
gPagingOverride = EKernelConfigCodePagingPolicyDefaultPaged;
|
sl@0
|
789 |
}
|
sl@0
|
790 |
if (fs.IsFileInRom(_L("\\pcy_nopaging")) != NULL)
|
sl@0
|
791 |
{
|
sl@0
|
792 |
gPagingPolicy = EKernelConfigCodePagingPolicyNoPaging;
|
sl@0
|
793 |
}
|
sl@0
|
794 |
if (fs.IsFileInRom(_L("\\pcy_alwayspage")) != NULL)
|
sl@0
|
795 |
{
|
sl@0
|
796 |
gPagingPolicy = EKernelConfigCodePagingPolicyAlwaysPage;
|
sl@0
|
797 |
}
|
sl@0
|
798 |
if (fs.IsFileInRom(_L("\\pcy_defaultunpaged")) != NULL)
|
sl@0
|
799 |
{
|
sl@0
|
800 |
gPagingPolicy = EKernelConfigCodePagingPolicyDefaultUnpaged;
|
sl@0
|
801 |
}
|
sl@0
|
802 |
if (fs.IsFileInRom(_L("\\pcy_defaultpaged")) != NULL)
|
sl@0
|
803 |
{
|
sl@0
|
804 |
gPagingPolicy = EKernelConfigCodePagingPolicyDefaultPaged;
|
sl@0
|
805 |
}
|
sl@0
|
806 |
|
sl@0
|
807 |
gIsRomDemangPagingEnabled = (fs.IsFileInRom(_L("Z:\\SYS\\BIN\\DPEXE046.EXE")) == NULL);
|
sl@0
|
808 |
|
sl@0
|
809 |
test.Printf(_L("Demand Paging Enabled? %d\n"), gIsRomDemangPagingEnabled);
|
sl@0
|
810 |
test.Printf(_L("PagingOverride %d\n"), gPagingOverride);
|
sl@0
|
811 |
test.Printf(_L("PagingPolicy %d\n"), gPagingPolicy);
|
sl@0
|
812 |
|
sl@0
|
813 |
test.Next(_L("Load ROM EXEs"));
|
sl@0
|
814 |
LoadExesRom();
|
sl@0
|
815 |
test.Next(_L("Load ROM DLLs"));
|
sl@0
|
816 |
LoadDllsRom();
|
sl@0
|
817 |
|
sl@0
|
818 |
btrace.Close();
|
sl@0
|
819 |
fs.Close();
|
sl@0
|
820 |
test.End();
|
sl@0
|
821 |
test.Close();
|
sl@0
|
822 |
return KErrNone;
|
sl@0
|
823 |
}
|