Work around Catch multi-thread unsafety
Don't use Catch asserts in threads other than main, this doesn't work reliably. Switch to using simple wxASSERT() which doesn't give as much information as Catch asserts when the test fails, but at least allows the tests to pass when the asserts don't fail.
This commit is contained in:
parent
ebf30adeb6
commit
729dd5e693
2 changed files with 9 additions and 5 deletions
|
|
@ -195,20 +195,22 @@ void *QueueTestCase::MyThread::Entry()
|
|||
if ( res == wxMSGQUEUE_MISC_ERROR )
|
||||
return (wxThread::ExitCode)wxMSGQUEUE_MISC_ERROR;
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( wxMSGQUEUE_NO_ERROR, res );
|
||||
// We can't use Catch asserts outside of the main thread
|
||||
// currently, unfortunately.
|
||||
wxASSERT( res == wxMSGQUEUE_NO_ERROR );
|
||||
}
|
||||
++messagesReceived;
|
||||
continue;
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL ( result, wxMSGQUEUE_TIMEOUT );
|
||||
wxASSERT( result == wxMSGQUEUE_TIMEOUT );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( messagesReceived != m_maxMsgCount )
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL( m_type, WaitWithTimeout );
|
||||
wxASSERT( m_type == WaitWithTimeout );
|
||||
|
||||
return (wxThread::ExitCode)wxMSGQUEUE_TIMEOUT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,10 @@ public:
|
|||
gs_threadData.name = "worker";
|
||||
gs_threadData.number = 2;
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( std::string("worker"), gs_threadData.name );
|
||||
CPPUNIT_ASSERT_EQUAL( 2, gs_threadData.number );
|
||||
// We can't use Catch asserts outside of the main thread,
|
||||
// unfortunately.
|
||||
wxASSERT( gs_threadData.name == std::string("worker") );
|
||||
wxASSERT( gs_threadData.number == 2 );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue