• E
    event: share state driver between test:///default connections · fc967c3e
    Eric Blake 提交于
    Prior to this patch, every test:/// URI has its own event manager,
    which means that registering for an event can only ever receive
    events from the connection where it issued the API that triggered
    the event.  But the whole idea of events is to be able to learn
    about something where an API call did NOT trigger the action.
    
    In order to actually test asynchronous events, I wanted to be able
    to tie multiple test connections to the same state.  Use of a file
    in a test URI is still per-connection state, but now parallel
    connections to test:///default (from the same binary, of course)
    now share common state and can affect one another.
    
    The updated testsuite fails without the rest of this patch.
    Valgrind didn't report any leaks.
    
    * src/test/test_driver.c (testConnectOpen): Move per-connection
    state initialization...
    (testOpenFromFile): ...here.
    (defaultConn, defaultConnections, defaultLock, testOnceInit): New
    shared state.
    (testOpenDefault): Only initialize on first connection.
    (testConnectClose): Don't clobber state if still shared.
    * tests/objecteventtest.c (testDomainStartStopEvent): Enhance to
    cover this.
    (timeout, mymain): Ensure test fails rather than blocks.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    fc967c3e
test_driver.c 209.6 KB