Skip to content
Snippets Groups Projects
Commit 4fba2fa0 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux florent@laas.fr
Browse files

[Test] Use standard option BUILD_TESTING for test.

parent c26b0491
No related branches found
No related tags found
No related merge requests found
...@@ -25,15 +25,13 @@ SET(PROJECT_DESCRIPTION "Classes for manipulation planning.") ...@@ -25,15 +25,13 @@ SET(PROJECT_DESCRIPTION "Classes for manipulation planning.")
SET(CXX_DISABLE_WERROR TRUE) SET(CXX_DISABLE_WERROR TRUE)
INCLUDE(cmake/hpp.cmake) INCLUDE(cmake/hpp.cmake)
INCLUDE(cmake/boost.cmake) INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/test.cmake)
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX) COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
LIST(APPEND PKG_CONFIG_ADDITIONAL_VARIABLES cmake_plugin) LIST(APPEND PKG_CONFIG_ADDITIONAL_VARIABLES cmake_plugin)
# Activate test using UR5 if requested
SET (TEST_UR5 FALSE CACHE BOOL "Activate tests using ur5")
# Ask Doxygen to create a tree view in html documentation # Ask Doxygen to create a tree view in html documentation
SET(DOXYGEN_TREEVIEW "NO" CACHE STRING "Set to YES to generate a tree view in the html documentation") SET(DOXYGEN_TREEVIEW "NO" CACHE STRING "Set to YES to generate a tree view in the html documentation")
...@@ -53,8 +51,8 @@ ADD_REQUIRED_DEPENDENCY("hpp-statistics >= 1.1") ...@@ -53,8 +51,8 @@ ADD_REQUIRED_DEPENDENCY("hpp-statistics >= 1.1")
IF (HPP_MANIPULATION_HAS_WHOLEBODY_STEP) IF (HPP_MANIPULATION_HAS_WHOLEBODY_STEP)
ADD_REQUIRED_DEPENDENCY("hpp-wholebody-step >= 4") ADD_REQUIRED_DEPENDENCY("hpp-wholebody-step >= 4")
ENDIF () ENDIF ()
IF (TEST_UR5) IF (BUILD_TESTING)
ADD_REQUIRED_DEPENDENCY("hpp_universal_robot") ADD_REQUIRED_DEPENDENCY("example-robot-data >= 3")
ENDIF () ENDIF ()
CONFIG_FILES (doc/main.hh CONFIG_FILES (doc/main.hh
...@@ -103,9 +101,13 @@ SET (${PROJECT_NAME}_HEADERS ...@@ -103,9 +101,13 @@ SET (${PROJECT_NAME}_HEADERS
include/hpp/manipulation/steering-method/end-effector-trajectory.hh include/hpp/manipulation/steering-method/end-effector-trajectory.hh
) )
SET(LIBRARY_NAME ${PROJECT_NAME})
ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(plugins) ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(tests) IF(BUILD_TESTING)
ADD_SUBDIRECTORY(tests)
ENDIF()
# Add dependency toward hpp-manipulation library in pkg-config file. # Add dependency toward hpp-manipulation library in pkg-config file.
PKG_CONFIG_APPEND_LIBS("hpp-manipulation") PKG_CONFIG_APPEND_LIBS("hpp-manipulation")
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
# hpp-manipulation If not, see # hpp-manipulation If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
SET(LIBRARY_NAME ${PROJECT_NAME})
SET(SOURCES SET(SOURCES
handle.cc handle.cc
manipulation-planner.cc manipulation-planner.cc
......
...@@ -20,32 +20,7 @@ INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) ...@@ -20,32 +20,7 @@ INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
# Make Boost.Test generates the main function in test cases. # Make Boost.Test generates the main function in test cases.
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
# ADD_TESTCASE(NAME) ADD_UNIT_TEST(test-constraintgraph test-constraintgraph.cc)
# ------------------------ PKG_CONFIG_USE_DEPENDENCY(test-constraintgraph hpp-core)
# TARGET_LINK_LIBRARIES(test-constraintgraph ${LIBRARY_NAME})
# Define a test named `NAME'.
#
# This macro will create a binary from `NAME.cc', link it against
# Boost and add it to the test suite.
#
MACRO(ADD_TESTCASE NAME GENERATED)
IF (${GENERATED} STREQUAL TRUE)
ADD_EXECUTABLE(${NAME} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.cc)
ELSE()
ADD_EXECUTABLE(${NAME} ${NAME}.cc)
ENDIF()
ADD_TEST(${NAME} ${RUNTIME_OUTPUT_DIRECTORY}/${NAME})
PKG_CONFIG_USE_DEPENDENCY (${NAME} hpp-constraints)
# Link against Boost and project library.
TARGET_LINK_LIBRARIES(${NAME}
${PROJECT_NAME}
${Boost_LIBRARIES}
)
ENDMACRO(ADD_TESTCASE)
IF (TEST_UR5)
ADD_TESTCASE (test-constraintgraph FALSE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_UR5")
ENDIF ()
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
// received a copy of the GNU Lesser General Public License along with // received a copy of the GNU Lesser General Public License along with
// hpp-manipulation. If not, see <http://www.gnu.org/licenses/>. // hpp-manipulation. If not, see <http://www.gnu.org/licenses/>.
#include <hpp/util/pointer.hh>
#include <hpp/pinocchio/urdf/util.hh> #include <hpp/pinocchio/urdf/util.hh>
#include <hpp/pinocchio/liegroup-element.hh> #include <hpp/pinocchio/liegroup-element.hh>
...@@ -70,15 +69,11 @@ namespace hpp_test { ...@@ -70,15 +69,11 @@ namespace hpp_test {
void initialize (bool ur5) void initialize (bool ur5)
{ {
robot = hpp::manipulation::Device::create ("test-robot"); robot = hpp::manipulation::Device::create ("test-robot");
hpp::manipulation::ProblemPtr_t problem hpp::manipulation::ProblemPtr_t problem(hpp::manipulation::Problem::create
(new hpp::manipulation::Problem (robot)); (robot));
if (ur5) { if (ur5) {
#ifdef TEST_UR5
hpp::pinocchio::urdf::loadUrdfModel (robot, "anchor", "ur_description", hpp::pinocchio::urdf::loadUrdfModel (robot, "anchor", "ur_description",
"ur5_joint_limited_robot"); "ur5_joint_limited_robot");
#else // TEST_UR5
BOOST_ERROR ("Set TEST_UR5 in cmake to activate this.");
#endif // TEST_UR5
} }
SteeringMethodPtr_t sm SteeringMethodPtr_t sm
(hpp::manipulation::steeringMethod::Graph::create (*problem)); (hpp::manipulation::steeringMethod::Graph::create (*problem));
...@@ -89,7 +84,7 @@ namespace hpp_test { ...@@ -89,7 +84,7 @@ namespace hpp_test {
components.push_back(graph_); components.push_back(graph_);
graph_->maxIterations (20); graph_->maxIterations (20);
graph_->errorThreshold (1e-4); graph_->errorThreshold (1e-4);
ns = graph_->createStateSelector("node-selector"); components.push_back(ns); ns = graph_->createStateSelector("node-selector");
n1 = ns->createState ("node 1"); components.push_back(n1); n1 = ns->createState ("node 1"); components.push_back(n1);
n2 = ns->createState ("node 2"); components.push_back(n2); n2 = ns->createState ("node 2"); components.push_back(n2);
e11 = n1->linkTo ("edge 11", n1); components.push_back(e11); e11 = n1->linkTo ("edge 11", n1); components.push_back(e11);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment