Changeset 12754 for tests/SystemQueue-tests.cc
- Timestamp:
- Mar 7, 2014, 7:39:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/SystemQueue-tests.cc
r12753 r12754 112 112 void OrderedCall(int num) 113 113 { 114 // XXX 115 cout << "### OrderedCall num: " << num << endl; 116 114 117 // check ordering 115 118 EXPECT_EQ( num, last_ordered_call + 1); … … 273 276 * but should not lengthen the test excessivly 274 277 */ 275 #define DELAY_TIME 10 // ms276 #define DELAY_MARGIN 1000 // microseconds (1/1000 ms)278 #define DELAY_TIME 20 // ms 279 #define DELAY_MARGIN 2000 // microseconds (1/1000 ms) 277 280 278 281 … … 308 311 // scheduleCall 309 312 sysq.scheduleCall( 310 boost::bind(&SystemQueueT est::Check, this), DELAY_TIME313 boost::bind(&SystemQueueTimingTest::Check, this), DELAY_TIME 311 314 ); 312 315 313 316 // noting to do until the delay is up.. 314 usleep(DELAY_TIME + DELAY_MARGIN );317 usleep(DELAY_TIME + DELAY_MARGIN*10); // XXX margin too high (TODO lower when SysQ is reimplemented) 315 318 316 319 // wait for the event to happen 317 320 wait_for_checkmark(MAX_WAIT); 318 321 319 EXPECT_TRUE( checkmark ) << "Del eyed function was not called within delaytime ("322 EXPECT_TRUE( checkmark ) << "Delayed function was not called within delaytime (" 320 323 << DELAY_TIME << " ms) + " << (MAX_WAIT + DELAY_MARGIN) << " microseconds."; 321 324 } 322 325 326 327 /** 328 * schedules a delayed call and tests whether it is called (more or less timely..) 329 */ 330 TEST_F(SystemQueueTimingTest, MultipleCalls) 331 { 332 // schedule 4th call 333 sysq.scheduleCall( 334 boost::bind(&SystemQueueTest::OrderedCall, this, 4), 335 DELAY_TIME*3 336 ); 337 338 // schedule 2nd call 339 sysq.scheduleCall( 340 boost::bind(&SystemQueueTest::OrderedCall, this, 2), 341 DELAY_TIME*1 342 ); 343 344 // schedule 3rd call 345 sysq.scheduleCall( 346 boost::bind(&SystemQueueTest::OrderedCall, this, 3), 347 DELAY_TIME*2 348 ); 349 350 // schedule 1st call (without delay) 351 sysq.scheduleCall( 352 boost::bind(&SystemQueueTest::OrderedCall, this, 1) 353 ); 354 355 356 // XXX the usual bug.. 357 sysq.scheduleCall( 358 boost::bind(&SystemQueueTest::Check, this), 359 DELAY_TIME*4 360 ); 361 362 // noting to do until the delay is up.. 363 usleep(DELAY_TIME*4 + DELAY_MARGIN*100); // XXX margin too high 364 365 // wait for the event to happen 366 wait_for_checkmark(MAX_WAIT); 367 368 // evaluation 369 EXPECT_EQ( 4, last_ordered_call); 370 }
Note:
See TracChangeset
for help on using the changeset viewer.