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 <[email protected]>
  • Loading branch information
methylDragon committed May 20, 2022
1 parent 3a68528 commit 362c080
Show file tree
Hide file tree
Showing 31 changed files with 96 additions and 96 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/include/gz/transport/log/Log.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace gz
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//
/// \brief Name of Environment variable containing path to schema
const std::string SchemaLocationEnvVar = "IGN_TRANSPORT_LOG_SQL_PATH";
const std::string SchemaLocationEnvVar = "GZ_TRANSPORT_LOG_SQL_PATH";

/// \brief Interface to a log file
class GZ_TRANSPORT_LOG_VISIBLE Log
Expand Down
2 changes: 1 addition & 1 deletion log/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ign_build_tests(
foreach(test_target ${logging_tests})

set_tests_properties(${logging_tests} PROPERTIES
ENVIRONMENT IGN_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql)
ENVIRONMENT GZ_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql)

endforeach()

Expand Down
2 changes: 1 addition & 1 deletion log/src/Log_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ TEST(Log, OpenCorruptDatabase)
{
log::Log logFile;
std::string path =
testing::portablePathUnion(IGN_TRANSPORT_LOG_TEST_PATH, "data");
testing::portablePathUnion(GZ_TRANSPORT_LOG_TEST_PATH, "data");
path = testing::portablePathUnion(path, "state.tlog");
logFile.Open(path);
EXPECT_GT(logFile.EndTime(), 0ns) << "logFile.EndTime() == "
Expand Down
12 changes: 6 additions & 6 deletions log/test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ endif()
foreach(test_target ${logging_tests})

set_tests_properties(${test_target} PROPERTIES
ENVIRONMENT IGN_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql)
ENVIRONMENT GZ_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql)
target_compile_definitions(${test_target}
PRIVATE IGN_TRANSPORT_LOG_SQL_PATH="${PROJECT_SOURCE_DIR}/log/sql")
PRIVATE GZ_TRANSPORT_LOG_SQL_PATH="${PROJECT_SOURCE_DIR}/log/sql")
target_compile_definitions(${test_target}
PRIVATE IGN_TRANSPORT_LOG_BUILD_PATH="$<TARGET_FILE_DIR:${test_target}>")
PRIVATE GZ_TRANSPORT_LOG_BUILD_PATH="$<TARGET_FILE_DIR:${test_target}>")

endforeach()

Expand Down Expand Up @@ -61,12 +61,12 @@ foreach(source_file ${aux})
endif()

target_compile_definitions(${BINARY_NAME}
PRIVATE IGN_TRANSPORT_LOG_BUILD_PATH="$<TARGET_FILE_DIR:${BINARY_NAME}>")
PRIVATE GZ_TRANSPORT_LOG_BUILD_PATH="$<TARGET_FILE_DIR:${BINARY_NAME}>")
endforeach()

# ign log CLI test
if (IGNITION-TOOLS_BINARY_DIRS)
set(IGN_CONFIG_PATH "${CMAKE_BINARY_DIR}/log/test/lib/ruby/ignition")
set(GZ_CONFIG_PATH "${CMAKE_BINARY_DIR}/log/test/lib/ruby/ignition")

add_test(ign_log_record_no_overwrite
ruby ${CMAKE_CURRENT_SOURCE_DIR}/ign_log_record_no_overwrite.rb
Expand All @@ -80,7 +80,7 @@ if (IGNITION-TOOLS_BINARY_DIRS)
ign_log_record_force
PROPERTIES
ENVIRONMENT
"IGN_CONFIG_PATH=${IGN_CONFIG_PATH};IGN_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql"
"GZ_CONFIG_PATH=${GZ_CONFIG_PATH};GZ_TRANSPORT_LOG_SQL_PATH=${PROJECT_SOURCE_DIR}/log/sql"
TIMEOUT 10
)
endif ()
2 changes: 1 addition & 1 deletion log/test/integration/ChirpParams.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace gz
{
// Set the chirping process name
const std::string process =
IGN_TRANSPORT_LOG_BUILD_PATH"/INTEGRATION_topicChirp_aux";
GZ_TRANSPORT_LOG_BUILD_PATH"/INTEGRATION_topicChirp_aux";

// Argument list:
// [0]: Executable name
Expand Down
2 changes: 1 addition & 1 deletion log/test/integration/playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ int main(int argc, char **argv)
setenv("IGN_PARTITION", partition.c_str(), 1);

setenv(gz::transport::log::SchemaLocationEnvVar.c_str(),
IGN_TRANSPORT_LOG_SQL_PATH, 1);
GZ_TRANSPORT_LOG_SQL_PATH, 1);

::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down
2 changes: 1 addition & 1 deletion log/test/integration/recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ int main(int argc, char **argv)
setenv("IGN_PARTITION", partition.c_str(), 1);

setenv(gz::transport::log::SchemaLocationEnvVar.c_str(),
IGN_TRANSPORT_LOG_SQL_PATH, 1);
GZ_TRANSPORT_LOG_SQL_PATH, 1);

::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
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
6 changes: 3 additions & 3 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 All @@ -56,7 +56,7 @@ if (TARGET UNIT_ign_TEST)
UNIT_ign_TEST
PROPERTIES
ENVIRONMENT
"IGN_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>"
"GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>"
)
endif()

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
Loading

0 comments on commit 362c080

Please sign in to comment.