Commit graph

125 commits

Author SHA1 Message Date
Neil Guertin
7e81b5ebbc Replace total pid count waits with targeted waits
Wait for doc kits or spare kit counts specifically. This removes the chance of
race conditions between waiting for doc kits to shutdown and the spare kit to
start back up.

Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: If28da4b786d3e2b429acb5840dfcdb7bb5a3f948
2024-03-09 16:36:39 +00:00
Neil Guertin
f82915ebcb Move kit pid helper functions to one file
Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: If77b8ac3c7493f4d44b510ec54b68292856f89d5
2024-03-09 16:36:39 +00:00
Michael Meeks
7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Caolán McNamara
0ed831dfae restore TileCacheTests::testTileProcessed
with the original 25 expected results from 25 requests

from cid#318925 Structurally dead code

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I236876fadd5b5c82ecdbcc52a13fc58e8513aa12
2023-10-19 09:59:02 +02:00
Paris Oplopoios
e5b7464bbf Invalidate canonical id unconditionally
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I061e34af1a1676e5bba5d476ea9e7ff5758744a1
2023-09-12 00:49:18 +02:00
Caolán McNamara
084e715dc6 TileDesc broadcast field is always false
apparently since:

commit b0a7532b08
Date:   Sat Nov 14 19:43:02 2020 +0300

    Turn off broadcast on presentation preview tiles

so drop this field from TileDesc and protocol.txt

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib4b1eca0d30911e13c245551cb3e3261afc99dd2
2023-09-11 09:38:49 +01:00
Paris Oplopoios
0621aa4825 Fix canonical id related unit tests
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ie4b965c3bac8cddd48a47343d2d1c5f387d8bd41
2023-09-06 10:28:26 +02:00
Paris Oplopoios
cfd1d2e01f Revert "Give new sockets a canonical view id in tests"
This reverts commit a003126a65.

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
2023-09-06 10:28:26 +02:00
Caolán McNamara
0c611649e5 cid#318854 Unchecked return value
check this one like we check all the others

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id8379c6873fe7dd6466dc265cea6847d120aa0ce
2023-08-09 13:39:23 +02:00
Paris Oplopoios
a003126a65 Give new sockets a canonical view id in tests
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I0c8a534fccb8088ab303852304802b4926369058
2023-08-05 12:00:08 +03:00
Caolán McNamara
040ee51ec9 occasionally testTileSubscription fails
sometimes the deltas arrive in a different order, later in the same test
we have "ordering is undefined tiles arrive in so swap if needed" for
a pair of later deltas, so do the same reordering for this
intermittently failing earlier test

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If51edb9a4e22d469d9e029c38da7348c34b17832
2023-08-04 11:18:02 +01:00
Michael Meeks
f41a8bed3e deltas: more unit tests for wire-id fun.
This should catch the case where one view should get an empty
update delta, and the other should get a new keyframe tile.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I3ad8f564cc45d80186430b463214ffcf092346f3
2023-07-18 09:43:34 +02:00
Michael Meeks
4d9070b1da Remove long obsolete ENABLE_DELTAS conditional.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I7f254328ba1be8074d8f1feabd7b89304166281d
2023-07-17 11:35:25 +02:00
Michael Meeks
d309d7199a deltas: fold the update: command back into an empty delta: command.
Also: address parts of #6897, primarily:

* remove the problematic aspect of bumping the last wid in our
  TileData, when this could trigger a re-send of a previously
  sent delta, causing tile corruption.
    * instead append an empty wid entry.
    * as an optimization - if the last entry is empty update
      the wid - since re-sending an empty delta is of no
      concern.

* simplify a number of code-paths that special-case zero length
  deltas. All deltas now commence with 'D'.

* still track updates in the JS - by detecting empty deltas.

* shares more code and simplifies various paths.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I02af6d4b152524c201b6985b7a3497da7f08a517
2023-07-17 11:35:25 +02:00
Michael Meeks
b7d7c02a3f deltas: allow JS tilecombine to force sending a keyframe to the client.
However, don't force rendering a keyframe, only sending it - other
clients may be happy with deltas. This is to better handle:

window.app.console.debug('Unusual: Delta sent - but we have no keyframe for ' + key);

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4efff0f6b1d2817e6b8bd567eb3b098383a1ef42
2023-07-17 11:35:25 +02:00
Michael Meeks
9270ceef16 update: send for redundant tilecombine requests.
Update tests to check for this too.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I02c8f3167886321496245589b34a382fd61617f0
2023-07-13 08:14:48 +01:00
Caolán McNamara
5aa0296d4d fix getPartFromInvalidateMessage
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Idd2cf3a7bf118ff82aaf0ed50c5f8fdd97fe5ee3
2023-07-08 13:08:59 +01:00
Caolán McNamara
490b0c0d0d drop non-standard width=400 height=400 tile request in unit test
there since:

commit 232499f542
Date:   Thu Apr 21 12:34:30 2016 +0300

and

commit bf66f7a908
Date:   Mon Jun 13 20:31:14 2016 -0400

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I04745be0581a697bbc3b15ba1d8bb94207320a7a
2023-06-23 16:55:25 +01:00
Michael Meeks
12e0830b1b Kill canceltiles support completely.
This stopped working well a long time ago, and is already disabled
on the coolwsd side, so dung out the rest of the code & docs on this.

Change-Id: I2e0b73fe9780e16c3cc74ae3a38ae6b04434717a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Michael Meeks
5a2127003f disable fragile TileCacheTests::testTileBeingRenderedHandling.
Fails intermittently under load, responsible for most unit-tile
failures.

Change-Id: I88de8524b51ee7d97a28e31c001534a506d52f0e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-04-12 18:01:40 +01:00
Michael Meeks
05ae0ab631 TileCacheTests: re-copy documents when repeating tests.
Attempted blind fix for intermittent failure:

[ kitbroker_004 ] TRC  Document::GlobalCallback LOK_CALLBACK_ERROR
[{ "classification": "error", "cmd": "load", "kind": "io", "code": 770, "message": ""}].
filter/source/config/cache/typedetection.cxx:452: caught exception while querying type of ...
"Could not open stream for <file:///tmp/.../disconnectMultiView_5f47c785_setclientpart.ods>
at filter/source/config/cache/typedetection.cxx:1123"

[ coolwsd ] TST  disconnectMultiView-1  [loadDocAndGetSession] (+22012ms):
ERROR: Assertion failure: Failed to load the document
cool/file%3A%2F%2F%2Ftmp%2FdisconnectMultiView_5f47c785_setclientpart.ods/ws.
Condition: isLoaded| helpers.hpp:531

Change-Id: I91062bf4c136dbd6a4cf6def842ff2ae7687c758
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-04-10 19:46:07 +01:00
Paris Oplopoios
da57ca61e1 Uncomment most TileCacheTests
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I1103d6c5f474b2f177189f3cc82030be7340235c
2023-03-22 15:32:52 +01:00
Andras Timar
0cd7ec4449 CI check
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ibc2c700a5c5f89ada067125ad995fd57c1274159
2023-03-20 20:10:49 +03:00
Andras Timar
98ae6ac269 disable fragile TileCacheTests::testTileProcessed()
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I791b24b59a22f87006a334332e7b8661615ac21d
2023-03-14 21:17:13 +01:00
Ashod Nakashian
48c08a40d8 wsd: test: enable tile-tests
Based on the assumption that the new
number of tiles is correct, the assertion
is updated and the tile tests re-enabled.

Change-Id: I9dabe1ea4ec1b091917c4a94c549f967b9539c13
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-11-12 18:45:35 -05:00
Szymon Kłos
7043365475 masterpage: get & set optional mode parameter for tiles (server side)
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I756e3d515c86a635cfa9db81106848ee3dcf684a
2022-09-19 15:18:23 +02:00
Ashod Nakashian
64ee298bab wsd: test: killpoco for TileCacheTests
We now use our http::Socket and SocketPoll
instead of Poco.

Change-Id: I422c31d85e3422541a0ab367007876c3a33fa124
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-25 14:02:00 +01:00
Ashod Nakashian
1d96fe827a wsd: test: remove default testname arg from helpers
Change-Id: Iecbc2c1fa2a7568aedeaa0b089c3ca0a584488f5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-25 14:02:00 +01:00
Michael Meeks
30e6f08147 perf: merge deltas and keyframes into the same storage.
Simplifies and accelerates the code.

Change-Id: I56b661e566efd75e3ed46918a481c26ddd5ca4c4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-27 22:01:24 +01:00
Michael Meeks
6483e1500a Enable deltas by default.
Cleanup some debugging, distinguish wsd/viewport delta fetches from
client-side tilecombines.

Update tests for deltas where they are expected.

Change-Id: I3dca09e4ceb094abf03db2aed2618f19351f3e28
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-25 20:31:06 +01:00
Michael Meeks
c130231379 deltas: track, transmit and cache deltas (disabled for now)
Squashed from feature/deltas-expanded.

TileCache changes:
    + add montonic sequence (wid) numbers to TileData
    + account for sizes of TileData with multiple blobs
    + simplify saving and notifying of tiles

Sends updates (via appendChanges) based on the sequence the
right mix of keyframes and/or deltas required as a single
message, and parse and apply those on the JS side.

We continue to use PNG for slide previews and dialogs,
but remove PngCache - used by document tiles only.

Annotates delta: properly as a binary package for the websocket.

Distinguishes between deltas and keyframes we get from
the Kit based on an initial un-compressed prefix
character which we then discard.

kit can be forced to render a keyframe by oldWid=0

Track invalidity on tiles themselves - to keep the keyframe around.

    We need to be able to track that a tile is invalid, and so subscribe
    to the updated version as/when it is ready - but we also want to
    store the keyframe underneath any deltas.

force rendering of a keyframe for an empty slot in the TileCache.

force tile sequence to be zero for combinedtiles - so the client can
always request standalone tiles with explicit combinedtiles, or tile
requests.

move Blob to Common.hpp

use zero size for un-changed tiles.

remove obsolete render-id, and color deltas in debug mode.

cleanup unit tests for non-png tile results.

Change-Id: I987f84ac4e58004758a243c233b19a6f0d60f8c2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-24 22:16:58 +01:00
Michael Meeks
8eebe1e345 Tile-deltas, expose TileData to unit tests.
Change-Id: I5f33a56009927187b460775129f0818f47843368
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
71ef6cb4a5 Switch Tile to have a list of deltas.
For each tile, the wire-id will grow incrementally for each key-frame
or delta appended; so we can tell which deltas to send.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ic5f201d23273c37eed232c5932b9da854e80d06a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Ashod Nakashian
f5c936ee63 wsd: add LOG_ASSERT to replace assert with extra logging
In NDEBUG builds, where there is no assert macro,
we log at debug level to still find issues without
adding noise to the logs.

However, in ENABLE_DEBUG builds not only do we assert
but we also log at error level.

Change-Id: I773dbf7bb2b459e505e73d91505b13d8ed2ed6d8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
cfca251654 wsd: test: faster unit-test execution
All tests are now ordered to minimize
the time paralell runs take. And the
two longest-running tests are augmented
to take less time. They still take about
20x longer than the fast test, but they
do serve a purpose and we have 50+ other
tests to go through in parallel.

Total time is not much longer than the
longest test with -j8, at around 150
seconds, give or take, on an 8 core,
16 thread CPU.

Duplication in Makefile.am is reduced
with some minor clean ups.

Change-Id: I14530531485bf85d8b59e476aa933e5b2cc26c93
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Ashod Nakashian
a4b798c9f5 wsd: test: extend tile test timeout
Change-Id: I3ce128ca96b394e20dc6ad7b3179e786302128ca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Ashod Nakashian
52f2600cf9 wsd: test: embue all tests with a name and unify logs
Now the remaining tests that didn't have a name
get one and the logs are unified between old-
and new-style tests. Mostly.

This makes sure that all logs and assertions
properly log the test name and make test
failures easier to debug and fix.

Change-Id: Id159ffacc81642a6ec594c5143498408adab67cf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Ashod Nakashian
a5ab0f6f4e wsd: test: improve and disable TileCacheTests::testTileInvalidatedOutside
TileCacheTests::testTileInvalidatedOutside is failing
locally, even on very old tests, because the tileinvalidation
returned is EMPTY (i.e. everything is invalidated)
which isn't expected.

Change-Id: I5ff9a3771d95d7177b8a3aee260223c4a17f906a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-01-11 09:28:03 +01:00
Luboš Luňák
1dfb6d3866 handle properly "EMPTY" invalidatetiles message (T32137)
ChildSession::loKitCallback() may generate a message in the format
"invalidatetiles: EMPTY, 0". Handle it properly in tests.

Signed-off-by: Luboš Luňák <l.lunak@centrum.cz>
Change-Id: If8009be3c4ce031466ed304df7028848a8ab960f
2021-12-13 22:08:25 +01:00
Luboš Luňák
9a54a5d68e actually require C++17
When I did the previous "C++17" commit I removed C++11 and C++14
from the checked list, but I missed the fact that the code checked
for C++17/14/11 and then did nothing with it. So actually do use
the detected required C++ standard.

Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: Ia82d14d11f81456abed7ee2609903afe5366f5e7
2021-12-07 13:42:06 +01:00
Ashod Nakashian
dc8ebc0460 wsd: test: tollerate extra tiles on invalidation
Change-Id: I87a3d073e31c1328db369ce911baff0be20826b1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-11-23 09:31:46 +01:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Henry Castro
85ba63ddce misc: more renames 'lool' -> 'cool'
Change-Id: Ic9fbae88d92921b9081e7067347852e385f45af3
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:46 +01:00
Ashod Nakashian
36c12dd49c wsd: always subscribe when proactively rendering tiles
When issuing tile render requests proactively (upon
getting invalidatetile event), if the registered
request has no subscriber, TileCache::saveTileAndNotify
simply drops the tiles!

New call sequence:
ClientSession::handleTileInvalidation
    docBroker->handleTileCombinedRequest
	tileCache().subscribeToTileRendering //< fix

The end result was that we rendered tiles only
to discard them, potentially leaving the clients with
stale tiles (unless they requested new tiles themselves).
If they do request them, we still benefit from the cached
copies of the internal requests we had issued (and dropped).
The issue is that we are wasting an opportunity for efficiency
and relying on the client to request tiles when we normally
push on invalidation, adding latency and being inconsistent.

Change-Id: I4d3aa3739c5324ffca15c80b20dce29ac03eef73
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-11-15 11:40:05 +01:00
Michael Meeks
b043b6213d Move LOOLWebSocket into test/ - where it can be slowly removed.
Change-Id: I388690261d323377648a1502b927e73f862ad802
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Miklos Vajna
3186597097 log: avoid logging after shutdown on all log levels
This can happen on an assertion failure, and causes noise while looking
for real memory errors.

Also disable an unstable test, it's not clear that it passes depending
on how loaded the machine is (just increasing timeouts doesn't seem to
help).

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I049bd0a06f41e2d43702ec12a2c35944bc5200d8
2021-08-12 10:02:48 +02:00
Ashod Nakashian
1159286fb2 wsd: test: killpoco in TileCacheTests
TileCacheTests now completely uses
async WebSockets. It is both more
stable and faster (by about 20-25%).

Change-Id: I6da0fd12ddf671a7ad666561249b6fb1c5d32a01
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
b47c81e7a8 wsd: improved WebSocketSession interface
SocketPoll is captured as weak_ptr into
WebSocketSession and a much better shutdown
support is now available. The new logic
can do async-shutdown after flushing and
will do sync-shutdown if SocketPoll is
no longer around.

Change-Id: Ia206cab58a13f20f7aeb3a6d8c57afee731c8231
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
930d977c36 wsd: test: log the actual test name instead of function names
Change-Id: I9b9fb93ac0b02fe55ea2876639c6e5a3a3d1ab85
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00