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

Fix two tests on Windows #1779

Merged
merged 3 commits into from
Nov 4, 2022
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
14 changes: 7 additions & 7 deletions src/Server_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,9 @@ TEST_P(ServerFixture, AddResourcePaths)
/////////////////////////////////////////////////
TEST_P(ServerFixture, ResolveResourcePaths)
{
ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", "");
ignition::common::setenv("SDF_PATH", "");
ignition::common::setenv("IGN_FILE_PATH", "");
common::setenv("IGN_GAZEBO_RESOURCE_PATH", "");
common::setenv("SDF_PATH", "");
common::setenv("IGN_FILE_PATH", "");

ServerConfig serverConfig;
gazebo::Server server(serverConfig);
Expand Down Expand Up @@ -1143,10 +1143,10 @@ TEST_P(ServerFixture, ResolveResourcePaths)
});

// Make sure the resource path is clear
ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", "");
common::setenv("IGN_GAZEBO_RESOURCE_PATH", "");

// An absolute path should return the same absolute path
test(PROJECT_SOURCE_PATH, PROJECT_SOURCE_PATH, true);
// A valid path should be returned as an absolute path
test(PROJECT_SOURCE_PATH, common::absPath(PROJECT_SOURCE_PATH), true);

// An absolute path, with the file:// prefix, should return the absolute path
test(std::string("file://") +
Expand All @@ -1168,7 +1168,7 @@ TEST_P(ServerFixture, ResolveResourcePaths)

// The model:// URI should not resolve
test("model://include_nested/model.sdf", "", false);
ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH",
common::setenv("IGN_GAZEBO_RESOURCE_PATH",
common::joinPaths(PROJECT_SOURCE_PATH, "test", "worlds", "models"));
// The model:// URI should now resolve because the RESOURCE_PATH has been
// updated.
Expand Down
9 changes: 5 additions & 4 deletions src/SystemLoader_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <sdf/World.hh>

#include <ignition/common/Filesystem.hh>
#include <ignition/common/SystemPaths.hh>
#include "ignition/gazebo/System.hh"
#include "ignition/gazebo/SystemLoader.hh"

Expand Down Expand Up @@ -93,13 +94,13 @@ TEST(SystemLoader, PluginPaths)
for (const auto &s : paths)
{
// the returned path string may not be exact match due to extra '/'
// appended at the end of the string. So use absPath to generate
// a path string that matches the format returned by joinPaths
if (common::absPath(s) == testBuildPath)
// appended at the end of the string. So use NormalizeDirectoryPath
if (common::SystemPaths::NormalizeDirectoryPath(s) ==
common::SystemPaths::NormalizeDirectoryPath(testBuildPath))
{
hasPath = true;
break;
}
}
EXPECT_TRUE(hasPath);
EXPECT_TRUE(hasPath) << testBuildPath;
}