Skip to content

Commit

Permalink
Merge pull request robotology#923 from drdanz/tests/serversql_wire_re…
Browse files Browse the repository at this point in the history
…p_utils

serversql,wire_rep_utils: Cleanup and fix unit tests
  • Loading branch information
drdanz authored Oct 10, 2016
2 parents 54e0b1b + b8a9b6a commit 0e5a043
Show file tree
Hide file tree
Showing 46 changed files with 968 additions and 670 deletions.
4 changes: 2 additions & 2 deletions example/libYARP_serversql/server_peek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#include <stdio.h>
#include <stdlib.h>

#include "TripleSourceCreator.h"
#include <yarp/serversql/impl/TripleSourceCreator.h>

using namespace yarp::serversql::impl;
using namespace std;

int main(int argc, char *argv[]) {
Expand Down Expand Up @@ -71,4 +72,3 @@ int main(int argc, char *argv[]) {

return 0;
}

13 changes: 7 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ add_subdirectory(libYARP_gsl)
add_subdirectory(libYARP_math)
add_subdirectory(libYARP_dev)

# private libraries
add_subdirectory(libYARP_name)
add_subdirectory(libYARP_serversql)
add_subdirectory(libYARP_manager)
add_subdirectory(libYARP_logger)
add_subdirectory(libYARP_wire_rep_utils)

# plugins
set (YARP_LINK_PLUGINS TRUE)
if(YARP_FORCE_DYNAMIC_PLUGINS OR BUILD_SHARED_LIBS)
Expand All @@ -24,12 +31,6 @@ add_subdirectory(devices)
add_subdirectory(carriers)
add_subdirectory(libYARP_init)

# private libraries
add_subdirectory(libYARP_name)
add_subdirectory(libYARP_serversql)
add_subdirectory(libYARP_manager)
add_subdirectory(libYARP_logger)

if(YARP_COMPILE_EXECUTABLES)
# idl compilers (thrift and ros)
add_subdirectory(idls)
Expand Down
2 changes: 0 additions & 2 deletions src/carriers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ option(CREATE_OPTIONAL_CARRIERS "Compile some optional carriers" FALSE)
get_property(YARP_OS_INCLUDE_DIRS TARGET YARP_OS PROPERTY INCLUDE_DIRS)
include_directories(${YARP_OS_INCLUDE_DIRS})

add_subdirectory(wire_rep_utils)

include(YarpPlugin)
yarp_begin_plugin_library(yarpcar)
add_subdirectory(human_carrier)
Expand Down
169 changes: 0 additions & 169 deletions src/carriers/wire_rep_utils/test.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions src/libYARP_OS/include/yarp/os/impl/UnitTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ class YARP_OS_impl_API yarp::os::impl::UnitTest {
virtual void runSubTests(int argc, char *argv[]);


bool checkEqualImpl(int x, int y,
bool checkEqualImpl(int x, int y,
const char *desc,
const char *txt1,
const char *txt2,
const char *fname,
int fline);

bool checkEqualishImpl(double x, double y,
bool checkEqualishImpl(double x, double y,
const char *desc,
const char *txt1,
const char *txt2,
Expand Down Expand Up @@ -141,7 +141,7 @@ class YARP_OS_impl_API yarp::os::impl::UnitTest {
void count(int severity);
};

// add info
// add info

#define checkEqual(x,y,desc) checkEqualImpl(x,y,desc,#x,#y,__FILE__,__LINE__)
#define checkEqualish(x,y,desc) checkEqualishImpl(x,y,desc,#x,#y,__FILE__,__LINE__)
Expand Down
47 changes: 20 additions & 27 deletions src/libYARP_serversql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ set(YARP_serversql_SRCS src/TripleSourceCreator.cpp
src/ParseName.cpp
src/yarpserver.cpp
src/StyleNameService.cpp)
set(YARP_serversql_HDRS src/TripleSourceCreator.h
src/Triple.h
src/TripleSource.h
src/SqliteTripleSource.h
src/NameServiceOnTriples.h
src/Allocator.h
src/AllocatorOnTriples.h
src/Subscriber.h
src/SubscriberOnSql.h
src/ComposedNameService.h
src/ConnectThread.h
src/ParseName.h
src/StyleNameService.h)

set(YARP_serversql_HDRS include/yarp/serversql/yarpserversql.h)

set(YARP_serversql_IMPL_HDRS include/yarp/serversql/impl/TripleSourceCreator.h
include/yarp/serversql/impl/Triple.h
include/yarp/serversql/impl/TripleSource.h
include/yarp/serversql/impl/SqliteTripleSource.h
include/yarp/serversql/impl/NameServiceOnTriples.h
include/yarp/serversql/impl/Allocator.h
include/yarp/serversql/impl/AllocatorOnTriples.h
include/yarp/serversql/impl/Subscriber.h
include/yarp/serversql/impl/SubscriberOnSql.h
include/yarp/serversql/impl/ComposedNameService.h
include/yarp/serversql/impl/ConnectThread.h
include/yarp/serversql/impl/ParseName.h
include/yarp/serversql/impl/StyleNameService.h)

add_library(YARP_serversql STATIC ${YARP_serversql_SRCS}
${YARP_serversql_HDRS})
${YARP_serversql_HDRS}
${YARP_serversql_IMPL_HDRS})

target_link_libraries(YARP_serversql LINK_PRIVATE YARP_OS
YARP_init
Expand All @@ -60,16 +64,5 @@ install(TARGETS YARP_serversql
PRIVATE_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/yarp/serversql/impl")

set_property(GLOBAL APPEND PROPERTY YARP_LIBS YARP_serversql)
set_property(TARGET YARP_serversql PROPERTY INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include
${YARP_OS_INCLUDE_DIRS})

###############################################################
## Some extra test programs

if(YARP_ENABLE_TESTS)
add_executable(server_peek src/server_peek.cpp)
target_link_libraries(server_peek YARP_serversql)

add_executable(server_test src/server_test.cpp)
target_link_libraries(server_test YARP_OS YARP_init)
endif()
set_property(TARGET YARP_serversql PROPERTY INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
${YARP_OS_INCLUDE_DIRS})
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
*
*/

#ifndef YARPDB_ALLOCATOR_INC
#define YARPDB_ALLOCATOR_INC
#ifndef YARP_SERVERSQL_IMPL_ALLOCATOR_H
#define YARP_SERVERSQL_IMPL_ALLOCATOR_H

#include <yarp/os/Contact.h>


namespace yarp {
namespace serversql {
namespace impl {

/**
*
* Upper and lower bounds on port numbers etc for allocation.
Expand Down Expand Up @@ -43,5 +47,8 @@ class Allocator {
virtual bool freePortResources(const yarp::os::Contact& c)=0;
};

} // namespace impl
} // namespace serversql
} // namespace yarp

#endif
#endif // YARP_SERVERSQL_IMPL_ALLOCATOR_H
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
*
*/

#ifndef YARPDB_ALLOCATORONTRIPLES_INC
#define YARPDB_ALLOCATORONTRIPLES_INC
#ifndef YARP_SERVERSQL_IMPL_ALLOCATORONTRIPLES_H
#define YARP_SERVERSQL_IMPL_ALLOCATORONTRIPLES_H

#include "Allocator.h"
#include "TripleSource.h"
#include <yarp/serversql/impl/Allocator.h>
#include <yarp/serversql/impl/TripleSource.h>

namespace yarp {
namespace serversql {
namespace impl {

/**
*
Expand All @@ -22,7 +26,7 @@ class AllocatorOnTriples : public Allocator {
regid = -1;
tmpid = -1;
mcastCursor = -1;
db = 0 /*NULL*/;
db = YARP_NULLPTR;
}

void open(TripleSource *db, const AllocatorConfig& config) {
Expand Down Expand Up @@ -52,5 +56,9 @@ class AllocatorOnTriples : public Allocator {
AllocatorConfig config;
};

} // namespace impl
} // namespace serversql
} // namespace yarp


#endif
#endif // YARP_SERVERSQL_IMPL_ALLOCATORONTRIPLES_H
Loading

0 comments on commit 0e5a043

Please sign in to comment.