Skip to content

Commit

Permalink
Support gz-msgs hard-tock and update more macros
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed May 20, 2022
1 parent 3a68528 commit 40ad9f6
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 82 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ In the event that the installation is a mix of Debian and from source, command
line tools from `ign-tools` may not work correctly.

A workaround is to define the environment variable
`IGN_CONFIG_PATH` to point to the location of the Ignition library installation,
`GZ_CONFIG_PATH` to point to the location of the Ignition library installation,
where the YAML file for the package is found, such as
```
export IGN_CONFIG_PATH=/usr/local/share/ignition
export GZ_CONFIG_PATH=/usr/local/share/ignition
```

This issue is tracked [here](https://github.com/ignitionrobotics/ign-tools/issues/61).
Expand Down
2 changes: 1 addition & 1 deletion example/bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class PubTester

(*_stream) << "# " << std::put_time(&tm, "%FT%T%Z") << std::endl;
(*_stream) << "# Ignition Transport Version "
<< IGNITION_TRANSPORT_VERSION_FULL << std::endl;
<< GZ_TRANSPORT_VERSION_FULL << std::endl;

#ifdef __linux__
struct utsname unameData;
Expand Down
2 changes: 1 addition & 1 deletion log/test/test_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
#define GZ_TRANSPORT_LOG_TEST_CONFIG_HH_


#define IGN_TRANSPORT_LOG_TEST_PATH "@CMAKE_SOURCE_DIR@/log/test"
#define GZ_TRANSPORT_LOG_TEST_PATH "@CMAKE_SOURCE_DIR@/log/test"

#endif
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ foreach(test ${test_list})
# auxiliary files from. Using a generator expression here is useful for
# multi-configuration generators, like Visual Studio.
target_compile_definitions(${test} PRIVATE
"DETAIL_IGN_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\""
"IGN_TEST_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\"")
"DETAIL_GZ_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\""
"GZ_TEST_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\"")

endforeach()

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ foreach(test ${test_list})
# auxiliary files from. Using a generator expression here is useful for
# multi-configuration generators, like Visual Studio.
target_compile_definitions(${test} PRIVATE
"DETAIL_IGN_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\""
"IGN_TEST_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\"")
"DETAIL_GZ_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\""
"GZ_TEST_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\"")

endforeach()

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ign.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,5 +318,5 @@ extern "C" void cmdTopicEcho(const char *_topic,
//////////////////////////////////////////////////
extern "C" const char *ignitionVersion()
{
return IGNITION_TRANSPORT_VERSION_FULL;
return GZ_TRANSPORT_VERSION_FULL;
}
52 changes: 26 additions & 26 deletions src/cmd/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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(*)
std::string(IGN_VERSION_FULL));
std::string(GZ_VERSION_FULL));

/////////////////////////////////////////////////
std::string custom_exec_str(std::string _cmd)
Expand Down Expand Up @@ -79,14 +79,14 @@ TEST(ignTest, IGN_UTILS_TEST_DISABLED_ON_MAC(TopicList))
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_twoProcsPublisher_aux");

testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(),
g_partition.c_str());

// Check the 'ign topic -l' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool topicFound = false;
Expand All @@ -110,14 +110,14 @@ TEST(ignTest, TopicInfo)
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_twoProcsPublisher_aux");

testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(),
g_partition.c_str());

// Check the 'ign topic -i' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool infoFound = false;
Expand Down Expand Up @@ -146,14 +146,14 @@ TEST(ignTest, ServiceList)
{
// Launch a new responser process that advertises a service.
std::string replier_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_twoProcsSrvCallReplier_aux");

testing::forkHandlerType pi = testing::forkAndRun(replier_path.c_str(),
g_partition.c_str());

// Check the 'ign service -l' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool serviceFound = false;
Expand All @@ -177,14 +177,14 @@ TEST(ignTest, ServiceInfo)
{
// Launch a new publisher process that advertises a topic.
std::string replier_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_twoProcsSrvCallReplier_aux");

testing::forkHandlerType pi = testing::forkAndRun(replier_path.c_str(),
g_partition.c_str());

// Check the 'ign service -i' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool infoFound = false;
Expand Down Expand Up @@ -220,7 +220,7 @@ TEST(ignTest, TopicListSameProc)
EXPECT_TRUE(pub.Publish(msg));

// Check the 'ign topic -l' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool topicFound = false;
Expand Down Expand Up @@ -251,7 +251,7 @@ TEST(ignTest, TopicInfoSameProc)
EXPECT_TRUE(pub.Publish(msg));

// Check the 'ign topic -i' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool infoFound = false;
Expand All @@ -276,7 +276,7 @@ TEST(ignTest, ServiceListSameProc)
EXPECT_TRUE(node.Advertise("/foo", srvEcho));

// Check the 'ign service -l' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool serviceFound = false;
Expand All @@ -299,7 +299,7 @@ TEST(ignTest, ServiceInfoSameProc)
EXPECT_TRUE(node.Advertise("/foo", srvEcho));

// Check the 'ign service -i' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";

unsigned int retries = 0u;
bool infoFound = false;
Expand All @@ -326,7 +326,7 @@ TEST(ignTest, TopicPublish)
EXPECT_TRUE(node.Subscribe("/bar", topicCB));

// Check the 'ign topic -p' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";
std::string output;

unsigned int retries = 0;
Expand All @@ -336,7 +336,7 @@ TEST(ignTest, TopicPublish)
if (retries % 2)
{
output = custom_exec_str(ign +
" topic -t /bar -m ign_msgs.StringMsg -p 'data:\"good_value\"' " +
" topic -t /bar -m gz_msgs.StringMsg -p 'data:\"good_value\"' " +
g_ignVersion);
EXPECT_TRUE(output.empty()) << output;
}
Expand All @@ -347,21 +347,21 @@ TEST(ignTest, TopicPublish)
// Try to publish a message not included in Ignition Messages.
std::string error = "Unable to create message of type";
output = custom_exec_str(ign +
" topic -t /bar -m ign_msgs.__bad_msg_type -p 'data:\"good_value\"' " +
" topic -t /bar -m gz_msgs.__bad_msg_type -p 'data:\"good_value\"' " +
g_ignVersion);
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 +
" topic -t / -m ign_msgs.StringMsg -p 'data:\"good_value\"' "+
" topic -t / -m gz_msgs.StringMsg -p 'data:\"good_value\"' "+
g_ignVersion);
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 +
" topic -t / wrong_topic -m ign_msgs.StringMsg -p 'data:\"good_value\"' "+
" topic -t / wrong_topic -m gz_msgs.StringMsg -p 'data:\"good_value\"' "+
g_ignVersion);
EXPECT_EQ(output.compare(0, error.size(), error), 0) << output;
}
Expand All @@ -381,10 +381,10 @@ TEST(ignTest, ServiceRequest)
msg.set_data(10);

// Check the 'ign service -r' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";
std::string output = custom_exec_str(ign +
" service -s " + service + " --reqtype ign_msgs.Int32 " +
"--reptype ign_msgs.Int32 --timeout 1000 " +
" service -s " + service + " --reqtype gz_msgs.Int32 " +
"--reptype gz_msgs.Int32 --timeout 1000 " +
"--req 'data: " + value + "' " + g_ignVersion);

ASSERT_EQ(output, "data: " + value + "\n\n");
Expand All @@ -396,14 +396,14 @@ TEST(ignTest, TopicEcho)
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_twoProcsPublisher_aux");

testing::forkHandlerType pi = testing::forkAndRun(publisher_path.c_str(),
g_partition.c_str());

// Check the 'ign topic -e' command.
std::string ign = std::string(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";
std::string output = custom_exec_str(
ign + " topic -e -t /foo -d 1.5 " + g_ignVersion);

Expand All @@ -422,14 +422,14 @@ TEST(ignTest, TopicEchoNum)
{
// Launch a new publisher process that advertises a topic.
std::string publisher_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_twoProcsPublisher_aux");

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(IGN_PATH) + "/ign";
std::string ign = std::string(GZ_PATH) + "/ign";
std::string output = custom_exec_str(
ign + " topic -e -t /foo -n 2 " + g_ignVersion);

Expand Down Expand Up @@ -474,7 +474,7 @@ int main(int argc, char **argv)
std::string value = "";
gz::transport::env("LD_LIBRARY_PATH", value);
// Add the directory where ignition transport has been built.
value = std::string(IGN_TEST_LIBRARY_PATH) + ":" + value;
value = std::string(GZ_TEST_LIBRARY_PATH) + ":" + value;
setenv("LD_LIBRARY_PATH", value.c_str(), 1);

::testing::InitGoogleTest(&argc, argv);
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ign_src_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace gz;
// Global constants.
static const std::string g_topic = "/topic"; // NOLINT(*)
static const std::string g_service = "/echo"; // NOLINT(*)
static const std::string g_intType = "ign_msgs.Int32"; // NOLINT(*)
static const std::string g_intType = "gz_msgs.Int32"; // NOLINT(*)
static const std::string g_reqData = "data: 10"; // NOLINT(*)

// Global variables.
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/service_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int main(int argc, char** argv)
app.set_help_all_flag("--help-all", "Show all help");

app.add_flag_callback("-v,--version", [](){
std::cout << IGNITION_TRANSPORT_VERSION_FULL << std::endl;
std::cout << GZ_TRANSPORT_VERSION_FULL << std::endl;
throw CLI::Success();
});

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/topic_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int main(int argc, char** argv)
CLI::App app{"Introspect Ignition topics"};

app.add_flag_callback("-v,--version", [](){
std::cout << IGNITION_TRANSPORT_VERSION_FULL << std::endl;
std::cout << GZ_TRANSPORT_VERSION_FULL << std::endl;
throw CLI::Success();
});

Expand Down
2 changes: 1 addition & 1 deletion test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ foreach(test ${test_list})
# auxiliary files from. Using a generator expression here is useful for
# multi-configuration generators, like Visual Studio.
target_compile_definitions(${test} PRIVATE
"DETAIL_IGN_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\"")
"DETAIL_GZ_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\"")

endforeach()

Expand Down
2 changes: 1 addition & 1 deletion test/integration/authPubSub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(authPubSub, InvalidAuth)
EXPECT_FALSE(pub.HasConnections());

std::string subscriberPath = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_authPubSubSubscriberInvalid_aux");

// Start the subscriber in another process with incorrect credentials.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/scopedTopic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static int data = 5;
TEST(ScopedTopicTest, ProcessTest)
{
std::string subscriber_path = testing::portablePathUnion(
IGN_TRANSPORT_TEST_DIR,
GZ_TRANSPORT_TEST_DIR,
"INTEGRATION_scopedTopicSubscriber_aux");

testing::forkHandlerType pi = testing::forkAndRun(subscriber_path.c_str(),
Expand Down
Loading

0 comments on commit 40ad9f6

Please sign in to comment.