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