|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32test\misc\testexclusions.h |
|
15 // Gets the test exclusion property which is set by reading a file provided by base port and |
|
16 // based on this property some tests can be excluded |
|
17 // |
|
18 // |
|
19 |
|
20 #ifndef __TESTEXCLUSIONS_H__ |
|
21 #define __TESTEXCLUSIONS_H__ |
|
22 |
|
23 #include <e32svr.h> |
|
24 #include <u32hal.h> |
|
25 #include <e32property.h> |
|
26 #include <e32uid.h> |
|
27 #include <f32file.h> |
|
28 |
|
29 _LIT(KLitPlatformTestExclusionFile, "Z:\\sys\\data\\platformtestexclusion.txt"); |
|
30 |
|
31 // Bit masks to disable different tests |
|
32 |
|
33 // To disable invoking PowerController::PowerDown |
|
34 const TUint KDisableControllerShutdown = 0x1; |
|
35 |
|
36 TInt GetExclusionFromFile(TUint& aTestExclusion) |
|
37 { |
|
38 RFs theFs; |
|
39 TInt r = KErrNone; |
|
40 r = theFs.Connect(); |
|
41 if (r != KErrNone) |
|
42 return r; |
|
43 |
|
44 RFile file; |
|
45 TFileName filename(KLitPlatformTestExclusionFile); |
|
46 r = file.Open(theFs, filename, EFileRead); |
|
47 if (r == KErrNone) |
|
48 { |
|
49 TBuf8<8> data; |
|
50 file.Read(data); |
|
51 TLex8 lexData(data); |
|
52 r = lexData.Val(aTestExclusion, EHex); |
|
53 file.Close(); |
|
54 } |
|
55 |
|
56 theFs.Close(); |
|
57 return r; |
|
58 } |
|
59 |
|
60 |
|
61 TInt GetTestExclusionSettings(TInt& aTestExclusion) |
|
62 { |
|
63 TInt r = RProperty::Get(KUidSystemCategory, KPlatformTestExclusionKey, aTestExclusion); |
|
64 if (r != KErrNotFound) |
|
65 return r; |
|
66 |
|
67 _LIT_SECURITY_POLICY_PASS(KTestPropPolicy); |
|
68 r = RProperty::Define(KUidSystemCategory, KPlatformTestExclusionKey, RProperty::EInt, KTestPropPolicy, KTestPropPolicy); |
|
69 if (r != KErrNone) |
|
70 return r; |
|
71 |
|
72 |
|
73 TUint testExclusion = 0; |
|
74 r = GetExclusionFromFile(testExclusion); |
|
75 if ((r != KErrNotFound) && (r != KErrNone)) // All platforms need not have test exclusions file defined |
|
76 return r; |
|
77 |
|
78 aTestExclusion = testExclusion; |
|
79 r = RProperty::Set(KUidSystemCategory, KPlatformTestExclusionKey, testExclusion); |
|
80 return r; |
|
81 } |
|
82 |
|
83 #endif // __TESTEXCLUSIONS_H__ |
|
84 |