From 30fc00b1e6df9f4ee5621ee0fd801cb0434d0541 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 7 Jun 2022 17:47:47 -0700 Subject: [PATCH 1/3] Rename CMake project to gz Signed-off-by: Louise Poubel --- CMakeLists.txt | 28 ++++++++++----------- example/CMakeLists.txt | 56 +++++++++++++++++++++--------------------- src/CMakeLists.txt | 4 +-- src/cmd/CMakeLists.txt | 4 +-- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62b2ab83c..4b382f169 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,14 +3,14 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(ignition-transport12 VERSION 12.0.0) +project(gz-transport12 VERSION 12.0.0) #============================================================================ -# Find ignition-cmake +# Find gz-cmake #============================================================================ -# If you get an error at this line, you need to install ignition-cmake -find_package(ignition-cmake3 REQUIRED) -set(IGN_CMAKE_VER ${ignition-cmake3_VERSION_MAJOR}) +# If you get an error at this line, you need to install gz-cmake +find_package(gz-cmake3 REQUIRED) +set(GZ_CMAKE_VER ${gz-cmake3_VERSION_MAJOR}) #============================================================================ # Configure the project @@ -23,7 +23,7 @@ gz_configure_project( # Set project-specific options #============================================================================ -# ignition-transport currently has no options that are unique to it +# gz-transport currently has no options that are unique to it if (UNIX AND NOT APPLE) set (EXTRA_TEST_LIB_DEPS stdc++fs) @@ -77,14 +77,14 @@ else() endif() #-------------------------------------- -# Find ignition-utils -gz_find_package(ignition-utils2 REQUIRED COMPONENTS cli) -set(IGN_UTILS_VER ${ignition-utils2_VERSION_MAJOR}) +# Find gz-utils +gz_find_package(gz-utils2 REQUIRED COMPONENTS cli) +set(GZ_UTILS_VER ${gz-utils2_VERSION_MAJOR}) #-------------------------------------- -# Find ignition-msgs -gz_find_package(ignition-msgs9 REQUIRED) -set(IGN_MSGS_VER ${ignition-msgs9_VERSION_MAJOR}) +# Find gz-msgs +gz_find_package(gz-msgs9 REQUIRED) +set(GZ_MSGS_VER ${gz-msgs9_VERSION_MAJOR}) #-------------------------------------- # Find ifaddrs @@ -96,8 +96,8 @@ else () endif() #-------------------------------------- -# Find ignition-tools -gz_find_package(ignition-tools2 QUIET) +# Find gz-tools +gz_find_package(gz-tools2 QUIET) #-------------------------------------- # Find SQLite3 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 30265dac4..2a60fcc35 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(ignition-transport-examples) +project(gz-transport-examples) # Find the Ignition_Transport library -find_package(ignition-transport12 QUIET REQUIRED OPTIONAL_COMPONENTS log) -set(IGN_TRANSPORT_VER ${ignition-transport12_VERSION_MAJOR}) +find_package(gz-transport12 QUIET REQUIRED OPTIONAL_COMPONENTS log) +set(GZ_TRANSPORT_VER ${gz-transport12_VERSION_MAJOR}) if (EXISTS "${CMAKE_SOURCE_DIR}/msgs/") # Message generation. Only required when using custom Protobuf messages. @@ -27,7 +27,7 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/bench.cc") include_directories(SYSTEM ${gflags_INCLUDE_DIRS}) add_executable(bench bench.cc) target_link_libraries(bench - ignition-transport${IGN_TRANSPORT_VER}::core + gz-transport${GZ_TRANSPORT_VER}::core ${gflags_LIBRARIES} pthread) endif() @@ -35,88 +35,88 @@ endif() if (NOT MSVC AND EXISTS "${CMAKE_SOURCE_DIR}/publisher_c.cc") add_executable(publisher_c publisher_c.cc) - target_link_libraries(publisher_c ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(publisher_c gz-transport${GZ_TRANSPORT_VER}::core) endif() if (NOT MSVC AND EXISTS "${CMAKE_SOURCE_DIR}/publisher_c_fast.cc") add_executable(publisher_c_fast publisher_c_fast.cc) - target_link_libraries(publisher_c_fast ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(publisher_c_fast gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/subscriber_c.cc") add_executable(subscriber_c subscriber_c.cc) - target_link_libraries(subscriber_c ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(subscriber_c gz-transport${GZ_TRANSPORT_VER}::core) endif() if (NOT MSVC AND EXISTS "${CMAKE_SOURCE_DIR}/subscriber_c_slow.cc") add_executable(subscriber_c_slow subscriber_c_slow.cc) - target_link_libraries(subscriber_c_slow ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(subscriber_c_slow gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/subscriber_stats.cc") add_executable(subscriber_stats subscriber_stats.cc) - target_link_libraries(subscriber_stats ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(subscriber_stats gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/publisher.cc") add_executable(publisher publisher.cc) - target_link_libraries(publisher ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(publisher gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/subscriber.cc") add_executable(subscriber subscriber.cc) - target_link_libraries(subscriber ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(subscriber gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/subscriber_generic.cc") add_executable(subscriber_generic subscriber_generic.cc) target_link_libraries(subscriber_generic - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/responser.cc") add_executable(responser responser.cc) - target_link_libraries(responser ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(responser gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/requester.cc") add_executable(requester requester.cc) - target_link_libraries(requester ignition-transport${IGN_TRANSPORT_VER}::core) + target_link_libraries(requester gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/requester_async.cc") add_executable(requester_async requester_async.cc) target_link_libraries(requester_async - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/responser_oneway.cc") add_executable(responser_oneway responser_oneway.cc) target_link_libraries(responser_oneway - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/requester_oneway.cc") add_executable(requester_oneway requester_oneway.cc) target_link_libraries(requester_oneway - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/responser_no_input.cc") add_executable(responser_no_input responser_no_input.cc) target_link_libraries(responser_no_input - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/requester_no_input.cc") add_executable(requester_no_input requester_no_input.cc) target_link_libraries(requester_no_input - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/requester_async_no_input.cc") add_executable(requester_async_no_input requester_async_no_input.cc) target_link_libraries(requester_async_no_input - ignition-transport${IGN_TRANSPORT_VER}::core) + gz-transport${GZ_TRANSPORT_VER}::core) endif() # FIXME(chapulina) Linking failure on Windows: @@ -125,7 +125,7 @@ if (NOT MSVC AND TARGET protobuf_compilation AND EXISTS "${CMAKE_SOURCE_DIR}/publisher_custom_msg.cc") add_executable(publisher_custom_msg publisher_custom_msg.cc) target_link_libraries(publisher_custom_msg - ignition-transport${IGN_TRANSPORT_VER}::core + gz-transport${GZ_TRANSPORT_VER}::core ${PROTO_SRC} ) add_dependencies(publisher_custom_msg protobuf_compilation) @@ -137,7 +137,7 @@ if (NOT MSVC AND TARGET protobuf_compilation AND EXISTS "${CMAKE_SOURCE_DIR}/subscriber_custom_msg.cc") add_executable(subscriber_custom_msg subscriber_custom_msg.cc) target_link_libraries(subscriber_custom_msg - ignition-transport${IGN_TRANSPORT_VER}::core + gz-transport${GZ_TRANSPORT_VER}::core ${PROTO_SRC} ) add_dependencies(subscriber_custom_msg protobuf_compilation) @@ -146,38 +146,38 @@ endif() if (EXISTS "${CMAKE_SOURCE_DIR}/publisher_raw.cc") add_executable(publisher_raw publisher_raw.cc) target_link_libraries(publisher_raw - ignition-transport${IGN_TRANSPORT_VER}::core + gz-transport${GZ_TRANSPORT_VER}::core ) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/subscriber_raw.cc") add_executable(subscriber_raw subscriber_raw.cc) target_link_libraries(subscriber_raw - ignition-transport${IGN_TRANSPORT_VER}::core + gz-transport${GZ_TRANSPORT_VER}::core ) endif() # Logging examples. -if (TARGET ignition-transport${IGN_TRANSPORT_VER}::log) +if (TARGET gz-transport${GZ_TRANSPORT_VER}::log) if (EXISTS "${CMAKE_SOURCE_DIR}/record.cc") add_executable(log_record record.cc) target_link_libraries(log_record - ignition-transport${IGN_TRANSPORT_VER}::log + gz-transport${GZ_TRANSPORT_VER}::log ) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/playback.cc") add_executable(log_playback playback.cc) target_link_libraries(log_playback - ignition-transport${IGN_TRANSPORT_VER}::log + gz-transport${GZ_TRANSPORT_VER}::log ) endif() if (EXISTS "${CMAKE_SOURCE_DIR}/custom_query.cc") add_executable(log_custom_query custom_query.cc) target_link_libraries(log_custom_query - ignition-transport${IGN_TRANSPORT_VER}::log + gz-transport${GZ_TRANSPORT_VER}::log ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a46a1eb36..96fda2098 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,8 +17,8 @@ gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17) # Link the libraries that we always need. target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC - ignition-utils${IGN_UTILS_VER}::ignition-utils${IGN_UTILS_VER} - ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER} + gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER} + gz-msgs${GZ_MSGS_VER}::gz-msgs${GZ_MSGS_VER} CPPZMQ::CPPZMQ PRIVATE ${ZeroMQ_TARGET} diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 24393f4e7..5dac33bca 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -19,7 +19,7 @@ set(topic_executable ign-transport-topic) add_executable(${topic_executable} topic_main.cc) target_link_libraries(${topic_executable} gz - ignition-utils${IGN_UTILS_VER}::cli + gz-utils${GZ_UTILS_VER}::cli ${PROJECT_LIBRARY_TARGET_NAME} ) install(TARGETS ${topic_executable} DESTINATION ${IGN_LIB_INSTALL_DIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/) @@ -29,7 +29,7 @@ set(service_executable ign-transport-service) add_executable(${service_executable} service_main.cc) target_link_libraries(${service_executable} gz - ignition-utils${IGN_UTILS_VER}::cli + gz-utils${GZ_UTILS_VER}::cli ${PROJECT_LIBRARY_TARGET_NAME} ) install(TARGETS ${service_executable} DESTINATION ${IGN_LIB_INSTALL_DIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/) From 1b1d4796f1e37d50e4321ca3adc8533367aeb619 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sat, 25 Jun 2022 16:49:54 -0700 Subject: [PATCH 2/3] Migrate IGNITION- CMake variables Signed-off-by: methylDragon --- example/configure.bat | 12 ++++++------ log/test/integration/CMakeLists.txt | 2 +- test/test_config.h.in | 2 +- tutorials/04_messages.md | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/example/configure.bat b/example/configure.bat index 30f7b4b85..7c6946cad 100644 --- a/example/configure.bat +++ b/example/configure.bat @@ -9,15 +9,15 @@ @set PROTOBUF_PATH=%cd%\..\..\..\protobuf-2.6.0-win%build_bitness%-vc12 @set IGN_TRANSPORT_PATH=%cd%\..\..\build\install\%build_type% -@set IGNITION-MSGS_PATH=%cd%\..\..\..\ign-msgs\build\install\%build_type% -@set IGNITION-MSGS_CMAKE_PREFIX_PATH=%IGNITION-MSGS_PATH%\CMake -@set IGNITION-MATH_PATH=%cd%\..\..\..\ign-math\build\install\%build_type% -@set IGNITION-MATH_CMAKE_PREFIX_PATH=%IGNITION-MATH_PATH%\CMake +@set GZ-MSGS_PATH=%cd%\..\..\..\ign-msgs\build\install\%build_type% +@set GZ-MSGS_CMAKE_PREFIX_PATH=%GZ-MSGS_PATH%\CMake +@set GZ-MATH_PATH=%cd%\..\..\..\ign-math\build\install\%build_type% +@set GZ-MATH_CMAKE_PREFIX_PATH=%GZ-MATH_PATH%\CMake cmake -G "NMake Makefiles"^ - -DCMAKE_PREFIX_PATH="%IGN_TRANSPORT_PATH%\lib\cmake\ignition-transport12;%IGNITION-MSGS_CMAKE_PREFIX_PATH%;%IGNITION-MATH_CMAKE_PREFIX_PATH%;"^ + -DCMAKE_PREFIX_PATH="%IGN_TRANSPORT_PATH%\lib\cmake\ignition-transport12;%GZ-MSGS_CMAKE_PREFIX_PATH%;%GZ-MATH_CMAKE_PREFIX_PATH%;"^ -DPROTOBUF_SRC_ROOT_FOLDER="%PROTOBUF_PATH%"^ - -DIGNITION-MSGS_FOLDER="%IGNITION-MSGS_PATH%"^ + -DGZ-MSGS_FOLDER="%GZ-MSGS_PATH%"^ -DCMAKE_INSTALL_PREFIX="install"^ -DCMAKE_BUILD_TYPE=%build_type%^ .. diff --git a/log/test/integration/CMakeLists.txt b/log/test/integration/CMakeLists.txt index eb3a7bf1f..5b362075b 100644 --- a/log/test/integration/CMakeLists.txt +++ b/log/test/integration/CMakeLists.txt @@ -65,7 +65,7 @@ foreach(source_file ${aux}) endforeach() # gz log CLI test -if (IGNITION-TOOLS_BINARY_DIRS) +if (GZ-TOOLS_BINARY_DIRS) set(GZ_CONFIG_PATH "${CMAKE_BINARY_DIR}/log/test/lib/ruby/gz") add_test(gz_log_record_no_overwrite diff --git a/test/test_config.h.in b/test/test_config.h.in index f058564be..7236b460d 100644 --- a/test/test_config.h.in +++ b/test/test_config.h.in @@ -18,7 +18,7 @@ #ifndef GZ_TRANSPORT_TEST_CONFIG_HH_ #define GZ_TRANSPORT_TEST_CONFIG_HH_ -#define GZ_PATH "@IGNITION-TOOLS2_BINARY_DIRS@" +#define GZ_PATH "@GZ-TOOLS2_BINARY_DIRS@" #define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf" #define GZ_VERSION_FULL "@PROJECT_VERSION_FULL@" diff --git a/tutorials/04_messages.md b/tutorials/04_messages.md index a4e2de65c..dfe645fd7 100644 --- a/tutorials/04_messages.md +++ b/tutorials/04_messages.md @@ -496,7 +496,7 @@ there is a new subdirectory to inspect containing our custom messages. if (EXISTS "${CMAKE_SOURCE_DIR}/publisher_custom_msg.cc") add_executable(publisher_custom_msg publisher_custom_msg.cc) target_link_libraries(publisher_custom_msg - ${IGNITION-TRANSPORT_LIBRARIES} + ${GZ-TRANSPORT_LIBRARIES} ${PROTO_SRC} ) add_dependencies(publisher_custom_msg protobuf_compilation) @@ -505,7 +505,7 @@ endif() if (EXISTS "${CMAKE_SOURCE_DIR}/subscriber_custom_msg.cc") add_executable(subscriber_custom_msg subscriber_custom_msg.cc) target_link_libraries(subscriber_custom_msg - ${IGNITION-TRANSPORT_LIBRARIES} + ${GZ-TRANSPORT_LIBRARIES} ${PROTO_SRC} ) add_dependencies(subscriber_custom_msg protobuf_compilation) From 7c85b142a3192e8fc2ed455ccb4c6a80cab6f9a5 Mon Sep 17 00:00:00 2001 From: methylDragon Date: Sat, 25 Jun 2022 17:44:45 -0700 Subject: [PATCH 3/3] Use find_program for gz CLI directory Signed-off-by: methylDragon --- CMakeLists.txt | 1 + log/test/integration/CMakeLists.txt | 2 +- src/cmd/gz_TEST.cc | 114 ++++++++++++++-------------- test/test_config.h.in | 2 +- 4 files changed, 60 insertions(+), 59 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b382f169..87adda160 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ endif() #-------------------------------------- # Find gz-tools gz_find_package(gz-tools2 QUIET) +find_program(HAVE_GZ_TOOLS gz) #-------------------------------------- # Find SQLite3 diff --git a/log/test/integration/CMakeLists.txt b/log/test/integration/CMakeLists.txt index 5b362075b..7aa020c7c 100644 --- a/log/test/integration/CMakeLists.txt +++ b/log/test/integration/CMakeLists.txt @@ -65,7 +65,7 @@ foreach(source_file ${aux}) endforeach() # gz log CLI test -if (GZ-TOOLS_BINARY_DIRS) +if (HAVE_GZ_TOOLS) set(GZ_CONFIG_PATH "${CMAKE_BINARY_DIR}/log/test/lib/ruby/gz") add_test(gz_log_record_no_overwrite diff --git a/src/cmd/gz_TEST.cc b/src/cmd/gz_TEST.cc index 10955e2bc..fb69e8184 100644 --- a/src/cmd/gz_TEST.cc +++ b/src/cmd/gz_TEST.cc @@ -33,7 +33,7 @@ using namespace gz; static std::string g_partition; // NOLINT(*) static std::string g_topicCBStr; // NOLINT(*) -static const std::string g_ignVersion("--force-version " + // NOLINT(*) +static const std::string g_gzVersion("--force-version " + // NOLINT(*) std::string(GZ_VERSION_FULL)); ///////////////////////////////////////////////// @@ -74,7 +74,7 @@ void topicCB(const gz::msgs::StringMsg &_msg) } ////////////////////////////////////////////////// -/// \brief Check 'ign topic -l' running the advertiser on a different process. +/// \brief Check 'gz topic -l' running the advertiser on a different process. TEST(gzTest, GZ_UTILS_TEST_DISABLED_ON_MAC(TopicList)) { // Launch a new publisher process that advertises a topic. @@ -85,15 +85,15 @@ TEST(gzTest, GZ_UTILS_TEST_DISABLED_ON_MAC(TopicList)) testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(), g_partition.c_str()); - // Check the 'ign topic -l' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -l' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool topicFound = false; while (!topicFound && retries++ < 10u) { - std::string output = custom_exec_str(ign + " topic -l " + g_ignVersion); + std::string output = custom_exec_str(gz + " topic -l " + g_gzVersion); topicFound = output == "/foo\n"; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -105,7 +105,7 @@ TEST(gzTest, GZ_UTILS_TEST_DISABLED_ON_MAC(TopicList)) } ////////////////////////////////////////////////// -/// \brief Check 'ign topic -i' running the advertiser on a different process. +/// \brief Check 'gz topic -i' running the advertiser on a different process. TEST(gzTest, TopicInfo) { // Launch a new publisher process that advertises a topic. @@ -116,8 +116,8 @@ TEST(gzTest, TopicInfo) testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(), g_partition.c_str()); - // Check the 'ign topic -i' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -i' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool infoFound = false; @@ -125,7 +125,7 @@ TEST(gzTest, TopicInfo) while (!infoFound && retries++ < 10u) { - output = custom_exec_str(ign + " topic -t /foo -i " + g_ignVersion); + output = custom_exec_str(gz + " topic -t /foo -i " + g_gzVersion); infoFound = output.size() > 50u; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -140,7 +140,7 @@ TEST(gzTest, TopicInfo) } ////////////////////////////////////////////////// -/// \brief Check 'ign service -l' running the advertiser on a different +/// \brief Check 'gz service -l' running the advertiser on a different /// process. TEST(gzTest, ServiceList) { @@ -152,15 +152,15 @@ TEST(gzTest, ServiceList) testing::forkHandlerType pi = testing::forkAndRun(replier_path.c_str(), g_partition.c_str()); - // Check the 'ign service -l' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz service -l' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool serviceFound = false; while (!serviceFound && retries++ < 10u) { - std::string output = custom_exec_str(ign + " service -l " + g_ignVersion); + std::string output = custom_exec_str(gz + " service -l " + g_gzVersion); serviceFound = output == "/foo\n"; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -172,7 +172,7 @@ TEST(gzTest, ServiceList) } ////////////////////////////////////////////////// -/// \brief Check 'ign service -i' running the advertiser on a different process. +/// \brief Check 'gz service -i' running the advertiser on a different process. TEST(gzTest, ServiceInfo) { // Launch a new publisher process that advertises a topic. @@ -183,8 +183,8 @@ TEST(gzTest, ServiceInfo) testing::forkHandlerType pi = testing::forkAndRun(replier_path.c_str(), g_partition.c_str()); - // Check the 'ign service -i' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz service -i' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool infoFound = false; @@ -192,7 +192,7 @@ TEST(gzTest, ServiceInfo) while (!infoFound && retries++ < 10u) { - output = custom_exec_str(ign + " service -s /foo -i " + g_ignVersion); + output = custom_exec_str(gz + " service -s /foo -i " + g_gzVersion); infoFound = output.size() > 50u; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -205,7 +205,7 @@ TEST(gzTest, ServiceInfo) } ////////////////////////////////////////////////// -/// \brief Check 'ign topic -l' running the advertiser on the same process. +/// \brief Check 'gz topic -l' running the advertiser on the same process. TEST(gzTest, TopicListSameProc) { gz::transport::Node node; @@ -219,15 +219,15 @@ TEST(gzTest, TopicListSameProc) EXPECT_TRUE(pub); EXPECT_TRUE(pub.Publish(msg)); - // Check the 'ign topic -l' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -l' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool topicFound = false; while (!topicFound && retries++ < 10u) { - std::string output = custom_exec_str(ign + " topic -l " + g_ignVersion); + std::string output = custom_exec_str(gz + " topic -l " + g_gzVersion); topicFound = output == "/foo\n"; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -236,7 +236,7 @@ TEST(gzTest, TopicListSameProc) } ////////////////////////////////////////////////// -/// \brief Check 'ign topic -i' running the advertiser on the same process. +/// \brief Check 'gz topic -i' running the advertiser on the same process. TEST(gzTest, TopicInfoSameProc) { gz::transport::Node node; @@ -250,8 +250,8 @@ TEST(gzTest, TopicInfoSameProc) EXPECT_TRUE(pub); EXPECT_TRUE(pub.Publish(msg)); - // Check the 'ign topic -i' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -i' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool infoFound = false; @@ -259,7 +259,7 @@ TEST(gzTest, TopicInfoSameProc) while (!infoFound && retries++ < 10u) { - output = custom_exec_str(ign + " topic -t /foo -i " + g_ignVersion); + output = custom_exec_str(gz + " topic -t /foo -i " + g_gzVersion); infoFound = output.size() > 50u; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -269,21 +269,21 @@ TEST(gzTest, TopicInfoSameProc) } ////////////////////////////////////////////////// -/// \brief Check 'ign service -l' running the advertiser on the same process. +/// \brief Check 'gz service -l' running the advertiser on the same process. TEST(gzTest, ServiceListSameProc) { transport::Node node; EXPECT_TRUE(node.Advertise("/foo", srvEcho)); - // Check the 'ign service -l' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz service -l' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool serviceFound = false; while (!serviceFound && retries++ < 10u) { - std::string output = custom_exec_str(ign + " service -l " + g_ignVersion); + std::string output = custom_exec_str(gz + " service -l " + g_gzVersion); serviceFound = output == "/foo\n"; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -292,14 +292,14 @@ TEST(gzTest, ServiceListSameProc) } ////////////////////////////////////////////////// -/// \brief Check 'ign service -i' running the advertiser on the same process. +/// \brief Check 'gz service -i' running the advertiser on the same process. TEST(gzTest, ServiceInfoSameProc) { gz::transport::Node node; EXPECT_TRUE(node.Advertise("/foo", srvEcho)); - // Check the 'ign service -i' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz service -i' command. + std::string gz = std::string(GZ_PATH); unsigned int retries = 0u; bool infoFound = false; @@ -307,7 +307,7 @@ TEST(gzTest, ServiceInfoSameProc) while (!infoFound && retries++ < 10u) { - output = custom_exec_str(ign + " service -s /foo -i " + g_ignVersion); + output = custom_exec_str(gz + " service -s /foo -i " + g_gzVersion); infoFound = output.size() > 50u; std::this_thread::sleep_for(std::chrono::milliseconds(300)); } @@ -318,15 +318,15 @@ TEST(gzTest, ServiceInfoSameProc) ////////////////////////////////////////////////// -/// \brief Check 'ign topic -p' to send a message. +/// \brief Check 'gz topic -p' to send a message. TEST(gzTest, TopicPublish) { gz::transport::Node node; g_topicCBStr = "bad_value"; EXPECT_TRUE(node.Subscribe("/bar", topicCB)); - // Check the 'ign topic -p' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -p' command. + std::string gz = std::string(GZ_PATH); std::string output; unsigned int retries = 0; @@ -335,9 +335,9 @@ TEST(gzTest, TopicPublish) // Send on alternating retries if (retries % 2) { - output = custom_exec_str(ign + + output = custom_exec_str(gz + " topic -t /bar -m gz_msgs.StringMsg -p 'data:\"good_value\"' " + - g_ignVersion); + g_gzVersion); EXPECT_TRUE(output.empty()) << output; } std::this_thread::sleep_for(std::chrono::milliseconds(30)); @@ -346,28 +346,28 @@ TEST(gzTest, TopicPublish) // Try to publish a message not included in Gazebo Messages. std::string error = "Unable to create message of type"; - output = custom_exec_str(ign + + output = custom_exec_str(gz + " topic -t /bar -m gz_msgs.__bad_msg_type -p 'data:\"good_value\"' " + - g_ignVersion); + g_gzVersion); EXPECT_EQ(output.compare(0, error.size(), error), 0); // Try to publish using an incorrect topic name. error = "Topic [/] is not valid"; - output = custom_exec_str(ign + + output = custom_exec_str(gz + " topic -t / -m gz_msgs.StringMsg -p 'data:\"good_value\"' "+ - g_ignVersion); + g_gzVersion); EXPECT_EQ(output.compare(0, error.size(), error), 0) << output; // Try to publish using an incorrect number of arguments. error = "The following argument was not expected: wrong_topic"; - output = custom_exec_str(ign + + output = custom_exec_str(gz + " topic -t / wrong_topic -m gz_msgs.StringMsg -p 'data:\"good_value\"' "+ - g_ignVersion); + g_gzVersion); EXPECT_EQ(output.compare(0, error.size(), error), 0) << output; } ////////////////////////////////////////////////// -/// \brief Check 'ign service -r' to request a service. +/// \brief Check 'gz service -r' to request a service. TEST(gzTest, ServiceRequest) { gz::transport::Node node; @@ -380,18 +380,18 @@ TEST(gzTest, ServiceRequest) gz::msgs::Int32 msg; msg.set_data(10); - // Check the 'ign service -r' command. - std::string ign = std::string(GZ_PATH) + "/ign"; - std::string output = custom_exec_str(ign + + // Check the 'gz service -r' command. + std::string gz = std::string(GZ_PATH); + std::string output = custom_exec_str(gz + " service -s " + service + " --reqtype gz_msgs.Int32 " + "--reptype gz_msgs.Int32 --timeout 1000 " + - "--req 'data: " + value + "' " + g_ignVersion); + "--req 'data: " + value + "' " + g_gzVersion); ASSERT_EQ(output, "data: " + value + "\n\n"); } ////////////////////////////////////////////////// -/// \brief Check 'ign topic -e' running the publisher on a separate process. +/// \brief Check 'gz topic -e' running the publisher on a separate process. TEST(gzTest, TopicEcho) { // Launch a new publisher process that advertises a topic. @@ -402,10 +402,10 @@ TEST(gzTest, TopicEcho) testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(), g_partition.c_str()); - // Check the 'ign topic -e' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -e' command. + std::string gz = std::string(GZ_PATH); std::string output = custom_exec_str( - ign + " topic -e -t /foo -d 1.5 " + g_ignVersion); + gz + " topic -e -t /foo -d 1.5 " + g_gzVersion); EXPECT_TRUE(output.find("x: 1") != std::string::npos); EXPECT_TRUE(output.find("y: 2") != std::string::npos); @@ -416,7 +416,7 @@ TEST(gzTest, TopicEcho) } ////////////////////////////////////////////////// -/// \brief Check 'ign topic -e -n 2' running the publisher on a separate +/// \brief Check 'gz topic -e -n 2' running the publisher on a separate /// process. TEST(gzTest, TopicEchoNum) { @@ -428,10 +428,10 @@ TEST(gzTest, TopicEchoNum) testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(), g_partition.c_str()); - // Check the 'ign topic -e -n' command. - std::string ign = std::string(GZ_PATH) + "/ign"; + // Check the 'gz topic -e -n' command. + std::string gz = std::string(GZ_PATH); std::string output = custom_exec_str( - ign + " topic -e -t /foo -n 2 " + g_ignVersion); + gz + " topic -e -t /foo -n 2 " + g_gzVersion); size_t pos = output.find("x: 1"); EXPECT_TRUE(pos != std::string::npos); diff --git a/test/test_config.h.in b/test/test_config.h.in index 7236b460d..4f6461068 100644 --- a/test/test_config.h.in +++ b/test/test_config.h.in @@ -18,7 +18,7 @@ #ifndef GZ_TRANSPORT_TEST_CONFIG_HH_ #define GZ_TRANSPORT_TEST_CONFIG_HH_ -#define GZ_PATH "@GZ-TOOLS2_BINARY_DIRS@" +#define GZ_PATH "@HAVE_GZ_TOOLS@" #define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf" #define GZ_VERSION_FULL "@PROJECT_VERSION_FULL@"