test-runner-corba.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 10 15:59:50 CET 2005 test-runner.cpp
3 
4  test-runner.cpp - description
5  -------------------
6  begin : Mon January 10 2005
7  copyright : (C) 2005 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 // need access to all TLSF functions embedded in RTT
20 // this call must occur before ALL RTT include's!!
21 #define ORO_MEMORY_POOL
22 #include <rtt/os/tlsf/tlsf.h>
23 
24 #include <os/main.h>
25 #include <Logger.hpp>
26 #include <iostream>
27 
28 #include <os/StartStopManager.hpp>
31 
32 #include "test-runner.hpp"
33 #define BOOST_TEST_MAIN
34 #define BOOST_TEST_DYN_LINK
35 #include <boost/test/unit_test.hpp>
36 
37 using boost::unit_test::test_suite;
38 
39 using namespace RTT;
40 using namespace RTT::corba;
41 using namespace std;
42 
43 boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv)
44 {
45  if ( argc > 1 && strncmp(argv[1],"--help",6) == 0 ) {
46  cout << "This unit test executable takes the following options:" <<endl<<endl;
47  cout << "The starred option is the default, available options depend on Boost UTF library version." <<endl<<endl;
48  cout << " --build_info[=<yes|no*>] "<<endl;
49  cout << " --catch_system_errors[=<yes*|no> "<<endl;
50  cout << " --detect_memory_leaks[=<yes*|no> "<<endl;
51  cout << " --log_format[=<HRF*|XML> "<<endl;
52  cout << " --log_level[=<all|success|test_suite|message|warning|error*|cpp_exception|system_error|fatal_error|nothing>"<<endl;
53  cout << " --result_code[=<yes*|no> "<<endl;
54  cout << " --output_format[=<HRF*|XML> "<<endl;
55  cout << " --random[=<0*|1|>1> "<<endl;
56  cout << " --report_format[=<HRF*|XML> "<<endl;
57  cout << " --report level[=<no|confirm*|short|detailed>"<<endl;
58  cout << " --show_progress[=<yes|no*> "<<endl<<endl;
59  cout << " --use_alt_stack[=<yes*|no> "<<endl<<endl;
60 
61  cout << "Select tests by using the form:"<<endl;
62  cout << " " << argv[0] << " --run_test=suite/testX"<<endl;
63  cout << "Wildcards are accepted:"<<endl;
64  cout << " " << argv[0] << " --run_test=*/testX"<<endl;
65  exit(0);
66  }
67 
68  // sets environment if not set by user.
69  setenv("RTT_COMPONENT_PATH","../rtt", 0);
70 #ifdef OS_RT_MALLOC
71  void* rtMem=0;
72  size_t freeMem=0;
73 
75  rtMem = malloc(BUILD_TEST_RT_MEM_POOL_SIZE); // don't calloc() as is first thing TLSF does.
76  assert(0 != rtMem);
77  freeMem = init_memory_pool(BUILD_TEST_RT_MEM_POOL_SIZE, rtMem);
78  assert((size_t)-1 != freeMem); // increase MEMORY_SIZE above most likely, as TLSF has a several kilobyte overhead
79  (void)freeMem; // avoid compiler warning
80 #endif
81  __os_init(argc, argv);
82 
85 
86 
87  // disable logging of errors or warnings if no ORO_LOGLEVEL was set.
88  if ( log().getLogLevel() == Logger::Warning ) {
89  log(Info) << "Lowering LogLevel to Critical." << endlog();
91  } else {
92  log(Info) << "LogLevel unaltered by test-runner." << endlog();
93  }
94 
95  return 0;
96 }
97 
98 using namespace boost::unit_test;
99 struct InitOrocos {
100 public:
102  init_unit_test_suite(framework::master_test_suite().argc,framework::master_test_suite().argv);
103  }
108 
109  // If we call __os_exit() in Xenomai, we get an ABORT
110  // because the main task is cleaned up too early.
111  // The work around for now is to stop all threads but
112  // the main thread. To be fixed if boost::test allows it.
113 #ifndef OROCOS_TARGET_XENOMAI
114  __os_exit();
115 #else
118 #endif
119 }
120 
121 };
122 
123 #if BOOST_VERSION >= 106000
125 #else
127 #endif
boost::unit_test::test_suite * init_unit_test_suite(int argc, char **const argv)
int __os_init(int argc, char **argv)
Definition: startstop.cpp:79
Definition: mystd.hpp:163
size_t init_memory_pool(size_t mem_pool_size, void *mem_pool)
Definition: tlsf.c:498
static StartStopManager * Instance()
static RTT_CORBA_API bool InitOrb(int argc, char *argv[], Seconds orb_timeout=0)
void __os_exit(void)
Definition: startstop.cpp:166
printstream cout
Definition: rtstreams.cpp:45
#define BOOST_GLOBAL_FIXTURE(F)
basic_ostreams & endl(basic_ostreams &s)
Definition: rtstreams.cpp:110
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
int setenv(const char *name, const char *value, int overwrite)
Definition: fosi.cpp:64
static void ShutdownOrb(bool wait_for_completion=true)
void stop()
Call all registered stop functions.
static Logger & log()
Definition: Logger.hpp:350
static Logger::LogFunction endlog()
Definition: Logger.hpp:362
void setLogLevel(LogLevel ll)
Definition: Logger.cpp:606


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:44