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