diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-03-23 08:50:44 +0000 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-17 16:39:39 +0200 |
commit | 0b7f8fb6971ca1df6f94508e45c42cdb157e3dab (patch) | |
tree | 7e7d4fa1279ef3e468179af3aa28e56d3f4a0fc8 /tubes/qa/test_manager.cxx | |
parent | 1b601608ec0a67a27d4e36955da2c32927f3f04f (diff) |
tubes test: fix stack corruption on test failure
We can't use CPPUNIT_ASSERT() from a callback called by C code (such as
the FileSent callback), or we'll trash the stack if it fails.
Diffstat (limited to 'tubes/qa/test_manager.cxx')
-rw-r--r-- | tubes/qa/test_manager.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index ce9a2d0a13db..d08190d56289 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -69,6 +69,8 @@ public: GMainLoop* mpMainLoop; void spinMainLoop(); + static void FileSent( bool success, void *user_data); + // Order is significant. CPPUNIT_TEST_SUITE( TestTeleTubes ); CPPUNIT_TEST( testSetupManager1 ); @@ -98,6 +100,8 @@ private: rtl::OString maOffererIdentifier; rtl::OString maAccepterIdentifier; + + bool maFileSentSuccess; }; // static, not members, so they actually survive cppunit test iteration @@ -287,11 +291,11 @@ void TestTeleTubes::testReceivePacket() CPPUNIT_ASSERT( nReceivedPackets == nSentPackets); } -static void TestTeleTubes_FileSent( bool success, void *user_data) +void TestTeleTubes::FileSent( bool success, void *user_data) { TestTeleTubes *self = reinterpret_cast<TestTeleTubes *>(user_data); - CPPUNIT_ASSERT( success); + self->maFileSentSuccess = success; g_main_loop_quit (self->mpMainLoop); } @@ -302,8 +306,10 @@ void TestTeleTubes::testSendFile() /* This has to run after testContactList has run successfully. */ CPPUNIT_ASSERT( mpAccepterContact != 0); mpManager1->sendFile( maTestConfigIniURL, - TestTeleTubes_FileSent, this); + &TestTeleTubes::FileSent, this); spinMainLoop(); + + CPPUNIT_ASSERT( maFileSentSuccess); } void TestTeleTubes::testFlushLoops() |