MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / TEST

Function TEST

framework/test/gtest/OpenFileHandleTest.cpp:96–117  ·  view source on GitHub ↗

Test that the file handle count doesn't change after installing a bundle. Installing a bundle should not hold the file open.

Source from the content-addressed store, hash-verified

94// Test that the file handle count doesn't change after installing a bundle.
95// Installing a bundle should not hold the file open.
96TEST(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.
120TEST(OpenFileHandleTest, InstallBundleFailure)

Callers

nothing calls this directly

Calls 9

InstallLibFunction · 0.85
GetBundleFunction · 0.85
NewFrameworkMethod · 0.80
InstallBundlesMethod · 0.80
StartMethod · 0.45
GetBundleContextMethod · 0.45
StopMethod · 0.45
WaitForStopMethod · 0.45

Tested by

no test coverage detected