Commit graph

62 commits

Author SHA1 Message Date
Ashod Nakashian
82560d9657 wsd: test assertion macros
Because the new-style tests are intrustive,
the exception that CppUnit throws on assertion
failures is caught and processed with the
application logic, which is far from ideal,
because it's very difficult to find the
cause of failure.

What we'd like is a way to control what happens
when an test assertion fails, such that we can
properly log/print the failure, and even break
in the debugger.

The new macros allow us to control the behavior
at compile-time and have added flexibility.
For now, they log an assertion failure before
invoking the CPPUNIT macro, and support a
compile-time directive to assert, which is
useful for breaking in the debugger.

Change-Id: If464ba246e3ec747f31496a4215cb73ef735dfaf
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-03-14 15:45:00 +01:00
Miklos Vajna
b8bd1990aa Rework LOOLProtocol::tokenize() to return a StringVector object
The bulk of this commit just changes std::vector<std::string> to
StringVector when we deal with tokens from a websocket message.

The less boring part of it is the new StringVector class, which is a
wrapper around std::vector<std::string>, and provides the same API,
except that operator[] returns a string, not a string&, and this allows
returning an empty string in case that prevents reading past the end of
the underlying array.

This means in case client code forgets to check size() before invoking
operator[], we don't crash. (See the ~3 previous commits which fixed
such crashes.)

Later the ctor could be changed to take a single underlying string to
avoid lots of tiny allocations, that's not yet done in this commit.

Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-28 16:07:56 +01:00
Michael Meeks
8f91659ae0 test: dung out redundant LOOL_TEST_CLIENT_PORT.
And cleanup other related oddities.

Change-Id: I2d179a2ece6a8553e10e406ad4e5da08a2ff58e5
2020-01-21 15:07:54 +00:00
Andras Timar
fd93e11934 build fix after 'killpoco: removed StringTokenizer'
Change-Id: I2f1cb0da199a8dca1cf300955f133f45b8d7ba3b
2019-11-13 22:16:59 +01:00
Pranam Lashkari
8fb94e1827 StringTokenizer replaced with tokenize in file TileCacheTsts.cpp
Change-Id: I1024329bf518795b819f19f497af70d2266ec7da
Reviewed-on: https://gerrit.libreoffice.org/82543
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-11-12 17:50:17 +01:00
Miklos Vajna
3ba17824e3 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
2019-10-31 09:39:45 +01:00
Ashod Nakashian
0106ab24f6 test: improve TileCacheTests::testUnresponsiveClient
Change-Id: Ib08c4675c9477cb925b5d42545cdc2cdae780fbe
Reviewed-on: https://gerrit.libreoffice.org/81579
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-10-29 02:40:34 +01:00
Ashod Nakashian
c82760f103 test: improve TileCache tests
This fixes up some minor issues, improves stability
and logging of tests.

Reviewed-on: https://gerrit.libreoffice.org/81259
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit a6e2dff35a4f1234066c66cb64f7e3bcd034ed58)

Change-Id: I906922c1c74427a53f9017f7be73c1f85ecf4cd7
Reviewed-on: https://gerrit.libreoffice.org/81575
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-10-29 02:32:54 +01:00
Ashod Nakashian
d110f4cc58 test: improve TileCacheTests
Sometimes core renderes with sub-pixel differences
(the crosshair at the corners of the Writer pages
show line anti-aliasing differences). This causes
failure of the tests that count the tile deduplication.

We now tolerate when we get an unchanged tile twice,
assuming it was due to such a rendering difference,
but we re-trigger another change and this time we
don't expect any extra tiles, no more than two
variations of the anti-aliased crosshair was
observed.

We also move some duplicate code into utility
functions to improve readability and reuse.

Reviewed-on: https://gerrit.libreoffice.org/81196
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 9603597fd1aaecb27893792cfd2d243e450b58b8)

Change-Id: I1a66732dd3443bfbd770d8dc65721571dfa08615
Reviewed-on: https://gerrit.libreoffice.org/81572
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-10-29 02:32:05 +01:00
Michael Meeks
7890533419 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
2019-10-28 20:29:01 +00:00
Ashod Nakashian
4ff376bb45 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 <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit e173427bd9ca5939339994180f5b51ea11393050)

Change-Id: I6c2b80022ffcef2b21c99dd57bca61e7daaadc86
Reviewed-on: https://gerrit.libreoffice.org/81568
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-10-28 12:01:38 +01:00
mert
a5000034cd Added normalizedViewId to the tests with tilemsg
Change-Id: I479246a2c592b7e4f50b613a0fb0f96af761198c
2019-10-15 18:13:03 +03:00
Andras Timar
d1ae1b36c2 typo fixes in comments and code
Change-Id: Idd98516d30d98dea18eda9bbec8ac9777063b553
2019-10-08 11:49:45 +02:00
Tamás Zolnai
10a0ee1cfe 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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-10-01 13:03:31 +02:00
Miklos Vajna
24615d9dd0 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
2019-09-12 23:09:54 +02:00
Andras Timar
69140fcdbb CPPUNIT_ASSERT_GREATEREQUAL is not available in cppunit of older distros
Change-Id: I37001791e05df9a55c25b48fff3bbe5d6bd050e2
2019-09-05 23:02:18 +02:00
DarkByt31
22f1656e08 tdf#107038 Poco::Timestamp replacement with std::chrono
Added functions to get file timestamp and to convert
chrono timestamp in ISO8601 fraction format and some
test cases.

Change-Id: I58961a31f7262b367cff9f33cffdec7571a2f8f7
2019-09-02 15:50:37 -04:00
Miklos Vajna
1b27ed045d Fix TileCacheTests::testClientPartImpress()
After commit 8e118889cb (wsd: leaflet:
support statusupdate: messages to sync clients, 2019-08-17), which added
a new hiddenparts= key, but forgot to adapt tests accordingly.

Change-Id: Ia5baefff37b88f5b173d65ae80a126f94b420cb0
2019-08-22 09:06:02 +02:00
Michael Meeks
abbe1de459 Update unit test data for recent master.
Also add better printout for unit-client case.

Change-Id: Ic3c5573eab55ad5469adefa5bbfbd6c0e05e571e
2019-05-03 14:04:57 +01:00
Michael Meeks
98fb165c69 Adapt test for new hiddenparts field.
Change-Id: Id2173a38167b97327d0735dfe2a8c88e2dcc4bc7
Reviewed-on: https://gerrit.libreoffice.org/71640
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-05-01 22:56:17 +02:00
Michael Meeks
6634d3b3e9 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
2019-03-05 06:58:50 +01:00
Michael Meeks
66ac62429c TileCache: switch to in-memory, rather than persistent.
Remove significant complexity; if we need it later lets do it more simply
serializing when we start / finish a session.

Turn off caching for mobile - possibly should kill for single-user too.

Change-Id: I5ea56088ddbb61f22fe7920f8c9ac7440cb3296a
2019-02-15 12:10:16 +01:00
Michael Meeks
36e9d5b376 TileCache: re-factor API to work in terms of vectors, not file references.
Change-Id: Ia9d48773121ab965b79ddb16b55b5d3fdcd7fd5c
2019-02-14 21:46:39 +01:00
Miklos Vajna
c04fd49d42 TileCacheTests: these writes are never read
They are written again inside the do { ... } while (...) which runs at
least once.

Change-Id: I9ff07d7cb68b73bccf1bd38490fcba615b87a6ba
2018-12-05 09:14:50 +01:00
Ashod Nakashian
03f58b9a9a wsd: disable tile caching when TileCachePersistent is false
Change-Id: I660438d478ab6d1ef60575b5f63b71c8b86bab4f
2018-10-12 17:43:31 +02:00
Tamás Zolnai
f16a868226 Reduce the running time of testWireIDFilteringOnWSDSide
Change-Id: I1c7e576aaa1af938380a2de33b1512b31ef6ca75
2018-10-01 18:36:50 +02:00
Tamás Zolnai
4512d4090f Reduce the running time of these this test
Change-Id: Iaf72007309e8e2aca09a01e7d1637f2875f3e564
2018-10-01 18:29:20 +02:00
Tamás Zolnai
ac2cd92d25 Upper limit of sent out versions of the same tile
We try to decrease the network usage with avoiding sending out
to much tiles to the client. When we already sent out two versions
of the same tile without having the tileprocessed message from the
client we delay sending out the next version to avoid spamming tiles
on the network.

Change-Id: Ia47cd7c0d3fb829f6777f0c3265970433591df19
2018-09-29 09:27:06 +02:00
Tamás Zolnai
a1e2acd5ef Better to have a smaller tiles-on-fly limit
It's good if this limit big enough to send all the tiles of the
current visible area at once, so the tiles arrive at the same
time to the client by zoom or scroll. Now this value is set to a bit
bigger so if we have a small amount of tiles before zoom / scroll we'll
still see the same on the client side.

Change-Id: I8e28dbf6197fe2f683fe9528e9a32c15a191b20e
2018-09-29 09:27:06 +02:00
Tamás Zolnai
9683f53a9c Filter out tiles by wired on wsd side too
Some times tiles with the same wireID survives the wireID
filtering in kit, so we should do that in wsd too.
The issue is with the tilesBeingRendered construction. First when
one tile is filtered out on kit side the client remains subcribed
to the tile, since wsd does not know filtering happened.
Second via the tilesBeingRendered object more clients can be subcribed
to the same tile and so when one client request a new version of this
tile (with an old wireID) the rendered tile is sent to all subscribed
clients even if the other clients has up-to-date tiles.

Change-Id: I4ca6b7a83a5d6979a9f924d766a71aba5e5362c7
2018-09-29 09:27:06 +02:00
Tamás Zolnai
a1a0bf3718 Don't send tiles which was changed outside of the visible area
Since this commit:
9473908d45
We can avoid that, because the tiles will be invalidated
on the client side and when the client visible area changes
the invalidated tiles are requested anyway.

Change-Id: I272e3b4b87380ae574c16a2b480dbc8caabf4b32
2018-09-29 09:27:06 +02:00
Tamás Zolnai
5260eae05f Avoid rendering / sending the same tile twice
When we're doing the prerendering we also need to register
a tileBeingRendered object, so we know that the given tile
will arrive soon. In earlier version of the code, rendering
and sending of the tile was not separated in time, but now it is,
so we need create a tileBeingRendered object even if we don't
subscribe the client to it yet.

Change-Id: I1374c22e5ffebe1d6fcc6e37261ddcedeb9066ec
2018-09-29 09:27:06 +02:00
Tamás Zolnai
1e0b4928ad Remove this printing line used only for debugging
Change-Id: I482adcac61cf2fa4bec4fb02feec0e23370a3e45
2018-09-03 16:54:12 +02:00
Tamás Zolnai
8085b112dc Add some test for the new tile rendering code
Change-Id: I92e925740e67a62cd69e8c8135484c10d74dabc8
2018-08-30 18:43:43 +02:00
Tamás Zolnai
1001f083f1 Remove this test, it just dumps the result instead of assert on that
Change-Id: Id9976d98bbd30cb38cee86b1ff45b96922065d11
2018-08-16 16:02:20 +02:00
Tamás Zolnai
4d1ffab941 Disable testCancelTilesMultiView
It's seems unstable. After canceltiles wsd still can send tiles
if they already in the senderqueue.

Change-Id: I28f669aa18dfbfee1d9d242bd1ee3d0490f06c68
2018-08-03 13:50:40 +02:00
Tamás Zolnai
33a0cb1ee7 Fix failing unit tests after latency changes
With the new code, wsd is waiting for tileprocessed messages
if the upper limit of tiles-on-fly limit is reached. To avoid that
send canceltiles message.

Change-Id: Iadf16c834f12d14000d630078882dfa8e11a99a0
2018-07-19 14:19:07 +02:00
Michael Meeks
ed87891d28 Make PNG tile tests more robust.
Change-Id: Id7afcfe9b29b2d5544e296b13f04c195d35655b5
2018-05-18 14:32:50 +01:00
Ashod Nakashian
2562d8919a ut: log the test name for easier traceability
Change-Id: Icbcbb36857b748c2ac2d0d36a5c4c23609f5453a
Reviewed-on: https://gerrit.libreoffice.org/49568
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-11 19:22:14 +01:00
Ashod Nakashian
7be98efd93 ut: log timestamp to track timeouts better
And improve the logging support in unit-tests to
help troubleshoot issues faster and more accurately.
Also makes the code more readable (hopefully).

Change-Id: I4f8aafb5245e2f774b03231591a74544f9ec84aa
Reviewed-on: https://gerrit.libreoffice.org/48645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-11 19:21:15 +01:00
Miklos Vajna
4bcfdbb5b3 test: spell out non-trivial autos to improve readability
Change-Id: Ie3b4b961c50ab61ef63380c4724a0f00e8f960d2
2018-02-07 10:18:12 +01:00
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Miklos Vajna
a3d6dee503 Remove unused strings
Change-Id: I621c462bca38222dcf26dfa1e414cf27e1a3e088
2017-11-03 15:25:09 +01:00
Michael Meeks
097cc58d53 Run old-style unit tests as a new-style unit test.
This moves the code into the same process, for easier logging & debugging.

Disabled initially.

Change-Id: Id48b5649ba14deb0a2159ca59e321c7d0ae66dad
2017-06-02 18:33:26 +01:00
Ashod Nakashian
7633525904 wsd: correct the name of testDisconnectMultiView in output
Change-Id: Ibfcee83825bf8f48e635d93061bf4fd1306a95fc
Reviewed-on: https://gerrit.libreoffice.org/37371
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-08 04:52:39 +02:00
Ashod Nakashian
0feea0e80e wsd: include cleanup in test
Change-Id: Ie54aabc74e8980f3131a66f3610c1dcdd9f668ff
Reviewed-on: https://gerrit.libreoffice.org/36600
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:08:58 +02:00
Jan Holesovsky
fb4fbdd575 Disable the unreliable unit tests.
Change-Id: I1de9cc566b1b88563152aa36a5505867e46ea2af
2017-04-06 16:58:42 +01:00
Ashod Nakashian
3816b0c8eb wsd: faster and more informative tile tests
Change-Id: Ifcd179600ca1b019f43a86eaf0fd11a5d8a6177a
Reviewed-on: https://gerrit.libreoffice.org/33667
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 02:03:54 +00:00
Jan Holesovsky
da93cd416b Temporarily disable, these tests are affected by the order of invalidates.
Change-Id: Icd08629315417f3ca8f2c5560271a12c62309956
2017-01-27 19:17:42 +01:00
Ashod Nakashian
f861a9e1a7 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 <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-09 06:27:43 +00:00