tearing down test_roslib

This commit is contained in:
Ken Conley 2012-01-05 00:17:28 +00:00
parent 5282252d90
commit 179bcf7951
29 changed files with 0 additions and 501 deletions

View File

@ -6,7 +6,6 @@ find_package(Boost COMPONENTS thread)
foreach(subdir
core/roslib
tools/rosbash
test/test_roslib
)
add_subdirectory(${subdir})
endforeach()

View File

@ -1,13 +0,0 @@
project(test_roslib)
find_package(catkin)
find_package(Boost COMPONENTS thread)
find_package(ROS COMPONENTS roslib)
#integration tests
include_directories(${Boost_INCLUDE_DIRS} ${ROS_INCLUDE_DIRS})
add_gtest(${PROJECT_NAME}-utest test/utest.cpp)
target_link_libraries(${PROJECT_NAME}-utest ${Boost_LIBRARIES} ${ROS_LIBRARIES})
add_gtest(${PROJECT_NAME}-test_package test/package.cpp)
target_link_libraries(${PROJECT_NAME}-test_package ${ROS_LIBRARIES})

View File

@ -1,15 +0,0 @@
<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" />
<platform os="ubuntu" version="9.04"/>
<platform os="ubuntu" version="9.10"/>
<platform os="ubuntu" version="10.04"/>
<platform os="macports" version="macports"/>
</package>

View File

@ -1,21 +0,0 @@
<package>
<description brief="a brief description">Line 1
Line 2
</description>
<version>1.2.4</version> <!-- bad -->
<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>

View File

@ -1 +0,0 @@
not xml

View File

@ -1,20 +0,0 @@
<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>

View File

@ -1,11 +0,0 @@
<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>

View File

@ -1,20 +0,0 @@
<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>

View File

@ -1,13 +0,0 @@
<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>

View File

@ -1,14 +0,0 @@
<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>
<version>1.2.3</version>
<logo>http://www.willowgarage.com/files/willowgarage/robot10.jpg</logo>
<depend stack="stackname" />
<depend stack="common"/>
</stack>

View File

@ -1,64 +0,0 @@
/*
* 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();
}

View File

@ -1,14 +0,0 @@
<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>

View File

@ -1,14 +0,0 @@
<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>

View File

@ -1,14 +0,0 @@
<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>

View File

@ -1,8 +0,0 @@
<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>

View File

@ -1,4 +0,0 @@
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
set(ROSPACK_MAKEDIST true)
rosbuild_make_distribution(1.5.0-cmake)

View File

@ -1,9 +0,0 @@
<stack>
<description brief="bar">
bar
</description>
<author>Ken Conley</author>
<license>BSD</license>
</stack>

View File

@ -1,4 +0,0 @@
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
set(ROSPACK_MAKEDIST true)
rosbuild_make_distribution(1.5.0-cmake)

View File

@ -1,14 +0,0 @@
<package>
<description brief="foo_pkg">
foo_pkg
</description>
<author>Ken Conley</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://ros.org/wiki/foo_pkg</url>
</package>

View File

@ -1,14 +0,0 @@
<package>
<description brief="foo_pkg_2">
foo_pkg_2
</description>
<author>Ken Conley</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://ros.org/wiki/foo_pkg_2</url>
</package>

View File

@ -1,12 +0,0 @@
<stack>
<description brief="foo">
foo
</description>
<author>Ken Conley</author>
<version>
1.6.0-manifest
</version>
<license>BSD</license>
</stack>

View File

@ -1,9 +0,0 @@
<package>
<description brief="foo">
foo
</description>
<author>Ken Conley</author>
<license>BSD</license>
</package>

View File

@ -1 +0,0 @@
../stack_tests/s1

View File

@ -1,11 +0,0 @@
<package>
<description brief="roslib tests">
Fake
</description>
<author>No one</author>
<license>BSD</license>
<review status="test" notes=""/>
<depend package="roslib" />
<depend package="rosunit" />
</package>

View File

@ -1,9 +0,0 @@
<stack>
<description brief="bar">
bar
</description>
<author>Ken Conley</author>
<license>BSD</license>
</stack>

View File

@ -1,9 +0,0 @@
<stack>
<description brief="bar">
bar
</description>
<author>Ken Conley</author>
<license>BSD</license>
</stack>

View File

@ -1,11 +0,0 @@
<package>
<description brief="roslib tests">
Fake
</description>
<author>No one</author>
<license>BSD</license>
<review status="test" notes=""/>
<depend package="roslib" />
<depend package="rosunit" />
</package>

View File

@ -1,9 +0,0 @@
<stack>
<description brief="foo">
foo
</description>
<author>Ken Conley</author>
<license>BSD</license>
</stack>

View File

@ -1,142 +0,0 @@
/*
* 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.
*/
/* Author: Brian Gerkey */
#include <string>
#include <vector>
#include <stdlib.h>
#include <unistd.h>
#include <boost/thread.hpp>
#include <gtest/gtest.h>
#include "ros/package.h"
void string_split(const std::string &s, std::vector<std::string> &t, const std::string &d)
{ t.clear();
size_t start = 0, end;
while ((end = s.find_first_of(d, start)) != std::string::npos)
{
if((end-start) > 0)
t.push_back(s.substr(start, end-start));
start = end + 1;
}
if(start < s.size())
t.push_back(s.substr(start));
}
char g_rr_buf[1024];
void set_env_vars(void)
{
// Point ROS_PACKAGE_PATH at the test_roslib directory, and point
// ROS_ROOT into an empty directory.
getcwd(g_rr_buf, sizeof(g_rr_buf));
setenv("ROS_PACKAGE_PATH", g_rr_buf, 1);
strncpy(g_rr_buf+strlen(g_rr_buf), "/tmp.XXXXXX", sizeof(g_rr_buf)-strlen(g_rr_buf)-1);
g_rr_buf[sizeof(g_rr_buf)-1] = '\0';
mkdtemp(g_rr_buf);
setenv("ROS_ROOT", g_rr_buf, 1);
}
void cleanup_env_vars(void)
{
// Remove the empty directory that we created in set_env_vars().
rmdir(g_rr_buf);
memset(g_rr_buf, 0, sizeof(g_rr_buf));
}
TEST(roslib, commandListNames)
{
set_env_vars();
std::string output = ros::package::command("list-names");
std::vector<std::string> output_list;
string_split(output, output_list, "\n");
ASSERT_EQ((int)output_list.size(), 1);
ASSERT_STREQ(output_list[0].c_str(), "test_roslib");
cleanup_env_vars();
}
TEST(roslib, commandList)
{
set_env_vars();
std::string output = ros::package::command("list");
std::vector<std::string> output_list;
std::vector<std::string> name_path;
string_split(output, output_list, "\n");
ASSERT_EQ((int)output_list.size(), 1);
string_split(output_list[0], name_path, " ");
ASSERT_EQ((int)name_path.size(), 2);
ASSERT_STREQ(name_path[0].c_str(), "test_roslib");
cleanup_env_vars();
}
TEST(roslib, getAll)
{
set_env_vars();
std::vector<std::string> output_list;
ASSERT_TRUE(ros::package::getAll(output_list));
ASSERT_EQ((int)output_list.size(), 1);
ASSERT_STREQ(output_list[0].c_str(), "test_roslib");
cleanup_env_vars();
}
void
roslib_caller()
{
struct timespec ts = {0, 100000};
std::string output;
for(int i=0;i<100;i++)
{
output = ros::package::command("plugins --attrib=foo test_roslib");
nanosleep(&ts, NULL);
}
}
TEST(roslib, concurrent_access)
{
set_env_vars();
const int size = 10;
boost::thread t[size];
for(int i=0;i<size; i++)
t[i] = boost::thread(boost::bind(roslib_caller));
for(int i=0;i<size; i++)
t[i].join();
cleanup_env_vars();
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}