Ignore:
Timestamp:
Mar 6, 2014, 6:07:56 PM (11 years ago)
Author:
hock@…
Message:

fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/SystemQueue-tests.cc

    r12749 r12750  
    11#include "gtest/gtest.h"
    22#include "ariba/utility/system/SystemQueue.h"
     3
     4#include <unistd.h>  // usleep
    35
    46#include <ostream>
     
    8789TEST_F(SystemQueueTest, ScheduleCall)
    8890{
     91    #define MAX_WAIT 100  // microseconds
     92    #define SLEEP_TIME 10  // microseconds
     93
    8994    SystemQueue& sysq = SystemQueue::instance();
    9095    checkmark = false;  // just to be sure..
     
    97102        boost::bind(&SystemQueueTest::Check, this)
    98103    );
    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    }
    102114   
    103115    // stop
    104116    sysq.cancel();
    105117   
    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.";   
    111119}
    112120
Note: See TracChangeset for help on using the changeset viewer.