Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #define ORO_MEMORY_POOL
00022 #include <rtt/os/tlsf/tlsf.h>
00023
00024 #include <os/main.h>
00025 #include <Logger.hpp>
00026 #include <iostream>
00027
00028 #include <os/StartStopManager.hpp>
00029 #include <transports/corba/TaskContextServer.hpp>
00030 #include <transports/corba/CorbaDispatcher.hpp>
00031
00032 #include "test-runner.hpp"
00033 #define BOOST_TEST_MAIN
00034 #define BOOST_TEST_DYN_LINK
00035 #include <boost/test/unit_test.hpp>
00036
00037 using boost::unit_test::test_suite;
00038
00039 using namespace RTT;
00040 using namespace RTT::corba;
00041 using namespace std;
00042
00043 boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv)
00044 {
00045 if ( argc > 1 && strncmp(argv[1],"--help",6) == 0 ) {
00046 cout << "This unit test executable takes the following options:" <<endl<<endl;
00047 cout << "The starred option is the default, available options depend on Boost UTF library version." <<endl<<endl;
00048 cout << " --build_info[=<yes|no*>] "<<endl;
00049 cout << " --catch_system_errors[=<yes*|no> "<<endl;
00050 cout << " --detect_memory_leaks[=<yes*|no> "<<endl;
00051 cout << " --log_format[=<HRF*|XML> "<<endl;
00052 cout << " --log_level[=<all|success|test_suite|message|warning|error*|cpp_exception|system_error|fatal_error|nothing>"<<endl;
00053 cout << " --result_code[=<yes*|no> "<<endl;
00054 cout << " --output_format[=<HRF*|XML> "<<endl;
00055 cout << " --random[=<0*|1|>1> "<<endl;
00056 cout << " --report_format[=<HRF*|XML> "<<endl;
00057 cout << " --report level[=<no|confirm*|short|detailed>"<<endl;
00058 cout << " --show_progress[=<yes|no*> "<<endl<<endl;
00059 cout << " --use_alt_stack[=<yes*|no> "<<endl<<endl;
00060
00061 cout << "Select tests by using the form:"<<endl;
00062 cout << " " << argv[0] << " --run_test=suite/testX"<<endl;
00063 cout << "Wildcards are accepted:"<<endl;
00064 cout << " " << argv[0] << " --run_test=*/testX"<<endl;
00065 exit(0);
00066 }
00067
00068
00069 setenv("RTT_COMPONENT_PATH","../rtt", 0);
00070 #ifdef OS_RT_MALLOC
00071 void* rtMem=0;
00072 size_t freeMem=0;
00073
00075 rtMem = malloc(BUILD_TEST_RT_MEM_POOL_SIZE);
00076 assert(0 != rtMem);
00077 freeMem = init_memory_pool(BUILD_TEST_RT_MEM_POOL_SIZE, rtMem);
00078 assert((size_t)-1 != freeMem);
00079 #endif
00080 __os_init(argc, argv);
00081
00082 corba::TaskContextServer::InitOrb(argc,argv);
00083 corba::TaskContextServer::ThreadOrb();
00084
00085
00086
00087 if ( log().getLogLevel() == Logger::Warning ) {
00088 log(Info) << "Lowering LogLevel to Critical." << endlog();
00089 log().setLogLevel(Logger::Critical);
00090 } else {
00091 log(Info) << "LogLevel unaltered by test-runner." << endlog();
00092 }
00093
00094 return 0;
00095 }
00096
00097 using namespace boost::unit_test;
00098 struct InitOrocos {
00099 public:
00100 InitOrocos(){
00101 init_unit_test_suite(framework::master_test_suite().argc,framework::master_test_suite().argv);
00102 }
00103 ~InitOrocos(){
00104 corba::CorbaDispatcher::ReleaseAll();
00105 corba::TaskContextServer::ShutdownOrb(true);
00106 corba::TaskContextServer::DestroyOrb();
00107
00108
00109
00110
00111
00112 #ifndef OROCOS_TARGET_XENOMAI
00113 __os_exit();
00114 #else
00115 os::StartStopManager::Instance()->stop();
00116 os::StartStopManager::Release();
00117 #endif
00118 }
00119
00120 };
00121
00122 BOOST_GLOBAL_FIXTURE( InitOrocos )