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 the License "Eclipse Public License v1.0" |
4 // under the terms of the License "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". |
27 #include <e32def.h> |
27 #include <e32def.h> |
28 #include <e32def_private.h> |
28 #include <e32def_private.h> |
29 #include "testcaseroot.h" |
29 #include "testcaseroot.h" |
30 #include "testcasecontroller.h" |
30 #include "testcasecontroller.h" |
31 #include "testengine.h" |
31 #include "testengine.h" |
|
32 #include "OstTraceDefinitions.h" |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "testcasecontrollerTraces.h" |
|
35 #endif |
32 |
36 |
33 |
37 |
34 |
38 |
35 |
39 |
36 CTestCaseController* CTestCaseController::NewL(CTestEngine& aTestEngine,TBool aHostRole) |
40 CTestCaseController* CTestCaseController::NewL(CTestEngine& aTestEngine,TBool aHostRole) |
91 TInt err(iStatus.Int()); |
95 TInt err(iStatus.Int()); |
92 |
96 |
93 if (err != KErrNone) |
97 if (err != KErrNone) |
94 { |
98 { |
95 test.Printf(_L("<Error> Test case %lS failed\n"),&iTestCaseId); |
99 test.Printf(_L("<Error> Test case %lS failed\n"),&iTestCaseId); |
|
100 OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL, "<Error> Test case %lS failed\n",iTestCaseId); |
96 } |
101 } |
97 else |
102 else |
98 { |
103 { |
99 test.Printf(_L("Test case %lS passed\n"),&iTestCaseId); |
104 test.Printf(_L("Test case %lS passed\n"),&iTestCaseId); |
|
105 OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP01, "Test case %lS passed\n",iTestCaseId); |
100 } |
106 } |
101 |
107 |
102 // Find next test to run |
108 // Find next test to run |
103 err = iTestEngine.NextTestCaseId(iTestCaseId); |
109 err = iTestEngine.NextTestCaseId(iTestCaseId); |
104 if (err == KErrNone) |
110 if (err == KErrNone) |
105 { |
111 { |
106 test.Printf(_L("\n")); // ensures blank line between tests |
112 test.Printf(_L("\n")); // ensures blank line between tests |
|
113 OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP02, "\n"); // ensures blank line between tests |
107 test.Printf(_L("\n")); |
114 test.Printf(_L("\n")); |
|
115 OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP03, "\n"); |
108 test.Next(iTestCaseId); |
116 test.Next(iTestCaseId); |
109 |
117 |
110 // run the next test here |
118 // run the next test here |
111 iTestPolicy->RunTestCaseL(iTestCaseId, &iStatus); |
119 iTestPolicy->RunTestCaseL(iTestCaseId, &iStatus); |
112 SetActive(); |
120 SetActive(); |
113 } |
121 } |
114 else if (err == KErrNotFound) |
122 else if (err == KErrNotFound) |
115 { |
123 { |
116 RDebug::Printf("All specified test cases performed"); |
124 OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP04, "All specified test cases performed"); |
117 CActiveScheduler::Stop(); |
125 CActiveScheduler::Stop(); |
118 } |
126 } |
119 else |
127 else |
120 { |
128 { |
121 RDebug::Printf("<Error %d> Unknown error from CTestEngine::NextTestCaseId",err); |
129 OstTrace1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP05, "<Error %d> Unknown error from CTestEngine::NextTestCaseId",err); |
122 User::Leave(err); |
130 User::Leave(err); |
123 } |
131 } |
124 } |
132 } |
125 |
133 |
126 |
134 |
127 TInt CTestCaseController::RunError(TInt aError) |
135 TInt CTestCaseController::RunError(TInt aError) |
128 { |
136 { |
129 LOG_FUNC |
137 if(gVerboseOutput) |
|
138 { |
|
139 OstTraceFunctionEntry0(CTESTCASECONTROLLER_RUNERROR); |
|
140 } |
130 switch (aError) |
141 switch (aError) |
131 { |
142 { |
132 case KErrNoMemory: |
143 case KErrNoMemory: |
133 default: |
144 default: |
134 // Panic the test module |
145 // Panic the test module |