equal
deleted
inserted
replaced
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 */ |
20 */ |
21 |
21 |
22 #include "sysmontesthelper.h" |
22 #include "sysmontesthelper.h" |
23 #include <f32file.h> |
23 #include <f32file.h> |
24 #include <s32file.h> |
24 #include <s32file.h> |
|
25 #include <e32property.h> |
25 |
26 |
26 _LIT(KEIgnoreOnFailure, "EIgnoreOnFailure"); |
27 _LIT(KEIgnoreOnFailure, "EIgnoreOnFailure"); |
27 _LIT(KERestartOS, "ERestartOS"); |
28 _LIT(KERestartOS, "ERestartOS"); |
28 _LIT(KERestartOSWithMode, "ERestartOSWithMode"); |
29 _LIT(KERestartOSWithMode, "ERestartOSWithMode"); |
29 _LIT(KECriticalNoRetriesMode, "ECriticalNoRetries"); |
30 _LIT(KECriticalNoRetriesMode, "ECriticalNoRetries"); |
133 { |
134 { |
134 TBuf<KMaxFileName> fileName; |
135 TBuf<KMaxFileName> fileName; |
135 fileName.Append(KResultsRoot); |
136 fileName.Append(KResultsRoot); |
136 fileName.Append(aTestId); |
137 fileName.Append(aTestId); |
137 |
138 |
|
139 RDebug::Print(_L("Checking in file: %S"), &fileName); |
138 RFs fs; |
140 RFs fs; |
139 User::LeaveIfError(fs.Connect()); |
141 User::LeaveIfError(fs.Connect()); |
140 CleanupClosePushL(fs); |
142 CleanupClosePushL(fs); |
141 |
143 |
142 RFileReadStream file; |
144 RFileReadStream file; |
178 |
180 |
179 TBuf<KMaxFileName> fileName; |
181 TBuf<KMaxFileName> fileName; |
180 fileName.Append(KRunCountsRoot); |
182 fileName.Append(KRunCountsRoot); |
181 fileName.Append(parse.NameAndExt()); |
183 fileName.Append(parse.NameAndExt()); |
182 fileName.Append(KTxtExtension); |
184 fileName.Append(KTxtExtension); |
|
185 RDebug::Print(_L("Checking in file: %S"), &fileName); |
183 |
186 |
184 RFileReadStream file; |
187 RFileReadStream file; |
185 TInt err = 0; |
188 TInt err = 0; |
186 err = file.Open(fs, fileName, EFileRead); |
189 err = file.Open(fs, fileName, EFileRead); |
187 TInt result = 0; |
190 TInt result = 0; |
262 CleanupStack::PopAndDestroy(2, &fs); |
265 CleanupStack::PopAndDestroy(2, &fs); |
263 } |
266 } |
264 return result; |
267 return result; |
265 } |
268 } |
266 |
269 |
267 EXPORT_C TInt CSysMonTestHelper::GetRegisterCountL() |
270 EXPORT_C TInt CSysMonTestHelper::GetRegisterCount(TInt aKey) |
268 { |
271 { |
269 RFs fs; |
|
270 User::LeaveIfError(fs.Connect()); |
|
271 CleanupClosePushL(fs); |
|
272 |
|
273 RFile file; |
|
274 TInt err = 0; |
|
275 err = file.Open(fs, KRegisterCountFile, EFileRead); |
|
276 TInt result = 0; |
272 TInt result = 0; |
277 if (err == KErrNotFound || err == KErrPathNotFound) |
273 TInt error = RProperty::Get(KTestSysMon, aKey, result); |
278 { |
274 RDebug::Printf("RProperty::Get() with key %d returned with %d", aKey, error); |
279 CleanupStack::PopAndDestroy(&fs); |
|
280 } |
|
281 else |
|
282 { |
|
283 CleanupClosePushL(file); |
|
284 User::LeaveIfError(err); |
|
285 TBuf8<11> content; |
|
286 file.Read(content); |
|
287 content.Delete(0,9); |
|
288 TLex8 myLex(content); |
|
289 User::LeaveIfError(myLex.Val(result)); |
|
290 file.Close(); |
|
291 CleanupStack::PopAndDestroy(2, &fs); |
|
292 } |
|
293 return result; |
275 return result; |
294 } |
276 } |
295 |
277 |
296 EXPORT_C void CSysMonTestHelper::GetTestId(TDes& aTestId) |
278 EXPORT_C void CSysMonTestHelper::GetTestId(TDes& aTestId) |
297 { |
279 { |