From 22bd0e53abf90bf0685de4c017831892c9559b1d Mon Sep 17 00:00:00 2001 From: Alessandro Croci Date: Mon, 13 May 2024 14:31:26 +0200 Subject: [PATCH] Cast paths to string before passing them to testFixture --- tests/camera/CameraTest.cc | 8 ++++---- tests/clock/ClockTest.cc | 2 +- tests/commons/ConcurrentInstancesTest.cc | 8 ++++---- tests/commons/ConfigurationParsingFromFileTest.cc | 2 +- tests/commons/ConfigurationParsingFromStringTest.cc | 2 +- tests/controlboard/ControlBoardCommonsTest.cc | 8 ++++---- .../ControlBoardOnMultipleGazeboInstancesTest.cc | 10 ++++++---- tests/controlboard/ControlBoardPositionControlTest.cc | 5 +++-- .../ControlBoardPositionDirectControlTest.cc | 5 +++-- tests/controlboard/ControlBoardTorqueControlTest.cc | 4 +--- tests/forcetorque/ForceTorqueTest.cc | 2 +- tests/imu/ImuTest.cc | 2 +- tests/laser/LaserTest.cc | 2 +- 13 files changed, 31 insertions(+), 29 deletions(-) diff --git a/tests/camera/CameraTest.cc b/tests/camera/CameraTest.cc index f15f32b..adafe77 100644 --- a/tests/camera/CameraTest.cc +++ b/tests/camera/CameraTest.cc @@ -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; @@ -93,7 +93,7 @@ TEST(CameraTest, HorizontalFlip) // Instantiate test fixture auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model_hor_flip.sdf"; - gz::sim::TestFixture fixture(modelPath); + gz::sim::TestFixture fixture(modelPath.string()); int iterations = 1000; fixture.Server()->Run(/*_blocking=*/true, iterations, /*_paused=*/false); @@ -161,7 +161,7 @@ TEST(CameraTest, VerticalFlip) // Instantiate test fixture auto modelPath = std::filesystem::path(CMAKE_CURRENT_SOURCE_DIR) / "model_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); @@ -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); diff --git a/tests/clock/ClockTest.cc b/tests/clock/ClockTest.cc index a5dc080..f88820d 100644 --- a/tests/clock/ClockTest.cc +++ b/tests/clock/ClockTest.cc @@ -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 diff --git a/tests/commons/ConcurrentInstancesTest.cc b/tests/commons/ConcurrentInstancesTest.cc index 43e8209..849a166 100644 --- a/tests/commons/ConcurrentInstancesTest.cc +++ b/tests/commons/ConcurrentInstancesTest.cc @@ -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(); diff --git a/tests/commons/ConfigurationParsingFromFileTest.cc b/tests/commons/ConfigurationParsingFromFileTest.cc index 04b1e4b..4ea3cb9 100644 --- a/tests/commons/ConfigurationParsingFromFileTest.cc +++ b/tests/commons/ConfigurationParsingFromFileTest.cc @@ -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); diff --git a/tests/commons/ConfigurationParsingFromStringTest.cc b/tests/commons/ConfigurationParsingFromStringTest.cc index 83bc409..1c8cfe6 100644 --- a/tests/commons/ConfigurationParsingFromStringTest.cc +++ b/tests/commons/ConfigurationParsingFromStringTest.cc @@ -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); diff --git a/tests/controlboard/ControlBoardCommonsTest.cc b/tests/controlboard/ControlBoardCommonsTest.cc index cba2ca4..2cc5965 100644 --- a/tests/controlboard/ControlBoardCommonsTest.cc +++ b/tests/controlboard/ControlBoardCommonsTest.cc @@ -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); @@ -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); @@ -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 deviceIds; @@ -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; diff --git a/tests/controlboard/ControlBoardOnMultipleGazeboInstancesTest.cc b/tests/controlboard/ControlBoardOnMultipleGazeboInstancesTest.cc index f7db15c..9294043 100644 --- a/tests/controlboard/ControlBoardOnMultipleGazeboInstancesTest.cc +++ b/tests/controlboard/ControlBoardOnMultipleGazeboInstancesTest.cc @@ -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 diff --git a/tests/controlboard/ControlBoardPositionControlTest.cc b/tests/controlboard/ControlBoardPositionControlTest.cc index 4d99e8d..30f6d4a 100644 --- a/tests/controlboard/ControlBoardPositionControlTest.cc +++ b/tests/controlboard/ControlBoardPositionControlTest.cc @@ -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); diff --git a/tests/controlboard/ControlBoardPositionDirectControlTest.cc b/tests/controlboard/ControlBoardPositionDirectControlTest.cc index 970dd61..f50bd59 100644 --- a/tests/controlboard/ControlBoardPositionDirectControlTest.cc +++ b/tests/controlboard/ControlBoardPositionDirectControlTest.cc @@ -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); diff --git a/tests/controlboard/ControlBoardTorqueControlTest.cc b/tests/controlboard/ControlBoardTorqueControlTest.cc index 884618f..da82244 100644 --- a/tests/controlboard/ControlBoardTorqueControlTest.cc +++ b/tests/controlboard/ControlBoardTorqueControlTest.cc @@ -40,13 +40,11 @@ class ControlBoardTorqueControlFixture : public testing::TestWithParamRun(/*_blocking=*/true, iterations, /*_paused=*/false); diff --git a/tests/imu/ImuTest.cc b/tests/imu/ImuTest.cc index 9f226c5..4f698ea 100644 --- a/tests/imu/ImuTest.cc +++ b/tests/imu/ImuTest.cc @@ -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); diff --git a/tests/laser/LaserTest.cc b/tests/laser/LaserTest.cc index 11af2a4..023c2c3 100644 --- a/tests/laser/LaserTest.cc +++ b/tests/laser/LaserTest.cc @@ -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);