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