[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit fd93e11934317792b3633cfea986752354ef8bab Author: Andras Timar AuthorDate: Wed Nov 13 22:16:59 2019 +0100 Commit: Andras Timar CommitDate: Wed Nov 13 22:16:59 2019 +0100 build fix after 'killpoco: removed StringTokenizer' Change-Id: I2f1cb0da199a8dca1cf300955f133f45b8d7ba3b diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 88308165d..7dc7d1500 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1096,9 +1096,9 @@ void TileCacheTests::checkTiles(std::shared_ptr& socket, const st CPPUNIT_ASSERT_GREATEREQUAL(static_cast(6), tokens.size()); #else if (docType == "presentation") -CPPUNIT_ASSERT_EQUAL(static_cast(7), tokens.count()); // We have an extra field. +CPPUNIT_ASSERT_EQUAL(static_cast(7), tokens.size()); // We have an extra field. else -CPPUNIT_ASSERT_EQUAL(static_cast(6), tokens.count()); +CPPUNIT_ASSERT_EQUAL(static_cast(6), tokens.size()); #endif // Expected format is something like 'type= parts= current= width= height='. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 8fb94e18272afb5db9a2ba9cb4eeb40380fabfb9 Author: Pranam Lashkari AuthorDate: Tue Nov 12 19:18:43 2019 +0530 Commit: Jan Holesovsky CommitDate: Tue Nov 12 17:50:17 2019 +0100 StringTokenizer replaced with tokenize in file `TileCacheTsts.cpp` Change-Id: I1024329bf518795b819f19f497af70d2266ec7da Reviewed-on: https://gerrit.libreoffice.org/82543 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 0f0195b10..88308165d 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1088,12 +1088,12 @@ void TileCacheTests::checkTiles(std::shared_ptr& socket, const st std::istringstream istr(response.substr(8)); std::getline(istr, line); -Poco::StringTokenizer tokens(line, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); +std::vector tokens(LOOLProtocol::tokenize(line, ' ')); #if defined CPPUNIT_ASSERT_GREATEREQUAL if (docType == "presentation") -CPPUNIT_ASSERT_GREATEREQUAL(static_cast(7), tokens.count()); // We have an extra field. +CPPUNIT_ASSERT_GREATEREQUAL(static_cast(7), tokens.size()); // We have an extra field. else -CPPUNIT_ASSERT_GREATEREQUAL(static_cast(6), tokens.count()); +CPPUNIT_ASSERT_GREATEREQUAL(static_cast(6), tokens.size()); #else if (docType == "presentation") CPPUNIT_ASSERT_EQUAL(static_cast(7), tokens.count()); // We have an extra field. @@ -1198,7 +1198,7 @@ void TileCacheTests::requestTiles(std::shared_ptr& socket, sendTextFrame(socket, text, name); tile = assertResponseString(socket, "tile:", name); // expected tile: part= width= height= tileposx= tileposy= tilewidth= tileheight= -Poco::StringTokenizer tokens(tile, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); +std::vector tokens(LOOLProtocol::tokenize(tile, ' ')); CPPUNIT_ASSERT_EQUAL(std::string("tile:"), tokens[0]); CPPUNIT_ASSERT_EQUAL(0, std::stoi(tokens[1].substr(std::string("nviewid=").size(; CPPUNIT_ASSERT_EQUAL(part, std::stoi(tokens[2].substr(std::string("part=").size(; @@ -1346,7 +1346,7 @@ void TileCacheTests::testTileProcessed() ++arrivedTile; // Store tileID, so we can send it back -Poco::StringTokenizer tokens(tile, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); +std::vector tokens(LOOLProtocol::tokenize(tile, ' ')); std::string tileID = tokens[2].substr(std::string("part=").size()) + ":" + tokens[5].substr(std::string("tileposx=").size()) + ":" + tokens[6].substr(std::string("tileposy=").size()) + ":" + @@ -1394,7 +1394,7 @@ void TileCacheTests::testTileInvalidatedOutside() // First wsd forwards the invalidation std::string sInvalidate = assertResponseString(socket, "invalidatetiles:", testname); -Poco::StringTokenizer tokens(sInvalidate, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); +std::vector tokens(LOOLProtocol::tokenize(sInvalidate, ' ')); int y = std::stoi(tokens[3].substr(std::string("y=").size())); int height = std::stoi(tokens[5].substr(std::string("height=").size())); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 3ba17824e356db841aae2e40d07dd5c29aba9128 Author: Miklos Vajna AuthorDate: Thu Oct 31 09:39:38 2019 +0100 Commit: Miklos Vajna CommitDate: Thu Oct 31 09:39:45 2019 +0100 Fix TileCacheTests::testUnresponsiveClient() This started to reliably fail for me recently. I think the problem was that deleteAll() also listened for incoming messages, so while waiting for textselection:, perhaps it processed (and ignored) invalidatetiles:. As a consequence, once deleteAll() returned and testUnresponsiveClient() started to wait for invalidatetiles:, the test may or may not failed, depending on the order of messages. Fix the problem by just dispatching the SelectAll and Delete commands, then waiting for invalidatetiles:. Change-Id: I33f096e7dcb7f9daf1968dcb50d8a5f53824f5bd diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index f9d94c6e1..0f0195b10 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -456,7 +456,8 @@ void TileCacheTests::testUnresponsiveClient() for (int x = 0; x < 8; ++x) { // Invalidate to force re-rendering. -deleteAll(socket2, testname); +sendTextFrame(socket2, "uno .uno:SelectAll", testname); +sendTextFrame(socket2, "uno .uno:Delete", testname); assertResponseString(socket2, "invalidatetiles:", testname + "2 "); sendTextFrame(socket2, "paste mimetype=text/html\n" + documentContents, testname + "2 "); assertResponseString(socket2, "invalidatetiles:", testname + "2 "); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) New commits: commit 0106ab24f646ff28e463679bf2c540c6bcfacebf Author: Ashod Nakashian AuthorDate: Sat Oct 26 10:11:35 2019 -0400 Commit: Ashod Nakashian CommitDate: Tue Oct 29 02:40:34 2019 +0100 test: improve TileCacheTests::testUnresponsiveClient Change-Id: Ib08c4675c9477cb925b5d42545cdc2cdae780fbe Reviewed-on: https://gerrit.libreoffice.org/81579 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 913d777fc..f9d94c6e1 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -430,20 +430,22 @@ void TileCacheTests::testDisconnectMultiView() void TileCacheTests::testUnresponsiveClient() { -const char* testname = "testUnresponsiveClient"; +const std::string testname = "unresponsiveClient-"; + std::string documentPath, documentURL; -getDocumentPathAndURL("hello.odt", documentPath, documentURL, "unresponsiveClient "); +getDocumentPathAndURL("hello.odt", documentPath, documentURL, testname); TST_LOG("Connecting first client."); -std::shared_ptr socket1 = loadDocAndGetSocket(_uri, documentURL, "unresponsiveClient-1 "); +std::shared_ptr socket1 += loadDocAndGetSocket(_uri, documentURL, testname + "1 "); TST_LOG("Connecting second client."); -std::shared_ptr socket2 = loadDocAndGetSocket(_uri, documentURL, "unresponsiveClient-2 "); +std::shared_ptr socket2 += loadDocAndGetSocket(_uri, documentURL, testname + "2 "); // Pathologically request tiles and fail to read (say slow connection). // Meanwhile, verify that others can get all tiles fine. // TODO: Track memory consumption to verify we don't buffer too much. - std::ostringstream oss; for (int i = 0; i < 1000; ++i) { @@ -454,24 +456,31 @@ void TileCacheTests::testUnresponsiveClient() for (int x = 0; x < 8; ++x) { // Invalidate to force re-rendering. -sendTextFrame(socket2, "uno .uno:SelectAll"); -sendTextFrame(socket2, "uno .uno:Delete"); -assertResponseString(socket2, "invalidatetiles:", "client2 "); -sendTextFrame(socket2, "paste mimetype=text/html\n" + documentContents); -assertResponseString(socket2, "invalidatetiles:", "client2 "); +deleteAll(socket2, testname); +assertResponseString(socket2, "invalidatetiles:", testname + "2 "); +sendTextFrame(socket2, "paste mimetype=text/html\n" + documentContents, testname + "2 "); +assertResponseString(socket2, "invalidatetiles:", testname + "2 "); // Ask for tiles and don't read! -sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); +sendTextFrame(socket1, "tilecombine nviewid=0 part=0 width=256 height=256 " + "tileposx=0,3840,7680,11520,0,3840,7680,11520 " + "tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 " + "tileheight=3840", + testname + "1 "); // Verify that we get all 8 tiles. -sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); +sendTextFrame(socket2, "tilecombine nviewid=0 part=0 width=256 height=256 " + "tileposx=0,3840,7680,11520,0,3840,7680,11520 " + "tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 " + "tileheight=3840", + testname + "2 "); for (int i = 0; i < 8; ++i) { -std::vector tile = getResponseMessage(socket2, "tile:", "client2 "); +std::vector tile = getResponseMessage(socket2, "tile:", testname + "2 "); CPPUNIT_ASSERT_MESSAGE("Did not receive tile #" + std::to_string(i+1) + " of 8: message as expected", !tile.empty()); } /// Send canceltiles message to clear tiles-on-fly list, otherwise wsd waits for tileprocessed messages -sendTextFrame(socket2, "canceltiles"); +sendTextFrame(socket2, "canceltiles", testname + "2 "); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/TileCache.cpp wsd/TileCache.hpp
test/TileCacheTests.cpp | 31 wsd/DocumentBroker.cpp | 12 wsd/DocumentBroker.hpp |3 + wsd/TileCache.cpp | 116 ++-- wsd/TileCache.hpp | 18 +++ 5 files changed, 165 insertions(+), 15 deletions(-) New commits: commit 7890533419f2fda99e5d0a4f6c54e10b0516787d Author: Michael Meeks AuthorDate: Mon Oct 28 13:26:15 2019 + Commit: Michael Meeks CommitDate: Mon Oct 28 20:29:01 2019 + TileCache: track and limit size to control memory usage. Implement a basic WSD-side memory sizing approach and tell the Admin console about it. Change-Id: I1f0b5cf9fe29cb23ea574371e81e981b7af7a954 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index ad0f46823..174f3d5bb 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -60,6 +60,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testDesc); CPPUNIT_TEST(testSimple); CPPUNIT_TEST(testSimpleCombine); +CPPUNIT_TEST(testSize); CPPUNIT_TEST(testCancelTiles); // unstable // CPPUNIT_TEST(testCancelTilesMultiView); @@ -95,6 +96,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture void testDesc(); void testSimple(); void testSimpleCombine(); +void testSize(); void testCancelTiles(); void testCancelTilesMultiView(); void testDisconnectMultiView(); @@ -262,6 +264,35 @@ void TileCacheTests::testSimpleCombine() CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2b.empty()); } +void TileCacheTests::testSize() +{ +// Create TileCache and pretend the file was modified as recently as +// now, so it discards the cached data. +TileCache tc("doc.ods", std::chrono::system_clock::time_point()); + +int nviewid = 0; +int part = 0; +int width = 256; +int height = 256; +int tilePosX = 0; +int tileWidth = 3840; +int tileHeight = 3840; +TileWireId id = 0; +const std::vector data = genRandomData(4096); + +// Churn the cache somewhat +size_t maxSize = (data.size() + sizeof (TileDesc)) * 10; +tc.setMaxCacheSize(maxSize); +for (int tilePosY = 0; tilePosY < 20; tilePosY++) +{ +TileDesc tile(nviewid, part, width, height, tilePosX, tilePosY * tileHeight, + tileWidth, tileHeight, -1, 0, -1, false); +tile.setWireId(id++); +tc.saveTileAndNotify(tile, data.data(), data.size()); +} +CPPUNIT_ASSERT_MESSAGE("tile cache too big", tc.getMemorySize() < maxSize); +} + void TileCacheTests::testCancelTiles() { const char* testname = "cancelTiles "; diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index c3f0dd04c..081a07c55 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -290,6 +290,9 @@ void DocumentBroker::pollThread() const auto now = std::chrono::steady_clock::now(); #if !MOBILEAPP +// a tile's data is ~8k, a 4k screen is ~128 256x256 tiles +_tileCache->setMaxCacheSize(8 * 1024 * 128 * _sessions.size()); + if (!_isLoaded && (limit_load_secs > 0) && (now > loadDeadline)) { LOG_WRN("Doc [" << _docKey << "] is taking too long to load. Will kill process [" @@ -1444,7 +1447,8 @@ bool DocumentBroker::handleInput(const std::vector& payload) int dirty; if (message->getTokenInteger("dirty", dirty)) { -Admin::instance().updateMemoryDirty(_docKey, dirty); +Admin::instance().updateMemoryDirty( +_docKey, dirty + getMemorySize()/1024); } } #endif @@ -1458,6 +1462,12 @@ bool DocumentBroker::handleInput(const std::vector& payload) return true; } +size_t DocumentBroker::getMemorySize() const +{ +return sizeof(DocumentBroker) + _tileCache->getMemorySize() + +_sessions.size() * sizeof(ClientSession); +} + void DocumentBroker::invalidateTiles(const std::string& tiles, int normalizedViewId) { // Remove from cache. diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 4d66ffae3..b64c7c28c 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -362,6 +362,9 @@ public: /// For testing only [!] std::vector> getSessionsTestOnlyUnsafe(); +/// Estimate memory usage / bytes +size_t getMemorySize() const; + private: /// Loads a document from the public URI into the jail. diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp index df4141dfa..4c34577d2 100644 --- a/wsd/TileCache.cpp +++ b/wsd/TileCache.cpp @@ -35,7 +35,9 @@ TileCache::TileCache(const std::string& docURL, const std::chrono::system_clock::time_point& modifiedTime, bool dontCache) : _docURL(docURL), -_dontCache(dontCache) +_dontCache(dontCache), +_cacheSize(0), +_maxCacheSize(512*1024) { #ifndef BUILDING_TESTS LOG_INF("
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit 4ff376bb454ccb0c6d2106c978323305d0a2bb08 Author: Ashod Nakashian AuthorDate: Wed Oct 16 09:09:59 2019 -0400 Commit: Michael Meeks CommitDate: Mon Oct 28 12:01:38 2019 +0100 testTileWriteIDHandling: don't block for too long When polling for tile messages, the last wait (which will timeout) by default will be 10 seconds. This is too long to make the tests fast enough, and also results in the internal cache from evicting tiles in some cases. Reviewed-on: https://gerrit.libreoffice.org/80897 Reviewed-by: Andras Timar Tested-by: Andras Timar (cherry picked from commit e173427bd9ca5939339994180f5b51ea11393050) Change-Id: I6c2b80022ffcef2b21c99dd57bca61e7daaadc86 Reviewed-on: https://gerrit.libreoffice.org/81568 Reviewed-by: Michael Meeks Tested-by: Michael Meeks diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 0eba9e2d3..ad0f46823 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1145,7 +1145,7 @@ void TileCacheTests::requestTiles(std::shared_ptr& socket, const sendTextFrame(socket, text, name); tile = assertResponseString(socket, "tile:", name); -// expected tile: nviewid= part= width= height= tileposx= tileposy= tilewidth= tileheight= +// expected tile: nviewid= part= width= height= tileposx= tileposy= tilewidth= tileheight= Poco::StringTokenizer tokens(tile, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); CPPUNIT_ASSERT_EQUAL(std::string("tile:"), tokens[0]); CPPUNIT_ASSERT_EQUAL(0, std::stoi(tokens[1].substr(std::string("nviewid=").size(; @@ -1243,7 +1243,8 @@ void TileCacheTests::testTileWireIDHandling() bool gotTile = false; do { -std::vector tile = getResponseMessage(socket, "tile:", testname); +// If we wait for too long, the cached tiles will get evicted. +std::vector tile = getResponseMessage(socket, "tile:", testname, 500); gotTile = !tile.empty(); if(gotTile) ++arrivedTiles; @@ -1393,7 +1394,7 @@ void TileCacheTests::testTileBeingRenderedHandling() bool gotTile = false; do { -std::vector tile = getResponseMessage(socket, "tile:", testname); +std::vector tile = getResponseMessage(socket, "tile:", testname, 500); gotTile = !tile.empty(); if(gotTile) ++arrivedTiles; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 10a0ee1cfe9c3a90e13b8fbf7fb8c1591418c2ad Author: Tamás Zolnai AuthorDate: Mon Sep 30 13:42:43 2019 +0200 Commit: Tamás Zolnai CommitDate: Tue Oct 1 13:03:31 2019 +0200 Fix up TileCacheTests::testTileInvalidateWriterPage() test The part number in case of writer has no actual meaning, since for writer we have only one part (the whole document). It seems the code is not consistent in that it is 0 or 1. Change-Id: I9e56079f7861f7e0d5794e6f711045cd9448dfa7 Reviewed-on: https://gerrit.libreoffice.org/79851 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 673d9580c..12bd324e7 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -830,7 +830,7 @@ void TileCacheTests::testTileInvalidateWriterPage() int part = -1; CPPUNIT_ASSERT_MESSAGE("No part# in invalidatetiles message.", LOOLProtocol::getTokenIntegerFromMessage(res, "part", part)); -CPPUNIT_ASSERT_EQUAL(1, part); +CPPUNIT_ASSERT_EQUAL(0, part); } // This isn't yet used ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 45 + 1 file changed, 25 insertions(+), 20 deletions(-) New commits: commit 24615d9dd005fafac3c03645fe7469dd75a21893 Author: Miklos Vajna AuthorDate: Thu Sep 12 23:09:35 2019 +0200 Commit: Miklos Vajna CommitDate: Thu Sep 12 23:09:54 2019 +0200 test: avoid writing to cerr directly in TileCacheTests So that we always know which line comes from which test, to make the output more readable. Change-Id: Icabfb45b719daf733fb4cff99f364a574cbdb65d diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 42a9b5f2c..673d9580c 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -250,7 +250,7 @@ void TileCacheTests::testSimpleCombine() CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty()); // Second. -std::cerr << "Connecting second client." << std::endl; +TST_LOG("Connecting second client."); std::shared_ptr socket2 = loadDocAndGetSocket(_uri, documentURL, "simpleCombine-2 ", true); sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840"); @@ -263,25 +263,25 @@ void TileCacheTests::testSimpleCombine() void TileCacheTests::testCancelTiles() { -const char* testName = "cancelTiles "; +const char* testname = "cancelTiles "; // The tile response can race past the canceltiles, // so be forgiving to avoid spurious failures. const size_t repeat = 4; for (size_t i = 1; i <= repeat; ++i) { -std::cerr << "cancelTiles try #" << i << std::endl; +TST_LOG("cancelTiles try #" << i); // Wait to clear previous sessions. countLoolKitProcesses(InitialLoolKitCount); -std::shared_ptr socket = loadDocAndGetSocket("setclientpart.ods", _uri, testName); +std::shared_ptr socket = loadDocAndGetSocket("setclientpart.ods", _uri, testname); // Request a huge tile, and cancel immediately. sendTextFrame(socket, "tilecombine part=0 width=2560 height=2560 tileposx=0 tileposy=0 tilewidth=38400 tileheight=38400"); sendTextFrame(socket, "canceltiles"); -const auto res = getResponseString(socket, "tile:", testName, 1000); +const auto res = getResponseString(socket, "tile:", testname, 1000); if (res.empty()) { break; @@ -293,13 +293,14 @@ void TileCacheTests::testCancelTiles() CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res + "].", res.empty()); } -std::cerr << "Unexpected: [" << res << "]" << std::endl; +TST_LOG("Unexpected: [" << res << "]"); } } } void TileCacheTests::testCancelTilesMultiView() { +const char* testname = "testCancelTilesMultiView"; std::string documentPath, documentURL; getDocumentPathAndURL("setclientpart.ods", documentPath, documentURL, "cancelTilesMultiView "); @@ -308,7 +309,7 @@ void TileCacheTests::testCancelTilesMultiView() const size_t repeat = 4; for (size_t j = 1; j <= repeat; ++j) { -std::cerr << "cancelTilesMultiView try #" << j << std::endl; +TST_LOG("cancelTilesMultiView try #" << j); // Wait to clear previous sessions. countLoolKitProcesses(InitialLoolKitCount); @@ -329,7 +330,7 @@ void TileCacheTests::testCancelTilesMultiView() CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res1 + "].", res1.empty()); } -std::cerr << "Unexpected: [" << res1 << "]" << std::endl; +TST_LOG("Unexpected: [" << res1 << "]"); continue; } @@ -350,7 +351,7 @@ void TileCacheTests::testCancelTilesMultiView() CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res2 + "].", res1.empty()); } -std::cerr << "Unexpected: [" << res2 << "]" << std::endl; +TST_LOG("Unexpected: [" << res2 << "]"); continue; } @@ -363,13 +364,14 @@ void TileCacheTests::testCancelTilesMultiView() void TileCacheTests::testDisconnectMultiView() { +const char* testname = "testDisconnectMultiView"; std::string documentPath, documentURL; getDocumentPathAndURL("setclientpart.ods", documentPath, documentURL, "disconnectMultiView "); const size_t repeat = 4; for (size_t j = 1; j <= repeat; ++j) { -std::cerr << "disconnectMultiView try #" << j << std::endl; +TST_LOG("disconnectMultiView try #" << j); // Wait to clear previous sessions. countLoolKitProcesses(InitialLoolKitCount); @@ -395,13 +397,14 @@ void TileCacheTests::testDisconnectMultiView() void TileCacheTests::testUnresponsiveClient() { +const char* testname = "testUnresponsiveClient"; std::string documentPath, documentURL; getDocumentPathAndURL("hello.odt", do
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 98fb165c6918cfc8db2482d46fc3efdfe38478bf Author: Michael Meeks AuthorDate: Wed May 1 21:54:45 2019 +0100 Commit: Michael Meeks CommitDate: Wed May 1 22:56:17 2019 +0200 Adapt test for new hiddenparts field. Change-Id: Id2173a38167b97327d0735dfe2a8c88e2dcc4bc7 Reviewed-on: https://gerrit.libreoffice.org/71640 Reviewed-by: Michael Meeks Tested-by: Michael Meeks diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index d6577f50a..7f8b0e63a 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1041,7 +1041,10 @@ void TileCacheTests::checkTiles(std::shared_ptr& socket, const st std::getline(istr, line); Poco::StringTokenizer tokens(line, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); -CPPUNIT_ASSERT_EQUAL(static_cast(6), tokens.count()); +if (docType == "presentation" || docType == "spreadsheet") // extra hiddenparts="..." +CPPUNIT_ASSERT_EQUAL(static_cast(7), tokens.count()); +else +CPPUNIT_ASSERT_EQUAL(static_cast(6), tokens.count()); // Expected format is something like 'type= parts= current= width= height='. const std::string text = tokens[0].substr(type.size()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/TileCache.cpp wsd/TileCache.hpp wsd/TileDesc.hpp
test/TileCacheTests.cpp | 11 ++ wsd/ClientSession.cpp | 14 +-- wsd/DocumentBroker.cpp |1 wsd/TileCache.cpp | 208 +--- wsd/TileCache.hpp | 106 +++- wsd/TileDesc.hpp|2 6 files changed, 212 insertions(+), 130 deletions(-) New commits: commit 6634d3b3e9c6ac8aac37a344fc2de4f543f52170 Author: Michael Meeks AuthorDate: Fri Feb 15 21:55:47 2019 +0100 Commit: Michael Meeks CommitDate: Tue Mar 5 06:58:50 2019 +0100 TileCache: key almost everything on TileDesc instead of string names. Saves lots of string construction and storage, simplifies lots of code. Store the more exotic font-caching bits etc. in a separate store: we should also pre-render these really and share them. Change-Id: Icaeff8fd72f52d7215c06a687b1e39cfb7631503 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index c02989dee..d6577f50a 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -57,6 +57,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST_SUITE(TileCacheTests); +CPPUNIT_TEST(testDesc); CPPUNIT_TEST(testSimple); CPPUNIT_TEST(testSimpleCombine); CPPUNIT_TEST(testCancelTiles); @@ -91,6 +92,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST_SUITE_END(); +void testDesc(); void testSimple(); void testSimpleCombine(); void testCancelTiles(); @@ -173,6 +175,15 @@ public: } }; +void TileCacheTests::testDesc() +{ +TileCacheDesc descA = TileDesc(0, 256, 256, 0, 0, 3200, 3200, /* ignored in cache */ 0, 1234, 1, true); +TileCacheDesc descB = TileDesc(0, 256, 256, 0, 0, 3200, 3200, /* ignored in cache */ 1, 1235, 2, false); + +CPPUNIT_ASSERT_MESSAGE("versions do match", descA.getVersion() != descB.getVersion()); +CPPUNIT_ASSERT_MESSAGE("Compare includes fields it should not", descA == descB); +} + void TileCacheTests::testSimple() { if (isStandalone()) diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index c3d5b9a83..6b61765ae 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -480,15 +480,11 @@ bool ClientSession::getCommandValues(const char *buffer, int length, const std:: { std::string command; if (tokens.size() != 2 || !getTokenString(tokens[1], "command", command)) -{ return sendTextFrame("error: cmd=commandvalues kind=syntax"); -} std::string cmdValues; -if (docBroker->tileCache().getTextFile("cmdValues" + command + ".txt", cmdValues)) -{ +if (docBroker->tileCache().getTextStream(TileCache::StreamType::CmdValues, command, cmdValues)) return sendTextFrame(cmdValues); -} return forwardToChild(std::string(buffer, length), docBroker); } @@ -505,8 +501,7 @@ bool ClientSession::sendFontRendering(const char *buffer, int length, const std: getTokenString(tokens[2], "char", text); - -TileCache::Tile cachedTile = docBroker->tileCache().lookupCachedTile(font+text, "font"); +TileCache::Tile cachedTile = docBroker->tileCache().lookupCachedStream(TileCache::StreamType::Font, font+text); if (cachedTile) { const std::string response = "renderfont: " + Poco::cat(std::string(" "), tokens.begin() + 1, tokens.end()) + "\n"; @@ -951,7 +946,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt commandName == ".uno:StyleApply") { // other commands should not be cached -docBroker->tileCache().saveTextFile(stringMsg, "cmdValues" + commandName + ".txt"); + docBroker->tileCache().saveTextStream(TileCache::StreamType::CmdValues, stringMsg, commandName); } } } @@ -1006,7 +1001,8 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt getTokenString(tokens[2], "char", text); assert(firstLine.size() < static_cast(length)); -docBroker->tileCache().saveRendering(font+text, "font", buffer + firstLine.size() + 1, length - firstLine.size() - 1); +docBroker->tileCache().saveStream(TileCache::StreamType::Font, font+text, + buffer + firstLine.size() + 1, length - firstLine.size() - 1); return forwardToClient(payload); } } diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 888500de8..3194d4f58 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -1645,7 +1645,6 @@ void DocumentBroker::setModified(const bool value) } _storage->setUserModified(value); -_tileCache->setUnsavedChanges(value); } bool DocumentBroker::isInitialSettingSet(const std::string& name) const diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp index 6ca40c9f9..3b9fb9d41 100644 --- a/wsd/TileCache.cpp
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |6 -- 1 file changed, 6 deletions(-) New commits: commit c04fd49d42dc41ed807cf4a9309a2f503027081e Author: Miklos Vajna AuthorDate: Wed Dec 5 09:07:18 2018 +0100 Commit: Miklos Vajna CommitDate: Wed Dec 5 09:14:50 2018 +0100 TileCacheTests: these writes are never read They are written again inside the do { ... } while (...) which runs at least once. Change-Id: I9ff07d7cb68b73bccf1bd38490fcba615b87a6ba diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 3f0be4016..3b1954a8b 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1238,7 +1238,6 @@ void TileCacheTests::testTileWireIDHandling() // For the second input wsd will send one tile, since some of them are indentical arrivedTiles = 0; -gotTile = false; do { std::vector tile = getResponseMessage(socket, "tile:", testname); @@ -1299,7 +1298,6 @@ void TileCacheTests::testTileProcessed() // Now we can get the remaining tiles int arrivedTile2 = 0; -gotTile = false; do { std::vector tile = getResponseMessage(socket, "tile:", testname); @@ -1391,7 +1389,6 @@ void TileCacheTests::testTileBeingRenderedHandling() assertResponseString(socket, "invalidatetiles:", testname); arrivedTiles = 0; -gotTile = false; do { std::vector tile = getResponseMessage(socket, "tile:", testname, 500); @@ -1449,7 +1446,6 @@ void TileCacheTests::testWireIDFilteringOnWSDSide() // For the second input wsd will send one tile, since other tiles are indentical arrivedTiles = 0; -gotTile = false; do { std::vector tile = getResponseMessage(socket1, "tile:", testname, 1000); @@ -1466,7 +1462,6 @@ void TileCacheTests::testWireIDFilteringOnWSDSide() // We expect three tiles sent to the second client arrivedTiles = 0; -gotTile = false; do { std::vector tile = getResponseMessage(socket2, "tile:", testname, 1000); @@ -1511,7 +1506,6 @@ void TileCacheTests::testLimitTileVersionsOnFly() sendChar(socket, 'x', skNone, testname); // Handle all tiles sent by wsd -getTileResp = false; do { std::string tile = getResponseString(socket, "tile:", testname, 1000); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit f16a868226738ebc425cda888268bf76d5fc2461 Author: Tamás Zolnai AuthorDate: Mon Oct 1 18:36:50 2018 +0200 Commit: Tamás Zolnai CommitDate: Mon Oct 1 18:36:50 2018 +0200 Reduce the running time of testWireIDFilteringOnWSDSide Change-Id: I1c7e576aaa1af938380a2de33b1512b31ef6ca75 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 6ade3ab6a..f4269c3bc 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1435,7 +1435,7 @@ void TileCacheTests::testWireIDFilteringOnWSDSide() bool gotTile = false; do { -std::vector tile = getResponseMessage(socket1, "tile:", testname); +std::vector tile = getResponseMessage(socket1, "tile:", testname, 5000); gotTile = !tile.empty(); if(gotTile) ++arrivedTiles; @@ -1452,7 +1452,7 @@ void TileCacheTests::testWireIDFilteringOnWSDSide() gotTile = false; do { -std::vector tile = getResponseMessage(socket1, "tile:", testname); +std::vector tile = getResponseMessage(socket1, "tile:", testname, 1000); gotTile = !tile.empty(); if(gotTile) ++arrivedTiles; @@ -1469,7 +1469,7 @@ void TileCacheTests::testWireIDFilteringOnWSDSide() gotTile = false; do { -std::vector tile = getResponseMessage(socket2, "tile:", testname); +std::vector tile = getResponseMessage(socket2, "tile:", testname, 1000); gotTile = !tile.empty(); if(gotTile) ++arrivedTiles; @@ -1478,7 +1478,7 @@ void TileCacheTests::testWireIDFilteringOnWSDSide() CPPUNIT_ASSERT_EQUAL(3, arrivedTiles); // wsd should not send tiles messages for the first client -std::vector tile = getResponseMessage(socket1, "tile:", testname); +std::vector tile = getResponseMessage(socket1, "tile:", testname, 1000); CPPUNIT_ASSERT_MESSAGE("Not expected tile message arrived!", tile.empty()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |1 - 1 file changed, 1 deletion(-) New commits: commit 1e0b4928ad84f640cb281257250d4f6206993543 Author: Tamás Zolnai AuthorDate: Mon Sep 3 16:54:12 2018 +0200 Commit: Tamás Zolnai CommitDate: Mon Sep 3 16:54:12 2018 +0200 Remove this printing line used only for debugging Change-Id: I482adcac61cf2fa4bec4fb02feec0e23370a3e45 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 10a1900f4..32a47169d 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -1192,7 +1192,6 @@ void TileCacheTests::testTileRequestByZoom() { std::vector tile = getResponseMessage(socket, "tile:", testname); CPPUNIT_ASSERT_MESSAGE("Did not get tile as expected!", !tile.empty()); -std::cout << i << std::endl; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 27 --- 1 file changed, 27 deletions(-) New commits: commit 1001f083f13248e2a51c03391f46cc4fef4636f9 Author: Tamás Zolnai AuthorDate: Thu Aug 16 16:02:20 2018 +0200 Commit: Tamás Zolnai CommitDate: Thu Aug 16 16:02:20 2018 +0200 Remove this test, it just dumps the result instead of assert on that Change-Id: Id9976d98bbd30cb38cee86b1ff45b96922065d11 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index dd6fb9714..afff54f55 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -58,7 +58,6 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testSimple); CPPUNIT_TEST(testSimpleCombine); -CPPUNIT_TEST(testPerformance); CPPUNIT_TEST(testCancelTiles); // unstable // CPPUNIT_TEST(testCancelTilesMultiView); @@ -84,7 +83,6 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture void testSimple(); void testSimpleCombine(); -void testPerformance(); void testCancelTiles(); void testCancelTilesMultiView(); void testDisconnectMultiView(); @@ -235,31 +233,6 @@ void TileCacheTests::testSimpleCombine() CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2b.empty()); } -void TileCacheTests::testPerformance() -{ -std::shared_ptr socket = loadDocAndGetSocket("hello.odt", _uri, "performance "); - -Poco::Timestamp timestamp; -for (int x = 0; x < 5; ++x) -{ -sendTextFrame(socket, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); -for (int i = 0; i < 8; ++i) -{ -std::vector tile = getResponseMessage(socket, "tile:", "tile-performance "); -CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile.empty()); -} -/// Send canceltiles message to clear tiles-on-fly list, otherwise wsd waits for tileprocessed messages -sendTextFrame(socket, "canceltiles"); -} - -std::cerr << "Tile rendering roundtrip for 5 x 8 tiles combined: " << timestamp.elapsed() / 1000. - << " ms. Per-tilecombine: " << timestamp.elapsed() / (1000. * 5) - << " ms. Per-tile: " << timestamp.elapsed() / (1000. * 5 * 8) << "ms." - << std::endl; - -socket->shutdown(); -} - void TileCacheTests::testCancelTiles() { const char* testName = "cancelTiles "; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 4d1ffab9413fdbc1636686b07d88df785485766a Author: Tamás Zolnai AuthorDate: Fri Aug 3 13:50:40 2018 +0200 Commit: Tamás Zolnai CommitDate: Fri Aug 3 13:50:40 2018 +0200 Disable testCancelTilesMultiView It's seems unstable. After canceltiles wsd still can send tiles if they already in the senderqueue. Change-Id: I28f669aa18dfbfee1d9d242bd1ee3d0490f06c68 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 09fe0671e..dd6fb9714 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -60,7 +60,8 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testSimpleCombine); CPPUNIT_TEST(testPerformance); CPPUNIT_TEST(testCancelTiles); -CPPUNIT_TEST(testCancelTilesMultiView); +// unstable +// CPPUNIT_TEST(testCancelTilesMultiView); CPPUNIT_TEST(testDisconnectMultiView); CPPUNIT_TEST(testUnresponsiveClient); CPPUNIT_TEST(testImpressTiles); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 10 ++ 1 file changed, 10 insertions(+) New commits: commit ed87891d284f0ac37b0ecdfcffe7657ed081d28c Author: Michael Meeks Date: Fri May 18 14:32:26 2018 +0100 Make PNG tile tests more robust. Change-Id: Id7afcfe9b29b2d5544e296b13f04c195d35655b5 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 4d1bde30d..10d8ba648 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -698,6 +698,10 @@ void TileCacheTests::testLoad12ods() { CPPUNIT_FAIL(exc.displayText()); } +catch (...) +{ +CPPUNIT_FAIL("Unexpected exception thrown during ods load"); +} } void TileCacheTests::checkBlackTile(std::stringstream& tile) @@ -742,6 +746,12 @@ void TileCacheTests::checkBlackTiles(std::shared_ptr& socket, con sendTextFrame(socket, req); const std::vector tile = getResponseMessage(socket, "tile:", name); +if (!tile.size()) +{ +CPPUNIT_FAIL("No tile returned to checkBlackTiles - failed load ?"); +return; +} + const std::string firstLine = LOOLProtocol::getFirstLine(tile); #if 0 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 7633525904083bc427590834a4aa309f84bb32cc Author: Ashod Nakashian Date: Sun May 7 11:03:10 2017 -0400 wsd: correct the name of testDisconnectMultiView in output Change-Id: Ibfcee83825bf8f48e635d93061bf4fd1306a95fc Reviewed-on: https://gerrit.libreoffice.org/37371 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 227f7adb..16577b3f 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -354,19 +354,19 @@ void TileCacheTests::testCancelTilesMultiView() void TileCacheTests::testDisconnectMultiView() { std::string documentPath, documentURL; -getDocumentPathAndURL("setclientpart.ods", documentPath, documentURL, "cancelTilesMultiView "); +getDocumentPathAndURL("setclientpart.ods", documentPath, documentURL, "disconnectMultiView "); const size_t repeat = 4; for (size_t j = 1; j <= repeat; ++j) { -std::cerr << "cancelTilesMultiView try #" << j << std::endl; +std::cerr << "disconnectMultiView try #" << j << std::endl; // Wait to clear previous sessions. countLoolKitProcesses(InitialLoolKitCount); // Request a huge tile, and cancel immediately. -auto socket1 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-1 "); -auto socket2 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-2 ", true); +auto socket1 = loadDocAndGetSocket(_uri, documentURL, "disconnectMultiView-1 "); +auto socket2 = loadDocAndGetSocket(_uri, documentURL, "disconnectMultiView-2 ", true); sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-1 "); sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-2 "); @@ -375,11 +375,11 @@ void TileCacheTests::testDisconnectMultiView() for (auto i = 0; i < 4; ++i) { -getTileMessage(*socket2, "cancelTilesMultiView-2 "); +getTileMessage(*socket2, "disconnectMultiView-2 "); } // Should never get more than 4 tiles on socket2. -const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 500); +const auto res2 = getResponseString(socket2, "tile:", "disconnectMultiView-2 ", 500); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 44 +++- 1 file changed, 35 insertions(+), 9 deletions(-) New commits: commit 3816b0c8eb4da05bbd21c520fdaa4c5694f48ff7 Author: Ashod Nakashian Date: Thu Jan 26 10:06:31 2017 -0500 wsd: faster and more informative tile tests Change-Id: Ifcd179600ca1b019f43a86eaf0fd11a5d8a6177a Reviewed-on: https://gerrit.libreoffice.org/33667 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index c0611a8..59dadfa 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -258,6 +258,9 @@ void TileCacheTests::testCancelTiles() { std::cerr << "cancelTiles try #" << i << std::endl; +// Wait to clear previous sessions. +countLoolKitProcesses(InitialLoolKitCount); + auto socket = loadDocAndGetSocket("setclientpart.ods", _uri, testName); // Request a huge tile, and cancel immediately. @@ -269,9 +272,14 @@ void TileCacheTests::testCancelTiles() { break; } -else if (i == repeat) +else { -CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res + "].", res.empty()); +if (i == repeat) +{ +CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res + "].", res.empty()); +} + +std::cerr << "Unexpected: [" << res << "]" << std::endl; } } } @@ -288,6 +296,9 @@ void TileCacheTests::testCancelTilesMultiView() { std::cerr << "cancelTilesMultiView try #" << j << std::endl; +// Wait to clear previous sessions. +countLoolKitProcesses(InitialLoolKitCount); + // Request a huge tile, and cancel immediately. auto socket1 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-1 "); auto socket2 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-2 ", true); @@ -296,10 +307,16 @@ void TileCacheTests::testCancelTilesMultiView() sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-2 "); sendTextFrame(socket1, "canceltiles"); -const auto res1 = getResponseString(socket1, "tile:", "cancelTilesMultiView-1 ", 1000); -if (!res1.empty() && j == repeat) +const auto res1 = getResponseString(socket1, "tile:", "cancelTilesMultiView-1 ", 500); +if (!res1.empty()) { -CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res1 + "].", res1.empty()); +if (j == repeat) +{ +CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res1 + "].", res1.empty()); +} + +std::cerr << "Unexpected: [" << res1 << "]" << std::endl; +continue; } for (auto i = 0; i < 4; ++i) @@ -311,10 +328,16 @@ void TileCacheTests::testCancelTilesMultiView() // Though in practice we get the rendering result from socket1's request and ours. // This happens because we currently always send back tiles even if they are of old version // because we want to be responsive, since we've rendered them anyway. -const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 1000); -if (!res2.empty() && j == repeat) +const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 500); +if (!res2.empty()) { -CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res2 + "].", res2.empty()); +if (j == repeat) +{ +CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res2 + "].", res1.empty()); +} + +std::cerr << "Unexpected: [" << res2 << "]" << std::endl; +continue; } if (res1.empty() && res2.empty()) @@ -334,6 +357,9 @@ void TileCacheTests::testDisconnectMultiView() { std::cerr << "cancelTilesMultiView try #" << j << std::endl; +// Wait to clear previous sessions. +countLoolKitProcesses(InitialLoolKitCount); + // Request a huge tile, and cancel immediately. auto socket1 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-1 "); auto socket2 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-2 ", true); @@ -349,7 +375,7 @@ void TileCacheTests::testDisconnectMultiView() } // Should never get more than 4 tiles on socket2. -const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 1000); +const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 500); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.fre
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit da93cd416b2b30e569cc34651e0bc21602841b9d Author: Jan Holesovsky Date: Fri Jan 27 19:16:51 2017 +0100 Temporarily disable, these tests are affected by the order of invalidates. Change-Id: Icd08629315417f3ca8f2c5560271a12c62309956 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 42f72c4..c0611a8 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -70,8 +70,9 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testTileInvalidateWriter); CPPUNIT_TEST(testTileInvalidateWriterPage); CPPUNIT_TEST(testTileInvalidateCalc); -CPPUNIT_TEST(testTileInvalidatePartCalc); -CPPUNIT_TEST(testTileInvalidatePartImpress); +// temporarily disable +//CPPUNIT_TEST(testTileInvalidatePartCalc); +//CPPUNIT_TEST(testTileInvalidatePartImpress); CPPUNIT_TEST_SUITE_END(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 31 +++ 1 file changed, 31 insertions(+) New commits: commit f861a9e1a7f2ad0c3bd58b4be3fce4cff5a98d6c Author: Ashod Nakashian Date: Sun Jan 8 23:31:51 2017 -0500 wsd: new unittest for multiview tiles when disconnecting When there are many views requesting tiles, disconnecting any should not cancel tiles for other views. Change-Id: I6029432c4b9ab931811dcb3b03b0441b413a9971 Reviewed-on: https://gerrit.libreoffice.org/32872 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 44a3484..42f72c4 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -56,6 +56,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testPerformance); CPPUNIT_TEST(testCancelTiles); CPPUNIT_TEST(testCancelTilesMultiView); +CPPUNIT_TEST(testDisconnectMultiView); CPPUNIT_TEST(testUnresponsiveClient); CPPUNIT_TEST(testImpressTiles); CPPUNIT_TEST(testClientPartImpress); @@ -79,6 +80,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture void testPerformance(); void testCancelTiles(); void testCancelTilesMultiView(); +void testDisconnectMultiView(); void testUnresponsiveClient(); void testImpressTiles(); void testClientPartImpress(); @@ -321,6 +323,35 @@ void TileCacheTests::testCancelTilesMultiView() } } +void TileCacheTests::testDisconnectMultiView() +{ +std::string documentPath, documentURL; +getDocumentPathAndURL("setclientpart.ods", documentPath, documentURL, "cancelTilesMultiView "); + +const size_t repeat = 4; +for (size_t j = 1; j <= repeat; ++j) +{ +std::cerr << "cancelTilesMultiView try #" << j << std::endl; + +// Request a huge tile, and cancel immediately. +auto socket1 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-1 "); +auto socket2 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-2 ", true); + +sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-1 "); +sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-2 "); + +socket1->shutdown(); + +for (auto i = 0; i < 4; ++i) +{ +getTileMessage(*socket2, "cancelTilesMultiView-2 "); +} + +// Should never get more than 4 tiles on socket2. +const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 1000); +} +} + void TileCacheTests::testUnresponsiveClient() { std::string documentPath, documentURL; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit 92ac46e5f1988adf5458a97e089d18ef13dff6ca Author: Ashod Nakashian Date: Sun Jan 8 21:28:20 2017 -0500 wsd: no need to render all tiles of all parts in unittests Change-Id: I4d2eadf64f0c86e4b83af2f25a772f4b88d6a987 Reviewed-on: https://gerrit.libreoffice.org/32869 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 78e54c5..44a3484 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -981,8 +981,9 @@ void TileCacheTests::checkTiles(std::shared_ptr& socket, const st // random setclientpart std::srand(std::time(nullptr)); -std::vector vParts = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +std::vector vParts = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; std::random_shuffle(vParts.begin(), vParts.end()); +int requests = 0; for (auto it : vParts) { if (currentPart != it) @@ -996,6 +997,12 @@ void TileCacheTests::checkTiles(std::shared_ptr& socket, const st assertResponseString(socket, "setpart:", name); requestTiles(socket, it, docWidth, docHeight, name); + +if (++requests >= 3) +{ +// No need to test all parts. +break; +} } currentPart = it; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 56 1 file changed, 42 insertions(+), 14 deletions(-) New commits: commit 93c66eeb9bad244e57555d5fe01a4d573922677e Author: Ashod Nakashian Date: Thu Jan 5 11:09:44 2017 -0500 wsd: fixup tileInvalidatePartImpress Since the Impress slides use large fonts, we end up overflowing the part bounds with this test. Luckily the top row of text has smaller font, and more vertical space within the slide, so now we edit the top-left textbox and this test doesn't fail anymore (tested 50 times) when it failed ~1 in 4 previously. Change-Id: I13d8cc4462d48b128578a9d3fdde90a79c607c4b Reviewed-on: https://gerrit.libreoffice.org/32862 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 2c235dc..78e54c5 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -94,8 +94,6 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture void testTileInvalidatePartCalc(); void testTileInvalidatePartImpress(); -void tileInvalidatePart(const std::string& filename, const std::string& testname); - void checkTiles(std::shared_ptr& socket, const std::string& type, const std::string& name = "checkTiles "); @@ -860,8 +858,10 @@ void TileCacheTests::testTileInvalidateCalc() } } -void TileCacheTests::tileInvalidatePart(const std::string& filename, const std::string& testname) +void TileCacheTests::testTileInvalidatePartCalc() { +const std::string filename = "setclientpart.ods"; +const std::string testname = "tileInvalidatePartCalc"; const std::string testname1 = testname + "-1 "; const std::string testname2 = testname + "-2 "; @@ -871,14 +871,14 @@ void TileCacheTests::tileInvalidatePart(const std::string& filename, const std:: sendTextFrame(socket1, "setclientpart part=2", testname1); assertResponseString(socket1, "setpart:", testname1); -sendTextFrame(socket1, "mouse type=buttondown x=7886 y=8929 count=1 buttons=1 modifier=0", testname1); +sendTextFrame(socket1, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname1); -auto socket2 = loadDocAndGetSocket(_uri, documentURL); +auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); sendTextFrame(socket2, "setclientpart part=5", testname2); assertResponseString(socket2, "setpart:", testname2); -sendTextFrame(socket2, "mouse type=buttondown x=7886 y=8929 count=1 buttons=1 modifier=0", testname2); +sendTextFrame(socket2, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname2); -std::string text = "Some test"; +static const std::string text = "Some test"; for (char ch : text) { sendChar(socket1, ch); @@ -896,15 +896,43 @@ void TileCacheTests::tileInvalidatePart(const std::string& filename, const std:: } } - -void TileCacheTests::testTileInvalidatePartCalc() -{ -tileInvalidatePart("setclientpart.ods", "tileInvalidatePartCalc"); -} - void TileCacheTests::testTileInvalidatePartImpress() { -tileInvalidatePart("setclientpart.odp", "tileInvalidatePartImpress"); +const std::string filename = "setclientpart.odp"; +const std::string testname = "tileInvalidatePartImpress"; +const std::string testname1 = testname + "-1 "; +const std::string testname2 = testname + "-2 "; + +std::string documentPath, documentURL; +getDocumentPathAndURL(filename, documentPath, documentURL, testname); +auto socket1 = loadDocAndGetSocket(_uri, documentURL, testname1); + +sendTextFrame(socket1, "setclientpart part=2", testname1); +assertResponseString(socket1, "setpart:", testname1); +sendTextFrame(socket1, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname1); + +auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); +sendTextFrame(socket2, "setclientpart part=5", testname2); +assertResponseString(socket2, "setpart:", testname2); +sendTextFrame(socket2, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname2); + +// This should be short, as in odp the font is large and we leave the page otherwise. +static const std::string text = "Some test"; +for (char ch : text) +{ +sendChar(socket1, ch); +sendChar(socket2, ch); + +const auto response1 = assertResponseString(socket1, "invalidatetiles:", testname1); +int value1; +LOOLProtocol::getTokenIntegerFromMessage(response1, "part", value1); +CPPUNIT_ASSERT_EQUAL(2, value1); + +const auto response2 = assertResponseString(socket2, "invalidatetiles:", testname2); +int value2; +LOOLProtocol::getTokenIntegerFromMessage(response2, "part", value2); +CPPUNIT_ASSERT_EQUAL(5, value2); +} } void TileCacheTest
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) New commits: commit 6f6f308895cdd687897f1e14d2b48bb8495468cd Author: Ashod Nakashian Date: Mon Jan 2 00:45:21 2017 -0500 wsd: more robust canceltiles unittest Change-Id: I0a71bbb84ff4ca3233d8a78a7c4b3718ec0ad382 Reviewed-on: https://gerrit.libreoffice.org/32634 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index df8e336..4acd29e 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -282,10 +282,10 @@ void TileCacheTests::testCancelTilesMultiView() sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-2 "); sendTextFrame(socket1, "canceltiles"); -auto res = getResponseString(socket1, "tile:", "cancelTilesMultiView-1 ", 1000); -if (!res.empty() && j == repeat) +const auto res1 = getResponseString(socket1, "tile:", "cancelTilesMultiView-1 ", 1000); +if (!res1.empty() && j == repeat) { -CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res + "].", res.empty()); +CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res1 + "].", res1.empty()); } for (auto i = 0; i < 4; ++i) @@ -294,8 +294,16 @@ void TileCacheTests::testCancelTilesMultiView() } // Should never get more than 4 tiles on socket2. -assertNotInResponse(socket2, "tile:", "cancelTilesMultiView-2 "); -if (res.empty()) +// Though in practice we get the rendering result from socket1's request and ours. +// This happens because we currently always send back tiles even if they are of old version +// because we want to be responsive, since we've rendered them anyway. +const auto res2 = getResponseString(socket2, "tile:", "cancelTilesMultiView-2 ", 1000); +if (!res2.empty() && j == repeat) +{ +CPPUNIT_ASSERT_MESSAGE("Did not expect getting message [" + res2 + "].", res2.empty()); +} + +if (res1.empty() && res2.empty()) { break; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] online.git: test/TileCacheTests.cpp
test/TileCacheTests.cpp |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit dc18ccfd560c65ba8184d970db1aba05593b635e Author: Tor Lillqvist Date: Mon Dec 5 11:02:26 2016 +0200 The part number we get here seems to be always 1, not 0 No deeper understanding of what is going on... This is when running against cp-5.1 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 64780a6..edc22d5 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -693,7 +693,7 @@ void TileCacheTests::testTileInvalidateWriterPage() int part = -1; CPPUNIT_ASSERT_MESSAGE("No part# in invalidatetiles message.", LOOLProtocol::getTokenIntegerFromMessage(res, "part", part)); -CPPUNIT_ASSERT_EQUAL(0, part); +CPPUNIT_ASSERT_EQUAL(1, part); } // This isn't yet used ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits