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