27 #include <blackboard/internal/memory_manager.h>
28 #include <blackboard/local.h>
29 #include <blackboard/exceptions.h>
30 #include <blackboard/bbconfig.h>
32 #include <interfaces/TestInterface.h>
34 #include <core/exceptions/system.h>
44 using namespace fawkes;
50 signal_handler(
int signum)
59 main(
int argc,
char **argv)
62 signal(SIGINT, signal_handler);
73 cout <<
"Opening interfaces.. " << flush;
76 cout <<
"success, " <<
80 cout <<
"failed! Aborting" << endl;
86 cout <<
"Trying to open second writer.. " << flush;
89 bb->
close(ti_writer_two);
90 cout <<
"BUG: Detection of second writer did NOT work!" << endl;
93 cout <<
"exception caught as expected, detected and prevented second writer!" << endl;
96 cout <<
"Printing some meminfo ===============================================" << endl;
97 cout <<
"Free chunks:" << endl;
99 cout <<
"Allocated chunks:" << endl;
102 cout <<
"End of meminfo ======================================================" << endl;
105 cout <<
"Trying to open third writer.. " << flush;
108 cout <<
"No exception as expected, different ID ok!" << endl;
109 bb->
close(ti_writer_three);
111 cout <<
"BUG: Third writer with different ID detected as another writer!" << endl;
116 <<
"Running data tests ==================================================" << endl;
118 cout <<
"Writing initial value ("
119 << TestInterface::TEST_CONSTANT <<
") into interface as TestInt" << endl;
120 ti_writer->
set_test_int( TestInterface::TEST_CONSTANT );
124 cout <<
"BUG: caught write denied exception" << endl;
128 cout <<
"Reading value from reader interface.. " << flush;
131 if ( val == TestInterface::TEST_CONSTANT ) {
132 cout <<
" success, value is " << ti_reader->
test_int() <<
" as expected" << endl;
134 cout <<
" failure, value is " << ti_reader->
test_int() <<
", expected "
135 << TestInterface::TEST_CONSTANT << endl;
139 cout <<
"Iterating over reader interface.." << endl;
144 cout <<
"done" << endl;
146 cout <<
"Harnessing interface by excessive reading and writing, use Ctrl-C to interrupt" << endl
147 <<
"If you do not see any output everything is fine" << endl;
149 int expval = ti_reader->
test_int() + 1;
156 cout <<
"BUG: caught write denied exception" << endl;
163 if ( val == expval ) {
166 cout <<
" failure, value is " << ti_reader->
test_int() <<
", expected "
173 cout <<
"Tests done" << endl;
175 bb->
close(ti_reader);
176 bb->
close(ti_writer);