Test that the file handle count doesn't change after installing a bundle. Installing a bundle should not hold the file open.
| 94 | // Test that the file handle count doesn't change after installing a bundle. |
| 95 | // Installing a bundle should not hold the file open. |
| 96 | TEST(OpenFileHandleTest, InstallBundle) |
| 97 | { |
| 98 | auto f = FrameworkFactory().NewFramework(); |
| 99 | ASSERT_TRUE(f); |
| 100 | f.Start(); |
| 101 | |
| 102 | auto handleCountBefore = GetHandleCountForCurrentProcess(); |
| 103 | |
| 104 | #if defined(US_BUILD_SHARED_LIBS) |
| 105 | auto bundle = cppmicroservices::testing::InstallLib(f.GetBundleContext(), "TestBundleA"); |
| 106 | #else |
| 107 | auto bundle = cppmicroservices::testing::GetBundle("TestBundleA", f.GetBundleContext()); |
| 108 | #endif |
| 109 | |
| 110 | auto handleCountAfter = GetHandleCountForCurrentProcess(); |
| 111 | ASSERT_EQ(handleCountBefore, handleCountAfter) |
| 112 | << "The handle counts before and after installing a bundle should not " |
| 113 | "differ."; |
| 114 | |
| 115 | f.Stop(); |
| 116 | f.WaitForStop(std::chrono::seconds::zero()); |
| 117 | } |
| 118 | |
| 119 | // Test that file handles do not leak when a bundle fails to install. |
| 120 | TEST(OpenFileHandleTest, InstallBundleFailure) |
nothing calls this directly
no test coverage detected