[Libreoffice-commits] online.git: test/helpers.hpp

Miklos Vajna vmiklos at collabora.co.uk
Fri Jun 16 05:47:38 UTC 2017


 test/helpers.hpp |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit de785d90b26f5462fa21736fef130e9bf775afef
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jun 15 21:03:09 2017 +0200

    test: give the socket the chance to get the error in getErrorCode()
    
    make check fails for me like this:
    
    Test name: HTTPCrashTest::testCrashKit
    equality assertion failed
    - Expected: 1001
    - Actual  : 65535
    
    Failures !!!
    Run: 1   Failure total: 1   Failures: 1   Errors: 0
    
    But when I run loolwsd and ./test manually (./test is invoked by gdb) and I
    step through the code, then the test passes. So I guess what happens is that we
    read from the socket too fast, and the error we're looking for is just not
    there yet. Add the same amount of sleep here (0.5s) than what's used in
    connectLOKit(), with that the test passes fine.
    
    (The sleep is in test-only code.)
    
    Change-Id: Iff105c45f21c40c2fb0a649fc9fd9a9065e7c952
    Reviewed-on: https://gerrit.libreoffice.org/38846
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/test/helpers.hpp b/test/helpers.hpp
index 97f91929..220ffd30 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -166,6 +166,7 @@ int getErrorCode(LOOLWebSocket& ws, std::string& message, const std::string& tes
     {
         bytes = ws.receiveFrame(buffer.begin(), READ_BUFFER_SIZE, flags);
         std::cerr << testname << "Got " << LOOLProtocol::getAbbreviatedFrameDump(buffer.begin(), bytes, flags) << std::endl;
+        std::this_thread::sleep_for(std::chrono::milliseconds(POLL_TIMEOUT_MS));
     }
     while (bytes > 0 && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE);
 


More information about the Libreoffice-commits mailing list