at least the current execution count) which will be saved by the framework and\r
passed to the test case upon resume.\r
\r
- Generally called from within a test case prior to quitting or rebooting.\r
+ This should be called while the current test framework is valid and active. It is\r
+ generally called from within a test case prior to quitting or rebooting.\r
\r
- @param[in] FrameworkHandle A handle to the current running framework that\r
- dispatched the test. Necessary for recording\r
- certain test events with the framework.\r
@param[in] ContextToSave A buffer of test case-specific data to be saved\r
along with framework state. Will be passed as\r
"Context" to the test case upon resume. This\r
@param[in] ContextToSaveSize Size of the ContextToSave buffer.\r
\r
@retval EFI_SUCCESS The framework state and context were saved.\r
- @retval EFI_INVALID_PARAMETER FrameworkHandle is NULL.\r
+ @retval EFI_NOT_FOUND An active framework handle was not found.\r
@retval EFI_INVALID_PARAMETER ContextToSave is not NULL and\r
ContextToSaveSize is 0.\r
@retval EFI_INVALID_PARAMETER ContextToSave is >= 4GB.\r
EFI_STATUS\r
EFIAPI\r
SaveFrameworkState (\r
- IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,\r
IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL,\r
IN UINTN ContextToSaveSize\r
)\r
{\r
- EFI_STATUS Status;\r
- UNIT_TEST_SAVE_HEADER *Header;\r
+ EFI_STATUS Status;\r
+ UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle;\r
+ UNIT_TEST_SAVE_HEADER *Header;\r
\r
Header = NULL;\r
+ FrameworkHandle = GetActiveFrameworkHandle ();\r
+\r
+ //\r
+ // Return a unique error code if the framework is not set.\r
+ //\r
+ if (FrameworkHandle == NULL) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
\r
//\r
// First, let's not make assumptions about the parameters.\r
//\r
- if (FrameworkHandle == NULL ||\r
- (ContextToSave != NULL && ContextToSaveSize == 0) ||\r
+ if ((ContextToSave != NULL && ContextToSaveSize == 0) ||\r
ContextToSaveSize > MAX_UINT32) {\r
return EFI_INVALID_PARAMETER;\r
}\r