Skip to content

Commit

Permalink
Cast paths to string before passing them to testFixture
Browse files Browse the repository at this point in the history
  • Loading branch information
xela-95 committed May 13, 2024
1 parent 4efdb15 commit 2fff1f0
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions tests/camera/CameraTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEST(CameraTest, PluginTest)

// Instantiate test fixture
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model.sdf";
gz::sim::TestFixture fixture(modelPath);
gz::sim::TestFixture fixture(modelPath.string());

int iterations = 1000;

Expand Down Expand Up @@ -229,7 +229,7 @@ TEST(CameraTest, HorizontalVerticalFlip)

// Instantiate test fixture
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model_hor_ver_flip.sdf";
gz::sim::TestFixture fixture(modelPath);
gz::sim::TestFixture fixture(modelPath.string());

int iterations = 1000;
fixture.Server()->Run(/*_blocking=*/true, iterations, /*_paused=*/false);
Expand Down
2 changes: 1 addition & 1 deletion tests/clock/ClockTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TEST(ClockTest, GetSimulationTimeFromClockPort)
gz::common::Console::SetVerbosity(4);
// Instantiate test fixture
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model.sdf";
gz::sim::TestFixture fixture(modelPath);
gz::sim::TestFixture fixture(modelPath.string());

const int iterations = 1000;
const int deltaTns = 1e6; // 1ms
Expand Down
8 changes: 4 additions & 4 deletions tests/commons/ConcurrentInstancesTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ TEST(ConcurrentInstancesTest, StartConcurrentGazeboInstancesOfDifferentModels)
{
auto plannedIterations = 1'000;

gz::sim::TestFixture fixture1(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "dummy_sphere.sdf");
gz::sim::TestFixture fixture2(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "dummy_box.sdf");
gz::sim::TestFixture fixture1(
(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "dummy_sphere.sdf").string());
gz::sim::TestFixture fixture2(
(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "dummy_box.sdf").string());
gz::common::Console::SetVerbosity(4);

fixture1.Finalize();
Expand Down
2 changes: 1 addition & 1 deletion tests/commons/ConfigurationParsingFromFileTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST(ConfigurationParsingTest, LoadPluginsWithYarpConfigurationFile)

auto modelPath
= std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model_configuration_file.sdf";
gz::sim::TestFixture testFixture(modelPath);
gz::sim::TestFixture testFixture(modelPath.string());

yarp::os::NetworkBase::setLocalMode(true);
gz::common::Console::SetVerbosity(4);
Expand Down
2 changes: 1 addition & 1 deletion tests/commons/ConfigurationParsingFromStringTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TEST(ConfigurationParsingTest, LoadPluginsWithYarpConfigurationString)
{
auto modelPath
= std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model_configuration_string.sdf";
gz::sim::TestFixture testFixture(modelPath);
gz::sim::TestFixture testFixture(modelPath.string());
yarp::os::NetworkBase::setLocalMode(true);
gz::common::Console::SetVerbosity(4);

Expand Down
8 changes: 4 additions & 4 deletions tests/controlboard/ControlBoardCommonsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST(ControlBoardCommonsTest, ConfigureControlBoardWithoutInitialCondition)
{
auto modelPath
= std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "pendulum_no_initial_configuration.sdf";
gz::sim::TestFixture testFixture(modelPath);
gz::sim::TestFixture testFixture(modelPath.string());

gz::common::Console::SetVerbosity(4);

Expand All @@ -50,7 +50,7 @@ TEST(ControlBoardCommonsTest, ConfigureControlBoardWithInitialCondition)
{
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_with_initial_configuration.sdf";
gz::sim::TestFixture testFixture(modelPath);
gz::sim::TestFixture testFixture(modelPath.string());

gz::common::Console::SetVerbosity(4);

Expand All @@ -62,7 +62,7 @@ TEST(ControlBoardCommonsTest, ConfigureMultipleControlBoards)
{
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "coupled_pendulum_two_controlboards.sdf";
gz::sim::TestFixture testFixture(modelPath);
gz::sim::TestFixture testFixture(modelPath.string());

bool configured = false;
std::vector<std::string> deviceIds;
Expand Down Expand Up @@ -107,7 +107,7 @@ TEST(ControlBoardCommonsTest, JointPositionLimitsForMultipleJoints)
{
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "coupled_pendulum_two_joints_single_controlboard.sdf";
gz::sim::TestFixture testFixture(modelPath);
gz::sim::TestFixture testFixture(modelPath.string());

std::string deviceScopedName = "model/coupled_pendulum/controlboard_plugin_device";
yarp::dev::PolyDriver* driver;
Expand Down
10 changes: 6 additions & 4 deletions tests/controlboard/ControlBoardOnMultipleGazeboInstancesTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ TEST(ControlBoardOnMultipleGazeboInstances, StartConcurrentGazeboInstances)
unsigned int iterationsToCompleteMotion1 = 0;
unsigned int iterationsToCompleteMotion2 = 0;

gz::sim::TestFixture fixture1(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_multiple_gz_instances.sdf");
gz::sim::TestFixture fixture2(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_multiple_gz_instances.sdf");
gz::sim::TestFixture fixture1(
(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "pendulum_multiple_gz_instances.sdf")
.string());
gz::sim::TestFixture fixture2(
(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "pendulum_multiple_gz_instances.sdf")
.string());
gz::common::Console::SetVerbosity(4);

fixture1
Expand Down
5 changes: 3 additions & 2 deletions tests/controlboard/ControlBoardPositionControlTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ class ControlBoardPositionFixture : public testing::Test
protected:
// void SetUp() override
ControlBoardPositionFixture()
: testFixture{std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_joint_relative_to_parent_link.sdf"}
: testFixture{(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_joint_relative_to_parent_link.sdf")
.string()}
{
gz::common::Console::SetVerbosity(4);

Expand Down
5 changes: 3 additions & 2 deletions tests/controlboard/ControlBoardPositionDirectControlTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ class ControlBoardPositionDirectFixture : public ::testing::Test
protected:
// void SetUp() override
ControlBoardPositionDirectFixture()
: testFixture{std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_joint_relative_to_parent_link.sdf"}
: testFixture{(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR)
/ "pendulum_joint_relative_to_parent_link.sdf")
.string()}
{
gz::common::Console::SetVerbosity(4);

Expand Down
4 changes: 1 addition & 3 deletions tests/controlboard/ControlBoardTorqueControlTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ class ControlBoardTorqueControlFixture : public testing::TestWithParam<std::stri
protected:
// void SetUp() override
ControlBoardTorqueControlFixture()
: testFixture{std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / GetParam()}
: testFixture{(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / GetParam()).string()}
{
std::cerr << "========== Test Parameter: " << GetParam() << std::endl;
gz::common::Console::SetVerbosity(4);

// testFixture = gz::sim::TestFixture{"../../../tests/controlboard/" + GetParam()};

testFixture.
// Use configure callback to get values at startup
OnConfigure([&](const gz::sim::Entity& _worldEntity,
Expand Down
2 changes: 1 addition & 1 deletion tests/forcetorque/ForceTorqueTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEST(ForceTorqueTest, PluginTest)

// Instantiate test fixture
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model.sdf";
gz::sim::TestFixture fixture(modelPath);
gz::sim::TestFixture fixture(modelPath.string());

int iterations = 1000;
fixture.Server()->Run(/*_blocking=*/true, iterations, /*_paused=*/false);
Expand Down
2 changes: 1 addition & 1 deletion tests/imu/ImuTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ImuFixture : public testing::Test
{
protected:
ImuFixture()
: testFixture{std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model.sdf"}
: testFixture{(std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model.sdf").string()}
{
gz::common::Console::SetVerbosity(4);

Expand Down
2 changes: 1 addition & 1 deletion tests/laser/LaserTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEST(LaserTest, PluginTest)

// Instantiate test fixture
auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model.sdf";
gz::sim::TestFixture fixture(modelPath);
gz::sim::TestFixture fixture(modelPath.string());

int iterations = 1000;
fixture.Server()->Run(/*_blocking=*/true, iterations, /*_paused=*/false);
Expand Down

0 comments on commit 2fff1f0

Please sign in to comment.