moving test_roslib back to ros stack
This commit is contained in:
parent
ff81faec0e
commit
3b447688e1
|
@ -0,0 +1,36 @@
|
|||
cmake_minimum_required(VERSION 2.4.6)
|
||||
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
|
||||
rosbuild_init()
|
||||
rosbuild_genmsg()
|
||||
# unit tests
|
||||
rosbuild_add_pyunit(test/test_md5sums.py)
|
||||
rosbuild_add_pyunit(test/test_roslib.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_exceptions.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_genpy.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_gentools.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_manifest.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_manifestlib.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_message.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_msgs.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_os_detect.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_names.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_network.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_packages.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_params.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_rosenv.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_rospack.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_rostime.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_scriptutil.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_stacks.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_substitution_args.py)
|
||||
rosbuild_add_pyunit(test/test_roslib_xmlrpc.py)
|
||||
|
||||
#integration tests
|
||||
|
||||
rosbuild_add_boost_directories()
|
||||
rosbuild_add_gtest(test/utest test/utest.cpp)
|
||||
rosbuild_link_boost(test/utest thread)
|
||||
|
||||
|
||||
rosbuild_add_gtest(test_package test/package.cpp)
|
||||
target_link_libraries(test_package roslib)
|
|
@ -0,0 +1 @@
|
|||
include $(shell rospack find mk)/cmake.mk
|
|
@ -0,0 +1,17 @@
|
|||
<package>
|
||||
<description brief="roslib tests">
|
||||
Unit tests verifying that roslib is operating as expected.
|
||||
</description>
|
||||
<author>Jeremy Leibs/leibs@willowgarage.com, Ken Conley/kwc@willowgarage.com</author>
|
||||
<license>BSD</license>
|
||||
<review status="test" notes=""/>
|
||||
|
||||
<depend package="roslib" />
|
||||
<depend package="rosunit" />
|
||||
<depend package="std_msgs" />
|
||||
<depend package="std_srvs" />
|
||||
<platform os="ubuntu" version="9.04"/>
|
||||
<platform os="ubuntu" version="9.10"/>
|
||||
<platform os="ubuntu" version="10.04"/>
|
||||
<platform os="macports" version="macports"/>
|
||||
</package>
|
|
@ -0,0 +1,3 @@
|
|||
std_msgs/String[] strings
|
||||
std_msgs/Time[] times
|
||||
std_msgs/MultiArrayLayout[] muls
|
|
@ -0,0 +1 @@
|
|||
SameSubMsg1 a
|
|
@ -0,0 +1 @@
|
|||
SameSubMsg1 b
|
|
@ -0,0 +1,5 @@
|
|||
time t
|
||||
duration d
|
||||
std_msgs/String str_msg
|
||||
std_msgs/String[] str_msg_array
|
||||
int32 i32
|
|
@ -0,0 +1,4 @@
|
|||
int32 i32
|
||||
string str
|
||||
int32[] i32_array
|
||||
bool b
|
|
@ -0,0 +1,2 @@
|
|||
Header header
|
||||
int32 i32
|
|
@ -0,0 +1,5 @@
|
|||
int32 a
|
||||
float32 b
|
||||
string c
|
||||
uint64[10] d
|
||||
float64[] e
|
|
@ -0,0 +1,5 @@
|
|||
int32 a
|
||||
float32 b
|
||||
string c
|
||||
uint64[10] d
|
||||
float64[] e
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
# Lots of comments
|
||||
int32 a #And more comments
|
||||
float32 b
|
||||
string c
|
||||
# And also some white space
|
||||
|
||||
|
||||
uint64[10] d
|
||||
float64[] e
|
||||
|
|
@ -0,0 +1 @@
|
|||
SameSubMsg1 a
|
|
@ -0,0 +1 @@
|
|||
SameSubMsg2 a
|
|
@ -0,0 +1 @@
|
|||
SameSubMsg1[] a
|
|
@ -0,0 +1 @@
|
|||
SameSubMsg2[] a
|
|
@ -0,0 +1,2 @@
|
|||
SameSubMsg1[] a
|
||||
SameSubMsg2[10] b
|
|
@ -0,0 +1,2 @@
|
|||
SameSubMsg2[] a
|
||||
SameSubMsg3[10] b
|
|
@ -0,0 +1,177 @@
|
|||
_rules:
|
||||
rp-nobranch: &id002 {dev-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/trunk',
|
||||
distro-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
wg-nobranch: &id001 {dev-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/trunk',
|
||||
distro-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
wg-ros-pkg: &id003 {dev-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/branches/$STACK_NAME-1.0',
|
||||
distro-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
release: boxturtle
|
||||
stacks:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/branches/$STACK_NAME-1.0',
|
||||
distro-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
arm_navigation:
|
||||
_rules: *id001
|
||||
version: 0.2.2
|
||||
camera_drivers:
|
||||
_rules: *id002
|
||||
version: 0.9.2
|
||||
collision_environment:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
common: {version: 1.0.3}
|
||||
common_msgs: {version: 1.0.0}
|
||||
diagnostics: {version: 1.0.2}
|
||||
driver_common: {version: 1.0.1}
|
||||
executive_python:
|
||||
_rules: *id001
|
||||
version: 0.1.0
|
||||
geometry: {version: 1.0.2}
|
||||
image_common: {version: 1.0.1}
|
||||
image_pipeline: {version: 1.0.0}
|
||||
image_transport_plugins:
|
||||
_rules: *id002
|
||||
version: 0.1.1
|
||||
imu_drivers: {version: 1.0.1}
|
||||
joystick_drivers: {version: 1.0.1}
|
||||
kinematics:
|
||||
_rules: *id001
|
||||
version: 0.1.0
|
||||
laser_drivers: {version: 1.0.4}
|
||||
laser_pipeline: {version: 1.0.1}
|
||||
motion_planners:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
motion_planning_common:
|
||||
_rules: *id001
|
||||
version: 0.2.1
|
||||
motion_planning_environment:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
motion_planning_visualization:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
navigation: {version: 1.0.4}
|
||||
physics_ode: {version: 1.0.4}
|
||||
pr2_apps:
|
||||
_rules: *id001
|
||||
version: 0.2.1
|
||||
pr2_arm_navigation:
|
||||
_rules: *id001
|
||||
version: 0.2.1
|
||||
pr2_arm_navigation_apps:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_arm_navigation_tests:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_calibration:
|
||||
_rules: *id001
|
||||
version: 0.1.2
|
||||
pr2_common:
|
||||
_rules: *id003
|
||||
version: 1.0.2
|
||||
pr2_common_actions:
|
||||
_rules: *id001
|
||||
version: 0.1.3
|
||||
pr2_controllers:
|
||||
_rules: *id003
|
||||
version: 1.0.0
|
||||
pr2_doors:
|
||||
_rules: *id001
|
||||
version: 0.2.9
|
||||
pr2_ethercat_drivers:
|
||||
_rules: *id001
|
||||
version: 1.0.3
|
||||
pr2_gui:
|
||||
_rules: *id003
|
||||
version: 1.0.0
|
||||
pr2_kinematics:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_kinematics_with_constraints:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_mechanism:
|
||||
_rules: *id003
|
||||
version: 1.0.2
|
||||
pr2_navigation:
|
||||
_rules: *id001
|
||||
version: 0.1.1
|
||||
pr2_navigation_apps:
|
||||
_rules: *id001
|
||||
version: 0.1.1
|
||||
pr2_plugs:
|
||||
_rules: *id001
|
||||
version: 0.2.3
|
||||
pr2_power_drivers:
|
||||
_rules: *id001
|
||||
version: 1.0.2
|
||||
pr2_robot:
|
||||
_rules: *id001
|
||||
version: 0.3.7
|
||||
pr2_simulator:
|
||||
_rules: *id003
|
||||
version: 1.0.3
|
||||
pr2_web_apps:
|
||||
_rules: *id001
|
||||
version: 0.3.4
|
||||
robot_calibration:
|
||||
_rules: *id002
|
||||
version: 0.2.0
|
||||
robot_model: {version: 1.0.1}
|
||||
ros:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/rc', distro-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
version: 1.0.1
|
||||
ros_experimental:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/ros/stacks/$STACK_NAME/trunk', distro-svn: 'https://code.ros.org/svn/ros/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
version: 0.1.0
|
||||
simulator_gazebo: {version: 1.0.3}
|
||||
simulator_stage: {version: 1.0.0}
|
||||
slam_gmapping: {version: 1.0.0}
|
||||
sound_drivers: {version: 1.0.3}
|
||||
test_rule_override:
|
||||
_rules:
|
||||
dev-svn: 'https://madeup/stuff/$STACK_NAME/trunk'
|
||||
version: 0.1.3
|
||||
trajectory_filters:
|
||||
_rules: *id001
|
||||
version: 0.2.2
|
||||
vision_opencv: {version: 1.0.1}
|
||||
visualization: {version: 1.0.1}
|
||||
visualization_common: {version: 1.0.1}
|
||||
web_interface:
|
||||
_rules: *id001
|
||||
version: 0.3.15
|
||||
wg_common:
|
||||
_rules: *id001
|
||||
version: 0.1.2
|
||||
wg_pr2_apps:
|
||||
_rules: *id001
|
||||
version: 0.1.1
|
||||
wifi_drivers:
|
||||
_rules: *id001
|
||||
version: 0.1.3
|
||||
variants:
|
||||
- base:
|
||||
stacks: [ros, camera_drivers, common_msgs, common, diagnostics, driver_common,
|
||||
geometry, image_common, image_pipeline, imu_drivers, joystick_drivers, laser_drivers,
|
||||
laser_pipeline, navigation, physics_ode, robot_model, simulator_gazebo, simulator_stage,
|
||||
slam_gmapping, sound_drivers, vision_opencv, visualization_common, visualization]
|
||||
- pr2:
|
||||
extends: base
|
||||
stacks: [image_transport_plugins, pr2_apps, pr2_common, pr2_controllers, pr2_ethercat_drivers,
|
||||
pr2_gui, pr2_mechanism, pr2_power_drivers, pr2_robot, pr2_simulator, web_interface,
|
||||
wifi_drivers]
|
||||
version: 6
|
|
@ -0,0 +1,171 @@
|
|||
_rules:
|
||||
wg-ros-pkg: &id001 {dev-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/trunk',
|
||||
distro-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
release: latest
|
||||
stacks:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/trunk', distro-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
arm_navigation:
|
||||
_rules: *id001
|
||||
version: 0.2.2
|
||||
camera_drivers: {version: 0.9.2}
|
||||
collision_environment:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
common: {version: 1.1.0}
|
||||
common_msgs: {version: 1.1.1}
|
||||
diagnostics: {version: 1.0.2}
|
||||
driver_common: {version: 1.0.1}
|
||||
executive_python:
|
||||
_rules: *id001
|
||||
version: 0.1.0
|
||||
geometry: {version: 1.0.2}
|
||||
image_common: {version: 1.0.1}
|
||||
image_pipeline: {version: 1.1.1}
|
||||
image_transport_plugins: {version: 0.1.1}
|
||||
imu_drivers: {version: 1.0.1}
|
||||
joystick_drivers: {version: 1.0.1}
|
||||
kinematics:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
laser_drivers: {version: 1.0.4}
|
||||
laser_pipeline: {version: 1.0.1}
|
||||
motion_planners:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
motion_planning_common:
|
||||
_rules: *id001
|
||||
version: 0.2.1
|
||||
motion_planning_environment:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/trunk',
|
||||
distro-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/wg-ros-pkg/stacks/$STACK_NAME/tags/$STACK_NAME-$STACK_VERSION',
|
||||
source-tarball: 'http://ros.org/download/stacks/$STACK_NAME/$STACK_NAME-$STACK_VERSION.tar.bz2'}
|
||||
version: 0.2.0
|
||||
motion_planning_visualization:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
navigation: {version: 1.0.4}
|
||||
navigation_experimental: {version: 0.1.0}
|
||||
physics_ode: {version: 1.0.4}
|
||||
point_cloud_perception: {version: 0.1.0}
|
||||
pr2_apps:
|
||||
_rules: *id001
|
||||
version: 0.2.1
|
||||
pr2_arm_navigation:
|
||||
_rules: *id001
|
||||
version: 0.2.1
|
||||
pr2_arm_navigation_apps:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_arm_navigation_tests:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_calibration:
|
||||
_rules: *id001
|
||||
version: 0.3.0
|
||||
pr2_common:
|
||||
_rules: *id001
|
||||
version: 1.0.2
|
||||
pr2_common_actions:
|
||||
_rules: *id001
|
||||
version: 0.1.3
|
||||
pr2_controllers:
|
||||
_rules: *id001
|
||||
version: 1.0.1
|
||||
pr2_doors:
|
||||
_rules: *id001
|
||||
version: 0.2.9
|
||||
pr2_ethercat_drivers:
|
||||
_rules: *id001
|
||||
version: 1.0.3
|
||||
pr2_gui:
|
||||
_rules: *id001
|
||||
version: 1.0.0
|
||||
pr2_kinematics:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_kinematics_with_constraints:
|
||||
_rules: *id001
|
||||
version: 0.2.0
|
||||
pr2_mechanism:
|
||||
_rules: *id001
|
||||
version: 1.0.1
|
||||
pr2_navigation:
|
||||
_rules: *id001
|
||||
version: 0.1.1
|
||||
pr2_navigation_apps:
|
||||
_rules: *id001
|
||||
version: 0.1.1
|
||||
pr2_plugs:
|
||||
_rules: *id001
|
||||
version: 0.2.4
|
||||
pr2_power_drivers:
|
||||
_rules: *id001
|
||||
version: 1.0.2
|
||||
pr2_robot:
|
||||
_rules: *id001
|
||||
version: 0.3.7
|
||||
pr2_simulator:
|
||||
_rules: *id001
|
||||
version: 1.0.3
|
||||
pr2_web_apps:
|
||||
_rules: *id001
|
||||
version: 0.3.5
|
||||
robot_calibration: {version: 0.2.1}
|
||||
robot_model: {version: 1.0.1}
|
||||
ros:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/rc', distro-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/$RELEASE_NAME',
|
||||
release-svn: 'https://code.ros.org/svn/ros/stacks/ros/tags/$STACK_NAME-$STACK_VERSION'}
|
||||
version: 1.1.1
|
||||
simulator_gazebo: {version: 1.1.1}
|
||||
simulator_stage: {version: 1.0.0}
|
||||
slam_gmapping: {version: 1.1.0}
|
||||
sound_drivers: {version: 1.0.3}
|
||||
texas_drivers:
|
||||
_rules: *id001
|
||||
version: 0.2.10
|
||||
trajectory_filters:
|
||||
_rules: *id001
|
||||
version: 0.2.2
|
||||
vision_opencv: {version: 1.1.0}
|
||||
visualization:
|
||||
_rules: {dev-svn: 'https://code.ros.org/svn/ros-pkg/stacks/$STACK_NAME/branches/visualization-1.0'}
|
||||
version: 1.0.2
|
||||
visualization_common: {version: 1.0.1}
|
||||
web_interface:
|
||||
_rules: *id001
|
||||
version: 0.3.16
|
||||
wg_common:
|
||||
_rules: *id001
|
||||
version: 0.1.2
|
||||
wg_pr2_apps:
|
||||
_rules: *id001
|
||||
version: 0.1.1
|
||||
wifi_drivers:
|
||||
_rules: *id001
|
||||
version: 0.1.3
|
||||
variants:
|
||||
- base:
|
||||
stacks: [ros, camera_drivers, common_msgs, common, diagnostics, driver_common,
|
||||
geometry, image_common, image_transport_plugins, image_pipeline, imu_drivers,
|
||||
joystick_drivers, laser_drivers, laser_pipeline, navigation, physics_ode, robot_model,
|
||||
point_cloud_perception, simulator_gazebo, simulator_stage, slam_gmapping, sound_drivers,
|
||||
vision_opencv, visualization_common, visualization]
|
||||
- pr2:
|
||||
extends: base
|
||||
stacks: [pr2_common, pr2_controllers, pr2_ethercat_drivers, pr2_gui,
|
||||
pr2_mechanism, pr2_power_drivers, pr2_robot, pr2_simulator]
|
||||
- pr2all:
|
||||
extends: pr2
|
||||
stacks: [arm_navigation, collision_environment, kinematics, motion_planners, motion_planning_common,
|
||||
motion_planning_environment, motion_planning_visualization, pr2_apps, pr2_arm_navigation,
|
||||
pr2_arm_navigation_apps, pr2_arm_navigation_tests, pr2_calibration,
|
||||
pr2_common_actions, pr2_doors, pr2_kinematics, pr2_kinematics_with_constraints, pr2_navigation,
|
||||
pr2_navigation_apps, pr2_plugs,
|
||||
pr2_web_apps, robot_calibration, trajectory_filters, web_interface, wg_common,
|
||||
wg_pr2_apps, wifi_drivers]
|
||||
version: '$Revision: 468 $'
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
# this node only exists to test find_node functionality
|
||||
|
||||
print "hello"
|
|
@ -0,0 +1 @@
|
|||
not xml
|
|
@ -0,0 +1,20 @@
|
|||
<notpackage>
|
||||
<description brief="a brief description">Line 1
|
||||
Line 2
|
||||
</description>
|
||||
<author>The authors
|
||||
go here</author>
|
||||
<license>Public Domain
|
||||
with other stuff</license>
|
||||
<url>http://pr.willowgarage.com/package/</url>
|
||||
<logo>http://www.willowgarage.com/files/willowgarage/robot10.jpg</logo>
|
||||
<depend package="pkgname" />
|
||||
<depend package="common"/>
|
||||
<export>
|
||||
<cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -lros"/>
|
||||
<cpp os="osx" cflags="-I${prefix}/include" lflags="-L${prefix}/lib -lrosthread -framework CoreServices"/>
|
||||
</export>
|
||||
<rosdep name="python" />
|
||||
<rosdep name="bar" />
|
||||
<rosdep name="baz" />
|
||||
</notpackage>
|
|
@ -0,0 +1,11 @@
|
|||
<package>
|
||||
<description brief="a brief description">Line 1
|
||||
</description>
|
||||
<description brief="a brief second description">Second description
|
||||
</description>
|
||||
|
||||
<author>The authors
|
||||
go here</author>
|
||||
<license>Public Domain
|
||||
with other stuff</license>
|
||||
</package>
|
|
@ -0,0 +1,20 @@
|
|||
<package>
|
||||
<description brief="a brief description">Line 1
|
||||
Line 2
|
||||
</description>
|
||||
<author>The authors
|
||||
go here</author>
|
||||
<license>Public Domain
|
||||
with other stuff</license>
|
||||
<url>http://pr.willowgarage.com/package/</url>
|
||||
<logo>http://www.willowgarage.com/files/willowgarage/robot10.jpg</logo>
|
||||
<depend package="pkgname" />
|
||||
<depend package="common"/>
|
||||
<export>
|
||||
<cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -lros"/>
|
||||
<cpp os="osx" cflags="-I${prefix}/include" lflags="-L${prefix}/lib -lrosthread -framework CoreServices"/>
|
||||
</export>
|
||||
<rosdep name="python" />
|
||||
<rosdep name="bar" />
|
||||
<rosdep name="baz" />
|
||||
</package>
|
|
@ -0,0 +1,13 @@
|
|||
<stack>
|
||||
<description brief="a brief description">Line 1
|
||||
Line 2
|
||||
</description>
|
||||
<author>The authors
|
||||
go here</author>
|
||||
<license>Public Domain
|
||||
with other stuff</license>
|
||||
<url>http://ros.org/stack/</url>
|
||||
<logo>http://www.willowgarage.com/files/willowgarage/robot10.jpg</logo>
|
||||
<depend stack="stackname" />
|
||||
<depend stack="common"/>
|
||||
</stack>
|
|
@ -0,0 +1 @@
|
|||
int32 x=1
|
|
@ -0,0 +1 @@
|
|||
int32 x=2
|
|
@ -0,0 +1 @@
|
|||
int32 x=10
|
|
@ -0,0 +1,3 @@
|
|||
# protect against aliasing
|
||||
string s=u
|
||||
int32 a
|
|
@ -0,0 +1,2 @@
|
|||
# protect against aliasing
|
||||
string s=uint32 a
|
|
@ -0,0 +1,3 @@
|
|||
int32 a
|
||||
int32 b
|
||||
int32 c
|
|
@ -0,0 +1,2 @@
|
|||
int32 a
|
||||
int32 b
|
|
@ -0,0 +1,4 @@
|
|||
int32 a
|
||||
int32 b
|
||||
int32 c
|
||||
int32 d
|
|
@ -0,0 +1,3 @@
|
|||
int32 a1
|
||||
int32 b
|
||||
int32 c
|
|
@ -0,0 +1,3 @@
|
|||
uint32 a
|
||||
int32 b
|
||||
int32 c
|
|
@ -0,0 +1 @@
|
|||
int32 x=123456
|
|
@ -0,0 +1 @@
|
|||
int32 x = 123456
|
|
@ -0,0 +1,3 @@
|
|||
#x is a value
|
||||
int32 x=123456 #a constant
|
||||
#i'm done
|
|
@ -0,0 +1 @@
|
|||
string foo="#bar
|
|
@ -0,0 +1,3 @@
|
|||
#blah
|
||||
string foo ="#bar
|
||||
#b
|
|
@ -0,0 +1,6 @@
|
|||
int32 x=123
|
||||
int32 y=234
|
||||
int32 z=345
|
||||
float32 a=1.0
|
||||
float32 b=2.0
|
||||
float32 pi=3.14159
|
|
@ -0,0 +1,6 @@
|
|||
int32 x = 123
|
||||
int32 y = 234
|
||||
int32 z = 345
|
||||
float32 a= 1.0
|
||||
float32 b= 2.0
|
||||
float32 pi = 3.14159
|
|
@ -0,0 +1 @@
|
|||
acffd30cd6b6de30f120938c17c593fb log
|
|
@ -0,0 +1 @@
|
|||
roslib/Log log
|
|
@ -0,0 +1,3 @@
|
|||
#commented
|
||||
roslib/Log log
|
||||
#another comment
|
|
@ -0,0 +1,4 @@
|
|||
#comment. note the stripped package name
|
||||
Log log
|
||||
|
||||
#comment
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
### Just a comment
|
|
@ -0,0 +1,6 @@
|
|||
# A comment
|
||||
|
||||
# With multiple lines
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
int32 field
|
|
@ -0,0 +1,2 @@
|
|||
#comment before
|
||||
int32 field
|
|
@ -0,0 +1,2 @@
|
|||
int32 field
|
||||
#comment after
|
|
@ -0,0 +1 @@
|
|||
int32 field
|
|
@ -0,0 +1,5 @@
|
|||
int32 field #field does something
|
||||
|
||||
|
||||
|
||||
#the end
|
|
@ -0,0 +1,7 @@
|
|||
int32 a
|
||||
acffd30cd6b6de30f120938c17c593fb log
|
||||
string s
|
||||
a9c97c1d230cfc112e270351a944ee47 time
|
||||
int32 b
|
||||
duration d
|
||||
time t
|
|
@ -0,0 +1,14 @@
|
|||
# comment about a
|
||||
int32 a
|
||||
# comment about log
|
||||
roslib/Log log
|
||||
# comment about s
|
||||
string s
|
||||
# comment about time
|
||||
roslib/Clock time
|
||||
# comment about b
|
||||
int32 b
|
||||
# comment about d
|
||||
duration d
|
||||
# comment about t
|
||||
time t
|
|
@ -0,0 +1,7 @@
|
|||
int32 a
|
||||
Log log
|
||||
string s
|
||||
Clock time
|
||||
int32 b
|
||||
duration d
|
||||
time t
|
|
@ -0,0 +1,16 @@
|
|||
# short comment about a
|
||||
int32 a #a
|
||||
# short comment about log
|
||||
Log log #log
|
||||
#
|
||||
# short comment about s
|
||||
string s #s
|
||||
# short comment about time
|
||||
Clock time #time
|
||||
# short comment about b
|
||||
int32 b #b
|
||||
# short comment about d
|
||||
duration d #d
|
||||
# short comment about t
|
||||
time t # t
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
int32 a
|
||||
roslib/Log log
|
||||
|
||||
string s
|
||||
roslib/Clock time
|
||||
int32 b
|
||||
duration d
|
||||
time t
|
|
@ -0,0 +1 @@
|
|||
int32 x=123456
|
|
@ -0,0 +1 @@
|
|||
int32 x = 123456
|
|
@ -0,0 +1,3 @@
|
|||
#x is a value
|
||||
int32 x=123456 #a constant
|
||||
#i'm done
|
|
@ -0,0 +1 @@
|
|||
string foo="#bar
|
|
@ -0,0 +1,3 @@
|
|||
#blah
|
||||
string foo ="#bar
|
||||
#b
|
|
@ -0,0 +1,6 @@
|
|||
int32 x=123
|
||||
int32 y=234
|
||||
int32 z=345
|
||||
float32 a=1.0
|
||||
float32 b=2.0
|
||||
float32 pi=3.14159
|
|
@ -0,0 +1,6 @@
|
|||
int32 x = 123
|
||||
int32 y = 234
|
||||
int32 z = 345
|
||||
float32 a= 1.0
|
||||
float32 b= 2.0
|
||||
float32 pi = 3.14159
|
|
@ -0,0 +1 @@
|
|||
roslib/Log log
|
|
@ -0,0 +1 @@
|
|||
Log log
|
|
@ -0,0 +1,3 @@
|
|||
#commented
|
||||
roslib/Log log
|
||||
#another comment
|
|
@ -0,0 +1,4 @@
|
|||
#comment. note the stripped package name
|
||||
Log log
|
||||
|
||||
#comment
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
### Just a comment
|
|
@ -0,0 +1,6 @@
|
|||
# A comment
|
||||
|
||||
# With multiple lines
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
int32 field
|
|
@ -0,0 +1,2 @@
|
|||
#comment before
|
||||
int32 field
|
|
@ -0,0 +1,2 @@
|
|||
int32 field
|
||||
#comment after
|
|
@ -0,0 +1 @@
|
|||
int32 field
|
|
@ -0,0 +1,5 @@
|
|||
int32 field #field does something
|
||||
|
||||
|
||||
|
||||
#the end
|
|
@ -0,0 +1,7 @@
|
|||
int32 a
|
||||
roslib/Log log
|
||||
string s
|
||||
roslib/Clock time
|
||||
int32 b
|
||||
duration d
|
||||
time t
|
|
@ -0,0 +1,14 @@
|
|||
# comment about a
|
||||
int32 a
|
||||
# comment about log
|
||||
roslib/Log log
|
||||
# comment about s
|
||||
string s
|
||||
# comment about time
|
||||
roslib/Clock time
|
||||
# comment about b
|
||||
int32 b
|
||||
# comment about d
|
||||
duration d
|
||||
# comment about t
|
||||
time t
|
|
@ -0,0 +1,7 @@
|
|||
int32 a
|
||||
Log log
|
||||
string s
|
||||
Clock time
|
||||
int32 b
|
||||
duration d
|
||||
time t
|
|
@ -0,0 +1,16 @@
|
|||
# short comment about a
|
||||
int32 a #a
|
||||
# short comment about log
|
||||
Log log #log
|
||||
#
|
||||
# short comment about s
|
||||
string s #s
|
||||
# short comment about time
|
||||
Clock time #time
|
||||
# short comment about b
|
||||
int32 b #b
|
||||
# short comment about d
|
||||
duration d #d
|
||||
# short comment about t
|
||||
time t # t
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
int32 a
|
||||
roslib/Log log
|
||||
|
||||
string s
|
||||
roslib/Clock time
|
||||
int32 b
|
||||
duration d
|
||||
time t
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ros/package.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
using namespace ros;
|
||||
|
||||
TEST(Package, getPath)
|
||||
{
|
||||
std::string path = package::getPath("roslib");
|
||||
printf("Path: %s\n", path.c_str());
|
||||
ASSERT_FALSE(path.empty());
|
||||
}
|
||||
|
||||
TEST(Package, getAll)
|
||||
{
|
||||
using package::V_string;
|
||||
V_string packages;
|
||||
ASSERT_TRUE(package::getAll(packages));
|
||||
ASSERT_FALSE(packages.empty());
|
||||
|
||||
V_string::iterator it = packages.begin();
|
||||
V_string::iterator end = packages.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
printf("Package: %s\n", it->c_str());
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<package>
|
||||
<description brief="bar">
|
||||
|
||||
bar
|
||||
|
||||
</description>
|
||||
<author>Ken Conley</author>
|
||||
<license>BSD</license>
|
||||
<review status="unreviewed" notes=""/>
|
||||
<url>http://ros.org/wiki/bar</url>
|
||||
|
||||
</package>
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<package>
|
||||
<description brief="foo">
|
||||
|
||||
foo
|
||||
|
||||
</description>
|
||||
<author>Ken Conley</author>
|
||||
<license>BSD</license>
|
||||
<review status="unreviewed" notes=""/>
|
||||
<url>http://ros.org/wiki/foo</url>
|
||||
|
||||
</package>
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<package>
|
||||
<description brief="foo">
|
||||
|
||||
foo
|
||||
|
||||
</description>
|
||||
<author>Ken Conley</author>
|
||||
<license>BSD</license>
|
||||
<review status="unreviewed" notes=""/>
|
||||
<url>http://ros.org/wiki/foo</url>
|
||||
|
||||
</package>
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<package>
|
||||
<description brief="roslib tests">
|
||||
Unit tests verifying that roslib is operating as expected.
|
||||
</description>
|
||||
<author>none</author>
|
||||
<license>BSD</license>
|
||||
<platform os="test_os" version="test_version"/>
|
||||
</package>
|
|
@ -0,0 +1,9 @@
|
|||
<stack>
|
||||
<description brief="bar">
|
||||
bar
|
||||
</description>
|
||||
<author>Ken Conley</author>
|
||||
<license>BSD</license>
|
||||
</stack>
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<stack>
|
||||
<description brief="foo">
|
||||
foo
|
||||
</description>
|
||||
<author>Ken Conley</author>
|
||||
<license>BSD</license>
|
||||
</stack>
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<package>
|
||||
<description brief="foo">
|
||||
foo
|
||||
</description>
|
||||
<author>Ken Conley</author>
|
||||
<license>BSD</license>
|
||||
</package>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
../stack_tests/s1
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Revision $Id$
|
||||
|
||||
import roslib; roslib.load_manifest('test_roslib')
|
||||
|
||||
import unittest
|
||||
import rosunit
|
||||
from test_roslib.msg import *
|
||||
|
||||
|
||||
class TestMd5sums(unittest.TestCase):
|
||||
|
||||
def test_field_name_change(self):
|
||||
self.assertNotEquals(FieldNameChange1._md5sum, FieldNameChange2._md5sum)
|
||||
|
||||
def test_type_name_change(self):
|
||||
self.assertEquals(TypeNameChange1._md5sum, TypeNameChange2._md5sum)
|
||||
|
||||
def test_type_name_change_array(self):
|
||||
self.assertEquals(TypeNameChangeArray1._md5sum, TypeNameChangeArray2._md5sum)
|
||||
|
||||
def test_type_name_change_complex(self):
|
||||
self.assertEquals(TypeNameChangeComplex1._md5sum, TypeNameChangeComplex2._md5sum)
|
||||
|
||||
if __name__ == '__main__':
|
||||
rosunit.unitrun('test_roslib', 'test_md5sums', TestMd5sums, coverage_packages=[])
|
|
@ -0,0 +1,61 @@
|
|||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2009, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
import roslib; roslib.load_manifest('test_roslib')
|
||||
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import rosunit
|
||||
|
||||
class RoslibTest(unittest.TestCase):
|
||||
|
||||
def test_load_manifest(self):
|
||||
# this is a bit of a noop as it's a prerequisite of running with rosunit
|
||||
import roslib
|
||||
roslib.load_manifest('test_roslib')
|
||||
|
||||
def test_interactive(self):
|
||||
import roslib
|
||||
import roslib.scriptutil
|
||||
|
||||
# make sure that it's part of high-level API
|
||||
self.failIf(roslib.is_interactive(), "interactive should be false by default")
|
||||
for v in [True, False]:
|
||||
roslib.set_interactive(v)
|
||||
self.assertEquals(v, roslib.is_interactive())
|
||||
self.assertEquals(v, roslib.scriptutil.is_interactive())
|
||||
|
||||
if __name__ == '__main__':
|
||||
rosunit.unitrun('test_roslib', 'test_roslib_module', RoslibTest, coverage_packages=['roslib'])
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2009, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
import roslib; roslib.load_manifest('test_roslib')
|
||||
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import rosunit
|
||||
|
||||
class RoslibExceptionsTest(unittest.TestCase):
|
||||
|
||||
def test_exceptions(self):
|
||||
from roslib.exceptions import ROSLibException
|
||||
self.assert_(isinstance(ROSLibException(), Exception))
|
||||
|
||||
if __name__ == '__main__':
|
||||
rosunit.unitrun('test_roslib', 'test_exceptions', RoslibExceptionsTest, coverage_packages=['roslib.exceptions'])
|
||||
|
|
@ -0,0 +1,503 @@
|
|||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Revision $Id$
|
||||
|
||||
NAME = 'test_genpy'
|
||||
import roslib; roslib.load_manifest('test_roslib')
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
import cStringIO
|
||||
import time
|
||||
|
||||
import rosunit
|
||||
|
||||
# NOTE: roslib.genpy is in the roslib package to prevent circular
|
||||
# dependencies on messages in the roslib package
|
||||
# (Header/Time/Duration)
|
||||
|
||||
class TestGenpy(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
## Test genpy.reduce_pattern
|
||||
def test_reduce_pattern(self):
|
||||
tests = [
|
||||
('', ''),
|
||||
('hhhh', '4h'),
|
||||
('hhhhi', '4hi'),
|
||||
('hhhhiiiibbb', '4h4i3b'),
|
||||
('1h2h3h', '1h2h3h'),
|
||||
('hIi', 'hIi'),
|
||||
('66h', '66h'),
|
||||
('%ss', '%ss'), #don't reduce strings with format chars in them
|
||||
('<I', '<I'),
|
||||
('<11s', '<11s'),
|
||||
]
|
||||
from roslib.genpy import reduce_pattern
|
||||
for input, result in tests:
|
||||
self.assertEquals(result, reduce_pattern(input))
|
||||
def test_is_simple(self):
|
||||
from roslib.genpy import is_simple
|
||||
for t in ['uint8', 'int8', 'uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'float32', 'float64', 'byte', 'char']:
|
||||
self.assert_(is_simple(t))
|
||||
def test_SIMPLE_TYPES(self):
|
||||
import roslib.msgs
|
||||
import roslib.genpy
|
||||
# tripwire to make sure we don't add builtin types without making sure that simple types has been updated
|
||||
self.assertEquals(set(['string', 'time', 'duration']),
|
||||
set(roslib.msgs.BUILTIN_TYPES) - set(roslib.genpy.SIMPLE_TYPES))
|
||||
def test_is_special(self):
|
||||
from roslib.genpy import is_special
|
||||
for t in ['time', 'duration', 'Header']:
|
||||
self.assert_(is_special(t))
|
||||
def test_Simple(self):
|
||||
from roslib.genpy import get_special
|
||||
self.assertEquals('import roslib.rostime', get_special('time').import_str)
|
||||
self.assertEquals('import roslib.rostime', get_special('duration').import_str)
|
||||
self.assertEquals('import std_msgs.msg', get_special('Header').import_str)
|
||||
|
||||
self.assertEquals('roslib.rostime.Time()', get_special('time').constructor)
|
||||
self.assertEquals('roslib.rostime.Duration()', get_special('duration').constructor)
|
||||
self.assertEquals('std_msgs.msg._Header.Header()', get_special('Header').constructor)
|
||||
|
||||
self.assertEquals('self.foo.canon()', get_special('time').get_post_deserialize('self.foo'))
|
||||
self.assertEquals('bar.canon()', get_special('time').get_post_deserialize('bar'))
|
||||
self.assertEquals('self.foo.canon()', get_special('duration').get_post_deserialize('self.foo'))
|
||||
self.assertEquals(None, get_special('Header').get_post_deserialize('self.foo'))
|
||||
|
||||
def test_compute_post_deserialize(self):
|
||||
from roslib.genpy import compute_post_deserialize
|
||||
self.assertEquals('self.bar.canon()', compute_post_deserialize('time', 'self.bar'))
|
||||
self.assertEquals('self.bar.canon()', compute_post_deserialize('duration', 'self.bar'))
|
||||
self.assertEquals(None, compute_post_deserialize('Header', 'self.bar'))
|
||||
|
||||
self.assertEquals(None, compute_post_deserialize('int8', 'self.bar'))
|
||||
self.assertEquals(None, compute_post_deserialize('string', 'self.bar'))
|
||||
|
||||
def test_compute_struct_pattern(self):
|
||||
from roslib.genpy import compute_struct_pattern
|
||||
self.assertEquals(None, compute_struct_pattern(None))
|
||||
self.assertEquals(None, compute_struct_pattern([]))
|
||||
# string should immediately bork any simple types
|
||||
self.assertEquals(None, compute_struct_pattern(['string']))
|
||||
self.assertEquals(None, compute_struct_pattern(['uint32', 'string']))
|
||||
self.assertEquals(None, compute_struct_pattern(['string', 'int32']))
|
||||
# array types should not compute
|
||||
self.assertEquals(None, compute_struct_pattern(['uint32[]']))
|
||||
self.assertEquals(None, compute_struct_pattern(['uint32[1]']))
|
||||
|
||||
self.assertEquals("B", compute_struct_pattern(['uint8']))
|
||||
self.assertEquals("BB", compute_struct_pattern(['uint8', 'uint8']))
|
||||
self.assertEquals("B", compute_struct_pattern(['char']))
|
||||
self.assertEquals("BB", compute_struct_pattern(['char', 'char']))
|
||||
self.assertEquals("b", compute_struct_pattern(['byte']))
|
||||
self.assertEquals("bb", compute_struct_pattern(['byte', 'byte']))
|
||||
self.assertEquals("b", compute_struct_pattern(['int8']))
|
||||
self.assertEquals("bb", compute_struct_pattern(['int8', 'int8']))
|
||||
self.assertEquals("H", compute_struct_pattern(['uint16']))
|
||||
self.assertEquals("HH", compute_struct_pattern(['uint16', 'uint16']))
|
||||
self.assertEquals("h", compute_struct_pattern(['int16']))
|
||||
self.assertEquals("hh", compute_struct_pattern(['int16', 'int16']))
|
||||
self.assertEquals("I", compute_struct_pattern(['uint32']))
|
||||
self.assertEquals("II", compute_struct_pattern(['uint32', 'uint32']))
|
||||
self.assertEquals("i", compute_struct_pattern(['int32']))
|
||||
self.assertEquals("ii", compute_struct_pattern(['int32', 'int32']))
|
||||
self.assertEquals("Q", compute_struct_pattern(['uint64']))
|
||||
self.assertEquals("QQ", compute_struct_pattern(['uint64', 'uint64']))
|
||||
self.assertEquals("q", compute_struct_pattern(['int64']))
|
||||
self.assertEquals("qq", compute_struct_pattern(['int64', 'int64']))
|
||||
self.assertEquals("f", compute_struct_pattern(['float32']))
|
||||
self.assertEquals("ff", compute_struct_pattern(['float32', 'float32']))
|
||||
self.assertEquals("d", compute_struct_pattern(['float64']))
|
||||
self.assertEquals("dd", compute_struct_pattern(['float64', 'float64']))
|
||||
|
||||
self.assertEquals("bBhHiIqQfd", compute_struct_pattern(['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64', 'float32', 'float64']))
|
||||
|
||||
def test_flatten(self):
|
||||
from roslib.msgs import register, MsgSpec
|
||||
from roslib.genpy import flatten
|
||||
|
||||
simple = MsgSpec(['string'], ['data'], [], 'string data\n')
|
||||
simple2 = MsgSpec(['string', 'int32'], ['data', 'data2'], [], 'string data\nint32 data2\n')
|
||||
self.assertEquals(simple, flatten(simple))
|
||||
self.assertEquals(simple2, flatten(simple2))
|
||||
|
||||
b1 = MsgSpec(['int8'], ['data'], [], 'X')
|
||||
b2 = MsgSpec(['f_msgs/Base'], ['data'], [], 'X')
|
||||
b3 = MsgSpec(['f_msgs/Base2', 'f_msgs/Base2'], ['data3', 'data4'], [], 'X')
|
||||
b4 = MsgSpec(['f_msgs/Base3', 'f_msgs/Base3'], ['dataA', 'dataB'], [], 'X')
|
||||
register('f_msgs/Base', b1)
|
||||
register('f_msgs/Base2', b2)
|
||||
register('f_msgs/Base3', b3)
|
||||
register('f_msgs/Base4', b4)
|
||||
|
||||
self.assertEquals(MsgSpec(['int8'], ['data.data'], [], 'X'), flatten(b2))
|
||||
self.assertEquals(MsgSpec(['int8', 'int8'], ['data3.data.data', 'data4.data.data'], [], 'X'), flatten(b3))
|
||||
self.assertEquals(MsgSpec(['int8', 'int8', 'int8', 'int8'],
|
||||
['dataA.data3.data.data', 'dataA.data4.data.data', 'dataB.data3.data.data', 'dataB.data4.data.data'],
|
||||
[], 'X'), flatten(b4))
|
||||
|
||||
def test_numpy_dtype(self):
|
||||
for t in roslib.genpy.SIMPLE_TYPES:
|
||||
self.assert_(t in roslib.genpy._NUMPY_DTYPE)
|
||||
|
||||
def test_default_value(self):
|
||||
from roslib.msgs import register, MsgSpec
|
||||
from roslib.genpy import default_value
|
||||
|
||||
register('fake_msgs/String', MsgSpec(['string'], ['data'], [], 'string data\n'))
|
||||
register('fake_msgs/ThreeNums', MsgSpec(['int32', 'int32', 'int32'], ['x', 'y', 'z'], [], 'int32 x\nint32 y\nint32 z\n'))
|
||||
|
||||
# trip-wire: make sure all builtins have a default value
|
||||
for t in roslib.msgs.BUILTIN_TYPES:
|
||||
self.assert_(type(default_value(t, 'roslib')) == str)
|
||||
|
||||
# simple types first
|
||||
for t in ['uint8', 'int8', 'uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'byte', 'char']:
|
||||
self.assertEquals('0', default_value(t, 'std_msgs'))
|
||||
self.assertEquals('0', default_value(t, 'roslib'))
|
||||
for t in ['float32', 'float64']:
|
||||
self.assertEquals('0.', default_value(t, 'std_msgs'))
|
||||
self.assertEquals('0.', default_value(t, 'roslib'))
|
||||
self.assertEquals("''", default_value('string', 'roslib'))
|
||||
|
||||
# builtin specials
|
||||
self.assertEquals('roslib.rostime.Time()', default_value('time', 'roslib'))
|
||||
self.assertEquals('roslib.rostime.Duration()', default_value('duration', 'roslib'))
|
||||
self.assertEquals('std_msgs.msg._Header.Header()', default_value('Header', 'roslib'))
|
||||
|
||||
self.assertEquals('roslib.rostime.Time()', default_value('time', 'std_msgs'))
|
||||
self.assertEquals('roslib.rostime.Duration()', default_value('duration', 'std_msgs'))
|
||||
self.assertEquals('std_msgs.msg._Header.Header()', default_value('Header', 'std_msgs'))
|
||||
|
||||
# generic instances
|
||||
# - unregistered type
|
||||
self.assertEquals(None, default_value("unknown_msgs/Foo", "unknown_msgs"))
|
||||
# - wrong context
|
||||
self.assertEquals(None, default_value('ThreeNums', 'std_msgs'))
|
||||
|
||||
# - registered types
|
||||
self.assertEquals('fake_msgs.msg.String()', default_value('fake_msgs/String', 'std_msgs'))
|
||||
self.assertEquals('fake_msgs.msg.String()', default_value('fake_msgs/String', 'fake_msgs'))
|
||||
self.assertEquals('fake_msgs.msg.String()', default_value('String', 'fake_msgs'))
|
||||
self.assertEquals('fake_msgs.msg.ThreeNums()', default_value('fake_msgs/ThreeNums', 'roslib'))
|
||||
self.assertEquals('fake_msgs.msg.ThreeNums()', default_value('fake_msgs/ThreeNums', 'fake_msgs'))
|
||||
self.assertEquals('fake_msgs.msg.ThreeNums()', default_value('ThreeNums', 'fake_msgs'))
|
||||
|
||||
# var-length arrays always default to empty arrays... except for byte and uint8 which are strings
|
||||
for t in ['int8', 'uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'float32', 'float64', 'char']:
|
||||
self.assertEquals('[]', default_value(t+'[]', 'std_msgs'))
|
||||
self.assertEquals('[]', default_value(t+'[]', 'roslib'))
|
||||
|
||||
self.assertEquals("''", default_value('uint8[]', 'roslib'))
|
||||
self.assertEquals("''", default_value('byte[]', 'roslib'))
|
||||
|
||||
# fixed-length arrays should be zero-filled... except for byte and uint8 which are strings
|
||||
for t in ['float32', 'float64']:
|
||||
self.assertEquals('[0.,0.,0.]', default_value(t+'[3]', 'std_msgs'))
|
||||
self.assertEquals('[0.]', default_value(t+'[1]', 'std_msgs'))
|
||||
for t in ['int8', 'uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'char']:
|
||||
self.assertEquals('[0,0,0,0]', default_value(t+'[4]', 'std_msgs'))
|
||||
self.assertEquals('[0]', default_value(t+'[1]', 'roslib'))
|
||||
|
||||
self.assertEquals("chr(0)*1", default_value('uint8[1]', 'roslib'))
|
||||
self.assertEquals("chr(0)*4", default_value('uint8[4]', 'roslib'))
|
||||
self.assertEquals("chr(0)*1", default_value('byte[1]', 'roslib'))
|
||||
self.assertEquals("chr(0)*4", default_value('byte[4]', 'roslib'))
|
||||
|
||||
self.assertEquals('[]', default_value('fake_msgs/String[]', 'std_msgs'))
|
||||
self.assertEquals('[fake_msgs.msg.String(),fake_msgs.msg.String()]', default_value('fake_msgs/String[2]', 'std_msgs'))
|
||||
|
||||
def test_make_python_safe(self):
|
||||
from roslib.msgs import register, MsgSpec, Constant
|
||||
from roslib.genpy import make_python_safe
|
||||
s = MsgSpec(['int32', 'int32', 'int32', 'int32'], ['ok', 'if', 'self', 'fine'],
|
||||
[Constant('int32', 'if', '1', '1'), Constant('int32', 'okgo', '1', '1')],
|
||||
'x')
|
||||
s2 = make_python_safe(s)
|
||||
self.assertNotEquals(s, s2)
|
||||
self.assertEquals(['ok', 'if_', 'self_', 'fine'], s2.names)
|
||||
self.assertEquals(s2.types, s.types)
|
||||
self.assertEquals([Constant('int32', 'if_', '1', '1'), Constant('int32', 'okgo', '1', '1')], s2.constants)
|
||||
self.assertEquals(s2.text, s.text)
|
||||
|
||||
def test_compute_pkg_type(self):
|
||||
from roslib.genpy import compute_pkg_type, MsgGenerationException
|
||||
try:
|
||||
compute_pkg_type('std_msgs', 'really/bad/std_msgs/String')
|
||||
except MsgGenerationException: pass
|
||||
self.assertEquals(('std_msgs', 'String'), compute_pkg_type('std_msgs', 'std_msgs/String'))
|
||||
self.assertEquals(('std_msgs', 'String'), compute_pkg_type('foo', 'std_msgs/String'))
|
||||
self.assertEquals(('std_msgs', 'String'), compute_pkg_type('std_msgs', 'String'))
|
||||
|
||||
def test_compute_import(self):
|
||||
from roslib.msgs import register, MsgSpec
|
||||
from roslib.genpy import compute_import
|
||||
|
||||
self.assertEquals([], compute_import('foo', 'bar'))
|
||||
self.assertEquals([], compute_import('foo', 'int32'))
|
||||
|
||||
register('ci_msgs/Base', MsgSpec(['int8'], ['data'], [], 'int8 data\n'))
|
||||
register('ci2_msgs/Base2', MsgSpec(['ci_msgs/Base'], ['data2'], [], 'ci_msgs/Base data2\n'))
|
||||
register('ci3_msgs/Base3', MsgSpec(['ci2_msgs/Base2'], ['data3'], [], 'ci2_msgs/Base2 data3\n'))
|
||||
register('ci4_msgs/Base', MsgSpec(['int8'], ['data'], [], 'int8 data\n'))
|
||||
register('ci4_msgs/Base4', MsgSpec(['ci2_msgs/Base2', 'ci3_msgs/Base3', 'ci4_msgs/Base'],
|
||||
['data4a', 'data4b', 'data4c'],
|
||||
[], 'ci2_msgs/Base2 data4a\nci3_msgs/Base3 data4b\nci4_msgs/Base data4c\n'))
|
||||
|
||||
register('ci5_msgs/Base', MsgSpec(['time'], ['data'], [], 'time data\n'))
|
||||
|
||||
self.assertEquals(['import ci_msgs.msg'], compute_import('foo', 'ci_msgs/Base'))
|
||||
self.assertEquals(['import ci_msgs.msg'], compute_import('ci_msgs', 'ci_msgs/Base'))
|
||||
self.assertEquals(['import ci2_msgs.msg', 'import ci_msgs.msg'], compute_import('ci2_msgs', 'ci2_msgs/Base2'))
|
||||
self.assertEquals(['import ci2_msgs.msg', 'import ci_msgs.msg'], compute_import('foo', 'ci2_msgs/Base2'))
|
||||
self.assertEquals(['import ci3_msgs.msg', 'import ci2_msgs.msg', 'import ci_msgs.msg'], compute_import('ci3_msgs', 'ci3_msgs/Base3'))
|
||||
|
||||
self.assertEquals(set(['import ci4_msgs.msg', 'import ci3_msgs.msg', 'import ci2_msgs.msg', 'import ci_msgs.msg']),
|
||||
set(compute_import('foo', 'ci4_msgs/Base4')))
|
||||
self.assertEquals(set(['import ci4_msgs.msg', 'import ci3_msgs.msg', 'import ci2_msgs.msg', 'import ci_msgs.msg']),
|
||||
set(compute_import('ci4_msgs', 'ci4_msgs/Base4')))
|
||||
|
||||
self.assertEquals(['import ci4_msgs.msg'], compute_import('foo', 'ci4_msgs/Base'))
|
||||
self.assertEquals(['import ci4_msgs.msg'], compute_import('ci4_msgs', 'ci4_msgs/Base'))
|
||||
self.assertEquals(['import ci4_msgs.msg'], compute_import('ci4_msgs', 'Base'))
|
||||
|
||||
self.assertEquals(['import ci5_msgs.msg', 'import roslib.rostime'], compute_import('foo', 'ci5_msgs/Base'))
|
||||
|
||||
def test_get_registered_ex(self):
|
||||
from roslib.msgs import MsgSpec, register
|
||||
from roslib.genpy import MsgGenerationException, get_registered_ex
|
||||
s = MsgSpec(['string'], ['data'], [], 'string data\n')
|
||||
register('tgr_msgs/String', s)
|
||||
self.assertEquals(s, get_registered_ex('tgr_msgs/String'))
|
||||
try:
|
||||
get_registered_ex('bad_msgs/String')
|
||||
except MsgGenerationException: pass
|
||||
|
||||
def test_compute_constructor(self):
|
||||
from roslib.msgs import register, MsgSpec
|
||||
from roslib.genpy import compute_constructor
|
||||
register('fake_msgs/String', MsgSpec(['string'], ['data'], [], 'string data\n'))
|
||||
register('fake_msgs/ThreeNums', MsgSpec(['int32', 'int32', 'int32'], ['x', 'y', 'z'], [], 'int32 x\nint32 y\nint32 z\n'))
|
||||
|
||||
# builtin specials
|
||||
self.assertEquals('roslib.rostime.Time()', compute_constructor('roslib', 'time'))
|
||||
self.assertEquals('roslib.rostime.Duration()', compute_constructor('roslib', 'duration'))
|
||||
self.assertEquals('std_msgs.msg._Header.Header()', compute_constructor('std_msgs', 'Header'))
|
||||
|
||||
self.assertEquals('roslib.rostime.Time()', compute_constructor('std_msgs', 'time'))
|
||||
self.assertEquals('roslib.rostime.Duration()', compute_constructor('std_msgs', 'duration'))
|
||||
|
||||
# generic instances
|
||||
# - unregistered type
|
||||
self.assertEquals(None, compute_constructor("unknown_msgs", "unknown_msgs/Foo"))
|
||||
self.assertEquals(None, compute_constructor("unknown_msgs", "Foo"))
|
||||
# - wrong context
|
||||
self.assertEquals(None, compute_constructor('std_msgs', 'ThreeNums'))
|
||||
|
||||
# - registered types
|
||||
self.assertEquals('fake_msgs.msg.String()', compute_constructor('std_msgs', 'fake_msgs/String'))
|
||||
self.assertEquals('fake_msgs.msg.String()', compute_constructor('fake_msgs', 'fake_msgs/String'))
|
||||
self.assertEquals('fake_msgs.msg.String()', compute_constructor('fake_msgs', 'String'))
|
||||
self.assertEquals('fake_msgs.msg.ThreeNums()', compute_constructor('fake_msgs', 'fake_msgs/ThreeNums'))
|
||||
self.assertEquals('fake_msgs.msg.ThreeNums()', compute_constructor('fake_msgs', 'fake_msgs/ThreeNums'))
|
||||
self.assertEquals('fake_msgs.msg.ThreeNums()', compute_constructor('fake_msgs', 'ThreeNums'))
|
||||
|
||||
def test_pack(self):
|
||||
from roslib.genpy import pack
|
||||
self.assertEquals("buff.write(_struct_3lL3bB.pack(foo, bar))", pack('lllLbbbB', 'foo, bar'))
|
||||
|
||||
def test_pack2(self):
|
||||
from roslib.genpy import pack2
|
||||
self.assertEquals('buff.write(struct.pack(patt_name, foo, bar))', pack2('patt_name', 'foo, bar'))
|
||||
|
||||
def test_unpack(self):
|
||||
from roslib.genpy import unpack
|
||||
self.assertEquals("var_x = _struct_I3if2I.unpack(bname)", unpack('var_x', 'IiiifII', 'bname'))
|
||||
|
||||
def test_unpack2(self):
|
||||
from roslib.genpy import unpack2
|
||||
self.assertEquals('x = struct.unpack(patt, b)', unpack2('x', 'patt', 'b'))
|
||||
|
||||
def test_generate_dynamic(self):
|
||||
from roslib.genpy import generate_dynamic
|
||||
msgs = generate_dynamic("gd_msgs/EasyString", "string data\n")
|
||||
self.assertEquals(['gd_msgs/EasyString'], msgs.keys())
|
||||
m_cls = msgs['gd_msgs/EasyString']
|
||||
m_instance = m_cls()
|
||||
m_instance.data = 'foo'
|
||||
buff = cStringIO.StringIO()
|
||||
m_instance.serialize(buff)
|
||||
m_cls().deserialize(buff.getvalue())
|
||||
|
||||
# 'probot_msgs' is a test for #1183, failure if the package no longer exists
|
||||
msgs = generate_dynamic("gd_msgs/MoveArmState", """Header header
|
||||
probot_msgs/ControllerStatus status
|
||||
|
||||
#Current arm configuration
|
||||
probot_msgs/JointState[] configuration
|
||||
#Goal arm configuration
|
||||
probot_msgs/JointState[] goal
|
||||
|
||||
================================================================================
|
||||
MSG: std_msgs/Header
|
||||
#Standard metadata for higher-level flow data types
|
||||
#sequence ID: consecutively increasing ID
|
||||
uint32 seq
|
||||
#Two-integer timestamp that is expressed as:
|
||||
# * stamp.secs: seconds (stamp_secs) since epoch
|
||||
# * stamp.nsecs: nanoseconds since stamp_secs
|
||||
# time-handling sugar is provided by the client library
|
||||
time stamp
|
||||
#Frame this data is associated with
|
||||
# 0: no frame
|
||||
# 1: global frame
|
||||
string frame_id
|
||||
|
||||
================================================================================
|
||||
MSG: probot_msgs/ControllerStatus
|
||||
# This message defines the expected format for Controller Statuss messages
|
||||
# Embed this in the feedback state message of highlevel controllers
|
||||
byte UNDEFINED=0
|
||||
byte SUCCESS=1
|
||||
byte ABORTED=2
|
||||
byte PREEMPTED=3
|
||||
byte ACTIVE=4
|
||||
|
||||
# Status of the controller = {UNDEFINED, SUCCESS, ABORTED, PREEMPTED, ACTIVE}
|
||||
byte value
|
||||
|
||||
#Comment for debug
|
||||
string comment
|
||||
================================================================================
|
||||
MSG: probot_msgs/JointState
|
||||
string name
|
||||
float64 position
|
||||
float64 velocity
|
||||
float64 applied_effort
|
||||
float64 commanded_effort
|
||||
byte is_calibrated
|
||||
|
||||
""")
|
||||
self.assertEquals(set(['gd_msgs/MoveArmState', 'probot_msgs/JointState', 'probot_msgs/ControllerStatus', 'std_msgs/Header']),
|
||||
set(msgs.keys()))
|
||||
import roslib.rostime
|
||||
import time
|
||||
m_instance1 = msgs['std_msgs/Header']() # make sure default constructor works
|
||||
m_instance2 = msgs['std_msgs/Header'](stamp=roslib.rostime.Time.from_seconds(time.time()), frame_id='foo-%s'%time.time(), seq=12391)
|
||||
self._test_ser_deser(m_instance2, m_instance1)
|
||||
|
||||
m_instance1 = msgs['probot_msgs/ControllerStatus']()
|
||||
m_instance2 = msgs['probot_msgs/ControllerStatus'](value=4, comment=str(time.time()))
|
||||
d = {'UNDEFINED':0,'SUCCESS':1,'ABORTED':2,'PREEMPTED':3,'ACTIVE':4}
|
||||
for k, v in d.iteritems():
|
||||
self.assertEquals(v, getattr(m_instance1, k))
|
||||
self._test_ser_deser(m_instance2, m_instance1)
|
||||
|
||||
m_instance1 = msgs['probot_msgs/JointState']()
|
||||
m_instance2 = msgs['probot_msgs/JointState'](position=time.time(), velocity=time.time(), applied_effort=time.time(), commanded_effort=time.time(), is_calibrated=2)
|
||||
self._test_ser_deser(m_instance2, m_instance1)
|
||||
|
||||
m_instance1 = msgs['gd_msgs/MoveArmState']()
|
||||
js = msgs['probot_msgs/JointState']
|
||||
config = []
|
||||
goal = []
|
||||
# generate some data for config/goal
|
||||
for i in range(0, 10):
|
||||
config.append(js(position=time.time(), velocity=time.time(), applied_effort=time.time(), commanded_effort=time.time(), is_calibrated=2))
|
||||
goal.append(js(position=time.time(), velocity=time.time(), applied_effort=time.time(), commanded_effort=time.time(), is_calibrated=2))
|
||||
m_instance2 = msgs['gd_msgs/MoveArmState'](header=msgs['std_msgs/Header'](),
|
||||
status=msgs['probot_msgs/ControllerStatus'](),
|
||||
configuration=config, goal=goal)
|
||||
self._test_ser_deser(m_instance2, m_instance1)
|
||||
|
||||
def _test_ser_deser(self, m_instance1, m_instance2):
|
||||
buff = cStringIO.StringIO()
|
||||
m_instance1.serialize(buff)
|
||||
m_instance2.deserialize(buff.getvalue())
|
||||
self.assertEquals(m_instance1, m_instance2)
|
||||
|
||||
def test_len_serializer_generator(self):
|
||||
# generator tests are mainly tripwires/coverage tests
|
||||
from roslib.genpy import len_serializer_generator
|
||||
# Test Serializers
|
||||
# string serializer simply initializes local var
|
||||
g = len_serializer_generator('foo', True, True)
|
||||
self.assertEquals('length = len(foo)', '\n'.join(g))
|
||||
# array len serializer writes var
|
||||
g = len_serializer_generator('foo', False, True)
|
||||
self.assertEquals("length = len(foo)\nbuff.write(_struct_I.pack(length))", '\n'.join(g))
|
||||
|
||||
# Test Deserializers
|
||||
val = """start = end
|
||||
end += 4
|
||||
(length,) = _struct_I.unpack(str[start:end])"""
|
||||
# string serializer and array serializer are identical
|
||||
g = len_serializer_generator('foo', True, False)
|
||||
self.assertEquals(val, '\n'.join(g))
|
||||
g = len_serializer_generator('foo', False, False)
|
||||
self.assertEquals(val, '\n'.join(g))
|
||||
|
||||
def test_string_serializer_generator(self):
|
||||
# generator tests are mainly tripwires/coverage tests
|
||||
from roslib.genpy import string_serializer_generator
|
||||
# Test Serializers
|
||||
g = string_serializer_generator('foo', 'string', 'var_name', True)
|
||||
self.assertEquals("""length = len(var_name)
|
||||
buff.write(struct.pack('<I%ss'%length, length, var_name))""", '\n'.join(g))
|
||||
|
||||
for t in ['uint8[]', 'byte[]', 'uint8[10]', 'byte[20]']:
|
||||
g = string_serializer_generator('foo', 'uint8[]', 'b_name', True)
|
||||
self.assertEquals("""length = len(b_name)
|
||||
# - if encoded as a list instead, serialize as bytes instead of string
|
||||
if type(b_name) in [list, tuple]:
|
||||
buff.write(struct.pack('<I%sB'%length, length, *b_name))
|
||||
else:
|
||||
buff.write(struct.pack('<I%ss'%length, length, b_name))""", '\n'.join(g))
|
||||
|
||||
# Test Deserializers
|
||||
val = """start = end
|
||||
end += 4
|
||||
(length,) = _struct_I.unpack(str[start:end])
|
||||
start = end
|
||||
end += length
|
||||
var_name = str[start:end]"""
|
||||
# string serializer and array serializer are identical
|
||||
g = string_serializer_generator('foo', 'string', 'var_name', False)
|
||||
self.assertEquals(val, '\n'.join(g))
|
||||
|
||||
if __name__ == '__main__':
|
||||
rosunit.unitrun('test_roslib', NAME, TestGenpy, sys.argv, coverage_packages=['roslib.genpy'])
|
|
@ -0,0 +1,134 @@
|
|||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Revision $Id$
|
||||
|
||||
NAME = 'test_gentools'
|
||||
import roslib; roslib.load_manifest('test_roslib')
|
||||
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
import unittest
|
||||
import cStringIO
|
||||
|
||||
import roslib.names
|
||||
import roslib.packages
|
||||
import rosunit
|
||||
|
||||
class TestGentools(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def _load_md5_tests(self, dir):
|
||||
test_dir = os.path.join(roslib.packages.get_pkg_dir('test_roslib'), 'test', 'md5tests', dir)
|
||||
tests = {}
|
||||
for f in os.listdir(test_dir):
|
||||
path = os.path.join(test_dir, f)
|
||||
if not f.endswith('.txt'):
|
||||
continue
|
||||
name = f[:-4]
|
||||
while name and name[-1].isdigit():
|
||||
name = name[:-1]
|
||||
self.assert_(name)
|
||||
if name in tests:
|
||||
tests[name].append(path)
|
||||
else:
|
||||
tests[name] = [path]
|
||||
return tests
|
||||
|
||||
def _compute_md5(self, f):
|
||||
from roslib.gentools import compute_md5, get_dependencies
|
||||
from roslib.msgs import load_from_string
|
||||
|
||||
text = open(f, 'r').read()
|
||||
spec = load_from_string(text, package_context='roslib')
|
||||
get_deps_dict = get_dependencies(spec, 'roslib', compute_files=False)
|
||||
return compute_md5(get_deps_dict)
|
||||
|
||||
def _compute_md5_text(self, f):
|
||||
from roslib.gentools import compute_md5_text, get_dependencies
|
||||
from roslib.msgs import load_from_string
|
||||
|
||||
text = open(f, 'r').read()
|
||||
spec = load_from_string(text, package_context='roslib')
|
||||
get_deps_dict = get_dependencies(spec, 'roslib', compute_files=False)
|
||||
return compute_md5_text(get_deps_dict, spec)
|
||||
|
||||
def test_compute_md5_text(self):
|
||||
from std_msgs.msg import Header
|
||||
Header_md5 = Header._md5sum
|
||||
roslib_msg_dir = os.path.join(roslib.packages.get_pkg_dir('roslib'), 'msg')
|
||||
clock_msg = os.path.join(roslib_msg_dir, 'Clock.msg')
|
||||
# a bit gory, but go ahead and regression test these important messages
|
||||
self.assertEquals("time clock", self._compute_md5_text(clock_msg))
|
||||
log_msg = os.path.join(roslib_msg_dir, 'Log.msg')
|
||||
self.assertEquals("byte DEBUG=1\nbyte INFO=2\nbyte WARN=4\nbyte ERROR=8\nbyte FATAL=16\n%s header\nbyte level\nstring name\nstring msg\nstring file\nstring function\nuint32 line\nstring[] topics"%Header_md5, self._compute_md5_text(log_msg))
|
||||
|
||||
tests = self._load_md5_tests('md5text')
|
||||
# text file #1 is the reference
|
||||
for k, files in tests.iteritems():
|
||||
print "running tests", k
|
||||
ref_file = [f for f in files if f.endswith('%s1.txt'%k)]
|
||||
if not ref_file:
|
||||
self.fail("failed to load %s"%k)
|
||||
ref_file = ref_file[0]
|
||||
ref_text = open(ref_file, 'r').read().strip()
|
||||
print "KEY", k
|
||||
files = [f for f in files if not f.endswith('%s1.txt'%k)]
|
||||
for f in files[1:]:
|
||||
f_text = self._compute_md5_text(f)
|
||||
self.assertEquals(ref_text, f_text, "failed on %s\n%s\n%s: \n[%s]\nvs.\n[%s]\n"%(k, ref_file, f, ref_text, f_text))
|
||||
|
||||
def test_md5_equals(self):
|
||||
tests = self._load_md5_tests('same')
|
||||
for k, files in tests.iteritems():
|
||||
print "running tests", k
|
||||
md5sum = self._compute_md5(files[0])
|
||||
for f in files[1:]:
|
||||
self.assertEquals(md5sum, self._compute_md5(f), "failed on %s: \n[%s]\nvs.\n[%s]\n"%(k, self._compute_md5_text(files[0]), self._compute_md5_text(f)))
|
||||
|
||||
def test_md5_not_equals(self):
|
||||
tests = self._load_md5_tests('different')
|
||||
for k, files in tests.iteritems():
|
||||
print "running tests", k
|
||||
md5s = set()
|
||||
md6md5sum = self._compute_md5(files[0])
|
||||
for f in files:
|
||||
md5s.add(self._compute_md5(f))
|
||||
# each md5 should be unique
|
||||
self.assertEquals(len(md5s), len(files))
|
||||
|
||||
if __name__ == '__main__':
|
||||
rosunit.unitrun('test_roslib', NAME, TestGentools, sys.argv, coverage_packages=['roslib.gentools'])
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue