From 7ba440921092e52b13b0d568a25868d451dfdc1b Mon Sep 17 00:00:00 2001 From: Lucas Walter Date: Mon, 21 Mar 2016 20:21:13 -0700 Subject: [PATCH] #408 The require isn't supported, the wait for publishers is redundant, also commenting out the test since it can't be run_tested --- gazebo_plugins/CMakeLists.txt | 9 +++++---- gazebo_plugins/test/camera/camera.cpp | 4 +++- gazebo_plugins/test/camera/camera.test | 3 +-- gazebo_ros/test/empty.world | 13 +++++++++++++ gazebo_ros/test/gazebo_ros.test | 5 +++-- gazebo_ros/test/gazebo_ros2.test | 5 +++-- gazebo_ros/test/gazebo_ros3.test | 19 +++++++++++++++++++ gazebo_ros/test/gazebo_ros_test.cpp | 4 ++-- 8 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 gazebo_ros/test/empty.world create mode 100644 gazebo_ros/test/gazebo_ros3.test diff --git a/gazebo_plugins/CMakeLists.txt b/gazebo_plugins/CMakeLists.txt index 6f6f91360..74539f345 100644 --- a/gazebo_plugins/CMakeLists.txt +++ b/gazebo_plugins/CMakeLists.txt @@ -344,8 +344,9 @@ if (CATKIN_ENABLE_TESTING) test/set_model_state_test/set_model_state_test.cpp) target_link_libraries(set_model_state-test ${catkin_LIBRARIES}) - add_rostest_gtest(camera-test - test/camera/camera.test - test/camera/camera.cpp) - target_link_libraries(camera-test ${catkin_LIBRARIES}) + # Can't run this and the above test together + # add_rostest_gtest(camera-test + # test/camera/camera.test + # test/camera/camera.cpp) + # target_link_libraries(camera-test ${catkin_LIBRARIES}) endif() diff --git a/gazebo_plugins/test/camera/camera.cpp b/gazebo_plugins/test/camera/camera.cpp index 54e7ab3b1..25a2932d3 100644 --- a/gazebo_plugins/test/camera/camera.cpp +++ b/gazebo_plugins/test/camera/camera.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include class CameraTest : public testing::Test @@ -31,6 +31,7 @@ TEST_F(CameraTest, cameraSubscribeTest) &CameraTest::imageCallback, dynamic_cast(this)); +#if 0 // wait for gazebo to start publishing // TODO(lucasw) this isn't really necessary since this test // is purely passive @@ -45,6 +46,7 @@ TEST_F(CameraTest, cameraSubscribeTest) wait_for_topic = false; ros::Duration(0.5).sleep(); } +#endif while (!has_new_image_) { diff --git a/gazebo_plugins/test/camera/camera.test b/gazebo_plugins/test/camera/camera.test index d4016a078..06f58a4e6 100644 --- a/gazebo_plugins/test/camera/camera.test +++ b/gazebo_plugins/test/camera/camera.test @@ -7,6 +7,5 @@ args="-r $(find gazebo_plugins)/test/camera/camera.world" /> + clear_params="true" time-limit="30.0" /> diff --git a/gazebo_ros/test/empty.world b/gazebo_ros/test/empty.world new file mode 100644 index 000000000..532167242 --- /dev/null +++ b/gazebo_ros/test/empty.world @@ -0,0 +1,13 @@ + + + + + + model://sun + + + + model://ground_plane + + + diff --git a/gazebo_ros/test/gazebo_ros.test b/gazebo_ros/test/gazebo_ros.test index 8fc980f17..09992b452 100644 --- a/gazebo_ros/test/gazebo_ros.test +++ b/gazebo_ros/test/gazebo_ros.test @@ -4,8 +4,9 @@ + args="-r $(find gazebo_ros)/test/empty.world" /> + time-limit="10.0" /> + diff --git a/gazebo_ros/test/gazebo_ros2.test b/gazebo_ros/test/gazebo_ros2.test index 1815d79c1..db8ab67b2 100644 --- a/gazebo_ros/test/gazebo_ros2.test +++ b/gazebo_ros/test/gazebo_ros2.test @@ -4,8 +4,9 @@ + args="-r $(find gazebo_ros)/test/empty.world" /> + time-limit="10.0" /> + diff --git a/gazebo_ros/test/gazebo_ros3.test b/gazebo_ros/test/gazebo_ros3.test new file mode 100644 index 000000000..33c9c3d9e --- /dev/null +++ b/gazebo_ros/test/gazebo_ros3.test @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/gazebo_ros/test/gazebo_ros_test.cpp b/gazebo_ros/test/gazebo_ros_test.cpp index 9ebdf6a96..01334752c 100644 --- a/gazebo_ros/test/gazebo_ros_test.cpp +++ b/gazebo_ros/test/gazebo_ros_test.cpp @@ -23,9 +23,9 @@ class GazeboRosTest : public testing::Test } }; -// Test if the camera image is published at all, and that the timestamp +// Test if the clock is published at all, and that the timestamp // is not too long in the past. -TEST_F(GazeboRosTest, cameraSubscribeTest) +TEST_F(GazeboRosTest, clockSubscribeTest) { model_states_sub_ = nh_.subscribe("clock", 1, &GazeboRosTest::clockCallback,