diff --git a/.travis.yml b/.travis.yml index 92161b8f7..080681cb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,79 @@ -sudo: required -dist: trusty -language: - - cpp -compiler: - - gcc +language: cpp + +cache: ccache + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libxml-xpath-perl + - libboost-all-dev + - omniorb + - omniidl + - omniorb-nameserver + - libomniorb4-dev + - pkg-config + - clang-3.8 + +env: + global: + - EXTRA_CMAKE_ARGS="-DENABLE_TESTS=ON -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB" + - BOOST_TEST_LOG_LEVEL=message + - CFLAGS="-Wall -Wextra -Wno-unused-parameter" + +matrix: + include: + - os: linux + dist: xenial + env: COMPILER=gcc CXXFLAGS="-std=c++03 -Wall -Wextra -Wno-unused-parameter" + - os: linux + dist: xenial + env: COMPILER=gcc CXXFLAGS="-std=c++11 -Wall -Wextra -Wno-unused-parameter" + - os: linux + dist: xenial + env: COMPILER=clang-3.8 CXXFLAGS="-std=c++11 -Wall -Wextra -Wno-unused-parameter" + - os: linux + dist: xenial + env: COMPILER=clang CXXFLAGS="-std=c++11 -Wall -Wextra -Wno-unused-parameter" + - os: osx + osx_image: xcode10.1 + +branches: + only: + - master + - /^toolchain-[\d\.]+[\d]$/ + before_install: - # Update package indexes and install dependencies - - sudo apt-get update -qq - - sudo apt-get install -qq -y libxml-xpath-perl libboost-all-dev omniorb omniidl omniorb-nameserver libomniorb4-dev pkg-config - -install: - - export EXTRA_CMAKE_ARGS="-DENABLE_TESTS=ON -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB" - - export CFLAGS="-std=c99 -Wall -Wextra -Wno-unused-parameter" - - export CXXFLAGS="-std=c++11 -Wall -Wextra -Wno-unused-parameter" + # Set C/C++ compiler + - | + if [[ "${COMPILER}" != "" ]]; then + export CC=${COMPILER} + if [[ "${COMPILER}" == "gcc"* ]]; then + export CXX=${COMPILER/gcc/g++} + elif [[ "${COMPILER}" == "clang"* ]]; then + export CXX=${COMPILER/clang/clang++} + fi + ${CC} --version + ${CXX} --version + fi + + # Install HomeBrew dependencies (macOS only) + - | + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew update + brew reinstall boost cmake ccache omniorb + export PATH="/use/local/opt/ccache/libexec:$PATH" + fi + + # Create build directory - mkdir -p build && cd build - - cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/install $EXTRA_CMAKE_ARGS - - make -j2 install script: + # Build and install RTT + - cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/install ${EXTRA_CMAKE_ARGS} + - make -j2 install + # Run tests - export BOOST_TEST_LOG_LEVEL=message - export ORBtraceExceptions=1 diff --git a/rtt/types/TypeInfo.cpp b/rtt/types/TypeInfo.cpp index a74c651fb..d3b9a5e7d 100644 --- a/rtt/types/TypeInfo.cpp +++ b/rtt/types/TypeInfo.cpp @@ -41,6 +41,7 @@ #include "../internal/DataSourceTypeInfo.hpp" #include "../internal/ConnFactory.hpp" #include "TypeTransporter.hpp" +#include "TypeInfoRepository.hpp" #include "rtt-config.h" @@ -159,6 +160,7 @@ namespace RTT else { log(Warning) << "The protocol with id "<logTypeInfo(); return 0; // That transport did not register a fall-back ! } } diff --git a/tests/corba_ipc_server.cpp b/tests/corba_ipc_server.cpp index 58a8be2ce..9b952f521 100644 --- a/tests/corba_ipc_server.cpp +++ b/tests/corba_ipc_server.cpp @@ -57,7 +57,12 @@ class TheServer : public TaskContext, public OperationsFixture ports()->addEventPort( mi1 ); ports()->addPort( mo1 ); this->createOperationCallerFactories( this ); - ts = corba::TaskContextServer::Create( this, /* use_naming = */ true ); +#if ORO_NO_EMIT_CORBA_IOR + const bool use_naming = true; +#else + const bool use_naming = false; +#endif + ts = corba::TaskContextServer::Create( this, use_naming ); this->start(); addOperation("callBackPeer", &TheServer::callBackPeer, this,ClientThread); addOperation("callBackPeerOwn", &TheServer::callBackPeer, this,OwnThread); diff --git a/tests/corba_ipc_test.cpp b/tests/corba_ipc_test.cpp index 54e4ce1d3..0ef56b020 100644 --- a/tests/corba_ipc_test.cpp +++ b/tests/corba_ipc_test.cpp @@ -234,10 +234,12 @@ BOOST_FIXTURE_TEST_SUITE( CorbaIPCTestSuite, CorbaTest ) BOOST_AUTO_TEST_CASE( testRemoteOperationCallerC ) { - tp = corba::TaskContextProxy::Create( "peerRMC", /* is_ior = */ false ); // no-ior - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerRMC.ior"); - BOOST_REQUIRE( tp ); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerRMC.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerRMC", /* is_ior = */ false); + BOOST_REQUIRE(tp); // This test tests 'transparant' remote invocation of Orocos internal::OperationCallerC objects. internal::OperationCallerC mc; @@ -262,10 +264,13 @@ BOOST_AUTO_TEST_CASE( testRemoteOperationCallerC ) BOOST_AUTO_TEST_CASE( testRemoteOperationCaller ) { - tp = corba::TaskContextProxy::Create( "peerRM" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerRM.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerRM.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerRM", /* is_ior = */ false); BOOST_REQUIRE(tp); + // This test tests 'transparant' remote invocation of Orocos methods. // This requires the internal::RemoteOperationCaller class, which does not work yet. RTT::OperationCaller m0 = tp->provides("methods")->getOperation("m0"); @@ -287,9 +292,11 @@ BOOST_AUTO_TEST_CASE( testRemoteOperationCaller ) */ BOOST_AUTO_TEST_CASE( testRemoteOperationCallerCallback ) { - tp = corba::TaskContextProxy::Create( "peerRMCb" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerRMC.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerRMCb.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerRMCb", /* is_ior = */ false); BOOST_REQUIRE(tp); BOOST_REQUIRE( RTT::internal::DataSourceTypeInfo::getTypeInfo() != 0 ); @@ -308,9 +315,12 @@ BOOST_AUTO_TEST_CASE( testRemoteOperationCallerCallback ) BOOST_AUTO_TEST_CASE( testAnyOperationCaller ) { double d; - tp = corba::TaskContextProxy::Create( "peerAM" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerAM.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerAM.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerAM", /* is_ior = */ false); + BOOST_REQUIRE(tp); BOOST_REQUIRE(tp); s = tp->server(); @@ -379,9 +389,12 @@ BOOST_AUTO_TEST_CASE( testAnyOperationCaller ) BOOST_AUTO_TEST_CASE(testDataFlowInterface) { - tp = corba::TaskContextProxy::Create( "peerDFI" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerDFI.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerDFI.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerDFI", /* is_ior = */ false); + BOOST_REQUIRE(tp); BOOST_REQUIRE(tp); corba::CDataFlowInterface_var ports = tp->server()->ports(); @@ -407,10 +420,13 @@ BOOST_AUTO_TEST_CASE(testDataFlowInterface) BOOST_AUTO_TEST_CASE( testPortConnections ) { - // This test tests the differen port-to-port connections. - tp = corba::TaskContextProxy::Create( "peerPC", /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerPC.ior"); + // This test tests the different port-to-port connections. +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerPC.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerPC", /* is_ior = */ false); + BOOST_REQUIRE(tp); BOOST_REQUIRE(tp); @@ -499,9 +515,12 @@ BOOST_AUTO_TEST_CASE( testPortConnections ) BOOST_AUTO_TEST_CASE( testPortProxying ) { // This test creates connections between local and remote ports. - tp = corba::TaskContextProxy::Create( "peerPP" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerPP.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerPP.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerPP", /* is_ior = */ false); + BOOST_REQUIRE(tp); BOOST_REQUIRE(tp); @@ -563,16 +582,13 @@ BOOST_AUTO_TEST_CASE( testPortProxying ) BOOST_AUTO_TEST_CASE( testDataHalfs ) { - if(std::getenv("CI") != NULL) { - BOOST_TEST_MESSAGE("Skipping testDataHalfs because it can fail on integration servers."); - return; - } - double result; - // This test tests the differen port-to-port connections. - tp = corba::TaskContextProxy::Create( "peerDH" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerDH.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerDH.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerDH", /* is_ior = */ false); + BOOST_REQUIRE(tp); BOOST_REQUIRE(tp); @@ -631,17 +647,13 @@ BOOST_AUTO_TEST_CASE( testDataHalfs ) BOOST_AUTO_TEST_CASE( testBufferHalfs ) { - if(std::getenv("CI") != NULL) { - BOOST_TEST_MESSAGE("Skipping testBufferHalfs because it can fail on integration servers."); - return; - } - double result; - - // This test tests the differen port-to-port connections. - tp = corba::TaskContextProxy::Create( "peerBH" , /* is_ior = */ false); - if (!tp ) - tp = corba::TaskContextProxy::CreateFromFile( "peerBH.ior"); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "peerBH.ior"); +#endif + if (!tp) + tp = corba::TaskContextProxy::Create( "peerBH", /* is_ior = */ false); + BOOST_REQUIRE(tp); BOOST_REQUIRE(tp); diff --git a/tests/corba_mqueue_ipc_server.cpp b/tests/corba_mqueue_ipc_server.cpp index 60a048710..36aac0449 100644 --- a/tests/corba_mqueue_ipc_server.cpp +++ b/tests/corba_mqueue_ipc_server.cpp @@ -44,7 +44,12 @@ class TheServer : public TaskContext ports()->addEventPort( mi1 ); ports()->addPort( mo1 ); this->start(); - ts = corba::TaskContextServer::Create( this, /* use_naming = */ true ); +#if ORO_NO_EMIT_CORBA_IOR + const bool use_naming = true; +#else + const bool use_naming = false; +#endif + ts = corba::TaskContextServer::Create( this, use_naming ); } ~TheServer() { this->stop(); diff --git a/tests/corba_mqueue_ipc_test.cpp b/tests/corba_mqueue_ipc_test.cpp index 175ac4beb..8255d1aa9 100644 --- a/tests/corba_mqueue_ipc_test.cpp +++ b/tests/corba_mqueue_ipc_test.cpp @@ -188,10 +188,11 @@ BOOST_AUTO_TEST_CASE( testPortConnections ) { // This test tests the different port-to-port connections. ts = corba::TaskContextServer::Create( tc, /* use_naming = */ false ); - tp = corba::TaskContextProxy::Create( "other", /* is_ior = */ false ); +#ifndef ORO_NO_EMIT_CORBA_IOR + tp = corba::TaskContextProxy::CreateFromFile( "other.ior"); +#endif if (!tp) - tp = corba::TaskContextProxy::CreateFromFile( "other.ior"); - + tp = corba::TaskContextProxy::Create( "other", /* is_ior = */ false); BOOST_REQUIRE(tp); // Create a default CORBA policy specification diff --git a/tests/datasource_test.cpp b/tests/datasource_test.cpp index b0a6b3563..29348679a 100644 --- a/tests/datasource_test.cpp +++ b/tests/datasource_test.cpp @@ -178,8 +178,8 @@ BOOST_AUTO_TEST_CASE( testArrayPartDataSource ) index->set( 3 ); d->set( 'L' ); BOOST_CHECK_EQUAL( "WorLd", btype.c ); - BOOST_CHECK( strcmp( &d->set(), &abase->get().c[3]) == 0 ); - BOOST_CHECK_EQUAL( &d->set(), &btype.c[3] ); + BOOST_CHECK( strcmp( &d->set(), abase->get().c + 3) == 0 ); + BOOST_CHECK_EQUAL( &d->set(), btype.c + 3 ); } diff --git a/tests/setup_corba.cpp b/tests/setup_corba.cpp index 7abc19645..b2883f9df 100644 --- a/tests/setup_corba.cpp +++ b/tests/setup_corba.cpp @@ -23,8 +23,8 @@ int main(int argc, char** argv) { - int i = system("[ ! -r ./corba-ipc-server ] || ./corba-ipc-server &"); - i = system("[ ! -r ./corba-mqueue-ipc-server ] || ./corba-mqueue-ipc-server &"); + int i = system("[ ! -r ./corba-ipc-server ] || ORO_LOGLEVEL=6 ./corba-ipc-server &"); + i = system("[ ! -r ./corba-mqueue-ipc-server ] || ORO_LOGLEVEL=6 ./corba-mqueue-ipc-server &"); usleep(500000); return i; } diff --git a/tests/tasks_test.cpp b/tests/tasks_test.cpp index 724ef41e7..fd4d4f423 100644 --- a/tests/tasks_test.cpp +++ b/tests/tasks_test.cpp @@ -443,6 +443,7 @@ BOOST_AUTO_TEST_CASE( testAffinity ) BOOST_TEST_MESSAGE("Skipping testAffinity because it can fail on integration servers."); return; } + // this test is kind of irrelevant with only 1 CPU int numCPU = sysconf( _SC_NPROCESSORS_ONLN ); if (1 < numCPU) diff --git a/tests/taskthread_test.cpp b/tests/taskthread_test.cpp index fd903d6af..d468787be 100644 --- a/tests/taskthread_test.cpp +++ b/tests/taskthread_test.cpp @@ -21,6 +21,7 @@ #include "taskthread_test.hpp" +#include #include #include @@ -235,12 +236,16 @@ BOOST_AUTO_TEST_CASE( testPeriodicActivity ) } // Different CPU affinity - unsigned cpu_affinity = 1; // first CPU only - if ( mtask.thread()->getCpuAffinity() != (unsigned) ~0 && - mtask.thread()->getCpuAffinity() != cpu_affinity ) { - PeriodicActivity m4task(ORO_SCHED_OTHER, 15, 0.01, cpu_affinity); - BOOST_CHECK( mtask.thread() != m4task.thread() ); - BOOST_CHECK_EQUAL( cpu_affinity, m4task.thread()->getCpuAffinity() ); + if (std::getenv("CI") != NULL) { + BOOST_TEST_MESSAGE("Skipping CPU affinity test in testPeriodic because it can fail on integration servers."); + } else { + unsigned cpu_affinity = 1; // first CPU only + if ( mtask.thread()->getCpuAffinity() != (unsigned) ~0 && + mtask.thread()->getCpuAffinity() != cpu_affinity ) { + PeriodicActivity m4task(ORO_SCHED_OTHER, 15, 0.01, cpu_affinity); + BOOST_CHECK( mtask.thread() != m4task.thread() ); + BOOST_CHECK_EQUAL( cpu_affinity, m4task.thread()->getCpuAffinity() ); + } } // Starting thread if thread not running diff --git a/tests/test-runner-corba.cpp b/tests/test-runner-corba.cpp index 8ac32d9cb..d5b461932 100644 --- a/tests/test-runner-corba.cpp +++ b/tests/test-runner-corba.cpp @@ -33,6 +33,7 @@ #define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK #include +#include using boost::unit_test::test_suite; @@ -40,6 +41,11 @@ using namespace RTT; using namespace RTT::corba; using namespace std; +void translate_corba_exception(const CORBA::Exception &e) { + BOOST_FAIL(e._name()); + e._raise(); +} + boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) { if ( argc > 1 && strncmp(argv[1],"--help",6) == 0 ) { @@ -78,11 +84,6 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) assert((size_t)-1 != freeMem); // increase MEMORY_SIZE above most likely, as TLSF has a several kilobyte overhead (void)freeMem; // avoid compiler warning #endif - __os_init(argc, argv); - - corba::TaskContextServer::InitOrb(argc,argv); - corba::TaskContextServer::ThreadOrb(); - // disable logging of errors or warnings if no ORO_LOGLEVEL was set. if ( log().getLogLevel() == Logger::Warning ) { @@ -92,6 +93,13 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) log(Info) << "LogLevel unaltered by test-runner." << endlog(); } + __os_init(argc, argv); + + boost::unit_test::unit_test_monitor.register_exception_translator(&translate_corba_exception); + + corba::TaskContextServer::InitOrb(argc,argv); + corba::TaskContextServer::ThreadOrb(); + return 0; } diff --git a/tests/test-runner.cpp b/tests/test-runner.cpp index ad912da7b..c8fcf749a 100644 --- a/tests/test-runner.cpp +++ b/tests/test-runner.cpp @@ -83,7 +83,6 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) assert((size_t)-1 != freeMem); // increase MEMORY_SIZE above most likely, as TLSF has a several kilobyte overhead (void)freeMem; // avoid compiler warning #endif - __os_init(argc, argv); // disable logging of errors or warnings if no ORO_LOGLEVEL was set. if ( log().getLogLevel() == Logger::Warning ) { @@ -93,6 +92,8 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) log(Info) << "LogLevel unaltered by test-runner." << endlog(); } + __os_init(argc, argv); + return 0; }