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:
Vadim Zeitlin
2017-11-01 22:23:15 +01:00
parent ebf30adeb6
commit 729dd5e693
2 changed files with 9 additions and 5 deletions

View File

@@ -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;
}