-
Notifications
You must be signed in to change notification settings - Fork 20
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
Load global symbols #30
Changes from all commits
3fa65b7
ba7dfa4
fa3fc44
f0baa76
a8160b2
dd19257
7ff136d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,8 +108,6 @@ TEST(EnablePluginFromThis, LibraryManagement) | |
{ | ||
ignition::plugin::PluginPtr longterm; | ||
|
||
CHECK_FOR_LIBRARY(libraryPath, false); | ||
|
||
{ | ||
ignition::plugin::Loader pl; | ||
pl.LoadLib(libraryPath); | ||
|
@@ -136,8 +134,6 @@ TEST(EnablePluginFromThis, LibraryManagement) | |
} | ||
|
||
EXPECT_TRUE(weak.IsExpired()); | ||
|
||
CHECK_FOR_LIBRARY(libraryPath, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe these checks are here to make sure the library is unloaded correctly. But @mxgrey's comment on the function suggests that it may not be reliable, so that could explain why you had to remove these. What do you think @mxgrey , should we remove the false checks, or adjust the |
||
} | ||
|
||
///////////////////////////////////////////////// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,26 +31,7 @@ | |
#include "../plugins/DummyPlugins.hh" | ||
#include "utils.hh" | ||
|
||
///////////////////////////////////////////////// | ||
TEST(Loader, LoadBadPlugins) | ||
{ | ||
std::vector<std::string> libraries = { | ||
IGNBadPluginAPIVersionOld_LIB, | ||
IGNBadPluginAPIVersionNew_LIB, | ||
IGNBadPluginAlign_LIB, | ||
IGNBadPluginNoInfo_LIB, | ||
IGNBadPluginSize_LIB}; | ||
for (auto const & library : libraries) | ||
{ | ||
ignition::plugin::Loader pl; | ||
|
||
// Make sure the expected plugins were loaded. | ||
std::unordered_set<std::string> pluginNames = pl.LoadLib(library); | ||
EXPECT_TRUE(pluginNames.empty()); | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
//////////////////////////////////////////////// | ||
TEST(Loader, LoadExistingLibrary) | ||
{ | ||
ignition::plugin::Loader pl; | ||
|
@@ -171,7 +152,6 @@ TEST(Loader, LoadExistingLibrary) | |
EXPECT_EQ(intBase->MyIntegerValueIs(), object.dummyInt); | ||
} | ||
|
||
|
||
///////////////////////////////////////////////// | ||
class SomeInterface { }; | ||
|
||
|
@@ -502,12 +482,9 @@ TEST(PluginPtr, LibraryManagement) | |
CHECK_FOR_LIBRARY(path, true); | ||
} | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
|
||
// Test that we can transfer between plugins | ||
{ | ||
ignition::plugin::PluginPtr somePlugin; | ||
CHECK_FOR_LIBRARY(path, false); | ||
|
||
{ | ||
ignition::plugin::PluginPtr temporaryPlugin = GetSomePlugin(path); | ||
|
@@ -518,8 +495,6 @@ TEST(PluginPtr, LibraryManagement) | |
CHECK_FOR_LIBRARY(path, true); | ||
} | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
|
||
// Test that we can forget libraries | ||
{ | ||
ignition::plugin::Loader pl; | ||
|
@@ -528,8 +503,6 @@ TEST(PluginPtr, LibraryManagement) | |
CHECK_FOR_LIBRARY(path, true); | ||
|
||
EXPECT_TRUE(pl.ForgetLibrary(path)); | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
} | ||
|
||
// Test that we can forget libraries, but the library will remain loaded if | ||
|
@@ -551,8 +524,6 @@ TEST(PluginPtr, LibraryManagement) | |
} | ||
|
||
// Check that the library will be unloaded once the plugin instance is deleted | ||
CHECK_FOR_LIBRARY(path, false); | ||
|
||
// Check that we can unload libraries based on plugin name | ||
{ | ||
ignition::plugin::Loader pl; | ||
|
@@ -561,16 +532,13 @@ TEST(PluginPtr, LibraryManagement) | |
CHECK_FOR_LIBRARY(path, true); | ||
|
||
pl.ForgetLibraryOfPlugin("test::util::DummyMultiPlugin"); | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
} | ||
|
||
// Check that the std::shared_ptrs that we provide for interfaces will | ||
// successfully keep the library loaded. | ||
{ | ||
std::shared_ptr<test::util::DummyNameBase> interface; | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
{ | ||
interface = GetSomePlugin(path)->QueryInterfaceSharedPtr< | ||
test::util::DummyNameBase>(); | ||
|
@@ -584,8 +552,6 @@ TEST(PluginPtr, LibraryManagement) | |
CHECK_FOR_LIBRARY(path, true); | ||
} | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
|
||
// Check that mulitple Loaders can work side-by-side | ||
{ | ||
ignition::plugin::Loader pl1; | ||
|
@@ -602,8 +568,25 @@ TEST(PluginPtr, LibraryManagement) | |
|
||
CHECK_FOR_LIBRARY(path, true); | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
TEST(Loader, LoadBadPlugins) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was there a reason to move this test down here? Was it failing above? |
||
{ | ||
std::vector<std::string> libraries = { | ||
IGNBadPluginAPIVersionOld_LIB, | ||
IGNBadPluginAPIVersionNew_LIB, | ||
IGNBadPluginAlign_LIB, | ||
IGNBadPluginNoInfo_LIB, | ||
IGNBadPluginSize_LIB}; | ||
for (auto const & library : libraries) | ||
{ | ||
ignition::plugin::Loader pl; | ||
|
||
CHECK_FOR_LIBRARY(path, false); | ||
// Make sure the expected plugins were loaded. | ||
std::unordered_set<std::string> pluginNames = pl.LoadLib(library); | ||
EXPECT_TRUE(pluginNames.empty()); | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think, @mxgrey , are we trying to do something that
ign-plugin
wasn't meant to do, or is this a reasonable change?See gazebosim/gz-sensors#38 (comment) for the reason why this change is needed.