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

Backport of #60: Fix macOS/windows tests that failed to load library #101

Merged
merged 1 commit into from
Feb 18, 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
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,19 @@ ign_build_tests(TYPE UNIT SOURCES ${gtest_sources} LIB_DEPS ${rendering_target})
ign_build_tests(TYPE UNIT SOURCES Lidar_TEST.cc LIB_DEPS ${lidar_target})
ign_build_tests(TYPE UNIT SOURCES Camera_TEST.cc LIB_DEPS ${camera_target})
ign_build_tests(TYPE UNIT SOURCES ImuSensor_TEST.cc LIB_DEPS ${imu_target})

set(plugin_test_targets)
list(APPEND plugin_test_targets "UNIT_Camera_TEST")
list(APPEND plugin_test_targets "UNIT_Lidar_TEST")
list(APPEND plugin_test_targets "UNIT_ImuSensor_TEST")

foreach(plugin_test ${plugin_test_targets})
if(TARGET ${plugin_test})
set(_env_vars)
list(APPEND _env_vars "IGN_PLUGIN_PATH=$<TARGET_FILE_DIR:${camera_target}>")
list(APPEND _env_vars "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

set_tests_properties(${plugin_test} PROPERTIES
ENVIRONMENT "${_env_vars}")
endif()
endforeach()
12 changes: 12 additions & 0 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ ign_build_tests(TYPE INTEGRATION
${PROJECT_LIBRARY_TARGET_NAME}-imu
)

foreach(plugin_test ${dri_tests} ${tests})
get_filename_component(BINARY_NAME ${plugin_test} NAME_WE)
set(BINARY_NAME "${TEST_TYPE}_${BINARY_NAME}")
if(TARGET ${BINARY_NAME})
set(_env_vars)
list(APPEND _env_vars "IGN_PLUGIN_PATH=$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>")
list(APPEND _env_vars "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

set_tests_properties(${BINARY_NAME} PROPERTIES
ENVIRONMENT "${_env_vars}")
endif()
endforeach()
4 changes: 0 additions & 4 deletions test/integration/air_pressure_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ TEST_F(AirPressureSensorTest, CreateAirPressure)

// create the sensor using sensor factory
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::AirPressureSensor> sensor =
sf.CreateSensor<ignition::sensors::AirPressureSensor>(airPressureSdf);
ASSERT_NE(nullptr, sensor);
Expand Down Expand Up @@ -173,7 +172,6 @@ TEST_F(AirPressureSensorTest, SensorReadings)
// create the sensor using sensor factory
// try creating without specifying the sensor type and then cast it
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::Sensor> s =
sf.CreateSensor(airPressureSdf);
std::unique_ptr<ignition::sensors::AirPressureSensor> sensor(
Expand Down Expand Up @@ -239,8 +237,6 @@ TEST_F(AirPressureSensorTest, Topic)

// Factory
ignition::sensors::SensorFactory factory;
factory.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH,
"lib"));

// Default topic
{
Expand Down
4 changes: 0 additions & 4 deletions test/integration/altimeter_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ TEST_F(AltimeterSensorTest, CreateAltimeter)

// create the sensor using sensor factory
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::AltimeterSensor> sensor =
sf.CreateSensor<ignition::sensors::AltimeterSensor>(altimeterSdf);
ASSERT_NE(nullptr, sensor);
Expand Down Expand Up @@ -179,7 +178,6 @@ TEST_F(AltimeterSensorTest, SensorReadings)
// create the sensor using sensor factory
// try creating without specifying the sensor type and then cast it
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::Sensor> s =
sf.CreateSensor(altimeterSdf);
std::unique_ptr<ignition::sensors::AltimeterSensor> sensor(
Expand Down Expand Up @@ -267,8 +265,6 @@ TEST_F(AltimeterSensorTest, Topic)

// Factory
ignition::sensors::SensorFactory factory;
factory.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH,
"lib"));

// Default topic
{
Expand Down
1 change: 0 additions & 1 deletion test/integration/camera_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ void CameraSensorTest::ImagesWithBuiltinSDF(const std::string &_renderEngine)

// do the test
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

ignition::sensors::CameraSensor *sensor =
mgr.CreateSensor<ignition::sensors::CameraSensor>(sensorPtr);
Expand Down
1 change: 0 additions & 1 deletion test/integration/depth_camera_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ void DepthCameraSensorTest::ImagesWithBuiltinSDF(

// do the test
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

ignition::sensors::DepthCameraSensor *depthSensor =
mgr.CreateSensor<ignition::sensors::DepthCameraSensor>(sensorPtr);
Expand Down
6 changes: 0 additions & 6 deletions test/integration/gpu_lidar_sensor_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ void GpuLidarSensorTest::CreateGpuLidar(const std::string &_renderEngine)

// Create a sensor manager
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

// Create an scene with a box in it
scene->SetAmbientLight(0.3, 0.3, 0.3);
Expand Down Expand Up @@ -318,7 +317,6 @@ void GpuLidarSensorTest::DetectBox(const std::string &_renderEngine)

// Create a sensor manager
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

// Create a GpuLidarSensor
ignition::sensors::GpuLidarSensor *sensor =
Expand Down Expand Up @@ -462,7 +460,6 @@ void GpuLidarSensorTest::TestThreeBoxes(const std::string &_renderEngine)

// Create a sensor manager
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

// Create a GpuLidarSensors
ignition::sensors::GpuLidarSensor *sensor1 =
Expand Down Expand Up @@ -608,7 +605,6 @@ void GpuLidarSensorTest::VerticalLidar(const std::string &_renderEngine)

// Create a sensor manager
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

// Create a GpuLidarSensor
ignition::sensors::GpuLidarSensor *sensor =
Expand Down Expand Up @@ -726,7 +722,6 @@ void GpuLidarSensorTest::ManualUpdate(const std::string &_renderEngine)

// Create a sensor manager
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

// Create a GpuLidarSensors
ignition::sensors::GpuLidarSensor *sensor1 =
Expand Down Expand Up @@ -819,7 +814,6 @@ void GpuLidarSensorTest::Topic(const std::string &_renderEngine)

// Create a GpuLidarSensor
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));


// Default topic
Expand Down
4 changes: 0 additions & 4 deletions test/integration/imu_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ TEST_F(ImuSensorTest, CreateImu)

// create the sensor using sensor factory
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::ImuSensor> sensor =
sf.CreateSensor<ignition::sensors::ImuSensor>(imuSdf);
ASSERT_NE(nullptr, sensor);
Expand Down Expand Up @@ -114,7 +113,6 @@ TEST_F(ImuSensorTest, SensorReadings)
// create the sensor using sensor factory
// try creating without specifying the sensor type and then cast it
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::Sensor> s =
sf.CreateSensor(imuSdf);
std::unique_ptr<ignition::sensors::ImuSensor> sensor(
Expand Down Expand Up @@ -243,8 +241,6 @@ TEST_F(ImuSensorTest, Topic)

// Factory
ignition::sensors::SensorFactory factory;
factory.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH,
"lib"));

// Default topic
{
Expand Down
4 changes: 0 additions & 4 deletions test/integration/logical_camera_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ TEST_F(LogicalCameraSensorTest, CreateLogicalCamera)

// create the sensor using sensor factory
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::LogicalCameraSensor> sensor =
sf.CreateSensor<ignition::sensors::LogicalCameraSensor>(logicalCameraSdf);
ASSERT_NE(nullptr, sensor);
Expand Down Expand Up @@ -150,7 +149,6 @@ TEST_F(LogicalCameraSensorTest, DetectBox)
// create the sensor using sensor factory
// try creating without specifying the sensor type and then cast it
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::Sensor> s =
sf.CreateSensor(logicalCameraSdf);
std::unique_ptr<ignition::sensors::LogicalCameraSensor> sensor(
Expand Down Expand Up @@ -251,8 +249,6 @@ TEST_F(LogicalCameraSensorTest, Topic)

// Factory
ignition::sensors::SensorFactory factory;
factory.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH,
"lib"));

// Default topic
{
Expand Down
4 changes: 0 additions & 4 deletions test/integration/magnetometer_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ TEST_F(MagnetometerSensorTest, CreateMagnetometer)

// create the sensor using sensor factory
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::MagnetometerSensor> sensor =
sf.CreateSensor<ignition::sensors::MagnetometerSensor>(magnetometerSdf);
ASSERT_NE(nullptr, sensor);
Expand Down Expand Up @@ -184,7 +183,6 @@ TEST_F(MagnetometerSensorTest, SensorReadings)
// create the sensor using sensor factory
// try creating without specifying the sensor type and then cast it
ignition::sensors::SensorFactory sf;
sf.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));
std::unique_ptr<ignition::sensors::Sensor> s =
sf.CreateSensor(magnetometerSdf);
std::unique_ptr<ignition::sensors::MagnetometerSensor> sensor(
Expand Down Expand Up @@ -301,8 +299,6 @@ TEST_F(MagnetometerSensorTest, Topic)

// Factory
ignition::sensors::SensorFactory factory;
factory.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH,
"lib"));

// Default topic
{
Expand Down
1 change: 0 additions & 1 deletion test/integration/rgbd_camera_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF(

// do the test
ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

ignition::sensors::RgbdCameraSensor *rgbdSensor =
mgr.CreateSensor<ignition::sensors::RgbdCameraSensor>(sensorPtr);
Expand Down
1 change: 0 additions & 1 deletion test/integration/thermal_camera_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ void ThermalCameraSensorTest::ImagesWithBuiltinSDF(
root->AddChild(box);

ignition::sensors::Manager mgr;
mgr.AddPluginPaths(ignition::common::joinPaths(PROJECT_BUILD_PATH, "lib"));

ignition::sensors::ThermalCameraSensor *thermalSensor =
mgr.CreateSensor<ignition::sensors::ThermalCameraSensor>(sensorPtr);
Expand Down