Update contrib.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Bootstrap Shadow Memory Region Test Application
17 #define __E32TEST_EXTENSION__
25 #define __TRACE_LINE__() test.Printf(_L("%d\n"),__LINE__)
27 RTest test(_L("T_SMR"));
32 //---------------------------------------------
39 //! @SYMTestExpectedResults
43 //---------------------------------------------
44 TInt TestSMRIBPtr (TBool aEnforce)
46 /* These tests assume that the Core Loader does not load and user data areas
47 * as they are too large (>8Mb). Leaving the SMRIB undefined (==0) on NE1 and
51 /* Print out the SMRIB Pointer in the Super Page.
52 * When enforce, zero entries will lead to a test failure.
54 test.Next(_L("SMR Test: Test_CheckSMRIBPtr"));
55 test.Printf(_L("\n"));
56 test_KErrNone( SMRTest.Test_CheckSMRIBPtr(aEnforce));
61 TInt TestSMRAccess (TBool aEnforce)
63 /* These tests assume that the Core Loader has been modified to treat the
64 * user data partitions as SMR partitions and load them into SMR memory area
65 * and updated teh SMRIB. Two SMRs are expected, each of 4Mb in size.
69 /* Print out the SMRIB in the Super Page.
70 * When enforce, zero entries will lead to a test failure.
72 test.Next(_L("SMR Test: Test_PrintSMRIB"));
73 test.Printf(_L("\n"));
74 test_KErrNone( SMRTest.Test_PrintSMRIB(aEnforce));
76 /* Print out the SMRIB and access and dump 1Kb of memory in each SMR.
77 * When enforce, zero SMR entries will lead to a test failure.
79 test.Next(_L("SMR Test: Test_AccessAllSMRs"));
80 test.Printf(_L("\n"));
81 test_KErrNone( SMRTest.Test_AccessAllSMRs(aEnforce));
83 /* Print out the SMRIB in the Super Page.
84 * When enforce, zero entries will lead to a test failure.
91 TInt TestSMRAccessAndRAMFree (TBool aEnforce)
93 /* These tests assume that the Core Loader has been modified to treat the
94 * user data partitions as SMR partitions and load them into SMR memory area
95 * and updated teh SMRIB. Two SMRs are expected, each of 4Mb in size.
99 /* Print out the SMRIB in the Super Page.
100 * When enforce, zero entries will lead to a test failure.
102 test.Next(_L("SMR Test: Test_PrintSMRIB"));
103 test.Printf(_L("\n"));
104 test_KErrNone( SMRTest.Test_PrintSMRIB(aEnforce));
106 /* Print out the SMRIB and access and dump 1Kb of memory in each SMR.
107 * When enforce, zero SMR entries will lead to a test failure.
109 test.Next(_L("SMR Test: Test_AccessAllSMRs"));
110 test.Printf(_L("\n"));
111 test_KErrNone( SMRTest.Test_AccessAllSMRs(aEnforce));
113 /* Print out the SMRIB in the Super Page.
114 * When enforce, zero entries will lead to a test failure.
116 test.Next(_L("SMR Test: Test_FreeHalfSMR1PhysicalRam"));
117 test.Printf(_L("\n"));
118 test_KErrNone( SMRTest.Test_FreeHalfSMR1PhysicalRam(aEnforce));
120 /* Print out the SMRIB in the Super Page.
121 * When enforce, zero entries will lead to a test failure.
123 test.Next(_L("SMR Test: Test_FreeAllSMR2PhysicalRam"));
124 test.Printf(_L("\n"));
125 test_KErrNone( SMRTest.Test_FreeAllSMR2PhysicalRam(aEnforce));
129 /* Print out the SMRIB in the Super Page to see how it has been modified.
130 * When enforce, zero entries will lead to a test failure.
132 test.Next(_L("SMR Test: Test_PrintSMRIB"));
133 test.Printf(_L("\n"));
134 test_KErrNone( SMRTest.Test_PrintSMRIB(aEnforce));
140 GLDEF_C TInt E32Main()
145 TBool enforce = EFalse;
146 TBool getch = EFalse;
151 test.Start(_L("=== SMR Test Suite"));
153 arglen = User::CommandLineLength();
156 /** Process command arguments */
157 test_Compare(arglen,<,256);
158 User::CommandLine(args);
160 test.Printf(_L("Arguments: %S\n"), &args);
162 if (args.Find(_L("-1")) >= 0)
164 if (args.Find(_L("-2")) >= 0)
166 if (args.Find(_L("-3")) >= 0)
168 if (args.Find(_L("-4")) >= 0)
171 if (args.Find(_L("-e")) >= 0)
174 if (args.Find(_L("-g")) >= 0)
177 if (args.Find(_L("-h")) >= 0)
179 test.Printf(_L("usage: t_smr [-1|-2|-3|-4] [-e] [-h] [-g]\n"));
185 r = HAL::Get(HAL::EMachineUid, muid);
187 if ((muid != HALData::EMachineUid_NE1_TB) && (testcase != 1))
189 test.Printf (_L("Testing skipped as test only applies to NaviEngine platform\n"));
193 test.Next(_L("=== Open test LDD"));
194 r = User::LoadLogicalDevice(RSMRTest::Name());
195 test_Assert((r==KErrNone || r==KErrAlreadyExists),void (0));
205 TestSMRAccess(enforce);
207 else if (testcase == 2)
209 TestSMRAccessAndRAMFree(enforce);
211 else if (testcase == 3)
213 TestSMRIBPtr(enforce);
215 else if (testcase == 4)
217 TestSMRIBPtr(enforce);
221 test.Printf (_L("Just open and closing test driver, no test case argument supplied."));
224 test.Next(_L("=== Close LDD"));
227 r = User::FreeLogicalDevice(RSMRTest::Name());
235 test.Printf(_L("Press any key to continue...\n"));