IPC: Fixed DisconnectedPeerError test 79/33279/1
authorJan Olszak <j.olszak@samsung.com>
Wed, 7 Jan 2015 15:02:54 +0000 (16:02 +0100)
committerJan Olszak <j.olszak@samsung.com>
Wed, 7 Jan 2015 15:06:27 +0000 (16:06 +0100)
[Bug/Feature]  N/A
[Cause]        SERIALIZATION_ERROR may also be returned when peer disconnects
[Solution]     N/A
[Verification] Build, install, run tests

Change-Id: Ifaf67828796cfa0def8d5f56dc926314abb2d36b

tests/unit_tests/ipc/ut-ipc.cpp

index a7f8645..18c4785 100644 (file)
@@ -532,10 +532,14 @@ BOOST_AUTO_TEST_CASE(DisconnectedPeerError)
 
     // Wait for the response
     std::unique_lock<std::mutex> lock(mutex);
-    BOOST_CHECK(cv.wait_for(lock, std::chrono::seconds(10), [&retStatus]() {
+    BOOST_CHECK(cv.wait_for(lock, std::chrono::seconds(100), [&retStatus]() {
         return retStatus != ipc::Status::UNDEFINED;
     }));
-    BOOST_CHECK(retStatus == ipc::Status::PEER_DISCONNECTED); //TODO it fails from time to time
+
+    // The disconnection might have happened:
+    // - after sending the message (PEER_DISCONNECTED)
+    // - during external serialization (SERIALIZATION_ERROR)
+    BOOST_CHECK(retStatus == ipc::Status::PEER_DISCONNECTED || retStatus == ipc::Status::SERIALIZATION_ERROR);
 }