Skip to content

Add IPC tests for using an allocation after umfCloseIPCHandle() #840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Oct 25, 2024

Description

Add IPC tests for using an allocation after umfCloseIPCHandle().
Test if umfPoolMalloc() returns a usable pointer after umfCloseIPCHandle().

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly

@ldorau ldorau requested a review from a team as a code owner October 25, 2024 10:42
@ldorau ldorau force-pushed the Add_IPC_tests_for_umfPoolMalloc_after_umfCloseIPCHandle branch from ad0aa59 to c4a3db9 Compare October 25, 2024 13:45
@ldorau
Copy link
Contributor Author

ldorau commented Oct 25, 2024

Rebased

@ldorau ldorau force-pushed the Add_IPC_tests_for_umfPoolMalloc_after_umfCloseIPCHandle branch from c4a3db9 to ac0f5bd Compare October 28, 2024 10:39
@ldorau ldorau force-pushed the Add_IPC_tests_for_umfPoolMalloc_after_umfCloseIPCHandle branch from ac0f5bd to 30d0ea1 Compare October 29, 2024 08:43
@ldorau ldorau requested a review from vinser52 October 29, 2024 13:53
@ldorau ldorau force-pushed the Add_IPC_tests_for_umfPoolMalloc_after_umfCloseIPCHandle branch from 30d0ea1 to ebe4ac6 Compare October 30, 2024 10:55
@@ -328,8 +340,19 @@ TEST_P(umfIpcTest, AllocFreeAllocTest) {
ret = umfPoolFree(pool.get(), ptr);
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);

// Test if umfCloseIPCHandle() did not corrupt the pool
// and if umfPoolMalloc() works correctly after umfCloseIPCHandle().
ptr = umfPoolMalloc(pool.get(), SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But L325 already calls umfPoolMalloc after the umfCloseIPCHandle function. Why we need to check it again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Changed to test for using an allocation after umfCloseIPCHandle().

Comment on lines 223 to 234
// Test if umfCloseIPCHandle() did not corrupt the pool
// and if umfPoolMalloc() works correctly after umfCloseIPCHandle().
ptr = (int *)umfPoolMalloc(pool.get(), SIZE);
EXPECT_NE(ptr, nullptr);

// use the allocated memory - fill it with a 0xAB pattern
const uint32_t pattern = 0xAB;
memAccessor->fill(ptr, SIZE, &pattern, sizeof(pattern));

ret = umfPoolFree(pool.get(), ptr);
EXPECT_EQ(ret, UMF_RESULT_SUCCESS);

Copy link
Contributor

@vinser52 vinser52 Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a duplication. The AllocFreeAllocTest tests the same scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@ldorau ldorau changed the title Add IPC tests for umfPoolMalloc() after umfCloseIPCHandle() Add IPC tests for using an allocation after umfCloseIPCHandle() Oct 30, 2024
Add IPC tests for using an allocation after umfCloseIPCHandle().
Test if umfPoolMalloc() returns a usable pointer
after umfCloseIPCHandle().

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Add_IPC_tests_for_umfPoolMalloc_after_umfCloseIPCHandle branch from ebe4ac6 to 65e988a Compare October 30, 2024 13:45
@ldorau ldorau requested a review from vinser52 October 30, 2024 13:46
@ldorau ldorau merged commit 64ee85b into oneapi-src:main Oct 30, 2024
81 of 82 checks passed
@ldorau ldorau deleted the Add_IPC_tests_for_umfPoolMalloc_after_umfCloseIPCHandle branch October 31, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants