to ros_comm
This commit is contained in:
parent
7af34a2684
commit
75c10d596a
|
@ -1,34 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.4.6)
|
|
||||||
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
|
|
||||||
|
|
||||||
# Set the build type. Options are:
|
|
||||||
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
|
|
||||||
# Debug : w/ debug symbols, w/o optimization
|
|
||||||
# Release : w/o debug symbols, w/ optimization
|
|
||||||
# RelWithDebInfo : w/ debug symbols, w/ optimization
|
|
||||||
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
|
|
||||||
#set(ROS_BUILD_TYPE RelWithDebInfo)
|
|
||||||
|
|
||||||
rosbuild_init()
|
|
||||||
|
|
||||||
#set the default path for built executables to the "bin" directory
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
|
||||||
#set the default path for built libraries to the "lib" directory
|
|
||||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
|
||||||
|
|
||||||
#uncomment if you have defined messages
|
|
||||||
#rosbuild_genmsg()
|
|
||||||
#uncomment if you have defined services
|
|
||||||
#rosbuild_gensrv()
|
|
||||||
|
|
||||||
#common commands for building c++ executables and libraries
|
|
||||||
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
|
|
||||||
#target_link_libraries(${PROJECT_NAME} another_library)
|
|
||||||
#rosbuild_add_boost_directories()
|
|
||||||
#rosbuild_link_boost(${PROJECT_NAME} thread)
|
|
||||||
#rosbuild_add_executable(example examples/example.cpp)
|
|
||||||
#target_link_libraries(example ${PROJECT_NAME})
|
|
||||||
|
|
||||||
rosbuild_add_pyunit(test/test_rosdep_core.py)
|
|
||||||
rosbuild_add_pyunit(test/test_rosdep_commandline.py)
|
|
||||||
rosbuild_add_pyunit(test/test_rosdep_yaml_cache.py)
|
|
|
@ -1 +0,0 @@
|
||||||
include $(shell rospack find mk)/cmake.mk
|
|
|
@ -1,30 +0,0 @@
|
||||||
/**
|
|
||||||
\mainpage
|
|
||||||
\htmlinclude manifest.html
|
|
||||||
|
|
||||||
\b test_rosdep is ...
|
|
||||||
|
|
||||||
<!--
|
|
||||||
In addition to providing an overview of your package,
|
|
||||||
this is the section where the specification and design/architecture
|
|
||||||
should be detailed. While the original specification may be done on the
|
|
||||||
wiki, it should be transferred here once your package starts to take shape.
|
|
||||||
You can then link to this documentation page from the Wiki.
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
\section codeapi Code API
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Provide links to specific auto-generated API documentation within your
|
|
||||||
package that is of particular interest to a reader. Doxygen will
|
|
||||||
document pretty much every part of your code, so do your best here to
|
|
||||||
point the reader to the actual API.
|
|
||||||
|
|
||||||
If your codebase is fairly large or has different sets of APIs, you
|
|
||||||
should use the doxygen 'group' tag to keep these APIs together. For
|
|
||||||
example, the roscpp documentation has 'libros' group.
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
|
@ -1,20 +0,0 @@
|
||||||
<package>
|
|
||||||
<description brief="test_rosdep">
|
|
||||||
|
|
||||||
test_rosdep
|
|
||||||
|
|
||||||
</description>
|
|
||||||
<author>Tully Foote</author>
|
|
||||||
<license>BSD</license>
|
|
||||||
<review status="test" notes=""/>
|
|
||||||
<url>http://ros.org/wiki/test_rosdep</url>
|
|
||||||
<depend package="rostest"/>
|
|
||||||
<depend package="rosdep"/>
|
|
||||||
|
|
||||||
<platform os="ubuntu" version="9.04"/>
|
|
||||||
<platform os="ubuntu" version="9.10"/>
|
|
||||||
<platform os="ubuntu" version="10.04"/>
|
|
||||||
<platform os="macports" version="macports"/>
|
|
||||||
</package>
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
rosdep_test:
|
|
||||||
rosdep_test_os:
|
|
||||||
9.10: librosdep_test1.40-all-dev
|
|
||||||
rosdep_test_version: librosdep_test1.37-dev
|
|
||||||
8.10: |
|
|
||||||
this is a script
|
|
||||||
zlib:
|
|
||||||
rosdep_test_os: zlib1g-dev
|
|
||||||
debian: zlib1g-dev
|
|
||||||
other_rosdep_test:
|
|
||||||
rosdep_test_os:
|
|
||||||
other_version: foo
|
|
||||||
no_os_rosdep_test:
|
|
||||||
other_os: not_useful
|
|
|
@ -1,8 +0,0 @@
|
||||||
rosdep_test:
|
|
||||||
rosdep_test_os:
|
|
||||||
9.10: librosdep_test1.40-all-dev
|
|
||||||
rosdep_test_version: not-librosdep_test1.37-dev
|
|
||||||
8.10: |
|
|
||||||
this is a script
|
|
||||||
otherlib:
|
|
||||||
rosdep_test_os: package_name
|
|
|
@ -1,14 +0,0 @@
|
||||||
rosdep_test:
|
|
||||||
rosdep_test_os:
|
|
||||||
9.10: librosdep_test1.40-all-dev
|
|
||||||
rosdep_test_version: librosdep_test1.37-dev
|
|
||||||
8.10: |
|
|
||||||
this is a script
|
|
||||||
zlib:
|
|
||||||
rosdep_test_os: zlib1g-dev
|
|
||||||
debian: zlib1g-dev
|
|
||||||
other_rosdep_test:
|
|
||||||
rosdep_test_os:
|
|
||||||
other_version: foo
|
|
||||||
no_os_rosdep_test:
|
|
||||||
{
|
|
|
@ -1,63 +0,0 @@
|
||||||
# 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_rosdep')
|
|
||||||
|
|
||||||
import os
|
|
||||||
import struct
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
import rostest
|
|
||||||
import rosdep.core
|
|
||||||
|
|
||||||
|
|
||||||
class RosdepCommandlineTest(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_Rosdep_commandline_satisfy(self):
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "satisfy", "test_rosdep"]))
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "generate_bash", "test_rosdep"]))
|
|
||||||
def test_Rosdep_commandline_satisfy_y(self):
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "satisfy", "-y", "test_rosdep", "rosdep"]))
|
|
||||||
def test_Rosdep_commandline_satisfy_multiple(self):
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "satisfy", "test_rosdep", "rosdep"]))
|
|
||||||
def test_Rosdep_commandline_check(self):
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "check", "test_rosdep"]))
|
|
||||||
def test_Rosdep_commandline_what_needs(self):
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "what_needs", "boost"]))
|
|
||||||
def test_Rosdep_commandline_where_defined(self):
|
|
||||||
self.assertEqual(0,subprocess.call(["rosdep", "where_defined", "boost"]))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
rostest.unitrun('test_rosdep', 'test_commandline', RosdepCommandlineTest, coverage_packages=['rosdep.commandline'])
|
|
||||||
|
|
|
@ -1,161 +0,0 @@
|
||||||
# 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_rosdep')
|
|
||||||
|
|
||||||
import os
|
|
||||||
import struct
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import rostest
|
|
||||||
import rosdep.core
|
|
||||||
|
|
||||||
class RosdepCoreTest(unittest.TestCase):
|
|
||||||
def test_RosdepLookupPackage_parse_yaml_package(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
output = rdlp.lookup_rosdep("rosdep_test")
|
|
||||||
self.assertEqual("librosdep_test1.37-dev", output)
|
|
||||||
output = rdlp.lookup_rosdep("foobar")
|
|
||||||
self.assertEqual(False, output)
|
|
||||||
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_parse_yaml_package_override(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path2", True)
|
|
||||||
output = rdlp.lookup_rosdep("rosdep_test")
|
|
||||||
self.assertEqual("librosdep_test1.37-dev", output)
|
|
||||||
output = rdlp.lookup_rosdep("foobar")
|
|
||||||
self.assertEqual(False, output)
|
|
||||||
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_parse_yaml_package_collision_pass(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path2", False)
|
|
||||||
output = rdlp.lookup_rosdep("rosdep_test")
|
|
||||||
self.assertEqual("librosdep_test1.37-dev", output)
|
|
||||||
output = rdlp.lookup_rosdep("foobar")
|
|
||||||
self.assertEqual(False, output)
|
|
||||||
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_parse_yaml_package_collision_fail(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep_conflicting.yaml"))
|
|
||||||
self.assertRaises(rosdep.core.RosdepException, rdlp.insert_map, yaml_map, "example_yaml_path2", False)
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_parse_yaml_package_collision_override(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep_conflicting.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path2", True)
|
|
||||||
output = rdlp.lookup_rosdep("rosdep_test")
|
|
||||||
self.assertEqual("not-librosdep_test1.37-dev", output)
|
|
||||||
output = rdlp.lookup_rosdep("foobar")
|
|
||||||
self.assertEqual(False, output)
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_get_sources(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
|
|
||||||
sources = rdlp.get_sources("rosdep_test")
|
|
||||||
self.assertEqual([], sources)
|
|
||||||
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path2", False)
|
|
||||||
|
|
||||||
sources = rdlp.get_sources("rosdep_test")
|
|
||||||
self.assertEqual(["example_yaml_path", "example_yaml_path2"], sources)
|
|
||||||
|
|
||||||
sources = rdlp.get_sources("undefined")
|
|
||||||
self.assertEqual([], sources)
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_get_map(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
|
|
||||||
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
parsed_output = {'zlib': 'zlib1g-dev', 'rosdep_test': 'librosdep_test1.37-dev'}
|
|
||||||
self.assertEqual(parsed_output, rdlp.get_map())
|
|
||||||
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path2", False)
|
|
||||||
self.assertEqual(parsed_output, rdlp.get_map())
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_failed_version_lookup(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
output = rdlp.lookup_rosdep("other_rosdep_test")
|
|
||||||
self.assertEqual(output, False)
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_failed_os_lookup(self):
|
|
||||||
rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version"))
|
|
||||||
yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml"))
|
|
||||||
rdlp.insert_map(yaml_map, "example_yaml_path", False)
|
|
||||||
output = rdlp.lookup_rosdep("no_os_rosdep_test")
|
|
||||||
self.assertEqual(output, False)
|
|
||||||
|
|
||||||
def test_Rosdep_tripwire_robust(self):
|
|
||||||
rd = rosdep.core.Rosdep(["rosdep"], "rosdep", robust=True)
|
|
||||||
try:
|
|
||||||
rd.check()
|
|
||||||
rd.what_needs(["boost"])
|
|
||||||
rd.depdb(['rosdep'])
|
|
||||||
rd.where_defined(['boost'])
|
|
||||||
except:
|
|
||||||
self.fail("test Rosdep improperly Raised an exception.")
|
|
||||||
|
|
||||||
def test_Rosdep_tripwire(self):
|
|
||||||
rd = rosdep.core.Rosdep(["rosdep"], "rosdep", robust=False)
|
|
||||||
try:
|
|
||||||
rd.check()
|
|
||||||
rd.what_needs(["boost"])
|
|
||||||
rd.depdb(['rosdep'])
|
|
||||||
rd.where_defined(['boost'])
|
|
||||||
except:
|
|
||||||
self.fail("test Rosdep improperly Raised an exception.")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
os.environ["ROSDEP_TEST_OS"] = "rosdep_test_os"
|
|
||||||
rostest.unitrun('test_rosdep', 'test_core', RosdepCoreTest, coverage_packages=['rosdep.core'])
|
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
# 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_rosdep')
|
|
||||||
|
|
||||||
import os
|
|
||||||
import struct
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import rostest
|
|
||||||
import rosdep.core
|
|
||||||
|
|
||||||
|
|
||||||
class RosdepYamlCacheTest(unittest.TestCase):
|
|
||||||
def test_YamlCache_init(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
|
|
||||||
def test_YamlCache_get_yaml(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
yaml_dict = yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml"))
|
|
||||||
|
|
||||||
yaml_truth = {'other_rosdep_test':
|
|
||||||
{'rosdep_test_os':
|
|
||||||
{'other_version': 'foo'}
|
|
||||||
},
|
|
||||||
'no_os_rosdep_test':
|
|
||||||
{'other_os': 'not_useful'
|
|
||||||
},
|
|
||||||
'zlib':
|
|
||||||
{'rosdep_test_os': 'zlib1g-dev',
|
|
||||||
'debian': 'zlib1g-dev'
|
|
||||||
},
|
|
||||||
'rosdep_test':
|
|
||||||
{'rosdep_test_os':
|
|
||||||
{'rosdep_test_version': 'librosdep_test1.37-dev',
|
|
||||||
'9.10': 'librosdep_test1.40-all-dev',
|
|
||||||
'8.10': 'this is a script\n'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.assertEqual(yaml_dict, yaml_truth)
|
|
||||||
|
|
||||||
def test_YamlCache_get_yaml_repeated(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
yaml_dict = yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml"))
|
|
||||||
yaml_dict2 = yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml"))
|
|
||||||
self.assertEqual(yaml_dict, yaml_dict2)
|
|
||||||
|
|
||||||
yaml_truth = {'other_rosdep_test':
|
|
||||||
{'rosdep_test_os':
|
|
||||||
{'other_version': 'foo'}
|
|
||||||
},
|
|
||||||
'no_os_rosdep_test':
|
|
||||||
{'other_os': 'not_useful'
|
|
||||||
},
|
|
||||||
'zlib':
|
|
||||||
{'rosdep_test_os': 'zlib1g-dev',
|
|
||||||
'debian': 'zlib1g-dev'
|
|
||||||
},
|
|
||||||
'rosdep_test':
|
|
||||||
{'rosdep_test_os':
|
|
||||||
{'rosdep_test_version': 'librosdep_test1.37-dev',
|
|
||||||
'9.10': 'librosdep_test1.40-all-dev',
|
|
||||||
'8.10': 'this is a script\n'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.assertEqual(yaml_dict2, yaml_truth)
|
|
||||||
|
|
||||||
def test_YamlCache_rosstack_depends(self): ## TODO add this in a walled garden so it can be asserted as being equal to something specific
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
depends = yc.get_rosstack_depends("ros")
|
|
||||||
depends2 = yc.get_rosstack_depends("ros")
|
|
||||||
self.assertEqual(depends, depends2)
|
|
||||||
|
|
||||||
def test_YamlCache_no_file(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
self.assertEqual({}, yc.get_yaml("non_extant_rosdep.yaml"))
|
|
||||||
|
|
||||||
def test_YamlCache_parse_failure(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
self.assertEqual({}, yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "invalid_rosdep.yaml")))
|
|
||||||
|
|
||||||
def test_YamlCache_get_specific_rosdeps(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
yaml_dict = yc.get_specific_rosdeps(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml"))
|
|
||||||
|
|
||||||
yaml_truth = {
|
|
||||||
'zlib': 'zlib1g-dev',
|
|
||||||
'rosdep_test':'librosdep_test1.37-dev',
|
|
||||||
}
|
|
||||||
self.assertEqual(yaml_dict, yaml_truth)
|
|
||||||
|
|
||||||
def test_YamlCache_get_specific_rosdeps_repeated(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
yaml_dict = yc.get_specific_rosdeps(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml"))
|
|
||||||
yaml_dict2 = yc.get_specific_rosdeps(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml"))
|
|
||||||
self.assertEqual(yaml_dict, yaml_dict2)
|
|
||||||
|
|
||||||
yaml_truth = {
|
|
||||||
'zlib': 'zlib1g-dev',
|
|
||||||
'rosdep_test':'librosdep_test1.37-dev',
|
|
||||||
}
|
|
||||||
self.assertEqual(yaml_dict2, yaml_truth)
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_get_os_from_yaml(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
yaml_os_map = {"rosdep_test_os":"one", "other":"two", "three":"three"};
|
|
||||||
output = yc.get_os_from_yaml("rosdep_name", yaml_os_map, "source_path")
|
|
||||||
self.assertEqual("one", output)
|
|
||||||
|
|
||||||
def test_RosdepLookupPackage_get_version_from_yaml(self):
|
|
||||||
yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")
|
|
||||||
yaml_map = {"8.04":"one", "rosdep_test_version":"two", "three":"three"};
|
|
||||||
output = yc.get_version_from_yaml("rosdep_name", yaml_map, "source_path" )
|
|
||||||
self.assertEqual("two", output)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
rostest.unitrun('test_rosdep', 'test_yaml_cache', RosdepYamlCacheTest, coverage_packages=['rosdep.core'])
|
|
||||||
|
|
Loading…
Reference in New Issue