mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 08:04:07 +02:00
UnitTestFrameworkPkg/UnitTestLib: Implement Free*() services
Implement FreeUnitTestEntry(), FreeUnitTestSuiteEntry(), and FreeUnitTestFramework() so the UnitTestLib does not introduce any memory leaks. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
parent
182dbe79a0
commit
30b10dcdd0
@ -131,6 +131,59 @@ CompareFingerprints (
|
|||||||
return (CompareMem (FingerprintA, FingerprintB, UNIT_TEST_FINGERPRINT_SIZE) == 0);
|
return (CompareMem (FingerprintA, FingerprintB, UNIT_TEST_FINGERPRINT_SIZE) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
VOID
|
||||||
|
FreeUnitTestTestEntry (
|
||||||
|
IN UNIT_TEST_LIST_ENTRY *TestEntry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (TestEntry) {
|
||||||
|
if (TestEntry->UT.Description) {
|
||||||
|
FreePool (TestEntry->UT.Description);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TestEntry->UT.Name) {
|
||||||
|
FreePool (TestEntry->UT.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (TestEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
FreeUnitTestSuiteEntry (
|
||||||
|
IN UNIT_TEST_SUITE_LIST_ENTRY *SuiteEntry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UNIT_TEST_LIST_ENTRY *TestCase;
|
||||||
|
UNIT_TEST_LIST_ENTRY *NextTestCase;
|
||||||
|
LIST_ENTRY *TestCaseList;
|
||||||
|
|
||||||
|
if (SuiteEntry) {
|
||||||
|
TestCaseList = &(SuiteEntry->UTS.TestCaseList);
|
||||||
|
TestCase = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (TestCaseList);
|
||||||
|
while (&TestCase->Entry != TestCaseList) {
|
||||||
|
NextTestCase = (UNIT_TEST_LIST_ENTRY *)GetNextNode (TestCaseList, &TestCase->Entry);
|
||||||
|
RemoveEntryList (&TestCase->Entry);
|
||||||
|
FreeUnitTestTestEntry (TestCase);
|
||||||
|
TestCase = NextTestCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SuiteEntry->UTS.Title) {
|
||||||
|
FreePool (SuiteEntry->UTS.Title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SuiteEntry->UTS.Name) {
|
||||||
|
FreePool (SuiteEntry->UTS.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (SuiteEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cleanup a test framework.
|
Cleanup a test framework.
|
||||||
|
|
||||||
@ -151,27 +204,35 @@ FreeUnitTestFramework (
|
|||||||
IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
|
IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// TODO: Finish this function.
|
UNIT_TEST_FRAMEWORK *Framework;
|
||||||
return EFI_SUCCESS;
|
UNIT_TEST_SUITE_LIST_ENTRY *Suite;
|
||||||
}
|
UNIT_TEST_SUITE_LIST_ENTRY *NextSuite;
|
||||||
|
|
||||||
STATIC
|
Framework = (UNIT_TEST_FRAMEWORK *)FrameworkHandle;
|
||||||
EFI_STATUS
|
if (Framework) {
|
||||||
FreeUnitTestSuiteEntry (
|
Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
|
||||||
IN UNIT_TEST_SUITE_LIST_ENTRY *SuiteEntry
|
while ((LIST_ENTRY *)Suite != &Framework->TestSuiteList) {
|
||||||
)
|
NextSuite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite);
|
||||||
{
|
RemoveEntryList ((LIST_ENTRY *)Suite);
|
||||||
// TODO: Finish this function.
|
FreeUnitTestSuiteEntry (Suite);
|
||||||
return EFI_SUCCESS;
|
Suite = NextSuite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Framework->Title) {
|
||||||
|
FreePool (Framework->Title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Framework->ShortTitle) {
|
||||||
|
FreePool (Framework->ShortTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Framework->VersionString) {
|
||||||
|
FreePool (Framework->VersionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (Framework);
|
||||||
|
}
|
||||||
|
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
|
||||||
FreeUnitTestTestEntry (
|
|
||||||
IN UNIT_TEST_LIST_ENTRY *TestEntry
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// TODO: Finish this function.
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user