Changeset 12750 for tests/SystemQueue-tests.cc
- Timestamp:
- Mar 6, 2014, 6:07:56 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/SystemQueue-tests.cc
r12749 r12750 1 1 #include "gtest/gtest.h" 2 2 #include "ariba/utility/system/SystemQueue.h" 3 4 #include <unistd.h> // usleep 3 5 4 6 #include <ostream> … … 87 89 TEST_F(SystemQueueTest, ScheduleCall) 88 90 { 91 #define MAX_WAIT 100 // microseconds 92 #define SLEEP_TIME 10 // microseconds 93 89 94 SystemQueue& sysq = SystemQueue::instance(); 90 95 checkmark = false; // just to be sure.. … … 97 102 boost::bind(&SystemQueueTest::Check, this) 98 103 ); 99 100 // FIXME: yes, we have to wait a while here... 101 // maybe write a function (in the fixture): wait_for_remaining_events(int max_millisecs) 104 105 // wait for the event to happen, (but not too long!) 106 for ( int i = 0; i < MAX_WAIT / SLEEP_TIME; i++) 107 { 108 if ( checkmark ) 109 break; 110 111 cout << "/// sleeping for " << SLEEP_TIME << " microseconds ..." << endl; 112 usleep(SLEEP_TIME); 113 } 102 114 103 115 // stop 104 116 sysq.cancel(); 105 117 106 EXPECT_TRUE( checkmark ); 107 108 /* NOTE: If this fails, maybe we'll have to wait a bit..? 109 * There should be a possibility to cancel the SystemQueue as soon as it's empty.. 110 */ 118 EXPECT_TRUE( checkmark ) << "Function was called within " << MAX_WAIT << " microseconds."; 111 119 } 112 120
Note:
See TracChangeset
for help on using the changeset viewer.