summaryrefslogtreecommitdiffstats
path: root/UnitTestFrameworkPkg
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2020-04-16 16:47:18 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-06-14 23:56:05 +0000
commitb90beadfae8f1153697fbb87f923cfa14578ee3e (patch)
treea8bd4c82fe6d8f925d8bdea186113cd45936d248 /UnitTestFrameworkPkg
parent4260c478671537e2122ed6c5485a188c2f0449f9 (diff)
downloadedk2-b90beadfae8f1153697fbb87f923cfa14578ee3e.tar.gz
edk2-b90beadfae8f1153697fbb87f923cfa14578ee3e.tar.bz2
edk2-b90beadfae8f1153697fbb87f923cfa14578ee3e.zip
UnitTestFrameworkPkg/UnitTestLib: Update SaveFrameworkState() signature
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2612 Removes the FrameworkHandle parameter from SaveFrameworkState() in the UnitTestLib library instance and updates callers of the function in the library to use the new function signature. Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'UnitTestFrameworkPkg')
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c2
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c25
2 files changed, 16 insertions, 11 deletions
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
index b053e04959..793335fd0f 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
@@ -162,7 +162,7 @@ RunAllTestSuites (
//
// Save current state so if test is started again it doesn't have to run. It will just report
//
- SaveFrameworkState (FrameworkHandle, NULL, 0);
+ SaveFrameworkState (NULL, 0);
OutputUnitTestFrameworkReport (FrameworkHandle);
mFrameworkHandle = NULL;
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
index ba4b18568d..4a6bbd752c 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
@@ -781,11 +781,9 @@ SerializeState (
at least the current execution count) which will be saved by the framework and
passed to the test case upon resume.
- Generally called from within a test case prior to quitting or rebooting.
+ This should be called while the current test framework is valid and active. It is
+ generally called from within a test case prior to quitting or rebooting.
- @param[in] FrameworkHandle A handle to the current running framework that
- dispatched the test. Necessary for recording
- certain test events with the framework.
@param[in] ContextToSave A buffer of test case-specific data to be saved
along with framework state. Will be passed as
"Context" to the test case upon resume. This
@@ -793,7 +791,7 @@ SerializeState (
@param[in] ContextToSaveSize Size of the ContextToSave buffer.
@retval EFI_SUCCESS The framework state and context were saved.
- @retval EFI_INVALID_PARAMETER FrameworkHandle is NULL.
+ @retval EFI_NOT_FOUND An active framework handle was not found.
@retval EFI_INVALID_PARAMETER ContextToSave is not NULL and
ContextToSaveSize is 0.
@retval EFI_INVALID_PARAMETER ContextToSave is >= 4GB.
@@ -806,21 +804,28 @@ SerializeState (
EFI_STATUS
EFIAPI
SaveFrameworkState (
- IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL,
IN UINTN ContextToSaveSize
)
{
- EFI_STATUS Status;
- UNIT_TEST_SAVE_HEADER *Header;
+ EFI_STATUS Status;
+ UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle;
+ UNIT_TEST_SAVE_HEADER *Header;
Header = NULL;
+ FrameworkHandle = GetActiveFrameworkHandle ();
+
+ //
+ // Return a unique error code if the framework is not set.
+ //
+ if (FrameworkHandle == NULL) {
+ return EFI_NOT_FOUND;
+ }
//
// First, let's not make assumptions about the parameters.
//
- if (FrameworkHandle == NULL ||
- (ContextToSave != NULL && ContextToSaveSize == 0) ||
+ if ((ContextToSave != NULL && ContextToSaveSize == 0) ||
ContextToSaveSize > MAX_UINT32) {
return EFI_INVALID_PARAMETER;
}