Skip to content

Commit

Permalink
Find ign program instead of ignition-tools (#57)
Browse files Browse the repository at this point in the history
The find_package(ignition-tools) call was removed in #56,
but this disabled UNIT_ign_TEST. Search for the ign
program directly and adjust test logic accordingly.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Aug 19, 2021
1 parent 111ba95 commit 752cda6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ ign_find_package(DL
PRETTY libdl PURPOSE "Required for loading plugins")


#--------------------------------------
# Find ignition-tools
find_program(IGN_TOOLS_PROGRAM ign)


#============================================================================
# Configure the build
#============================================================================
Expand Down
4 changes: 2 additions & 2 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ign_get_libsources_and_unittests(sources tests)

# Disable ign_TEST if ignition-tools is not found
if (MSVC OR NOT IGNITION-TOOLS_BINARY_DIRS)
if (MSVC OR NOT IGN_TOOLS_PROGRAM)
list(REMOVE_ITEM tests src/ign_TEST.cc)
endif()

Expand Down Expand Up @@ -35,7 +35,7 @@ foreach(test ${test_targets})
"IGNDummyPlugins_LIB=\"$<TARGET_FILE:IGNDummyPlugins>\"")

target_compile_definitions(${test} PRIVATE
"IGN_PATH=\"${IGNITION-TOOLS_BINARY_DIRS}\"")
"IGN_PATH=\"${IGN_TOOLS_PROGRAM}\"")

target_compile_definitions(${test} PRIVATE
"IGN_VERSION_FULL=\"${PROJECT_VERSION_FULL}\"")
Expand Down
10 changes: 5 additions & 5 deletions loader/src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::string custom_exec_str(std::string _cmd)
TEST(ignTest, PluginInfoNonexistentLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(IGN_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
"/path/to/libDoesNotExist.so");
Expand All @@ -76,7 +76,7 @@ TEST(ignTest, PluginInfoNonexistentLibrary)
TEST(ignTest, PluginInfoNonLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(IGN_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
std::string(IGN_PLUGIN_SOURCE_DIR) + "/core/src/Plugin.cc");
Expand All @@ -94,7 +94,7 @@ TEST(ignTest, PluginInfoNonLibrary)
TEST(ignTest, PluginInfoNonPluginLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(IGN_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGN_PLUGIN_LIB);
Expand All @@ -113,7 +113,7 @@ TEST(ignTest, PluginInfoNonPluginLibrary)
TEST(ignTest, PluginInfoDummyPlugins)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(IGN_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGNDummyPlugins_LIB);
Expand Down Expand Up @@ -152,7 +152,7 @@ TEST(ignTest, PluginInfoDummyPlugins)
TEST(ignTest, PluginInfoVerboseDummyPlugins)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(IGN_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGNDummyPlugins_LIB + " --verbose");
Expand Down

0 comments on commit 752cda6

Please sign in to comment.