Skip to content

Commit

Permalink
Use find_program to find gz CLI path
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jun 26, 2022
1 parent b7802db commit ffcc1b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions src/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

static const std::string kBinPath(PROJECT_BINARY_PATH);

static const std::string kIgnCommand(
static const std::string kGzCommand(
std::string(BREW_RUBY) + std::string(GZ_PATH) + " sim -s ");

/////////////////////////////////////////////////
Expand Down Expand Up @@ -58,7 +58,7 @@ std::string customExecStr(std::string _cmd)
// See https://github.com/gazebosim/gz-sim/issues/1175
TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(Server))
{
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 " +
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 " +
std::string(PROJECT_SOURCE_PATH) + "/test/worlds/plugins.sdf";

std::cout << "Running command [" << cmd << "]" << std::endl;
Expand All @@ -73,7 +73,7 @@ TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(Server))

// Use GZ_SIM_RESOURCE_PATH instead of specifying the complete path
cmd = std::string("GZ_SIM_RESOURCE_PATH=") +
PROJECT_SOURCE_PATH + "/test/worlds " + kIgnCommand +
PROJECT_SOURCE_PATH + "/test/worlds " + kGzCommand +
" -r -v 4 --iterations 5 " + " plugins.sdf";

std::cout << "Running command [" << cmd << "]" << std::endl;
Expand All @@ -92,7 +92,7 @@ TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(CachedFuelWorld))
{
std::string projectPath = std::string(PROJECT_SOURCE_PATH) + "/test/worlds";
gz::common::setenv("GZ_FUEL_CACHE_PATH", projectPath.c_str());
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5" +
std::string cmd = kGzCommand + " -r -v 4 --iterations 5" +
" https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/Test%20world";
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand All @@ -104,7 +104,7 @@ TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(CachedFuelWorld))
/////////////////////////////////////////////////
TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(GazeboServer))
{
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 " +
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 " +
std::string(PROJECT_SOURCE_PATH) + "/test/worlds/plugins.sdf";

std::cout << "Running command [" << cmd << "]" << std::endl;
Expand All @@ -121,7 +121,7 @@ TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(GazeboServer))
/////////////////////////////////////////////////
TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(Gazebo))
{
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 " +
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 " +
std::string(PROJECT_SOURCE_PATH) + "/test/worlds/plugins.sdf";

std::cout << "Running command [" << cmd << "]" << std::endl;
Expand All @@ -138,7 +138,7 @@ TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(Gazebo))
/////////////////////////////////////////////////
TEST(CmdLine, GZ_UTILS_TEST_DISABLED_ON_WIN32(ResourcePath))
{
std::string cmd = kIgnCommand + " -s -r -v 4 --iterations 1 plugins.sdf";
std::string cmd = kGzCommand + " -s -r -v 4 --iterations 1 plugins.sdf";

// No path
std::string output = customExecStr(cmd);
Expand Down
22 changes: 11 additions & 11 deletions test/integration/log_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static const std::string kBinPath(PROJECT_BINARY_PATH);

// \todo(anyone) Enable tests for OSX once command line works there
#ifndef __APPLE__
static const std::string kIgnCommand(
static const std::string kGzCommand(
"GZ_SIM_SYSTEM_PLUGIN_PATH=" + kBinPath + "/lib LD_LIBRARY_PATH=" +
kBinPath + "/lib:/usr/local/lib:${LD_LIBRARY_PATH} gz sim -s ");
#endif
Expand Down Expand Up @@ -382,7 +382,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogDefaults))

{
// Command line triggers gz.cc, which handles initializing gzLogDirectory
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record " + recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -502,7 +502,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogPaths))
ofs.close();

// Command line triggers gz.cc, which handles initializing gzLogDirectory
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record " + tmpRecordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -625,7 +625,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogPaths))
// Both state and console logs should be stored here.
{
// Command line triggers gz.cc, which handles initializing gzLogDirectory
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record-path " + this->logDir + " " + recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -667,7 +667,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogPaths))
ofs.close();

// Command line triggers gz.cc, which handles initializing gzLogDirectory
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record-path " + cliPath + " " + tmpRecordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -1042,7 +1042,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogOverwrite))
{
// Command line triggers gz.cc, which handles creating a unique path if
// file already exists, so as to not overwrite
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 --log-overwrite "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 --log-overwrite "
+ "--record-path " + this->logDir + " " + recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -1070,7 +1070,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogOverwrite))
{
// Command line triggers gz.cc, which handles creating a unique path if
// file already exists, so as to not overwrite
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record-path " + this->logDir + " " + recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -1432,7 +1432,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogCompressCmdLine))

// Command line triggers gz.cc, which handles creating a unique path if
// file already exists, so as to not overwrite
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 --log-compress "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 --log-compress "
+ "--record-path " + recordPath + " " + recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -1462,7 +1462,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogCompressCmdLine))

// Command line triggers gz.cc, which handles creating a unique path if
// file already exists, so as to not overwrite
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 --log-compress "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 --log-compress "
+ "--record-path " + recordPath + " " + recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;

Expand Down Expand Up @@ -1506,7 +1506,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogResources))
// Log resources from command line
{
// Command line triggers gz.cc, which handles initializing gzLogDirectory
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record --record-resources --record-path " + recordPath + " "
+ recordSdfPath;
std::cout << "Running command [" << cmd << "]" << std::endl;
Expand Down Expand Up @@ -1593,7 +1593,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(LogTopics))
// Log only the /clock topic from command line
{
// Command line triggers gz.cc, which handles initializing gzLogDirectory
std::string cmd = kIgnCommand + " -r -v 4 --iterations 5 "
std::string cmd = kGzCommand + " -r -v 4 --iterations 5 "
+ "--record-topic /clock "
+ "--record-path " + recordPath + " "
+ recordSdfPath;
Expand Down

0 comments on commit ffcc1b8

Please sign in to comment.