36 { UNIT_TEST_PASSED,
"PASSED" },
37 { UNIT_TEST_ERROR_PREREQUISITE_NOT_MET,
"NOT RUN - PREREQUISITE FAILED" },
38 { UNIT_TEST_ERROR_TEST_FAILED,
"FAILED" },
39 { UNIT_TEST_RUNNING,
"RUNNING" },
40 { UNIT_TEST_PENDING,
"PENDING" },
45 { FAILURETYPE_NOFAILURE,
"NO FAILURE" },
46 { FAILURETYPE_OTHER,
"OTHER FAILURE" },
47 { FAILURETYPE_ASSERTTRUE,
"ASSERT_TRUE FAILURE" },
48 { FAILURETYPE_ASSERTFALSE,
"ASSERT_FALSE FAILURE" },
49 { FAILURETYPE_ASSERTEQUAL,
"ASSERT_EQUAL FAILURE" },
50 { FAILURETYPE_ASSERTNOTEQUAL,
"ASSERT_NOTEQUAL FAILURE" },
51 { FAILURETYPE_ASSERTNOTEFIERROR,
"ASSERT_NOTEFIERROR FAILURE" },
52 { FAILURETYPE_ASSERTSTATUSEQUAL,
"ASSERT_STATUSEQUAL FAILURE" },
53 { FAILURETYPE_ASSERTNOTNULL,
"ASSERT_NOTNULL FAILURE" },
54 { FAILURETYPE_EXPECTASSERT,
"EXPECT_ASSERT FAILURE" },
55 { 0,
"*UNKNOWN* Failure" }
64GetStringForUnitTestStatus (
70 for (Index = 0; Index <
ARRAY_SIZE (mStatusStrings) - 1; Index++) {
71 if (mStatusStrings[Index].Status == Status) {
75 return mStatusStrings[Index].String;
82 return mStatusStrings[Index].String;
87GetStringForFailureType (
93 for (Index = 0; Index <
ARRAY_SIZE (mFailureTypeStrings) - 1; Index++) {
94 if (mFailureTypeStrings[Index].Type == Failure) {
98 return mFailureTypeStrings[Index].String;
105 DEBUG ((DEBUG_INFO,
"%a Failure Type does not have string defined 0x%X\n", __func__, (UINT32)Failure));
106 return mFailureTypeStrings[Index].String;
117 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
136 if (Framework ==
NULL) {
137 return EFI_INVALID_PARAMETER;
140 ReportPrint (
"---------------------------------------------------------\n");
141 ReportPrint (
"------------- UNIT TEST FRAMEWORK RESULTS ---------------\n");
142 ReportPrint (
"---------------------------------------------------------\n");
150 (
LIST_ENTRY *)Suite != &Framework->TestSuiteList;
158 ReportPrint (
"/////////////////////////////////////////////////////////\n");
159 ReportPrint (
" SUITE: %a\n", Suite->UTS.Title);
160 ReportPrint (
" PACKAGE: %a\n", Suite->UTS.Name);
161 ReportPrint (
"/////////////////////////////////////////////////////////\n");
170 ReportPrint (
"*********************************************************\n");
171 ReportPrint (
" CLASS NAME: %a\n",
Test->UT.Name);
172 ReportPrint (
" TEST: %a\n",
Test->UT.Description);
173 ReportPrint (
" STATUS: %a\n", GetStringForUnitTestStatus (
Test->UT.Result));
174 ReportPrint (
" FAILURE: %a\n", GetStringForFailureType (
Test->UT.FailureType));
175 ReportPrint (
" FAILURE MESSAGE:\n%a\n",
Test->UT.FailureMessage);
178 ReportPrint (
" LOG:\n");
179 ReportOutput (
Test->UT.Log);
182 switch (
Test->UT.Result) {
183 case UNIT_TEST_PASSED:
186 case UNIT_TEST_ERROR_TEST_FAILED:
189 case UNIT_TEST_PENDING:
190 case UNIT_TEST_RUNNING:
191 case UNIT_TEST_ERROR_PREREQUISITE_NOT_MET:
198 ReportPrint (
"**********************************************************\n");
201 ReportPrint (
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
202 ReportPrint (
"Suite Stats\n");
203 ReportPrint (
" Passed: %d (%d%%)\n", SPassed, (SPassed * 100)/(SPassed+SFailed+SNotRun));
204 ReportPrint (
" Failed: %d (%d%%)\n", SFailed, (SFailed * 100) / (SPassed + SFailed + SNotRun));
205 ReportPrint (
" Not Run: %d (%d%%)\n", SNotRun, (SNotRun * 100) / (SPassed + SFailed + SNotRun));
206 ReportPrint (
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
213 ReportPrint (
"=========================================================\n");
214 ReportPrint (
"Total Stats\n");
215 ReportPrint (
" Passed: %d (%d%%)\n", Passed, (Passed * 100) / (Passed + Failed + NotRun));
216 ReportPrint (
" Failed: %d (%d%%)\n", Failed, (Failed * 100) / (Passed + Failed + NotRun));
217 ReportPrint (
" Not Run: %d (%d%%)\n", NotRun, (NotRun * 100) / (Passed + Failed + NotRun));
218 ReportPrint (
"=========================================================\n");
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
#define ARRAY_SIZE(Array)
#define DEBUG(Expression)
INTN EFIAPI Test(CONST VOID *b1, CONST VOID *b2)
EFI_STATUS EFIAPI OutputUnitTestFrameworkReport(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)