15STATIC UNIT_TEST_FRAMEWORK_HANDLE mFrameworkHandle =
NULL;
17BASE_LIBRARY_JUMP_BUFFER gUnitTestJumpBuffer;
19UNIT_TEST_FRAMEWORK_HANDLE
20GetActiveFrameworkHandle (
24 return mFrameworkHandle;
38 return EFI_INVALID_PARAMETER;
44 DEBUG ((DEBUG_VERBOSE,
"---------------------------------------------------------\n"));
45 DEBUG ((DEBUG_VERBOSE,
"RUNNING TEST SUITE: %a\n", Suite->Title));
46 DEBUG ((DEBUG_VERBOSE,
"---------------------------------------------------------\n"));
48 if (Suite->Setup !=
NULL) {
56 (
LIST_ENTRY *)TestEntry != &(Suite->TestCaseList);
59 Test = &TestEntry->UT;
60 ParentFramework->CurrentTest =
Test;
62 DEBUG ((DEBUG_VERBOSE,
"*********************************************************\n"));
63 DEBUG ((DEBUG_VERBOSE,
" RUNNING TEST: %a:\n",
Test->Description));
64 DEBUG ((DEBUG_VERBOSE,
"**********************************************************\n"));
70 if ((
Test->Result != UNIT_TEST_PENDING) && (
Test->Result != UNIT_TEST_RUNNING)) {
71 DEBUG ((DEBUG_VERBOSE,
"Test was run on a previous pass. Skipping.\n"));
72 ParentFramework->CurrentTest =
NULL;
78 if ((
Test->Result == UNIT_TEST_PENDING) && (
Test->Prerequisite !=
NULL)) {
79 DEBUG ((DEBUG_VERBOSE,
"PREREQ\n"));
80 if (
SetJump (&gUnitTestJumpBuffer) == 0) {
81 if (
Test->Prerequisite (
Test->Context) != UNIT_TEST_PASSED) {
82 DEBUG ((DEBUG_ERROR,
"Prerequisite Not Met\n"));
83 Test->Result = UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
84 ParentFramework->CurrentTest =
NULL;
88 DEBUG ((DEBUG_ERROR,
"Prerequisite Not Met\n"));
89 Test->Result = UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
90 ParentFramework->CurrentTest =
NULL;
100 if (
SetJump (&gUnitTestJumpBuffer) == 0) {
101 Test->Result = UNIT_TEST_RUNNING;
104 Test->Result = UNIT_TEST_ERROR_TEST_FAILED;
110 DEBUG ((DEBUG_VERBOSE,
"CLEANUP\n"));
111 if (
SetJump (&gUnitTestJumpBuffer) == 0) {
119 ParentFramework->CurrentTest =
NULL;
122 if (Suite->Teardown !=
NULL) {
146 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
156 if (Framework ==
NULL) {
157 return EFI_INVALID_PARAMETER;
160 DEBUG ((DEBUG_VERBOSE,
"---------------------------------------------------------\n"));
161 DEBUG ((DEBUG_VERBOSE,
"------------ RUNNING ALL TEST SUITES --------------\n"));
162 DEBUG ((DEBUG_VERBOSE,
"---------------------------------------------------------\n"));
163 mFrameworkHandle = FrameworkHandle;
169 (
LIST_ENTRY *)Suite != &Framework->TestSuiteList;
172 Status = RunTestSuite (&(Suite->UTS));
173 if (EFI_ERROR (Status)) {
174 DEBUG ((DEBUG_ERROR,
"Test Suite Failed with Error. %r\n", Status));
184 mFrameworkHandle =
NULL;
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
RETURNS_TWICE UINTN EFIAPI SetJump(OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
#define DEBUG(Expression)
INTN EFIAPI Test(CONST VOID *b1, CONST VOID *b2)
EFI_STATUS EFIAPI SaveFrameworkState(IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL, IN UINTN ContextToSaveSize)
EFI_STATUS EFIAPI RunAllTestSuites(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
EFI_STATUS EFIAPI OutputUnitTestFrameworkReport(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)