Commit graph

183 commits

Author SHA1 Message Date
Caolán McNamara
42e98bb2e4 experimentally bootstrap something using avx2 to generate bitmap
just enough to get the same results as before

https://github.com/CollaboraOnline/online/issues/7165

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I109c9b8f1e7935782c72e0179aa0ed48712eadb6
2023-09-25 16:55:04 +01:00
Michael Meeks
cce3767ba8 First cut SIMD wrappers / separation to accelerate RLE code.
Split it out as a C file, to avoid accidental C++ header inclusion,
and C is a cross-platform assembler anyway so a good match.

Change-Id: I6c042781713aecaf143b9663af8377659a7deaf1
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Ashod Nakashian
968ab3e529 wsd: test: move File-Serve whitebox tests to own file
Change-Id: I4e659f28636cc78beca3c05ed7f23ef714d32063
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 08:58:39 +02:00
Ashod Nakashian
87bce5dc5d wsd: test: merge UnitWopiUnlock into UnitWOPILock.cpp
Change-Id: If051032e2ed9d7a0ab345bdad710ba1eafe92d96
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Andras Timar
4ac8c8ee28 configure option to disable building unit tests
rational: building for release takes a lot of time and we
neither package, nor run (most of) these unit tests when
we make packages.
CI runs all of these tests before merging PRs, so risk is low,
if we do not run the few build-time unit tests when we package.

make -j12
--enable-tests (default): 3m 18s
--disable-test: 1m 9s
3x faster...

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I4edd98af55748432e30c65c4c910e72c0221272a
2023-06-16 09:12:21 +02:00
Caolán McNamara
71d630c607 DeltaTests::testDeltaCopyOutOfBounds fails in a build from make dist tarball
because data/delta-graphic.png and data/delta-graphic2.png are missing

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie850d9ae76946e891d2928de80c5ded4e970f4cf
2023-06-07 14:48:39 +01:00
Ashod Nakashian
941ff1e2fb wsd: test: reduce test run time
Change-Id: I0e6b013892d3ad813a5db6a8a1328849dcd0c6ab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-31 07:40:11 -04:00
Ashod Nakashian
545aa4acb8 wsd: test: merge UnitWopiHttpRedirectLoop with Redirect
Change-Id: I25a2ae4e5d0864b36e520ebb75c31d45b0c12530
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-31 07:40:11 -04:00
Ashod Nakashian
c6dd263ab1 make: silence clang complaining of -pthread
The clang linker doesn't need -pthread and
warns of unknown command-line option.

This detects clang and forgoes the -pthread
flag to the linker.

Change-Id: I658cd887c567a5beeeae0e6e1b6d596231894c1b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
d40aaec1e4 wsd: test: add quarantine test
Change-Id: Ic08f7ed0f177fc5e3a08b47e16ba8131c6dff788
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
5d2f27d4cb wsd: test: reorder tests to minimize parallel runtime
Change-Id: Ib308757cd100df83b934995c2eee2d38d3120ecb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-02 19:54:31 -04:00
Ashod Nakashian
86c1dca7b6 make: cosmetics
Change-Id: Id1ebe96edef9f41be05b84e4c27388adde864aa3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-02 19:54:31 -04:00
Andras Timar
3e6705a3b6 fix include_path with non-system libs in test/Makefile
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ic6dfa7086e1b7fc55b007cee679577a584adeee9
2023-02-26 19:19:22 +01:00
Ashod Nakashian
0adef5dd19 wsd: test: move UnitWOPIAsyncUpload_Close
Another failure-to-upload test that best
belongs to the UnitWOPIFailUpload suite.

Change-Id: I48f34413337f34a959a38402409e7321203dff35
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:03:18 -04:00
Ashod Nakashian
9ccb57b4c3 wsd: test: move UnitWOPIAsyncUpload_Modify
This is a failure-to-upload test that best
belongs to the UnitWOPIFailUpload suite.

Change-Id: I28e4e55f8298fe964537f8b67b0e717ecf2e3935
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-23 11:07:55 -04:00
Ashod Nakashian
db50626aff wsd: test: refactor BaseUnit self-test
The BaseUnit test didn't belong to UnitTimeout
and, more important, it needed access to
private members to both validate their state
and to reset them (since the test is artificially
initializing both WSD and Kit tests and cannot
uninitialize them, lest we unload ourselves).

As such, the self-test is now internal to
BaseUnit, with the added bonus that it
is called on all tests and not just UnitTimeout.

Also, more assertions have been added.

Change-Id: Ieaf60594f39e978a7250407262bd8bbc9b642c43
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-23 11:07:55 -04:00
Ashod Nakashian
155dfcee88 wsd: test: reduce the UnitWOPISlow test doc size
With the latest gcc and Core, debug builds load
and save is substantially slower. The size of
the test document for UnitWOPISlow was 100s
of pages, which took minutes to load and save.

This reduces the size and re-sorts the tests
to minimize the total run time.

Change-Id: Id1ca10d882c5ffcd1ea894279b21fedb06f287f7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-12-07 17:33:11 +03:00
Andras Timar
d17fb50487 enable link to non-system libpng and openssl
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I109242bde268e63e9918af0f44fcb456e2b8f6c5
2022-11-28 12:41:59 +01:00
Ashod Nakashian
2ad1b5f83e wsd: unlock the document only after uploading
Since uploading has become asynchronous, it
might not have finished by the time we
unlock the document. This race can result
in the upload to fail, if the document
is no longer locked.

Now, we ensure that the lock is released
only after uploading, when we remove the
session. With test.

Change-Id: Ic9ba3290dfbfde0eb4af7a70bb5b56ff28711f5c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-11-12 19:42:30 -05:00
Ashod Nakashian
c4fb6c1964 wsd: test: re-order tests to minimize execution time
Change-Id: I3e7b60962ba7d579328c48f500a062dda32e27be
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-11-12 18:45:35 -05: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
Michael Meeks
2def6dc3d5 Switch to zstd image compression.
zstd provides for much faster compression server-side, as well
as better decompression.

zstd allows us to de-compress a keyframe and several deltas in a
single call in JS, so it is necessar to add a terminator to the
delta stream so that we can detect when to flush the buffer we
are working on - so the next delta applies to the correct data.

Change-Id: I0e292e3a697b4902d6488b7c04deaba2d1485e94
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-11-02 12:09:53 +01:00
Aron Budea
6910653a8c Temporarily disable unit-tiletest
Due to this error:
[ coolwsd ] TST  testTileProcessed  [testTileProcessed] (+12566ms):
ERROR: Assertion failure: Expected exactly the requested number of
tiles Expected arrivedTile == [25] but got [28]
| TileCacheTests.cpp:1580

Probably since 2cc955f9109c0fc8443c9f93c1bf6bd317043cb5 (core)

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Ie854a57e4241f2c8fbf8e3d769aba8a19981feb1
2022-09-05 22:00:18 +02:00
Ashod Nakashian
648ab10c66 wsd: test: move UnitWOPIStuckSave
For some as-yet unknown reason, UnitWOPIStuckSave
is timing out with -j8 for me. It seems that
the issue has to do with the socket not having
the data in a timely fashion. The only thing
that reproduces the issue is the order, and
that isn't always the case. So, it seems
that at some point, on my particular system,
having this test any earlier than where I put
is causing the failure. The fix was to move it.

While I don't yet know the reason, this isn't
happening all the time. It would seem that
after restarting it goes away. So it might
be some system state that is interfering.
Still, I can't explain why this test should
suffer reliably and none of the others.

Worth investigating further, but for now
changing the order.

Change-Id: Ibbb912941f8872c4825468e940e82814b2d14168
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-25 15:12:10 +01:00
Ashod Nakashian
551454c9f5 wsd: test: reorder test execution order
Now that most tests are rid of poco sockets
and fixed a number of other issues, the
tests run much faster. The relative timings
have changed, so re-ordering can yield
better total time with -j.

The new order gives ~20% shorter execution
time with -j8 (on 8c/16t i9 @ 2.0 Ghz fixed).
Actual time went from ~2:11 down to 1:46.
A saving of more than 25 seconds.

Change-Id: I0f23b86e4218fff187cdbcc756eb77522732a64b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 09:24:46 -04:00
Ashod Nakashian
ba09a78721 wsd: test: modernize UnitTileCache
And disable it, since it's empty and has
no functional tests in it at all (it just
loads a document and exits the test, without
even waiting for the loading to finish).

We modernize, even though we also disable it,
because otherwise it wouldn't build.

Change-Id: I3735f28fa27af1d00e764f4e0070a25ff36b32d5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 09:24:46 -04:00
Ashod Nakashian
697607d122 wsd: timeout on saving stuck with test
Change-Id: I66769e4e5131f60b41327ada9a6f0a45b2ee11ac
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-27 14:07:08 +01:00
Ashod Nakashian
79f122c552 wsd: test: capture the log from unithttplib and display on failure
Change-Id: Iea7ae1c6ff129ea13aac89929f47d61a9e82eb80
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-24 07:08:55 +01:00
Ashod Nakashian
758ae15e5a wsd: test: add multi-language views test
Change-Id: Idbe1ab22caa4218ead6a8598f6b2990383291dbd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-10 13:14:35 +01:00
Ashod Nakashian
2bf6f419a3 make: fail the build when the whitebox unittests fail
Change-Id: I2e4b483740eac67efffa96449347cc1453798b87
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 08:34:59 -04:00
Ashod Nakashian
26348a9785 wsd: test: move StringVector tests to StringVectorTests
WhiteBoxTests.cpp is by far the slowest TU
to compile (taking minutes) and gcc started showing
'note: variable tracking size limit exceeded'
and recompiles, which doubles the time.

This moves the StringVector tests into a new
home, which reduces the size of WhiteBoxTests.

Change-Id: Ia4e8daa921fb941815ad7e68f4dbb964fb2cd93e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Ashod Nakashian
0403a0c0fe wsd: test: split out RequestDetails tests
WhiteBoxTests.cpp is by far the slowest TU
to compile (taking minutes) and even gcc gives
'note: variable tracking size limit exceeded'
and recompiles, which doubles the time.

This extracts the RequestDetails tests into
its own file to better parallelize the build.

Change-Id: Ic8d54d06223a122bc1ccf73cfa216e2b3a8f32a5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Miklos Vajna
f5836a5d1d sanitizers: fix unit-base, again
==4544==ERROR: AddressSanitizer: odr-violation (0x000002c40140):
  [1] size=104 'HostUtil::WopiHosts' ../wsd/HostUtil.cpp:12:34
  [2] size=104 'HostUtil::WopiHosts' wsd/HostUtil.cpp:12:34
These globals were registered at these points:
  [1]:
    #0 0x71f618 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_globals.cc:362
    #1 0x7f00cb0f3d7b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-base.so+0x10e0d7b)

  [2]:
    #0 0x71f618 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_globals.cc:362
    #1 0x120e2ae in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/coolwsd+0x120e2ae)

==4544==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'HostUtil::WopiHosts' at ../wsd/HostUtil.cpp:12:34
==4544==ABORTING

All of HostUtil was duplicated between the test shared objects and
coolwsd, so remove it from the test objects and rather exclude
RequestDetails::getDocKey() from the test objects instead, which was
linked in but was not used in practice.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ia2147c89cf4230df97a8f45ac7d509aa11cdca97
2022-04-01 13:31:45 +02:00
Ashod Nakashian
099246d67a wsd: unload when no Kit and nothing to upload
When the Kit dies and there is no data saved to
disk to upload, there is nothing to do but unload
DocBroker and log the fact.

With unit-test that simulates the situation by
killing the Kit of a modified document.

Change-Id: I7dcc0583c053d7166935d15d045fcf6624e43b4e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-30 23:18:57 -04:00
Rash419
31d8822758 wsd: cleanup: moved all parsing related static methods and containers to HostUtil.cpp
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8555522c6216f893b90ba4c27747314830f7abd2
2022-03-29 12:18:31 +02:00
Ashod Nakashian
9732689668 wsd: stop loading when low on disk space
For some reason the disk-space check wasn't
done for WOPI storage. Here we add the check
and bubble the exception up to stop loading.

UnitStorage has been updated and re-enabled.

Change-Id: I15a093554b662d6c0828da7683ca0190a8225fc9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-16 08:31:54 -04:00
Rash419
d02dd19f33 wsd: use hostname, port and scheme in doc key
This allows us to use multiple hosts using same coolwsd instance.

added aliases configuration to coolwsd.xml to avoid
possibility of opening the same file as two if the
WOPI host is accessed using different aliases

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I32913015c15fd396cecc702b76e0dcaa8bcafad3
2022-03-16 11:32:59 +03: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
Michael Meeks
96b15bd704 Count and report on various internal exceptions.
An initial set of seven of these, easy to add more as/when needed.

Change-Id: I6c65e052d00f9eaa10adee3c9464043e4c594848
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-02-18 13:51:41 +00:00
Ashod Nakashian
3d04a857bd wsd: test: improved and simplify test logging
Build-time unit-test output is now only
displayed when the test fails. This is to
reduce noise while building when not helpful.

Change-Id: I273d97dae192a24e9a1ae9f662b0fcd7ff555b75
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Ashod Nakashian
af77b68d97 wsd: limit store failure when unloading
When saving and/or uploading fails, we have
to give up after a certain number of retries.

A new config entry, per_document.limit_store_failures,
controls the number of consecutive failures
before giving up. This prevents locking-up
documents while uploading.

Includes a new unit-test.

Change-Id: I1296df1691fcaa982df9e861d34cb946a2eda860
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-09 19:35:19 -05:00
Ashod Nakashian
203a58f6d8 wsd: test: add SaveOnExit test
Refactor UnitWOPIDocumentConflict.cpp into
WOPIUploadConflictCommon.hpp and reuse for both
DocumentConflict and SaveOnExit tests.

Change-Id: I54ec1e37e5e9c6298b12a2b2e596363683fb2e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-08 20:46:01 -05:00
Ashod Nakashian
65d5a4f1a5 wsd: test: add slow save and upload test
Change-Id: I5c7e706a1ded7774c9da4545218ba9fa29fc9d81
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 29c26c9afee593c20bc72a668ba0c3d5634aa35b)
2022-01-11 09:28:03 +01:00
Luboš Luňák
a5de33496c make stringifyHexLine() simply work on std::string
Trying to construct a string using sprintf() and std::stringstream
is unnecessarily complicated for something as simple as this,
and it shows up in my profiling. This commit makes the hex values
change to uppercase because that's what hexFromByte() returns,
but I don't think it matters.

Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: I31c7b8e7cf4c2a495eca0bf03ae4cab53b26a04b
2021-12-07 13:44:40 +01:00
Mert Tumer
f1f2a4a9a9 unit test for save-as files with encoding characters in the name
this test ensures that double encoded filenames are not a problem.
file names can already be encoded like a%20b and this was causing
problems and fixed with #3786

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ibaf0456f26c3a2e8d3c2863c2b925c7a5b9fc79c
2021-12-06 12:19:38 +03: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
Mert Tumer
5ebabf9f58 rename: loolwsd -> coolwsd only binary
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ia44f7f96bcad7200031ad87f6a6fdd3e361f2808
2021-11-17 18:08:19 +03:00
Andras Timar
9a88a95097 --disable-lool-user-checking was renamed to --disable-cool-user-checking at some places, now replace it everywhere
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I881f8b7adfbb396da8beb07c4d0300a153ecd304
2021-11-17 09:56:09 +01:00
Mert Tumer
b17dc4c789 Unit test for X-WOPI-Lock
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I68ce373390a71d4df31716a8a2aa98c96dcb9647
2021-11-15 23:18:37 -05: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