Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect ign instead of using cmake module to check for ignition-tools #192

Merged
merged 4 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ci-bionic/after_make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -x
make install

# Compile examples
cd ../examples
cd ../example
mkdir build
cd build
cmake ..
Expand Down
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ set(IGN_COMMON_MAJOR_VER ${ignition-common1_VERSION_MAJOR})

#--------------------------------------
# Find ignition-tools
ign_find_package(ignition-tools QUIET)
if (ignition-tools_FOUND)
set (HAVE_IGN_TOOLS TRUE)
endif()
find_program(HAVE_IGN_TOOLS ign)

#============================================================================
# Configure the build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ https://ignitionfuel.org/anonymous/test_model_380348669
** Find a model on disk **
```
$ ign fuel locate --name am1
/home/developer/.ignition/fuel/staging_ignitionfuel/alice/am1
/home/developer/.ignition/fuel/fuel.ignitionrobotics.org/alice/am1
```

** C++ Get List models **
Expand Down
2 changes: 1 addition & 1 deletion bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: ubuntu:xenial
image: ubuntu:bionic

pipelines:
default:
Expand Down
16 changes: 8 additions & 8 deletions src/FuelClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ TEST(FuelClient, DownloadWorld)
common::createDirectories("test_cache");

ServerConfig server;
server.URL("https://staging-api.ignitionfuel.org");
server.URL("https://fuel.ignitionrobotics.org");

ClientConfig config;
config.AddServer(server);
Expand All @@ -901,7 +901,7 @@ TEST(FuelClient, DownloadWorld)
{
// Unversioned URL should get the latest available version
common::URI url{
"https://staging-api.ignitionfuel.org/1.0/chapulina/worlds/Empty"};
"https://fuel.ignitionrobotics.org/1.0/chapulina/worlds/Empty"};

// Check it is not cached
std::string cachedPath;
Expand All @@ -917,30 +917,30 @@ TEST(FuelClient, DownloadWorld)

// Check it was downloaded to `1`
EXPECT_EQ(path, common::cwd() +
"/test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1");
"/test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1");
EXPECT_TRUE(common::exists(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1"));
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1"));
EXPECT_TRUE(common::exists(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1/"
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1/"
"empty.world"));

// Check it wasn't downloaded to world root directory
EXPECT_FALSE(common::exists("test_cache/staging-api.ignitionfuel.org/" +
EXPECT_FALSE(common::exists("test_cache/fuel.ignitionrobotics.org/" +
std::string("chapulina/worlds/Empty/empty.world")));

// Check it is cached
auto res3 = client.CachedWorld(url, cachedPath);
EXPECT_TRUE(res3);
EXPECT_EQ(Result(Result::FETCH_ALREADY_EXISTS), res3);
EXPECT_EQ(common::cwd() +
"/test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1",
"/test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1",
cachedPath);
}

// Try using nonexistent URL
{
common::URI url{
"https://staging-api.ignitionfuel.org/1.0/chapulina/worlds/Bad world"};
"https://fuel.ignitionrobotics.org/1.0/chapulina/worlds/Bad world"};
std::string path;
auto result = client.DownloadWorld(url, path);
EXPECT_FALSE(result);
Expand Down
14 changes: 7 additions & 7 deletions src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,25 @@ TEST(CmdLine, ModelListConfigServerUgly)
TEST(CmdLine, ModelListCustomServerPretty)
{
auto output = custom_exec_str(
g_listCmd + " -t model -u https://staging-api.ignitionfuel.org");
g_listCmd + " -t model -u https://fuel.ignitionrobotics.org");

EXPECT_NE(output.find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(output.find("https://fuel.ignitionrobotics.org"),
std::string::npos) << output;
EXPECT_NE(output.find("owners"), std::string::npos) << output;
EXPECT_NE(output.find("models"), std::string::npos) << output;

EXPECT_EQ(output.find("https://api.ignitionfuel.org"), std::string::npos)
<< output;
EXPECT_EQ(output.find("https://staging-api.ignitionfuel.org/1.0/"),
EXPECT_EQ(output.find("https://fuel.ignitionrobotics.org/1.0/"),
std::string::npos) << output;
}

/////////////////////////////////////////////////
TEST(CmdLine, WorldListConfigServerUgly)
{
auto output = custom_exec_str(g_listCmd +
" -t world --raw -u https://staging-api.ignitionfuel.org");
EXPECT_NE(output.find("https://staging-api.ignitionfuel.org/1.0/"),
" -t world --raw -u https://fuel.ignitionrobotics.org");
EXPECT_NE(output.find("https://fuel.ignitionrobotics.org/1.0/"),
std::string::npos) << output;
EXPECT_EQ(output.find("owners"), std::string::npos) << output;
}
Expand All @@ -129,9 +129,9 @@ TEST(CmdLine, WorldListConfigServerUgly)
TEST(CmdLine, WorldListCustomServerPretty)
{
auto output = custom_exec_str(
g_listCmd + " -t world -u https://staging-api.ignitionfuel.org");
g_listCmd + " -t world -u https://fuel.ignitionrobotics.org");

EXPECT_NE(output.find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(output.find("https://fuel.ignitionrobotics.org"),
std::string::npos) << output;
EXPECT_NE(output.find("owners"), std::string::npos) << output;
EXPECT_NE(output.find("worlds"), std::string::npos) << output;
Expand Down
36 changes: 18 additions & 18 deletions src/ign_src_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ TEST(CmdLine, ModelListCustomServerPretty)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listModels("https://staging-api.ignitionfuel.org"));
EXPECT_TRUE(listModels("https://fuel.ignitionrobotics.org"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -111,7 +111,7 @@ TEST(CmdLine, ModelListCustomServerPretty)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand All @@ -125,10 +125,10 @@ TEST(CmdLine, ModelListCustomServerPrettyOwner)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listModels("https://staging-api.ignitionfuel.org",
EXPECT_TRUE(listModels("https://fuel.ignitionrobotics.org",
"openrobotics"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("1 owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -142,7 +142,7 @@ TEST(CmdLine, ModelListCustomServerPrettyOwner)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand Down Expand Up @@ -242,9 +242,9 @@ TEST(CmdLine, WorldListConfigServerUgly)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listWorlds("https://staging-api.ignitionfuel.org", "", "true"));
EXPECT_TRUE(listWorlds("https://fuel.ignitionrobotics.org", "", "true"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find("owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -260,9 +260,9 @@ TEST(CmdLine, WorldListCustomServerPretty)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listWorlds("https://staging-api.ignitionfuel.org"));
EXPECT_TRUE(listWorlds("https://fuel.ignitionrobotics.org"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -272,7 +272,7 @@ TEST(CmdLine, WorldListCustomServerPretty)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand All @@ -286,10 +286,10 @@ TEST(CmdLine, WorldListCustomServerPrettyOwner)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listWorlds("https://staging-api.ignitionfuel.org",
EXPECT_TRUE(listWorlds("https://fuel.ignitionrobotics.org",
"chapulina"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("1 owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -303,7 +303,7 @@ TEST(CmdLine, WorldListCustomServerPrettyOwner)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand Down Expand Up @@ -360,7 +360,7 @@ TEST(CmdLine, WorldDownloadUnversioned)

// Download
EXPECT_TRUE(downloadUrl(
"https://staging-api.ignitionfuel.org/1.0/chapulina/worlds/Empty"));
"https://fuel.ignitionrobotics.org/1.0/chapulina/worlds/Empty"));

// Check output
EXPECT_NE(stdOutBuffer.str().find("Download succeeded"),
Expand All @@ -369,11 +369,11 @@ TEST(CmdLine, WorldDownloadUnversioned)

// Check files
EXPECT_TRUE(ignition::common::isDirectory(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty"));
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty"));
EXPECT_TRUE(ignition::common::isDirectory(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1"));
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1"));
EXPECT_TRUE(ignition::common::isFile(
std::string("test_cache/staging-api.ignitionfuel.org/chapulina/worlds/")
std::string("test_cache/fuel.ignitionrobotics.org/chapulina/worlds/")
+ "Empty/1/empty.world"));

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand Down