SWDEV-485763 - Fix memory leaks in various unit tests

Fix memory leaks by adding missing destroy calls for
events, streams, and graphs at the end of tests.

Ensure that every test case executes destroy calls,
regardless of whether it passes or fails.

Change-Id: I814e35c528d90ed2abb34d77377f1a7fd3f1f11c
This commit is contained in:
Marko Arandjelovic committed 2024-12-10 10:25:08 -05:00
1 parent 7bb49582db
commit 9cffda4ebb
33 files changed
+142 -38

No files matched your search

+5 -1
View File
@@ -56,6 +56,7 @@ TEST_CASE("Unit_hipGraph_BasicCyclic1") {
HIP_CHECK(hipStreamCreate(&streamForGraph));
REQUIRE(hipErrorInvalidValue == hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
HIP_CHECK(hipStreamDestroy(streamForGraph));
HIP_CHECK(hipGraphDestroy(graph));
}
/**
@@ -83,13 +84,15 @@ TEST_CASE("Unit_hipGraph_BasicCyclic2") {
HIP_CHECK(hipGraphRemoveDependencies(graph, &emptyNode3, &emptyNode1, 1));
HIP_CHECK(hipStreamCreate(&streamForGraph));
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
HIP_CHECK(hipGraphExecDestroy(graphExec));
HIP_CHECK(hipGraphDestroy(graph));
HIP_CHECK(hipStreamDestroy(streamForGraph));
}
/**
* Tests basic functionality of cycle detection in hipGraph APIs by
* Adding manual empty nodes
* Cyclic graph, cycle formation first, Remove edge causes disconnected graph which is still
* Cyclic graph, cycle formation first, Remove edge causes disconnected graph which is still
* cyclic
*/
TEST_CASE("Unit_hipGraph_BasicCyclic3") {
@@ -115,6 +118,7 @@ TEST_CASE("Unit_hipGraph_BasicCyclic3") {
HIP_CHECK(hipStreamCreate(&streamForGraph));
REQUIRE(hipErrorInvalidValue == hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
HIP_CHECK(hipStreamDestroy(streamForGraph));
HIP_CHECK(hipGraphDestroy(graph));
}
/**