|
1 // Copyright (c) 2007-2009 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 // f32test\demandpaging\t_ramstress.cpp |
|
15 // Following this, it requests that the driver continuously attempt |
|
16 // to move pages directly. |
|
17 // Platforms/Drives/Compatibility: |
|
18 // Hardware only. No defrag support on emulator. |
|
19 // |
|
20 // |
|
21 |
|
22 //! @SYMTestCaseID KBASE-t_ramstress-0606 |
|
23 //! @SYMTestType CT |
|
24 //! @SYMTestCaseDesc RAM Defrag background defrag stresser |
|
25 //! @SYMPREQ PREQ308 |
|
26 //! @SYMTestPriority High |
|
27 //! @SYMTestActions t_ramstress loads and opens the logical device driver ("D_RAMSTRESS"). |
|
28 //! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise |
|
29 //! @SYMTestPriority High |
|
30 //! @SYMTestStatus Implemented |
|
31 //------------------------------------------------------------------------------------------------- |
|
32 #include <e32test.h> |
|
33 #include <u32hal.h> |
|
34 #include <f32file.h> |
|
35 #include <hal.h> |
|
36 #include "t_ramstress.h" |
|
37 |
|
38 RTest test(_L("T_RAMSTRESS")); |
|
39 |
|
40 RRamStressTestLdd RamstressLdd; |
|
41 |
|
42 |
|
43 // |
|
44 // E32Main |
|
45 // |
|
46 // Main entry point. |
|
47 // |
|
48 |
|
49 TInt E32Main() |
|
50 { |
|
51 test.Title(); |
|
52 test.Start(_L("RAM Defrag background stress testing...")); |
|
53 |
|
54 TBuf<256> args; |
|
55 User::CommandLine(args); |
|
56 TLex lex(args); |
|
57 TPtrC token=lex.NextToken(); |
|
58 if (token.Length() != 0) |
|
59 { |
|
60 // exit immediately if we are run as part of autotest |
|
61 test.End(); |
|
62 return KErrNone; |
|
63 } |
|
64 |
|
65 TInt r = User::LoadLogicalDevice(KRamStressTestLddName); |
|
66 test(r==KErrNone || r==KErrAlreadyExists); |
|
67 test(RamstressLdd.Open()==KErrNone); |
|
68 |
|
69 TUint zoneCount = 0; |
|
70 TInt ret = UserSvr::HalFunction(EHalGroupRam,ERamHalGetZoneCount,&zoneCount,0); |
|
71 test(ret == KErrNone); |
|
72 test(zoneCount != 0); |
|
73 |
|
74 TUint index; |
|
75 TInt iters = 0; |
|
76 while (1) |
|
77 { |
|
78 for (index = 0; index < zoneCount; index ++) |
|
79 { |
|
80 RamstressLdd.DoMovePagesInZone(index); |
|
81 User::AfterHighRes(1000); |
|
82 } |
|
83 //## mDH make it run forever iters ++; |
|
84 if (iters > 1000000) |
|
85 { |
|
86 break; |
|
87 } |
|
88 } |
|
89 RamstressLdd.Close(); |
|
90 test.Next(_L("Ram Defrag : Done")); |
|
91 test.End(); |
|
92 return KErrNone; |
|
93 } |